cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1641
Views
0
Helpful
1
Replies

how to implement NSO command devices device device-name live-status xpon-stats:exec show running-config-interface if-name in Java

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!

 

 

 

 

1 Accepted Solution

Accepted Solutions

gmuloche
Cisco Employee
Cisco Employee

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>");

 

View solution in original post

1 Reply 1

gmuloche
Cisco Employee
Cisco Employee

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>");

 

Polls
AI-powered tools for network troubleshooting are likely to be part of everyone’s workflow sooner or later. What is the single biggest challenge or concern you see with adopting these tools in your organization?