Update An Existing Policy - Juniper NETWORK AND SECURITY MANAGER 2010.4 - API GUIDE REV 1 Manual

Api guide
Table of Contents

Advertisement

Update an Existing Policy

Copyright © 2010, Juniper Networks, Inc.
OMElement ome
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
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();
}
}
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"));
Chapter 10: Using APIs for Policy Management
= builder.getDocumentElement();
= builder.getDocumentElement();
99

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the NETWORK AND SECURITY MANAGER 2010.4 - API GUIDE REV 1 and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Network and security manager 2010.4

Table of Contents