03-14-2018 10:10 PM - edited 03-01-2019 04:07 AM
Is there any documentation about action.
In subscriber we can differentiate operations like on create, on modify, on delete, e.t.c. can we differentiate the operations in actions as well.
Solved! Go to Solution.
03-15-2018 11:42 AM
Hi Kiran,
You can check this under ncs examples and developer guide ( path : ncs-4.5.3/examples.ncs/web-server-farm/web-site-service) . You can use maapi.diffIterate. You can read about the api from api reference under (ncs-4.5.3/doc/api/java/index.html) search for maapi and
The example uses kicker:action-input-params and is part of ncs examples
YANG:
container actions {
tailf:action diffcheck {
tailf:actionpoint diffcheck;
input {
uses kicker:action-input-params;
}
output {
}
}
}
}
JAVA call back :
@ActionCallback(callPoint="diffcheck", callType=ActionCBType.ACTION)
public ConfXMLParam[] diffcheck(DpActionTrans trans, ConfTag name,
ConfObject[] kp, ConfXMLParam[] params)
throws DpCallbackException {
try {
System.out.println("-------------------");
System.out.println(params[0]);
System.out.println(params[1]);
System.out.println(params[2]);
ConfUInt32 val = (ConfUInt32) params[2].getValue();
int tid = (int)val.longValue();
Socket s3 = new Socket("127.0.0.1", Conf.NCS_PORT);
Maapi maapi3 = new Maapi(s3);
maapi3.attach(tid, -1);
maapi3.diffIterate(tid, new MaapiDiffIterate() {
// Override the Default iterate function in the TestCase class
public DiffIterateResultFlag iterate(ConfObject[] kp,
DiffIterateOperFlag op,
ConfObject oldValue,
ConfObject newValue,
Object initstate) {
System.out.println("path = " + new ConfPath(kp));
System.out.println("op = " + op);
System.out.println("newValue = " + newValue);
return DiffIterateResultFlag.ITER_RECURSE;
}
});
maapi3.detach(tid);
s3.close();
}
03-15-2018 11:42 AM
Hi Kiran,
You can check this under ncs examples and developer guide ( path : ncs-4.5.3/examples.ncs/web-server-farm/web-site-service) . You can use maapi.diffIterate. You can read about the api from api reference under (ncs-4.5.3/doc/api/java/index.html) search for maapi and
The example uses kicker:action-input-params and is part of ncs examples
YANG:
container actions {
tailf:action diffcheck {
tailf:actionpoint diffcheck;
input {
uses kicker:action-input-params;
}
output {
}
}
}
}
JAVA call back :
@ActionCallback(callPoint="diffcheck", callType=ActionCBType.ACTION)
public ConfXMLParam[] diffcheck(DpActionTrans trans, ConfTag name,
ConfObject[] kp, ConfXMLParam[] params)
throws DpCallbackException {
try {
System.out.println("-------------------");
System.out.println(params[0]);
System.out.println(params[1]);
System.out.println(params[2]);
ConfUInt32 val = (ConfUInt32) params[2].getValue();
int tid = (int)val.longValue();
Socket s3 = new Socket("127.0.0.1", Conf.NCS_PORT);
Maapi maapi3 = new Maapi(s3);
maapi3.attach(tid, -1);
maapi3.diffIterate(tid, new MaapiDiffIterate() {
// Override the Default iterate function in the TestCase class
public DiffIterateResultFlag iterate(ConfObject[] kp,
DiffIterateOperFlag op,
ConfObject oldValue,
ConfObject newValue,
Object initstate) {
System.out.println("path = " + new ConfPath(kp));
System.out.println("op = " + op);
System.out.println("newValue = " + newValue);
return DiffIterateResultFlag.ITER_RECURSE;
}
});
maapi3.detach(tid);
s3.close();
}
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide