NSO API using Python #3
#IOS-XE
config replace flash:blank.ssh.enabled.cfg
#IOS-XR
configure
load bootflash:blank.ssh.enabled.cfg
commit replace
yAnswer
Explanation
Last updated
#IOS-XE
config replace flash:blank.ssh.enabled.cfg
#IOS-XR
configure
load bootflash:blank.ssh.enabled.cfg
commit replace
yLast updated
import ncs
with ncs.maapi.Maapi() as m:
with ncs.maapi.Session(m, 'admin', 'python'):
with m.start_read_trans() as t:
root = ncs.maagic.get_root(t)
device_group = root.devices.device_group['XE']
for device in device_group.device_name:
print(root.devices.device[device].config.ios__hostname)
with m.start_read_trans() as t:
root = ncs.maagic.get_root(t)
device_group = root.devices.device_group['XE']
for device in device_group.device_name:
print(root.devices.device[device].config.ios__interface.GigabitEthernet['2.254'].ip.address.primary.address)import ncs
with ncs.maapi.Maapi() as m:
with ncs.maapi.Session(m, 'admin', 'python'):import ncs
with ncs.maapi.Maapi() as m:
with ncs.maapi.Session(m, 'admin', 'python'):
with m.start_read_trans() as t:
with m.start_read_trans() as t: