cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
169
Views
0
Helpful
4
Replies
khgrant
Cisco Employee

SSH into Cisco device

I’m looking for easiest way to execute a "show ip dhcp binding“ command on a Cisco device. As far as I can see this is not covered with NED and modelled in Yang. I see classes NedWorked, NedMux, SSHConnection but don’t understand how they fit together. Any example on how to put it together would be much appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
khgrant
Cisco Employee

Just like any other action:

 

 

--------

 

NavuAction action1 = device.container("live-status").

 

                    container("ios-stats","exec").

 

                    action("show");

 

ConfXMLParam[]  args1 = new ConfXMLParam[1];

 

Conflict l1 = new ConfList();

 

l1.addElem(new ConfBuf(ip dhcp binding"));

 

args1[0] = new ConfXMLParamValue("ios-stats", "args", l1);  

 

    

 

// I execute the action and receive response as XML

 

    

 

ConfXMLParam[] resArr1 = action1.call(args1);

 

--------

 

 

You then need to navigate the output XML array…there are different ways, depending of your taste. Check the JavaDoc for ConfXMLParam[].

 

View solution in original post

4 REPLIES 4
khgrant
Cisco Employee

admin@ncs> request devices device ce0 live-status ios-stats:exec show args ip dhcp binding

Sorry, forgot to mention that I would like to do it from Java package…

khgrant
Cisco Employee

Just like any other action:

 

 

--------

 

NavuAction action1 = device.container("live-status").

 

                    container("ios-stats","exec").

 

                    action("show");

 

ConfXMLParam[]  args1 = new ConfXMLParam[1];

 

Conflict l1 = new ConfList();

 

l1.addElem(new ConfBuf(ip dhcp binding"));

 

args1[0] = new ConfXMLParamValue("ios-stats", "args", l1);  

 

    

 

// I execute the action and receive response as XML

 

    

 

ConfXMLParam[] resArr1 = action1.call(args1);

 

--------

 

 

You then need to navigate the output XML array…there are different ways, depending of your taste. Check the JavaDoc for ConfXMLParam[].

 

View solution in original post

khgrant
Cisco Employee

THANKS!!!! Just the thing I needed!

Content for Community-Ad

This widget could not be displayed.