12-02-2019 07:02 AM
Hi all,
I have to implement a java service which executes the following command:
devices device deviceName live-status xpon-stats:exec show running-config-interface xgei-xx/xx/xx
This is java code to implement the first part of the command:
NavuContainer devContainer =ncsRoot.container("devices").list("device").elem(oltName);
NavuContainer liveStatusContainer =devContainer.container("live-status");
NavuContainer execContainer= liveStatusContainer.container("xpon-stats:exec");
NavuAction actionShow = execContainer.action("show");
Unfortunately I can't find java API that can be used to add parameters to action show.
I know in Python it is possible to invoke the command by passing the input object into the device.live_status.ios_stats__exec.show() method in this way:
with ncs.maapi.Maapi() as m:
with ncs.maapi.Session(m, 'admin', 'python'):
root = ncs.maagic.get_root(m)
device = root.devices.device[device_name]
input1 = device.live_status.ios_stats__exec.show.get_input()
input1.args = [command]
output = device.live_status.ios_stats__exec.show(input1).result
print(output)
Can anybody help me to do the same in Java?
Thanks in advance for any contribution!
Solved! Go to Solution.
12-03-2019 05:37 AM
Hello,
in the configuration guide you have an example on how to use an NavuAction with parameters (nso_development guide) - in the section Java API Overview / NAVU API - at the bottom of the page. The paramaters are passed using the ConfXMLParam structure.
From the page:
NavuAction ping = if.action(interfaces.i_ping_test_); /* * Execute action. */ ConfXMLParamResult[] result = ping.call(new ConfXMLParam[] { new ConfXMLParamValue(new interfaces().hash(), interfaces._ttl, new ConfInt64(64))}; //or we could execute it with XML-String result = ping.call("<if:ttl>64</if:ttl>");
12-03-2019 05:37 AM
Hello,
in the configuration guide you have an example on how to use an NavuAction with parameters (nso_development guide) - in the section Java API Overview / NAVU API - at the bottom of the page. The paramaters are passed using the ConfXMLParam structure.
From the page:
NavuAction ping = if.action(interfaces.i_ping_test_); /* * Execute action. */ ConfXMLParamResult[] result = ping.call(new ConfXMLParam[] { new ConfXMLParamValue(new interfaces().hash(), interfaces._ttl, new ConfInt64(64))}; //or we could execute it with XML-String result = ping.call("<if:ttl>64</if:ttl>");
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