cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1081
Views
0
Helpful
4
Replies

set shutdown with python maagic api

peter.z.larsson
Level 1
Level 1

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

1 Accepted Solution

Accepted Solutions

My mistake

io.shutdown.create()

View solution in original post

4 Replies 4

frjansso
Cisco Employee
Cisco Employee

try "del lo.shutdown" or "del lo['shutdown']"

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.

My mistake

io.shutdown.create()

Nice, thanks!