nornir-automation/nornir

Can't get device state from Nornir

Oussema-99 opened this issue · 5 comments

Hello,

I'm using Netbox inventory plugin with Nornir and trying to filter on device state (active/planned...). I can't see status anywhere, is there something I'm missing or maybe better a better way of displaying all options?

ipdb> dir(nr.inventory.hosts["NX9300-1"])
['__bool__', '__class__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__len__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__slots__', '__str__', '__subclasshook__', '_get_connection_options_recursively', '_has_parent_group_by_name', '_has_parent_group_by_object', 'close_connection', 'close_connections', 'connection_options', 'connections', 'data', 'defaults', 'dict', 'extended_data', 'extended_groups', 'get', 'get_connection', 'get_connection_parameters', 'groups', 'has_parent_group', 'hostname', 'items', 'keys', 'name', 'open_connection', 'password', 'platform', 'port', 'schema', 'username', 'values']
ipdb> 

@Oussema-99 Did you look in the data field?

I did, this is what it shows:

ipdb> nr.inventory.hosts["NX9300-1"].data
{'serial': '', 'vendor': 'Cisco', 'asset_tag': None, 'site': 'test', 'role': 'border_leaf', 'model': 'nexus_9336'}
ipdb> 

Device in Netbox is configured to be in Active state, I tried data, state, status and many others, none of it worked.

@Oussema-99 You should probably ask your quest in the nornir-netbox community. I am going to close this as I don't think it is a Nornir specific issue.

Got it, I didn't realize nornir-netbox plugin was a separate community. Thank you for your help!