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

IOS-XR NED device module stored at position 3

Abdel el Anazi
Level 1
Level 1

Hi,

 

I have some question which I am struggling with, I have to read the device NED type from the device module. Almost all NEDs returns with position 0 from the keys the correct NED type except IOS-XR NED the position of the NED type is not 0 but 3 which confuses my python code: 

 

Here is an overview of the device modules:

1.PNG

This is what I read in Python:

 

def get_device_type(root, device):
   modules = root.devices.device[device].module.keys()
   return str(modules[0])
 
Is there a reason why IOS-XR has interfaces instead of device ned type in position 0?
How do I get around this without modifying the code?
1 Accepted Solution

Accepted Solutions

hniska
Cisco Employee
Cisco Employee

You cant without modifying your code. The module list isn't an "ordered-by user" list so there is not guarantee to what order the list will be returned in. 

 

View solution in original post

1 Reply 1

hniska
Cisco Employee
Cisco Employee

You cant without modifying your code. The module list isn't an "ordered-by user" list so there is not guarantee to what order the list will be returned in.