12-06-2017 08:28 AM - edited 03-01-2019 04:03 AM
Can't figure out how to set "shutdown" under a loopback interface for cisco ios-xr
Code snippet:
for lo in root.devices.device[er_info[0]["name"]].config.cisco_ios_xr__interface['Loopback']:
if lo.id == 40001:
lo['mtu'] = 1800
lo['shutdown'] = None
Create a leaf key mtu with value 1800 works fine but create leaf key shutdown gives me the following error:
File "lan5-subscr-bh-migration-ver1.py", line 215, in set_lan5_backhal
lo['shutdown'] = None
File "/home/peter/ncs-4.4.2/src/ncs/pyapi/ncs/maagic.py", line 501, in __setitem__
raise MaagicError("Node type does not support assignment")
ncs.maagic.MaagicError: Node type does not support assignment
I use python 2.7
Have also tried lo['shutdown'] = [] with the same result.
What is wrong?
//Peter
Solved! Go to Solution.
12-07-2017 06:47 AM
12-06-2017 08:30 AM
try "del lo.shutdown" or "del lo['shutdown']"
12-06-2017 11:38 PM
Thank's Fredrik your way of deleting (cli equivalent to "no shutdown") works fine. However my problem is the opposite, i.e. I want to do shutdown of an interface. If an interface is up there is no leaf key "shutdown" and I can't figure out why I can't create the leaf key.
12-07-2017 06:47 AM
My mistake
io.shutdown.create()
12-07-2017 07:43 AM
Nice, thanks!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide