12-04-2018 04:30 AM
I am trying to load merge my XML payload using maapi, and next i need to fetch dry-run output.
i tested with setting one key of leaf and tried action call on services but it giving me null and exception.
private String[] NSO_USER_GROUPS = new String[] { "admin", "ncsadmin" };
Socket s = new Socket("127.0.0.1", Conf.NCS_PORT);
Maapi maapi = new Maapi(s);
maapi.startUserSession(trans.getUserInfo().getUserName(), InetAddress.getLocalHost(), "maapi", NSO_USER_GROUPS, MaapiUserSessionFlag.PROTO_TCP);
int th = maapi.startTrans(Conf.DB_RUNNING, Conf.MODE_READ_WRITE);
NavuContext context = new NavuContext(maapi, th);
NavuContainer root = new NavuContainer(context);
root.container("http://com/cisco/abc").list("my-list").safeCreate("abc");
ConfXMLParam[] abc = root.container("http://tail-f.com/ns/ncs").container("services").action("commit-dry-run").call();
ConfObject abcd = abc[0].getValue();
System.out.println("********** " + abcd);
ncs-java log:
********** null
Error: com.tailf.maapi.MaapiException: badstate
com.tailf.maapi.MaapiException: badstate
at com.tailf.maapi.MaapiException.mk(MaapiException.java:61)
at com.tailf.maapi.MaapiException.mk(MaapiException.java:50)
at com.tailf.maapi.Maapi.abortTrans(Maapi.java:1522)
what is correct way to invoke dry-run action from java.
12-04-2018 09:14 AM
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the NSO Developer community: