cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

93
Views
0
Helpful
1
Replies
khgrant
Cisco Employee

Executing IOS exec commands via python

 

All ,

 

 

I’m having trouble getting a CSR1000v running on VMWare to license itself properly.

 

I initially was using an IOS_CONFIG_XXX ova properties to trigger the “do license …. Command” but for no apparent reason now that has stopped working.

 

 

I’d like to move to using the python api to issue the license token command when a “VM_ALIVE” event is seen coming from ESC.

 

I’m having trouble figuring out how to reference the router device object in “root.devices.device[‘Router_Device’]” to invoke the license command that is NOT part of the device configuration.

 

I’m guessing it would have to be related to the live_status attribute but I can’t figure out how to build the attribute reference or how to assign the command string.

 

 

Can someone point me to documentation on this or provide a sample bit of code?

 

 

-Scott

 

1 ACCEPTED SOLUTION

Accepted Solutions
khgrant
Cisco Employee

 

Hi Scott!

 

 

74         newDevice = root.ncs__devices.device[name]

 

75         exec_any = newDevice.live_status.ios_stats__exec.any

 

76         input = exec_any.get_input()

 

77         input.args = ['"sync-from-file {}"'.format(cfg_path)]

 

78         exec_any(input)

 

 

this runs sync-from-file <path> on a device, hopefully it's as simple as modifying line 77 to to your "do license..."

 

 

Br,

 

Fredrik

 

View solution in original post

1 REPLY 1
khgrant
Cisco Employee

 

Hi Scott!

 

 

74         newDevice = root.ncs__devices.device[name]

 

75         exec_any = newDevice.live_status.ios_stats__exec.any

 

76         input = exec_any.get_input()

 

77         input.args = ['"sync-from-file {}"'.format(cfg_path)]

 

78         exec_any(input)

 

 

this runs sync-from-file <path> on a device, hopefully it's as simple as modifying line 77 to to your "do license..."

 

 

Br,

 

Fredrik

 

Create
Recognize Your Peers
Content for Community-Ad