Closed dbench closed 1 month ago
To add additional details, the "pynautobot_dictionary" dict does not return rendered config context, only local config context. Returned data from the "pynatubot_dictionary" below.
ipdb> from pprint import pprint
ipdb> pprint(host_obj.data['pynautobot_dictionary'])
{'asset_tag': None,
'cluster': None,
'comments': '',
'controller_managed_device_group': None,
'created': '2024-01-23T19:00:00-05:00',
'custom_fields': {'excel_raw_import_data': None,
'last_network_data_sync': None,
'ssot_synced_to_servicenow': None},
'device_redundancy_group': None,
'device_redundancy_group_priority': None,
'device_type': {'comments': '',
'created': '2024-01-23T19:00:00-05:00',
'custom_fields': {'ssot_synced_to_servicenow': None},
'device_family': None,
'display': 'Cisco C8500-12X',
'front_image': 'https://nautobot.blah.net/media/devicetype-images/8500_12x_front.png',
'id': 'a6499f33-7faf-4678-9146-fb91fd8192fc',
'is_full_depth': True,
'last_updated': '2024-01-24T10:43:59.004343-05:00',
'manufacturer': {'id': 'fefbd152-b760-45dc-8a62-69ec087b4403',
'object_type': 'dcim.manufacturer',
'url': 'https://nautobot.blah.net/api/dcim/manufacturers/fefbd152-b760-45dc-8a62-69ec087b4403/'},
'model': 'C8500-12X',
'natural_slug': 'cisco_c8500-12x_a649',
'notes_url': 'https://nautobot.blah.net/api/dcim/device-types/a6499f33-7faf-4678-9146-fb91fd8192fc/notes/',
'object_type': 'dcim.devicetype',
'part_number': 'C8500-12X',
'rear_image': 'https://nautobot.blah.net/media/devicetype-images/8500_12x_rear.png',
'subdevice_role': {'label': 'Parent', 'value': 'parent'},
'u_height': 1,
'url': 'https://nautobot.blah.net/api/dcim/device-types/a6499f33-7faf-4678-9146-fb91fd8192fc/'},
'display': 'LAB-8500Border-A',
'face': None,
'id': '9b0126b6-8dbc-45e2-9517-baf6b5fc93d9',
'last_updated': '2024-07-08T17:43:46.417688-04:00',
'local_config_context_data': {'GigabitEthernet0': {'descr': 'Mgmt',
'ip_addr': 'x.x.x.x',
'mask': '255.255.255.0'},
'Loopback100': {'descr': 'SOURCE_ADDRESS_CLOUDFLARE_PRIMARY',
'ip_addr': 'x.x.x.x',
'mask': '255.255.255.255'},
'Loopback101': {'descr': 'SOURCE_ADDRESS_CLOUDFLARE_SECONDARY',
'ip_addr': 'x.x.x.x',
'mask': '255.255.255.255'},
'TenGigabitEthernet0_0_0': {'descr': 'Inet_LumenID_xxxxxxxx',
'ip_addr': 'x.x.x.x',
'mask': '255.255.255.252'},
'TenGigabitEthernet0_0_11': {'descr': 'To_FW',
'ip_addr': 'x.x.x.x',
'mask': '255.255.255.0'},
'TenGigabitEthernet0_0_6': {'descr': 'To_iBGP_Peer',
'ip_addr': 'x.x.x.x',
'mask': '255.255.255.0'},
'Tunnel100': {'cloudflare_destination': 'x.x.x.x',
'descr': 'SOURCE_TUNNEL_CLOUDFLARE_PRIMARY',
'ip_addr': 'x.x.x.x',
'mask': '255.255.255.252'},
'domain': 'arutnec',
'ebgp_neighbor_as': xxxx,
'ebgp_neighbor_ip': 'x.x.x.x',
'eigrp_delay': 1,
'hostname': 'x.x.x.x',
'ibgp_neighbor_ip': 'x.x.x.x',
'leased_public_subnet': 'x.x.x.x',
'oobm_default_gateway': 'x.x.x.x',
'owned_public_subnet': 'x.x.x.x',
'role': 'inet_border',
'serial_num': 'x.x.x.x',
'site': 'lab',
'snmp_phy_loc': 'blah '
'blah.'},
'local_config_context_data_owner_content_type': {'app_label': 'extras',
'display': 'extras | Git '
'repository',
'id': 81,
'model': 'gitrepository',
'natural_slug': 'extras_gitrepository_81',
'object_type': 'contenttypes.contenttype',
'url': 'https://nautobot.blah.net/api/extras/content-types/81/'},
'local_config_context_data_owner_object_id': 'b3dc63de-1019-49cd-889e-3a9e6f91f249',
'local_config_context_schema': None,
'location': {'asn': None,
'comments': '',
'contact_email': 'blah@blah.net',
'contact_name': 'blah',
'contact_phone': '',
'created': '2024-07-02T20:00:00-04:00',
'custom_fields': {'ssot_synced_to_servicenow': None},
'description': '',
'display': 'blah → blah',
'facility': 'blah',
'id': '58d19106-5d3b-46bb-9dbe-069eb60941e5',
'last_updated': '2024-07-03T11:40:48.053662-04:00',
'latitude': None,
'location_type': {'id': 'ab946807-b98b-4b31-878a-b22c3052bd06',
'object_type': 'dcim.locationtype',
'url': 'https://nautobot.blah.net/api/dcim/location-types/ab946807-b98b-4b31-878a-b22c3052bd06/'},
'longitude': None,
'name': 'blah',
'natural_slug': 'blah',
'notes_url': 'https://nautobot.blah.net/api/dcim/locations/58d19106-5d3b-46bb-9dbe-069eb60941e5/notes/',
'object_type': 'dcim.location',
'parent': {'id': '5d9cd489-ff42-479a-834e-70e3330475e6',
'object_type': 'dcim.location',
'url': 'https://nautobot.blah.net/api/dcim/locations/5d9cd489-ff42-479a-834e-70e3330475e6/'},
'physical_address': 'blah',
'shipping_address': '',
'status': {'id': '33a18039-3a05-45ac-be85-339d44663f32',
'object_type': 'extras.status',
'url': 'https://nautobot.blah.net/api/extras/statuses/33a18039-3a05-45ac-be85-339d44663f32/'},
'tenant': None,
'time_zone': 'America/Denver',
'url': 'https://nautobot.blah.net/api/dcim/locations/58d19106-5d3b-46bb-9dbe-069eb60941e5/'},
'name': 'blah',
'natural_slug': 'blah',
'notes_url': 'https://nautobot.blah.net/api/dcim/devices/9b0126b6-8dbc-45e2-9517-baf6b5fc93d9/notes/',
'object_type': 'dcim.device',
'parent_bay': None,
'platform': {'created': '2024-02-07T19:00:00-05:00',
'custom_fields': {},
'description': '',
'display': 'cisco_xe',
'id': 'c51e6e8f-52e8-4e55-88d6-b558a2a6f1f8',
'last_updated': '2024-02-08T18:16:29.983084-05:00',
'manufacturer': {'id': 'fefbd152-b760-45dc-8a62-69ec087b4403',
'object_type': 'dcim.manufacturer',
'url': 'https://nautobot.blah.net/api/dcim/manufacturers/fefbd152-b760-45dc-8a62-69ec087b4403/'},
'name': 'cisco_xe',
'napalm_args': None,
'napalm_driver': 'ios',
'natural_slug': 'cisco-xe_c51e',
'network_driver': 'cisco_ios',
'network_driver_mappings': {'ansible': 'cisco.ios.ios',
'hier_config': 'ios',
'napalm': 'ios',
'netmiko': 'cisco_ios',
'netutils_parser': 'cisco_ios',
'ntc_templates': 'cisco_ios',
'pyats': 'iosxe',
'pyntc': 'cisco_ios_ssh',
'scrapli': 'cisco_iosxe'},
'notes_url': 'https://nautobot.blah.net/api/dcim/platforms/c51e6e8f-52e8-4e55-88d6-b558a2a6f1f8/notes/',
'object_type': 'dcim.platform',
'url': 'https://nautobot.blah.net/api/dcim/platforms/c51e6e8f-52e8-4e55-88d6-b558a2a6f1f8/'},
'position': None,
'primary_ip4': {'address': 'blah',
'created': '2024-02-15T19:00:00-05:00',
'custom_fields': {},
'description': '',
'display': 'blah',
'dns_name': '',
'host': 'blah',
'id': '55527c0c-e7b1-4464-ba1d-b5108b4208ec',
'interfaces': [{'id': '9effb856-0c5f-433f-9b99-955d3d8ef5c5',
'object_type': 'dcim.interface',
'url': 'https://nautobot.blah.net/api/dcim/interfaces/9effb856-0c5f-433f-9b99-955d3d8ef5c5/'}],
'ip_version': 4,
'last_updated': '2024-07-03T14:16:47.591850-04:00',
'mask_length': 24,
'nat_inside': None,
'nat_outside_list': [],
'natural_slug': 'global_blah',
'notes_url': 'https://nautobot.blah.net/api/ipam/ip-addresses/55527c0c-e7b1-4464-ba1d-b5108b4208ec/notes/',
'object_type': 'ipam.ipaddress',
'parent': {'id': '732b9c2a-a1ca-4a3f-8f90-6eeced0e255c',
'object_type': 'ipam.prefix',
'url': 'https://nautobot.blah.net/api/ipam/prefixes/732b9c2a-a1ca-4a3f-8f90-6eeced0e255c/'},
'role': None,
'status': {'id': '33a18039-3a05-45ac-be85-339d44663f32',
'object_type': 'extras.status',
'url': 'https://nautobot.blah.net/api/extras/statuses/33a18039-3a05-45ac-be85-339d44663f32/'},
'tenant': None,
'type': 'host',
'url': 'https://nautobot.blah.net/api/ipam/ip-addresses/55527c0c-e7b1-4464-ba1d-b5108b4208ec/',
'vm_interfaces': []},
'primary_ip6': None,
'rack': None,
'role': {'color': '607d8b',
'created': '2024-07-02T20:00:00-04:00',
'custom_fields': {},
'description': 'role for inet border switches, primary in site',
'display': 'inet_border',
'id': '1e346da2-c77c-414f-a2cb-ebc74f2e4682',
'last_updated': '2024-07-03T11:40:34.125639-04:00',
'name': 'inet_border',
'natural_slug': 'inet-border_1e34',
'notes_url': 'https://nautobot.blah.net/api/extras/roles/1e346da2-c77c-414f-a2cb-ebc74f2e4682/notes/',
'object_type': 'extras.role',
'url': 'https://nautobot.blah.net/api/extras/roles/1e346da2-c77c-414f-a2cb-ebc74f2e4682/',
'weight': None},
'secrets_group': {'created': '2024-01-23T19:00:00-05:00',
'custom_fields': {},
'description': '',
'display': 'blah',
'id': '5450128b-c6b8-4163-9708-62886655c5f4',
'last_updated': '2024-02-08T18:37:27.228236-05:00',
'name': 'blah',
'natural_slug': 'blah_5450',
'notes_url': 'https://nautobot.blah.net/api/extras/secrets-groups/5450128b-c6b8-4163-9708-62886655c5f4/notes/',
'object_type': 'extras.secretsgroup',
'url': 'https://nautobot.blah.net/api/extras/secrets-groups/5450128b-c6b8-4163-9708-62886655c5f4/'},
'serial': 'TTM271004T4',
'software_image_files': [],
'software_version': None,
'status': {'color': '4caf50',
'created': '2024-01-22T19:00:00-05:00',
'custom_fields': {},
'description': 'Unit is active',
'display': 'Active',
'id': '33a18039-3a05-45ac-be85-339d44663f32',
'last_updated': '2024-01-23T10:08:53.202734-05:00',
'name': 'Active',
'natural_slug': 'active_33a1',
'notes_url': 'https://nautobot.blah.net/api/extras/statuses/33a18039-3a05-45ac-be85-339d44663f32/notes/',
'object_type': 'extras.status',
'url': 'https://nautobot.blah.net/api/extras/statuses/33a18039-3a05-45ac-be85-339d44663f32/'},
'tags': [],
'tenant': None,
'url': 'https://nautobot.blah.net/api/dcim/devices/9b0126b6-8dbc-45e2-9517-baf6b5fc93d9/',
'vc_position': None,
'vc_priority': None,
'virtual_chassis': None}
I believe this issue should be in https://github.com/nautobot/nornir-nautobot. Transferring...
@dbench have you added include
to your filter_parameters? Something like
my_nornir = InitNornir(
inventory={
"plugin": "NautobotInventory",
"options": {
"nautobot_url": os.getenv("NAUTOBOT_URL"),
"nautobot_token": os.getenv("NAUTBOT_TOKEN"),
"filter_parameters": {"include": "config_context"},
},
},
)
@jmcgill298 That did the trick for me. Much appreciated. I will close the issue.
you're welcome
Nautobot Version - 2.2.6
Using the nautobot inventory plugin for nornir, when attempting to access config context data for a device, only local config context is available. Rendered config context data is not available for each host. requirements.txt below: