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

Executing IOS exec commands via python

previousqna
Level 5
Level 5

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?

1 Accepted Solution

Accepted Solutions

previousqna
Level 5
Level 5

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..."

View solution in original post

1 Reply 1

previousqna
Level 5
Level 5

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..."