* <p/>
* Prerequisite:
* A policy object has been added in NSM.
*/
public void testGetPolicyObject() {
try {
System.out.println("Running testGetPolicyObject()");
GetObjectViewByIdRequest request = new GetObjectViewByIdRequest();
request.setAuthToken(DataCentricServiceTest.authToken);
ObjectIdentifierType oid = new ObjectIdentifierType();
oid.setDomainId(new UnsignedShort("1"));
oid.setCategory("nsmpolicy");
ObjectIdOrNameType choice = new ObjectIdOrNameType();
choice.setObjectName("test");
oid.setObjectIdOrName(choice);
request.addObjectIdentifier(oid);
GetObjectViewByIdResponse response =
DataCentricServiceTest.stub.GetObjectViewByIdRequest(request);
DataCentricServiceTest.print(response.getObject());
assertTrue(response.getStatus() == StatusCodeType.Success);
} catch (Exception e) {
e.printStackTrace();
}
}
Assign a Policy to a Device
This Data Centric Service API code sample assigns a policy.
/**
* Prerequisite: there is a device with id 2
* there is a policy with name test
*/
public void testAssignPolicy2Device() {
try {
System.out.println("Running testAssignPolicy2Device()");
ModifyObjectViewRequest request = new ModifyObjectViewRequest();
request.setAuthToken(PolicyAssignmentTest.authToken);
//creates an object of ModifyViewCommandType:
:
ModifyViewCommandType modifyCmd = new ModifyViewCommandType();
DeleteObjectViewType deleteObject = new DeleteObjectViewType();
//specifies the device to assign the policy:
ObjectIdentifierType objectId = new ObjectIdentifierType();
objectId.setCategory("deviceobj");
objectId.setDomainId(new UnsignedShort("1"));
ObjectIdOrNameType objIdOrName = new ObjectIdOrNameType();
objIdOrName.setObjectId(new UnsignedInt(0));
objectId.setObjectIdOrName(objIdOrName);
//create an object of UpdateObjectViewType:
Copyright © 2010, Juniper Networks, Inc.
102
Network and Security Manager 2010.4 API Guide
Содержание 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...