OMElement ome = builder.getDocumentElement();
ObjectDataType objData = new ObjectDataType();
objData.setData(this.createOpaqueDataType(ome));
insertObject.setObjecData;
//creates another object of ModifyViewComamndType
ModifyViewCommandType insertRulebaseCmd = new
ModifyViewCommandType();
InsertObjectViewType insertRulebaseObject = new
InsertObjectViewType();
insertRulebaseCmd.setInsertObject(insertRulebaseObject);
insertRulebaseObject.setCategory("rb_firewall");
insertRulebaseObject.setDomainId(new UnsignedShort("1"));
//reads the rulebase in XML format from file
"testRuleBaseFirewallInsert.xml"
parser = xmlInputFactory.createXMLStreamReader(new
FileInputStream(rbFile));
builder = new StAXOMBuilder(parser);
OMElement omeRulebase = builder.getDocumentElement();
ObjectDataType rbData = new ObjectDataType();
rbData.setData(this.createOpaqueDataType(omeRulebase));
insertRulebaseObject.setObjecData(rbData);
//inserts the rulebase first, then insert the policy
request.addCommand(insertRulebaseCmd);
request.addCommand(modifyCmd);
//invokes the service
ModifyObjectViewResponse response =
stub.ModifyObjectViewRequest(request);
print(response);
assertTrue(response.getStatus() == StatusCodeType.Success);
}catch (Exception e) {
e.printStackTrace();
}
}
Update an Existing Policy
The following Data Centric Service API code sample updates an existing service.
* Updates the service in the rule base with a predefined service object.
*/
public void testUpdateNodeRequest_Rulebase() {
try {
System.out.println("Running testUpdateNodeRequest_Rulebase()");
//creates an object of ModifyObjectViewRequest
ModifyObjectViewRequest request = new ModifyObjectViewRequest();
request.setAuthToken(DataCentricServiceTest.authToken);
//creates an object of ModifyViewCommandType
ModifyViewCommandType modifyCmd = new ModifyViewCommandType();
//specifies the device from which to the policy is unassigned
ObjectIdentifierType objectId = new ObjectIdentifierType();
objectId.setCategory("rb_firewall");
objectId.setDomainId(new UnsignedShort("1"));
99
Copyright © 2010, Juniper Networks, Inc.
Chapter 10: Using APIs for Policy Management
Содержание NETWORK AND SECURITY MANAGER 2010.4 - API GUIDE REV 1
Страница 6: ...Copyright 2010 Juniper Networks Inc vi...
Страница 10: ...Copyright 2010 Juniper Networks Inc x Network and Security Manager 2010 4 API Guide...
Страница 12: ...Copyright 2010 Juniper Networks Inc xii Network and Security Manager 2010 4 API Guide...
Страница 20: ...Copyright 2010 Juniper Networks Inc 2 Network and Security Manager 2010 4 API Guide...
Страница 24: ...Copyright 2010 Juniper Networks Inc 6 Network and Security Manager 2010 4 API Guide...
Страница 34: ...Copyright 2010 Juniper Networks Inc 16 Network and Security Manager 2010 4 API Guide...
Страница 58: ...Figure 10 IDP Rulebase Copyright 2010 Juniper Networks Inc 40 Network and Security Manager 2010 4 API Guide...
Страница 92: ...Copyright 2010 Juniper Networks Inc 74 Network and Security Manager 2010 4 API Guide...
Страница 98: ...Copyright 2010 Juniper Networks Inc 80 Network and Security Manager 2010 4 API Guide...
Страница 100: ...Copyright 2010 Juniper Networks Inc 82 Network and Security Manager 2010 4 API Guide...
Страница 112: ...Copyright 2010 Juniper Networks Inc 94 Network and Security Manager 2010 4 API Guide...
Страница 128: ...Copyright 2010 Juniper Networks Inc 110 Network and Security Manager 2010 4 API Guide...
Страница 138: ...Copyright 2010 Juniper Networks Inc 120 Network and Security Manager 2010 4 API Guide...
Страница 152: ...Copyright 2010 Juniper Networks Inc 134 Network and Security Manager 2010 4 API Guide...
Страница 165: ...PART 6 Index Index on page 149 147 Copyright 2010 Juniper Networks Inc...
Страница 166: ...Copyright 2010 Juniper Networks Inc 148 Network and Security Manager 2010 4 API Guide...