diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b91e562d..b1458cca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -92,7 +92,7 @@ jobs: fail-fast: true matrix: python-version: ["3.11"] - nautobot-version: ["2.2.3"] + nautobot-version: ["2.3.1"] env: INVOKE_NAUTOBOT_DEVICE_ONBOARDING_PYTHON_VER: "${{ matrix.python-version }}" INVOKE_NAUTOBOT_DEVICE_ONBOARDING_NAUTOBOT_VER: "${{ matrix.nautobot-version }}" @@ -145,7 +145,7 @@ jobs: include: - python-version: "3.11" db-backend: "postgresql" - nautobot-version: "2.2.3" + nautobot-version: "2.3.1" - python-version: "3.12" db-backend: "mysql" nautobot-version: "stable" diff --git a/README.md b/README.md index fcad87a9..353abdb8 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,8 @@ Regardless, the Onboarding App greatly simplifies the onboarding process by allo | Link Status | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | | 802.1Q mode | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | | Lag Member | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | -| VRF Membership | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | +| Vrf Membership | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | +| Software Version | ✅ | ✅ | ✅ | ❌ | ✅ | ✅ | ❌ | | VLANS | Cisco IOS | Cisco XE | Cisco NXOS | Cisco WLC | Juniper Junos | Arista EOS | F5 | | ----------------------- | :----------------: | :--------------: | :--------------: | :--------------: | :--------------: | :--------------: | :-: | diff --git a/changes/233.added b/changes/233.added new file mode 100644 index 00000000..e8505b54 --- /dev/null +++ b/changes/233.added @@ -0,0 +1 @@ +- Added support syncing in software versions from devices to nautobot core models. \ No newline at end of file diff --git a/docs/admin/install.md b/docs/admin/install.md index 15eb813a..12eb73a6 100644 --- a/docs/admin/install.md +++ b/docs/admin/install.md @@ -4,7 +4,7 @@ Here you will find detailed instructions on how to **install** and **configure** ## Prerequisites -- The app is compatible with Nautobot 2.0.3 and higher. +- The app is compatible with Nautobot 2.3.1 and higher. - Databases supported: PostgreSQL, MySQL !!! note diff --git a/docs/user/app_overview.md b/docs/user/app_overview.md index abb37817..38eda3af 100644 --- a/docs/user/app_overview.md +++ b/docs/user/app_overview.md @@ -47,6 +47,8 @@ Expose two new SSoT based Nautobot jobs to perform the syncing of data. - VRFs - VRF Names - Route Distinguishers (RD) + - Cabling + - Software Version - Cabling (**Note** Cables attached to Circuits will be skipped) !!! info diff --git a/nautobot_device_onboarding/command_mappers/arista_eos.yml b/nautobot_device_onboarding/command_mappers/arista_eos.yml index ef72954e..bad966d4 100755 --- a/nautobot_device_onboarding/command_mappers/arista_eos.yml +++ b/nautobot_device_onboarding/command_mappers/arista_eos.yml @@ -116,3 +116,8 @@ sync_network_data: jpath: '{admin_mode: switchports."{{ current_key }}".switchportInfo.mode, mode: switchports."{{ current_key }}".switchportInfo.mode, access_vlan: switchports."{{ current_key }}".switchportInfo.accessVlanId, trunking_vlans: switchports."{{ current_key }}".switchportInfo.trunkAllowedVlans, native_vlan: switchports."{{ current_key }}".switchportInfo.trunkingNativeVlanId}' # yamllint disable-line rule:quoted-strings post_processor: "{{ obj | get_vlan_data(vlan_map, 'untagged') | tojson }}" iterable_type: "dict" + software_version: + commands: + - command: "show version" + parser: "textfsm" + jpath: "[*].image" diff --git a/nautobot_device_onboarding/command_mappers/cisco_ios.yml b/nautobot_device_onboarding/command_mappers/cisco_ios.yml index 5d7734dc..b4141a54 100755 --- a/nautobot_device_onboarding/command_mappers/cisco_ios.yml +++ b/nautobot_device_onboarding/command_mappers/cisco_ios.yml @@ -129,3 +129,8 @@ sync_network_data: parser: "textfsm" jpath: "[*].{local_interface:local_interface, remote_interface:neighbor_interface, remote_device:neighbor_name}" post_processor: "{% set result = [] %}{% for cable in obj %}{% set _=result.append({'local_interface': cable['local_interface'], 'remote_interface': cable['remote_interface'], 'remote_device': cable['remote_device'] | remove_fqdn }) %}{% endfor %}{{ result | tojson }}" + software_version: + commands: + - command: "show version" + parser: "textfsm" + jpath: "[*].version" diff --git a/nautobot_device_onboarding/command_mappers/cisco_nxos.yml b/nautobot_device_onboarding/command_mappers/cisco_nxos.yml index e0f672a4..c7db1408 100755 --- a/nautobot_device_onboarding/command_mappers/cisco_nxos.yml +++ b/nautobot_device_onboarding/command_mappers/cisco_nxos.yml @@ -122,3 +122,8 @@ sync_network_data: parser: "textfsm" jpath: "[*].{local_interface:local_interface, remote_interface:neighbor_interface, remote_device:neighbor_name}" post_processor: "{% set result = [] %}{% for cable in obj %}{% set _=result.append({'local_interface': cable['local_interface'], 'remote_interface': cable['remote_interface'], 'remote_device': cable['remote_device'] | remove_fqdn }) %}{% endfor %}{{ result | tojson }}" + software_version: + commands: + - command: "show version" + parser: "textfsm" + jpath: "[*].os" diff --git a/nautobot_device_onboarding/command_mappers/cisco_xe.yml b/nautobot_device_onboarding/command_mappers/cisco_xe.yml index aa1e5c8a..64c280dc 100755 --- a/nautobot_device_onboarding/command_mappers/cisco_xe.yml +++ b/nautobot_device_onboarding/command_mappers/cisco_xe.yml @@ -126,3 +126,8 @@ sync_network_data: parser: "textfsm" jpath: "[*].{local_interface:local_interface, remote_interface:neighbor_interface, remote_device:neighbor_name}" post_processor: "{% set result = [] %}{% for cable in obj %}{% set _=result.append({'local_interface': cable['local_interface'], 'remote_interface': cable['remote_interface'], 'remote_device': cable['remote_device'] | remove_fqdn }) %}{% endfor %}{{ result | tojson }}" + software_version: + commands: + - command: "show version" + parser: "textfsm" + jpath: "[*].version" diff --git a/nautobot_device_onboarding/command_mappers/juniper_junos.yml b/nautobot_device_onboarding/command_mappers/juniper_junos.yml index b146f5f3..7eb51d82 100755 --- a/nautobot_device_onboarding/command_mappers/juniper_junos.yml +++ b/nautobot_device_onboarding/command_mappers/juniper_junos.yml @@ -121,3 +121,8 @@ sync_network_data: jpath: '"lldp-neighbors-information"[]."lldp-neighbor-information"[].{local_interface: "lldp-local-port-id"[0].data, remote_interface: "lldp-remote-port-id"[0].data, remote_device: "lldp-remote-system-name"[0].data}' # yamllint disable-line rule:quoted-strings post_processor: "{% set result = [] %}{% for cable in obj %}{% set _=result.append({'local_interface': cable['local_interface'], 'remote_interface': cable['remote_interface'], 'remote_device': cable['remote_device'] | remove_fqdn }) %}{% endfor %}{{ result | tojson }}" iterable_type: "dict" + software_version: + commands: + - command: "show system information | display json" + parser: "none" + jpath: '"system-information"[]."os-version"[].data' # yamllint disable-line rule:quoted-strings diff --git a/nautobot_device_onboarding/diffsync/adapters/sync_network_data_adapters.py b/nautobot_device_onboarding/diffsync/adapters/sync_network_data_adapters.py index 316f7dcb..b5ae3372 100644 --- a/nautobot_device_onboarding/diffsync/adapters/sync_network_data_adapters.py +++ b/nautobot_device_onboarding/diffsync/adapters/sync_network_data_adapters.py @@ -7,7 +7,7 @@ from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ValidationError -from nautobot.dcim.models import Interface +from nautobot.dcim.models import Device, Interface, SoftwareVersion from nautobot.ipam.models import VLAN, VRF, IPAddress from nautobot_ssot.contrib import NautobotAdapter from netaddr import EUI, mac_unix_expanded @@ -52,6 +52,8 @@ class SyncNetworkDataNautobotAdapter(FilteredNautobotAdapter): lag_to_interface = sync_network_data_models.SyncNetworkDataLagToInterface vrf_to_interface = sync_network_data_models.SyncNetworkDataVrfToInterface cable = sync_network_data_models.SyncNetworkDataCable + software_version = sync_network_data_models.SyncNetworkSoftwareVersion + software_version_to_device = sync_network_data_models.SyncNetworkSoftwareVersionToDevice primary_ips = None @@ -66,6 +68,8 @@ class SyncNetworkDataNautobotAdapter(FilteredNautobotAdapter): "lag_to_interface", "vrf_to_interface", "cable", + "software_version", + "software_version_to_device", ] def _cache_primary_ips(self, device_queryset): @@ -305,6 +309,32 @@ def load_cables(self): except diffsync.exceptions.ObjectAlreadyExists: continue + def load_software_versions(self): + """Load Software Versions into the Diffsync store.""" + for software_version in SoftwareVersion.objects.all(): + network_software_version = self.software_version( + adapter=self, + version=software_version.version, + platform__name=software_version.platform.name, + ) + try: + network_software_version.model_flags = DiffSyncModelFlags.SKIP_UNMATCHED_DST + self.add(network_software_version) + except diffsync.exceptions.ObjectAlreadyExists: + continue + + def load_software_version_to_device(self): + """Load Software Version to Device assignments into the Diffsync store.""" + for device in self.job.devices_to_load: + network_software_version_to_device = self.software_version_to_device( + adapter=self, + name=device.name, + serial=device.serial, + software_version__version=device.software_version.version if device.software_version else "", + ) + network_software_version_to_device.model_flags = DiffSyncModelFlags.SKIP_UNMATCHED_DST + self.add(network_software_version_to_device) + def load(self): """Generic implementation of the load function.""" if not hasattr(self, "top_level") or not self.top_level: @@ -334,6 +364,12 @@ def load(self): elif model_name == "cable": if self.job.sync_cables: self.load_cables() + elif model_name == "software_version": + if self.job.sync_software_version: + self.load_software_versions() + elif model_name == "software_version_to_device": + if self.job.sync_software_version: + self.load_software_version_to_device() else: diffsync_model = self._get_diffsync_class(model_name) self._load_objects(diffsync_model) @@ -409,6 +445,8 @@ def __init__(self, *args, job, sync=None, **kwargs): lag_to_interface = sync_network_data_models.SyncNetworkDataLagToInterface vrf_to_interface = sync_network_data_models.SyncNetworkDataVrfToInterface cable = sync_network_data_models.SyncNetworkDataCable + software_version = sync_network_data_models.SyncNetworkSoftwareVersion + software_version_to_device = sync_network_data_models.SyncNetworkSoftwareVersionToDevice top_level = [ "ip_address", @@ -421,6 +459,8 @@ def __init__(self, *args, job, sync=None, **kwargs): "lag_to_interface", "vrf_to_interface", "cable", + "software_version", + "software_version_to_device", ] def _handle_failed_devices(self, device_data): @@ -890,6 +930,46 @@ def load_cables(self): # pylint: disable=inconsistent-return-statements model_type="cable", ) + def load_software_versions(self): + """Load software versions into the Diffsync store.""" + for ( # pylint: disable=too-many-nested-blocks + hostname, + device_data, + ) in self.job.command_getter_result.items(): + if self.job.debug: + self.job.logger.debug(f"Loading Software Versions from {hostname}") + if device_data["software_version"]: + device = Device.objects.get(serial=device_data["serial"]) + try: + network_software_version = self.software_version( + adapter=self, + platform__name=device.platform.name, + version=device_data["software_version"], + ) + self.add(network_software_version) + except diffsync.exceptions.ObjectAlreadyExists: + continue + + def load_software_version_to_device(self): + """Load software version to device assignments into the Diffsync store.""" + for ( # pylint: disable=too-many-nested-blocks + hostname, + device_data, + ) in self.job.command_getter_result.items(): + if self.job.debug: + self.job.logger.debug(f"Loading Software Version to Device assignments from {hostname}") + if device_data["software_version"]: + try: + network_software_version_to_device = self.software_version_to_device( + adapter=self, + name=hostname, + serial=device_data["serial"], + software_version__version=device_data["software_version"], + ) + self.add(network_software_version_to_device) + except diffsync.exceptions.ObjectAlreadyExists: + continue + def load(self): """Load network data.""" self.execute_command_getter() @@ -908,3 +988,7 @@ def load(self): self.load_vrf_to_interface() if self.job.sync_cables: self.load_cables() + if self.job.sync_software_version: + self.load_software_versions() + if self.job.sync_software_version: + self.load_software_version_to_device() diff --git a/nautobot_device_onboarding/diffsync/models/sync_network_data_models.py b/nautobot_device_onboarding/diffsync/models/sync_network_data_models.py index 760f7678..e85d7451 100644 --- a/nautobot_device_onboarding/diffsync/models/sync_network_data_models.py +++ b/nautobot_device_onboarding/diffsync/models/sync_network_data_models.py @@ -1,6 +1,7 @@ """Diffsync models.""" from typing import List, Optional +from uuid import UUID try: from typing import Annotated # Python>=3.9 @@ -11,7 +12,7 @@ from diffsync import exceptions as diffsync_exceptions from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist, ValidationError from nautobot.dcim.choices import InterfaceTypeChoices -from nautobot.dcim.models import Cable, Device, Interface, Location +from nautobot.dcim.models import Cable, Device, Interface, Location, Platform, SoftwareVersion from nautobot.extras.models import Status from nautobot.ipam.models import VLAN, VRF, IPAddress, IPAddressToInterface from nautobot_ssot.contrib import CustomFieldAnnotation, NautobotModel @@ -667,3 +668,117 @@ class SyncNetworkDataCable(FilteredNautobotModel): termination_b__name: str status__name: str + + +class SyncNetworkSoftwareVersion(DiffSyncModel): + """Shared data model representing a software version.""" + + _modelname = "software_version" + _model = SoftwareVersion + _identifiers = ( + "version", + "platform__name", + ) + _attributes = () + _children = {} + + version: str + platform__name: str + + pk: Optional[UUID] = None + + @classmethod + def create(cls, adapter, ids, attrs): + """Create a new software version.""" + try: + platform = Platform.objects.get(name=ids["platform__name"]) + except ObjectDoesNotExist: + adapter.job.logger.error( + f"Failed to create software version {ids['version']}. An platform with name: " + f"{ids['platform__name']} was not found." + ) + raise diffsync_exceptions.ObjectNotCreated + try: + software_version = SoftwareVersion( + version=ids["version"], + platform=platform, + status=Status.objects.get(name="Active"), + ) + software_version.validated_save() + except ValidationError as err: + adapter.job.logger.error(f"Software version {software_version} failed to create, {err}") + raise diffsync_exceptions.ObjectNotCreated + + return super().create(adapter, ids, attrs) + + def delete(self): + """Prevent software version deletion.""" + self.adapter.job.logger.error(f"{self} will not be deleted.") + return None + + +class SyncNetworkSoftwareVersionToDevice(DiffSyncModel): + """Shared data model representing a software version to device.""" + + _model = Device + _modelname = "software_version_to_device" + _identifiers = ( + "name", + "serial", + ) + _attributes = ("software_version__version",) + + name: str + serial: str + software_version__version: str + + def _get_and_assign_sofware_version(self, adapter, attrs): + """Assign a software version to a device.""" + try: + device = Device.objects.get(**self.get_identifiers()) + except ObjectDoesNotExist: + adapter.job.logger.error( + f"Failed to assign software version to {self.name}. An device with name: " f"{self.name} was not found." + ) + raise diffsync_exceptions.ObjectNotCreated + try: + software_version = SoftwareVersion.objects.get( + version=attrs["software_version__version"], platform=device.platform + ) + device.software_version = software_version + except ObjectDoesNotExist: + adapter.job.logger.error( + f"Failed to assign software version to {self.name}. An software version with name: " + f"{self.name} was not found." + ) + raise diffsync_exceptions.ObjectNotUpdated + try: + device.validated_save() + except ValidationError as err: + adapter.job.logger.error(f"Software version {software_version} failed to assign, {err}") + raise diffsync_exceptions.ObjectNotUpdated + + def update(self, attrs): + """Update an existing SoftwareVersionToDevice object.""" + if attrs.get("software_version__version"): + try: + self._get_and_assign_sofware_version(self.adapter, attrs) + except ObjectDoesNotExist as err: + self.adapter.job.logger.error(f"{self} failed to update, {err}") + raise diffsync_exceptions.ObjectNotUpdated + + return super().update(attrs) + + @classmethod + def create(cls, adapter, ids, attrs): + """ + Do not create new devices. + + Network devices need to exist in Nautobot prior to syncing data and + need to be included in the queryset generated based on job form inputs. + """ + return None + + def delete(self): + """Prevent device deletion.""" + return None diff --git a/nautobot_device_onboarding/jobs.py b/nautobot_device_onboarding/jobs.py index 60ca84bd..ddd8c78f 100755 --- a/nautobot_device_onboarding/jobs.py +++ b/nautobot_device_onboarding/jobs.py @@ -594,6 +594,7 @@ class Meta: sync_vlans = BooleanVar(default=False, description="Sync VLANs and interface VLAN assignments.") sync_vrfs = BooleanVar(default=False, description="Sync VRFs and interface VRF assignments.") sync_cables = BooleanVar(default=False, description="Sync cables between interfaces via a LLDP or CDP.") + sync_software_version = BooleanVar(default=False, description="Sync software version from device.") namespace = ObjectVar( model=Namespace, required=True, @@ -670,6 +671,7 @@ def run( sync_vlans, sync_vrfs, sync_cables, + sync_software_version, *args, **kwargs, ): @@ -688,6 +690,7 @@ def run( self.sync_vlans = sync_vlans self.sync_vrfs = sync_vrfs self.sync_cables = sync_cables + self.sync_software_version = sync_software_version # Check for last_network_data_sync CustomField if self.debug: @@ -750,6 +753,7 @@ def run( "sync_vlans": sync_vlans, "sync_vrfs": sync_vrfs, "sync_cables": sync_cables, + "sync_software_version": sync_software_version, "connectivity_test": kwargs["connectivity_test"], } @@ -805,6 +809,7 @@ def run(self, *args, **kwargs): # pragma: no cover kwargs.update({"sync_vrfs": True}) kwargs.update({"sync_vlans": True}) kwargs.update({"sync_cables": True}) + kwargs.update({"sync_software_version": True}) nr_with_processors.run( task=netmiko_send_commands, command_getter_yaml_data=nornir_obj.inventory.defaults.data["platform_parsing_info"], @@ -824,6 +829,7 @@ def run(self, *args, **kwargs): # pragma: no cover kwargs.update({"sync_vrfs": True}) kwargs.update({"sync_vlans": True}) kwargs.update({"sync_cables": True}) + kwargs.update({"sync_software_version": True}) nr_with_processors.run( task=netmiko_send_commands, command_getter_yaml_data=nornir_obj.inventory.defaults.data["platform_parsing_info"], diff --git a/nautobot_device_onboarding/nornir_plays/command_getter.py b/nautobot_device_onboarding/nornir_plays/command_getter.py index eff29225..0d3b8abb 100755 --- a/nautobot_device_onboarding/nornir_plays/command_getter.py +++ b/nautobot_device_onboarding/nornir_plays/command_getter.py @@ -58,7 +58,7 @@ def deduplicate_command_list(data): return unique_list -def _get_commands_to_run(yaml_parsed_info, sync_vlans, sync_vrfs, sync_cables): +def _get_commands_to_run(yaml_parsed_info, sync_vlans, sync_vrfs, sync_cables, sync_software_version): """Using merged command mapper info and look up all commands that need to be run.""" all_commands = [] for key, value in yaml_parsed_info.items(): @@ -78,30 +78,36 @@ def _get_commands_to_run(yaml_parsed_info, sync_vlans, sync_vrfs, sync_cables): # Deduplicate commands + parser key current_root_key = value.get("commands") if isinstance(current_root_key, list): - # Means their is any "nested" structures. e.g multiple commands + # Means there is a "nested" structures. e.g. multiple commands for command in value["commands"]: - # If syncing vlans isn't inscope don't run the unneeded commands. + # If syncing vlans isn't in scope don't run the unneeded commands. if not sync_vlans and key in ["interfaces__tagged_vlans", "interfaces__untagged_vlan"]: continue - # If syncing vrfs isn't inscope remove the unneeded commands. + # If syncing vrfs isn't in scope remove the unneeded commands. if not sync_vrfs and key == "interfaces__vrf": continue - # If syncing cables isn't inscope remove the unneeded commands. + # If syncing cables isn't in scope remove the unneeded commands. if not sync_cables and key == "cables": continue + # If syncing software_versions isn't in scope remove the unneeded commands. + if not sync_software_version and key == "software_version": + continue all_commands.append(command) else: if isinstance(current_root_key, dict): - # If syncing vlans isn't inscope don't run the unneeded commands. + # Means there isn't a "nested" structures. e.g. 1 command + # If syncing vlans isn't in scope don't run the unneeded commands. if not sync_vlans and key in ["interfaces__tagged_vlans", "interfaces__untagged_vlan"]: continue - # If syncing vrfs isn't inscope remove the unneeded commands. + # If syncing vrfs isn't in scope remove the unneeded commands. if not sync_vrfs and key == "interfaces__vrf": continue - # If syncing cables isn't inscope remove the unneeded commands. + # If syncing cables isn't in scope remove the unneeded commands. if not sync_cables and key == "cables": continue - # Means their isn't a "nested" structures. e.g 1 command + # If syncing software_versions isn't in scope remove the unneeded commands. + if not sync_software_version and key == "software_version": + continue all_commands.append(current_root_key) return deduplicate_command_list(all_commands) @@ -129,6 +135,7 @@ def netmiko_send_commands( orig_job_kwargs.get("sync_vlans", False), orig_job_kwargs.get("sync_vrfs", False), orig_job_kwargs.get("sync_cables", False), + orig_job_kwargs.get("sync_software_version", False), ) if ( orig_job_kwargs.get("sync_cables", False) @@ -358,6 +365,7 @@ def sync_network_data_command_getter(job_result, log_level, kwargs): "sync_vlans": kwargs["sync_vlans"], "sync_vrfs": kwargs["sync_vrfs"], "sync_cables": kwargs["sync_cables"], + "sync_software_version": kwargs["sync_software_version"], }, }, }, diff --git a/nautobot_device_onboarding/nornir_plays/formatter.py b/nautobot_device_onboarding/nornir_plays/formatter.py index 1752c567..3e20ae64 100755 --- a/nautobot_device_onboarding/nornir_plays/formatter.py +++ b/nautobot_device_onboarding/nornir_plays/formatter.py @@ -127,6 +127,7 @@ def perform_data_extraction(host, command_info_dict, command_outputs_dict, job_d sync_vlans = host.defaults.data.get("sync_vlans", False) sync_vrfs = host.defaults.data.get("sync_vrfs", False) sync_cables = host.defaults.data.get("sync_cables", False) + sync_software_version = host.defaults.data.get("sync_software_version", False) get_context_from_pre_processor = {} if command_info_dict.get("pre_processor"): for pre_processor_name, field_data in command_info_dict["pre_processor"].items(): @@ -155,6 +156,8 @@ def perform_data_extraction(host, command_info_dict, command_outputs_dict, job_d continue if not sync_cables and ssot_field == "cables": continue + if not sync_software_version and ssot_field == "software_version": + continue if ssot_field == "pre_processor": continue if isinstance(field_data["commands"], dict): diff --git a/nautobot_device_onboarding/nornir_plays/schemas.py b/nautobot_device_onboarding/nornir_plays/schemas.py index b9cb40e9..045a203d 100755 --- a/nautobot_device_onboarding/nornir_plays/schemas.py +++ b/nautobot_device_onboarding/nornir_plays/schemas.py @@ -216,5 +216,9 @@ def sync_network_data_schema(json_schema=True): }, }, }, + "software_version": { + "type": "string", + "description": "Software version of the device", + }, }, } diff --git a/nautobot_device_onboarding/tests/fixtures/sync_network_data_fixture.py b/nautobot_device_onboarding/tests/fixtures/sync_network_data_fixture.py index 5043525a..d31e238d 100644 --- a/nautobot_device_onboarding/tests/fixtures/sync_network_data_fixture.py +++ b/nautobot_device_onboarding/tests/fixtures/sync_network_data_fixture.py @@ -109,6 +109,7 @@ "remote_interface": "GigabitEthernet3", }, ], + "software_version": "16.12.4", }, "demo-cisco-2": { "serial": "9ABUXU5882222", @@ -190,6 +191,7 @@ "remote_interface": "GigabitEthernet3", }, ], + "software_version": "3.12R.4", }, } failed_device = {"demo-cisco-3": {"failed": True, "failed_reason": "Authentication failure"}} diff --git a/nautobot_device_onboarding/tests/mock/arista_eos/sync_network_data_with_software/expected_result_1.json b/nautobot_device_onboarding/tests/mock/arista_eos/sync_network_data_with_software/expected_result_1.json new file mode 100644 index 00000000..afd6bea1 --- /dev/null +++ b/nautobot_device_onboarding/tests/mock/arista_eos/sync_network_data_with_software/expected_result_1.json @@ -0,0 +1,71 @@ +{ + "interfaces": { + "Ethernet1": { + "802.1Q_mode": "", + "description": "", + "ip_addresses": [ + { + "ip_address": "1.1.1.1", + "prefix_length": 24 + } + ], + "lag": [], + "link_status": "False", + "mac_address": "52:54:00:91:1e:bf", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet2": { + "802.1Q_mode": "access", + "description": "", + "ip_addresses": [], + "lag": [], + "link_status": "True", + "mac_address": "52:54:00:15:b8:13", + "mtu": "9214", + "type": "1000base-t" + }, + "Ethernet3": { + "802.1Q_mode": "access", + "description": "", + "ip_addresses": [], + "lag": [], + "link_status": "True", + "mac_address": "52:54:00:07:8d:69", + "mtu": "9214", + "type": "1000base-t" + }, + "Ethernet4": { + "802.1Q_mode": "tagged", + "description": "", + "ip_addresses": [ + { + "ip_address": "0.0.0.0", + "prefix_length": 0 + } + ], + "lag": [], + "link_status": "True", + "mac_address": "52:54:00:91:1e:bf", + "mtu": "1500", + "type": "1000base-t" + }, + "Management1": { + "802.1Q_mode": "", + "description": "", + "ip_addresses": [ + { + "ip_address": "198.51.100.1", + "prefix_length": 24 + } + ], + "lag": [], + "link_status": "True", + "mac_address": "52:54:00:0d:29:5c", + "mtu": "1500", + "type": "1000base-t" + } + }, + "serial": "17E1C0B9EEFFCE88C2E0703E4A1D4FB0", + "software_version": "4.31.0F" +} \ No newline at end of file diff --git a/nautobot_device_onboarding/tests/mock/cisco_ios/sync_network_data_with_software/expected_result_1.json b/nautobot_device_onboarding/tests/mock/cisco_ios/sync_network_data_with_software/expected_result_1.json new file mode 100644 index 00000000..42528e1b --- /dev/null +++ b/nautobot_device_onboarding/tests/mock/cisco_ios/sync_network_data_with_software/expected_result_1.json @@ -0,0 +1,276 @@ +{ + "interfaces": { + "GigabitEthernet0/1": { + "802.1Q_mode": "access", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "6c71.0d1d.3581", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/10": { + "802.1Q_mode": "tagged-all", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "6c71.0d1d.358a", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/11": { + "802.1Q_mode": "tagged-all", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "6c71.0d1d.358b", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/12": { + "802.1Q_mode": "tagged-all", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "6c71.0d1d.358c", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/13": { + "802.1Q_mode": "tagged-all", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "6c71.0d1d.358d", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/14": { + "802.1Q_mode": "tagged-all", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "6c71.0d1d.358e", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/15": { + "802.1Q_mode": "tagged", + "description": "***connection to SW1***", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "6c71.0d1d.358f", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/16": { + "802.1Q_mode": "tagged-all", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "6c71.0d1d.3590", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/2": { + "802.1Q_mode": "access", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "6c71.0d1d.3582", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/3": { + "802.1Q_mode": "access", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "6c71.0d1d.3583", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/4": { + "802.1Q_mode": "access", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "6c71.0d1d.3584", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/5": { + "802.1Q_mode": "tagged-all", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "6c71.0d1d.3585", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/6": { + "802.1Q_mode": "tagged-all", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "6c71.0d1d.3586", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/7": { + "802.1Q_mode": "tagged-all", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "6c71.0d1d.3587", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/8": { + "802.1Q_mode": "tagged-all", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "6c71.0d1d.3588", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/9": { + "802.1Q_mode": "tagged-all", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "6c71.0d1d.3589", + "mtu": "1500", + "type": "1000base-t" + }, + "Vlan1": { + "802.1Q_mode": "", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "6c71.0d1d.35c0", + "mtu": "1500", + "type": "virtual" + }, + "Vlan10": { + "802.1Q_mode": "", + "description": "", + "ip_addresses": [ + { + "ip_address": "198.51.100.1", + "prefix_length": "28" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "6c71.0d1d.35c1", + "mtu": "1500", + "type": "virtual" + } + }, + "serial": "FOC2341Y2CQ", + "software_version": "15.2(7)E9" +} \ No newline at end of file diff --git a/nautobot_device_onboarding/tests/mock/cisco_ios/sync_network_data_with_software/expected_result_2.json b/nautobot_device_onboarding/tests/mock/cisco_ios/sync_network_data_with_software/expected_result_2.json new file mode 100644 index 00000000..dda93f0e --- /dev/null +++ b/nautobot_device_onboarding/tests/mock/cisco_ios/sync_network_data_with_software/expected_result_2.json @@ -0,0 +1,201 @@ +{ + "interfaces": { + "GigabitEthernet0/1": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "2c3f.3899.1501", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/10": { + "802.1Q_mode": "tagged-all", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "2c3f.3899.150a", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/2": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "2c3f.3899.1502", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/3": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "2c3f.3899.1503", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/4": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "2c3f.3899.1504", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/5": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "2c3f.3899.1505", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/6": { + "802.1Q_mode": "access", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "2c3f.3899.1506", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/7": { + "802.1Q_mode": "access", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "2c3f.3899.1507", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/8": { + "802.1Q_mode": "access", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "2c3f.3899.1508", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet0/9": { + "802.1Q_mode": "access", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "2c3f.3899.1509", + "mtu": "1500", + "type": "1000base-t" + }, + "Vlan1": { + "802.1Q_mode": "", + "description": "", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "2c3f.3899.1540", + "mtu": "1500", + "type": "virtual" + }, + "Vlan255": { + "802.1Q_mode": "", + "description": "", + "ip_addresses": [ + { + "ip_address": "10.35.255.75", + "prefix_length": "24" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "2c3f.3899.1541", + "mtu": "1500", + "type": "virtual" + }, + "Vlan955": { + "802.1Q_mode": "", + "description": "", + "ip_addresses": [ + { + "ip_address": "198.51.100.1", + "prefix_length": "27" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "2c3f.3899.1542", + "mtu": "1500", + "type": "virtual" + } + }, + "serial": "FOC1541W2SP", + "software_version": "15.0(2)SE8" +} \ No newline at end of file diff --git a/nautobot_device_onboarding/tests/mock/cisco_nxos/sync_network_data_with_software/expected_result_1.json b/nautobot_device_onboarding/tests/mock/cisco_nxos/sync_network_data_with_software/expected_result_1.json new file mode 100644 index 00000000..3f4d4321 --- /dev/null +++ b/nautobot_device_onboarding/tests/mock/cisco_nxos/sync_network_data_with_software/expected_result_1.json @@ -0,0 +1,1221 @@ +{ + "serial": "FDO20432435", + "software_version": "7.0(3)I7(4)", + "interfaces": { + "Ethernet1/1": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/1.1": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "139.65.22.246", + "prefix_length": "30" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/10": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99f5", + "mtu": "9216", + "type": "1000base-t" + }, + "Ethernet1/11": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99f6", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/12": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99f7", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/13": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99f8", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/14": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99f9", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/15": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99fa", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/16": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99fb", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/17": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99fc", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/18": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99fd", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/19": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99fe", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/2": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/2.1": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "139.65.22.250", + "prefix_length": "30" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/20": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99ff", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/21": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.9a00", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/22": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.9a01", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/23": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.9a02", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/24": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a03", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/25": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.9a04", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/26": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.9a05", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/27": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.9a06", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/28": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/28.2": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "172.16.0.2", + "prefix_length": "31" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/29": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a08", + "mtu": "9216", + "type": "1000base-t" + }, + "Ethernet1/3": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99ee", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/30": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a09", + "mtu": "9216", + "type": "1000base-t" + }, + "Ethernet1/31": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a0a", + "mtu": "9216", + "type": "1000base-t" + }, + "Ethernet1/32": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a0b", + "mtu": "9216", + "type": "1000base-t" + }, + "Ethernet1/33": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a0c", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/34": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a0d", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/35": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a0e", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/36": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a0f", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/37": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a10", + "mtu": "9216", + "type": "1000base-t" + }, + "Ethernet1/38": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a11", + "mtu": "9216", + "type": "1000base-t" + }, + "Ethernet1/39": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a12", + "mtu": "9216", + "type": "1000base-t" + }, + "Ethernet1/4": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99ef", + "mtu": "9216", + "type": "1000base-t" + }, + "Ethernet1/40": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a13", + "mtu": "9216", + "type": "1000base-t" + }, + "Ethernet1/41": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/42": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/43": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a16", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/44": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a17", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/45": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a18", + "mtu": "9216", + "type": "1000base-t" + }, + "Ethernet1/46": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a19", + "mtu": "9216", + "type": "1000base-t" + }, + "Ethernet1/47": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a1a", + "mtu": "9216", + "type": "1000base-t" + }, + "Ethernet1/48": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a1b", + "mtu": "9216", + "type": "1000base-t" + }, + "Ethernet1/49": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.9a1c", + "mtu": "1500", + "type": "other" + }, + "Ethernet1/5": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99f0", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/50": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.9a1d", + "mtu": "1500", + "type": "other" + }, + "Ethernet1/51": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.9a1e", + "mtu": "1500", + "type": "other" + }, + "Ethernet1/52": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.9a1f", + "mtu": "1500", + "type": "other" + }, + "Ethernet1/53": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.9a20", + "mtu": "9216", + "type": "other" + }, + "Ethernet1/54": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.9a21", + "mtu": "1500", + "type": "other" + }, + "Ethernet1/6": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99f1", + "mtu": "1500", + "type": "1000base-t" + }, + "Ethernet1/7": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99f2", + "mtu": "9216", + "type": "1000base-t" + }, + "Ethernet1/8": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99f3", + "mtu": "9216", + "type": "1000base-t" + }, + "Ethernet1/9": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99f4", + "mtu": "9216", + "type": "1000base-t" + }, + "Vlan1": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan110": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.34.1.67", + "prefix_length": "28" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan115": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.34.1.83", + "prefix_length": "28" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan128": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.34.6.133", + "prefix_length": "27" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan135": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.135.3", + "prefix_length": "24" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan136": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "144.5.136.3", + "prefix_length": "24" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan160": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.34.6.174", + "prefix_length": "28" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan176": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.34.6.190", + "prefix_length": "28" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan192": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.34.6.198", + "prefix_length": "29" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan200": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.111.19", + "prefix_length": "29" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan201": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.73.3", + "prefix_length": "29" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan202": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.111.42", + "prefix_length": "29" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan210": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.111.98", + "prefix_length": "29" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan214": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.111.3", + "prefix_length": "29" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan215": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.57.131", + "prefix_length": "26" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan216": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.57.195", + "prefix_length": "26" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan218": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.218.3", + "prefix_length": "24" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan219": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.219.3", + "prefix_length": "24" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan220": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.59.243", + "prefix_length": "29" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan3112": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "172.22.32.1", + "prefix_length": "21" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99eb", + "mtu": "9216", + "type": "virtual" + }, + "Vlan3130": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "172.22.8.3", + "prefix_length": "24" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan3146": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.197.131", + "prefix_length": "25" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan345": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.34.5.174", + "prefix_length": "28" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan350": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "139.65.137.3", + "prefix_length": "26" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan63": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.63.3", + "prefix_length": "25" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "9216", + "type": "virtual" + }, + "Vlan64": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.34.6.126", + "prefix_length": "26" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan66": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.66.3", + "prefix_length": "24" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan67": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.67.3", + "prefix_length": "24" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan68": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.68.3", + "prefix_length": "24" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan70": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.70.3", + "prefix_length": "24" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan71": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.71.3", + "prefix_length": "24" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "Vlan72": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.72.3", + "prefix_length": "24" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "virtual" + }, + "loopback0": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.27.111.247", + "prefix_length": "32" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "mgmt0": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "198.51.100.1", + "prefix_length": "24" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99e4", + "mtu": "1500", + "type": "other" + }, + "port-channel29": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a0a", + "mtu": "9216", + "type": "lag" + }, + "port-channel3": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "0000.0000.0000", + "mtu": "1500", + "type": "lag" + }, + "port-channel33": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a0c", + "mtu": "1500", + "type": "lag" + }, + "port-channel35": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a0e", + "mtu": "1500", + "type": "lag" + }, + "port-channel36": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "0000.0000.0000", + "mtu": "1500", + "type": "lag" + }, + "port-channel37": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a10", + "mtu": "9216", + "type": "lag" + }, + "port-channel41": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.1.0.2", + "prefix_length": "30" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99eb", + "mtu": "1500", + "type": "lag" + }, + "port-channel43": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a16", + "mtu": "1500", + "type": "lag" + }, + "port-channel45": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.9a18", + "mtu": "9216", + "type": "lag" + }, + "port-channel53": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "False", + "mac_address": "0000.0000.0000", + "mtu": "9216", + "type": "lag" + }, + "port-channel6": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99f1", + "mtu": "1500", + "type": "lag" + }, + "port-channel7": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [], + "lag": "", + "link_status": "True", + "mac_address": "286f.7f7e.99f3", + "mtu": "9216", + "type": "lag" + } + } +} \ No newline at end of file diff --git a/nautobot_device_onboarding/tests/mock/cisco_xe/sync_network_data_with_software/expected_result_1.json b/nautobot_device_onboarding/tests/mock/cisco_xe/sync_network_data_with_software/expected_result_1.json new file mode 100644 index 00000000..e637b3a4 --- /dev/null +++ b/nautobot_device_onboarding/tests/mock/cisco_xe/sync_network_data_with_software/expected_result_1.json @@ -0,0 +1,771 @@ +{ + "interfaces": { + "GigabitEthernet0": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "ac3a.6789.5dcf", + "mtu": "1500", + "type": "other" + }, + "GigabitEthernet0/0/0": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "10.39.67.234", + "prefix_length": "30" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "ac3a.6789.5d40", + "mtu": "1500", + "type": "other" + }, + "GigabitEthernet0/0/1": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "ac3a.6789.5d41", + "mtu": "1500", + "type": "other" + }, + "GigabitEthernet0/0/1.100": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "10.39.67.1", + "prefix_length": "25" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "ac3a.6789.5d41", + "mtu": "1500", + "type": "other" + }, + "GigabitEthernet0/0/1.200": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "10.41.238.129", + "prefix_length": "26" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "ac3a.6789.5d41", + "mtu": "1500", + "type": "other" + }, + "GigabitEthernet0/0/1.300": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "10.39.67.209", + "prefix_length": "29" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "ac3a.6789.5d41", + "mtu": "1500", + "type": "other" + }, + "GigabitEthernet0/0/2": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "10.39.67.217", + "prefix_length": "30" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "ac3a.6789.5d42", + "mtu": "1500", + "type": "other" + }, + "GigabitEthernet0/2/0": { + "802.1Q_mode": "tagged-all", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "ac3a.6789.5d50", + "mtu": "1500", + "type": "other" + }, + "GigabitEthernet0/2/1": { + "802.1Q_mode": "tagged-all", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "ac3a.6789.5d51", + "mtu": "1500", + "type": "other" + }, + "GigabitEthernet0/2/2": { + "802.1Q_mode": "tagged-all", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "ac3a.6789.5d52", + "mtu": "1500", + "type": "other" + }, + "GigabitEthernet0/2/3": { + "802.1Q_mode": "tagged-all", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "ac3a.6789.5d53", + "mtu": "1500", + "type": "other" + }, + "GigabitEthernet0/2/4": { + "802.1Q_mode": "tagged-all", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "ac3a.6789.5d54", + "mtu": "1500", + "type": "other" + }, + "GigabitEthernet0/2/5": { + "802.1Q_mode": "tagged-all", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "ac3a.6789.5d55", + "mtu": "1500", + "type": "other" + }, + "GigabitEthernet0/2/6": { + "802.1Q_mode": "tagged-all", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "ac3a.6789.5d56", + "mtu": "1500", + "type": "other" + }, + "GigabitEthernet0/2/7": { + "802.1Q_mode": "access", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "ac3a.6789.5d57", + "mtu": "1500", + "type": "other" + }, + "Loopback0": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "198.51.100.1", + "prefix_length": "32" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "", + "mtu": "1514", + "type": "other" + }, + "Serial0/1/0:0": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:1": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:10": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:11": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:12": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:13": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:14": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:15": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:16": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:17": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:18": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:19": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:2": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:20": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:21": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:22": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:23": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:24": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:25": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:26": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:27": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:28": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:29": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:3": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:30": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:4": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:5": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:6": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:7": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:8": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Serial0/1/0:9": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "", + "mtu": "1500", + "type": "other" + }, + "Service-Engine0/1/0": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "cc70.ed3b.0716", + "mtu": "9216", + "type": "other" + }, + "Service-Engine0/4/0": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "ac3a.6789.5d40", + "mtu": "9216", + "type": "other" + }, + "Tunnel0": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "", + "mtu": "9972", + "type": "other" + }, + "Vlan1": { + "802.1Q_mode": "", + "description": "isr description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "ac3a.6789.5dc4", + "mtu": "1500", + "type": "virtual" + } + }, + "serial": "FLM241611GV", + "software_version": "16.9.4" +} \ No newline at end of file diff --git a/nautobot_device_onboarding/tests/mock/cisco_xe/sync_network_data_with_software/expected_result_2.json b/nautobot_device_onboarding/tests/mock/cisco_xe/sync_network_data_with_software/expected_result_2.json new file mode 100644 index 00000000..5a39abb1 --- /dev/null +++ b/nautobot_device_onboarding/tests/mock/cisco_xe/sync_network_data_with_software/expected_result_2.json @@ -0,0 +1,1656 @@ +{ + "interfaces": { + "FastEthernet0": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.ccb9", + "mtu": "1500", + "type": "other" + }, + "GigabitEthernet1/0/1": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf01", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/10": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf0a", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/11": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf0b", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/12": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf0c", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/13": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf0d", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/14": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf0e", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/15": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf0f", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/16": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf10", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/17": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf11", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/18": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf12", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/19": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf13", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/2": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf02", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/20": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf14", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/21": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf15", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/22": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf16", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/23": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf17", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/24": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf18", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/25": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf19", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/26": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf1a", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/27": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf1b", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/28": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf1c", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/29": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf1d", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/3": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf03", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/30": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf1e", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/31": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf1f", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/32": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf20", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/33": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf21", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/34": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf22", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/35": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf23", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/36": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf24", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/37": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf25", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/38": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf26", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/39": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf27", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/4": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf04", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/40": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf28", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/41": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf29", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/42": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf2a", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/43": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf2b", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/44": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf2c", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/45": { + "802.1Q_mode": "tagged-all", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "d0ec.3507.cf2d", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/46": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf2e", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/47": { + "802.1Q_mode": "tagged-all", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "d0ec.3507.cf2f", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/48": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf30", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/49": { + "802.1Q_mode": "tagged", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "Port-channel1", + "link_status": "False", + "mac_address": "d0ec.3507.cf31", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/5": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf05", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/50": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf32", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/6": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf06", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/7": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf07", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/8": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf08", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet1/0/9": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf09", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/1": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc81", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/10": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc8a", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/11": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc8b", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/12": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc8c", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/13": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc8d", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/14": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc8e", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/15": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc8f", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/16": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc90", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/17": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc91", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/18": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc92", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/19": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc93", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/2": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc82", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/20": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc94", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/21": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc95", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/22": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc96", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/23": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc97", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/24": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc98", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/25": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc99", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/26": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc9a", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/27": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc9b", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/28": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc9c", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/29": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc9d", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/3": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc83", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/30": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc9e", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/31": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc9f", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/32": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cca0", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/33": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cca1", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/34": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cca2", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/35": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cca3", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/36": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cca4", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/37": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cca5", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/38": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cca6", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/39": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cca7", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/4": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "d0ec.3507.cc84", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/40": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cca8", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/41": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cca9", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/42": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.ccaa", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/43": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.ccab", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/44": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.ccac", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/45": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.ccad", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/46": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.ccae", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/47": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.ccaf", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/48": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.ccb0", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/49": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.ccb1", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/5": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc85", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/50": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.ccb2", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/6": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc86", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/7": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc87", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/8": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc88", + "mtu": "1500", + "type": "1000base-t" + }, + "GigabitEthernet2/0/9": { + "802.1Q_mode": "access", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cc89", + "mtu": "1500", + "type": "1000base-t" + }, + "Port-channel1": { + "802.1Q_mode": "tagged-all", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "d0ec.3507.ccb3", + "mtu": "1500", + "type": "lag" + }, + "TenGigabitEthernet1/0/1": { + "802.1Q_mode": "tagged-all", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "d0ec.3507.cf33", + "mtu": "1500", + "type": "10gbase-t" + }, + "TenGigabitEthernet1/0/2": { + "802.1Q_mode": "tagged-all", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.cf34", + "mtu": "1500", + "type": "10gbase-t" + }, + "TenGigabitEthernet2/0/1": { + "802.1Q_mode": "tagged-all", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "Port-channel1", + "link_status": "True", + "mac_address": "d0ec.3507.ccb3", + "mtu": "1500", + "type": "10gbase-t" + }, + "TenGigabitEthernet2/0/2": { + "802.1Q_mode": "tagged-all", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.ccb4", + "mtu": "1500", + "type": "10gbase-t" + }, + "Vlan1": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.ccc0", + "mtu": "1500", + "type": "virtual" + }, + "Vlan255": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "10.60.255.59", + "prefix_length": "24" + } + ], + "lag": "", + "link_status": "False", + "mac_address": "d0ec.3507.ccc2", + "mtu": "1500", + "type": "virtual" + }, + "Vlan41": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "", + "prefix_length": "" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "d0ec.3507.ccc1", + "mtu": "1500", + "type": "virtual" + }, + "Vlan955": { + "802.1Q_mode": "", + "description": "a description", + "ip_addresses": [ + { + "ip_address": "198.51.100.1", + "prefix_length": "27" + } + ], + "lag": "", + "link_status": "True", + "mac_address": "d0ec.3507.ccc3", + "mtu": "1500", + "type": "virtual" + } + }, + "serial": "FJC2304W0BB", + "software_version": "15.2(4)E9" +} \ No newline at end of file diff --git a/nautobot_device_onboarding/tests/test_command_getter.py b/nautobot_device_onboarding/tests/test_command_getter.py index 49ad4f99..2ff05bed 100755 --- a/nautobot_device_onboarding/tests/test_command_getter.py +++ b/nautobot_device_onboarding/tests/test_command_getter.py @@ -29,6 +29,7 @@ def test_deduplicate_command_list_sync_devices(self): sync_vlans=False, sync_vrfs=False, sync_cables=False, + sync_software_version=False, ) expected_commands_to_run = [ {"command": "show version", "jpath": "[*].hostname", "parser": "textfsm"}, @@ -48,6 +49,7 @@ def test_deduplicate_command_list_sync_data_no_vrfs_no_vlans(self): sync_vlans=False, sync_vrfs=False, sync_cables=False, + sync_software_version=False, ) expected_commands_to_run = [ {"command": "show version", "parser": "textfsm", "jpath": "[*].serial[]"}, @@ -81,6 +83,7 @@ def test_deduplicate_command_list_sync_data_with_vrfs_no_vlans(self): sync_vlans=False, sync_vrfs=True, sync_cables=False, + sync_software_version=False, ) expected_commands_to_run = [ {"command": "show version", "parser": "textfsm", "jpath": "[*].serial[]"}, @@ -121,6 +124,7 @@ def test_deduplicate_command_list_sync_data_no_vrfs_with_vlans(self): sync_vlans=True, sync_vrfs=False, sync_cables=False, + sync_software_version=False, ) expected_commands_to_run = [ {"command": "show vlan", "parser": "textfsm", "jpath": "[*].{id: vlan_id, name: vlan_name}"}, @@ -155,6 +159,7 @@ def test_deduplicate_command_list_sync_data_with_vrfs_and_vlans(self): sync_vlans=True, sync_vrfs=True, sync_cables=False, + sync_software_version=False, ) expected_commands_to_run = [ {"command": "show vlan", "parser": "textfsm", "jpath": "[*].{id: vlan_id, name: vlan_name}"}, @@ -191,7 +196,11 @@ def test_deduplicate_command_list_sync_data_with_vrfs_and_vlans(self): def test_deduplicate_command_list_sync_data_cables(self): get_commands_to_run = _get_commands_to_run( - self.expected_data["sync_network_data"], sync_vlans=False, sync_vrfs=False, sync_cables=True + self.expected_data["sync_network_data"], + sync_vlans=False, + sync_vrfs=False, + sync_cables=True, + sync_software_version=False, ) expected_commands_to_run = [ {"command": "show version", "parser": "textfsm", "jpath": "[*].serial[]"}, diff --git a/nautobot_device_onboarding/tests/test_jobs.py b/nautobot_device_onboarding/tests/test_jobs.py index b2fd19cb..35909917 100644 --- a/nautobot_device_onboarding/tests/test_jobs.py +++ b/nautobot_device_onboarding/tests/test_jobs.py @@ -202,6 +202,7 @@ def test_sync_network_data__success(self, device_data): "sync_vlans": True, "sync_vrfs": True, "sync_cables": True, + "sync_software_version": True, "namespace": self.testing_objects["namespace"].pk, "interface_status": self.testing_objects["status"].pk, "ip_address_status": self.testing_objects["status"].pk, diff --git a/nautobot_device_onboarding/tests/test_sync_network_data_adapters.py b/nautobot_device_onboarding/tests/test_sync_network_data_adapters.py index 4b6db870..415ea0c0 100644 --- a/nautobot_device_onboarding/tests/test_sync_network_data_adapters.py +++ b/nautobot_device_onboarding/tests/test_sync_network_data_adapters.py @@ -4,7 +4,7 @@ from django.contrib.contenttypes.models import ContentType from nautobot.core.testing import TransactionTestCase -from nautobot.dcim.models import Cable, Device, Interface +from nautobot.dcim.models import Cable, Device, Interface, SoftwareVersion from nautobot.extras.models import JobResult from nautobot.ipam.models import VLAN, VRF, IPAddress @@ -41,6 +41,7 @@ def setUp(self): # pylint: disable=invalid-name self.job.namespace = self.testing_objects["namespace"] self.job.sync_vlans = True self.job.sync_vrfs = True + self.job.sync_software_version = True self.job.debug = True self.job.devices_to_load = None @@ -227,6 +228,25 @@ def test_load_cables(self): self.assertEqual(termination_b_device, diffsync_obj.termination_b__device__name) self.assertEqual(termination_b_interface, diffsync_obj.termination_b__name) + def test_load_software_versions(self): + """Test loading software version data returned from command getter into the diffsync store.""" + self.sync_network_data_adapter.load_software_versions() + for _, device_data in self.job.command_getter_result.items(): + device_data = self.job.command_getter_result["demo-cisco-1"] + device = Device.objects.get(serial=device_data["serial"]) + unique_id = f"{device_data['software_version']}__{device.platform}" + diffsync_obj = self.sync_network_data_adapter.get("software_version", unique_id) + self.assertEqual("cisco_ios", diffsync_obj.platform__name) + self.assertEqual(device_data["software_version"], diffsync_obj.version) + + def test_load_software_version_to_device(self): + self.sync_network_data_adapter.load_software_version_to_device() + for _, device_data in self.job.command_getter_result.items(): + device = Device.objects.get(serial=device_data["serial"]) + unique_id = f"{device.name}__{device.serial}" + diffsync_obj = self.sync_network_data_adapter.get("software_version_to_device", unique_id) + self.assertEqual(device_data["software_version"], diffsync_obj.software_version__version) + class SyncNetworkDataNautobotAdapterTestCase(TransactionTestCase): """Test SyncNetworkDataNautobotAdapter class.""" @@ -387,6 +407,23 @@ def test_load_vrf_to_interface(self): self.assertEqual(interface.name, diffsync_obj.name) self.assertEqual(vrf, diffsync_obj.vrf) + def test_load_software_versions(self): + """Test loading Nautobot software version data into the diffsync store.""" + self.sync_network_data_adapter.load_software_versions() + for software_version in SoftwareVersion.objects.all(): + unique_id = f"{software_version.version}__{software_version.platform.name}" + diffsync_obj = self.sync_network_data_adapter.get("software_version", unique_id) + self.assertEqual(software_version.platform.name, diffsync_obj.platform__name) + self.assertEqual(software_version.version, diffsync_obj.version) + + def test_load_software_version_to_device(self): + """Test loading Nautobot software version device assignments into the Diffsync store.""" + self.sync_network_data_adapter.load_software_version_to_device() + for device in Device.objects.filter(name__in=["demo-cisco-1", "demo-cisco-2"]): + unique_id = f"{device.name}__{device.serial}" + diffsync_obj = self.sync_network_data_adapter.get("software_version_to_device", unique_id) + self.assertEqual(device.software_version.version, diffsync_obj.software_version__version) + def test_sync_complete(self): """Test primary ip re-assignment if deleted during the sync.""" self.sync_network_data_adapter._cache_primary_ips( # pylint: disable=protected-access diff --git a/nautobot_device_onboarding/tests/utils.py b/nautobot_device_onboarding/tests/utils.py index ad94acfa..0930fcbf 100644 --- a/nautobot_device_onboarding/tests/utils.py +++ b/nautobot_device_onboarding/tests/utils.py @@ -3,7 +3,17 @@ from django.contrib.contenttypes.models import ContentType from nautobot.circuits.models import Circuit, CircuitTermination, CircuitType, Provider from nautobot.dcim.choices import InterfaceModeChoices, InterfaceTypeChoices -from nautobot.dcim.models import Cable, Device, DeviceType, Interface, Location, LocationType, Manufacturer, Platform +from nautobot.dcim.models import ( + Cable, + Device, + DeviceType, + Interface, + Location, + LocationType, + Manufacturer, + Platform, + SoftwareVersion, +) from nautobot.extras.choices import SecretsGroupAccessTypeChoices, SecretsGroupSecretTypeChoices from nautobot.extras.models import Role, Secret, SecretsGroup, SecretsGroupAssociation, Status from nautobot.ipam.choices import IPAddressTypeChoices, PrefixTypeChoices @@ -23,6 +33,7 @@ def sync_network_data_ensure_required_nautobot_objects(): status.content_types.add(ContentType.objects.get_for_model(VLAN)) status.content_types.add(ContentType.objects.get_for_model(VRF)) status.content_types.add(ContentType.objects.get_for_model(Cable)) + status.content_types.add(ContentType.objects.get_for_model(SoftwareVersion)) status.content_types.add(ContentType.objects.get_for_model(Circuit)) status.validated_save() @@ -86,6 +97,8 @@ def sync_network_data_ensure_required_nautobot_objects(): vlan_2, _ = VLAN.objects.get_or_create(vid=50, name="vlan50", location=location, status=status) vrf_1, _ = VRF.objects.get_or_create(name="mgmt", namespace=namespace) vrf_2, _ = VRF.objects.get_or_create(name="vrf2", namespace=namespace) + software_version_1, _ = SoftwareVersion.objects.get_or_create(version="16.12.4", platform=platform_1, status=status) + software_version_2, _ = SoftwareVersion.objects.get_or_create(version="3.12R.4", platform=platform_2, status=status) device_type, _ = DeviceType.objects.get_or_create(model="CSR1000V17", manufacturer=manufacturer) device_1, _ = Device.objects.get_or_create( @@ -97,6 +110,7 @@ def sync_network_data_ensure_required_nautobot_objects(): role=device_role, platform=platform_1, secrets_group=secrets_group, + software_version=software_version_1, ) device_2, _ = Device.objects.get_or_create( name="demo-cisco-2", @@ -107,6 +121,7 @@ def sync_network_data_ensure_required_nautobot_objects(): role=device_role, platform=platform_2, secrets_group=secrets_group, + software_version=software_version_2, ) device_3, _ = Device.objects.get_or_create( name="demo-cisco-3", @@ -117,6 +132,7 @@ def sync_network_data_ensure_required_nautobot_objects(): role=device_role, platform=platform_2, secrets_group=secrets_group, + software_version=software_version_2, ) interface_1, _ = Interface.objects.get_or_create( device=device_1, name="GigabitEthernet1", status=status, type=InterfaceTypeChoices.TYPE_VIRTUAL @@ -188,6 +204,8 @@ def sync_network_data_ensure_required_nautobot_objects(): testing_objects["vlan_2"] = vlan_2 testing_objects["vrf_1"] = vrf_1 testing_objects["vrf_2"] = vrf_2 + testing_objects["software_version_1"] = software_version_1 + testing_objects["software_version_2"] = software_version_2 testing_objects["cable_to_circuit"] = cable_to_circuit_1 return testing_objects diff --git a/poetry.lock b/poetry.lock index 0eb83f9f..36aca184 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1363,15 +1363,18 @@ dev = ["coverage", "pytest (>=7.4.4)"] [[package]] name = "exceptiongroup" -version = "1.2.2" +version = "1.3.0" description = "Backport of PEP 654 (exception groups)" optional = false python-versions = ">=3.7" files = [ - {file = "exceptiongroup-1.2.2-py3-none-any.whl", hash = "sha256:3111b9d131c238bec2f8f516e123e14ba243563fb135d3fe885990585aa7795b"}, - {file = "exceptiongroup-1.2.2.tar.gz", hash = "sha256:47c2edf7c6738fafb49fd34290706d1a1a2f4d1c6df275526b62cbb4aa5393cc"}, + {file = "exceptiongroup-1.3.0-py3-none-any.whl", hash = "sha256:4d111e6e0c13d0644cad6ddaa7ed0261a0b36971f6d23e7ec9b4b9097da78a10"}, + {file = "exceptiongroup-1.3.0.tar.gz", hash = "sha256:b241f5885f560bc56a59ee63ca4c6a8bfa46ae4ad651af316d4e81817bb9fd88"}, ] +[package.dependencies] +typing-extensions = {version = ">=4.6.0", markers = "python_version < \"3.13\""} + [package.extras] test = ["pytest (>=6)"] @@ -4860,4 +4863,4 @@ all = [] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.13" -content-hash = "8d95fe8b5c3306eddd69e369e6d8eb132395c81d9d9e8e3685648913345bcf85" +content-hash = "92ce506bc44f4239cea92aaacd38b160cc7e6c58ca64a568fda76c9815bcdab2" diff --git a/pyproject.toml b/pyproject.toml index fc56e95a..4d95a4bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -30,7 +30,7 @@ include = [ python = ">=3.8,<3.13" napalm = ">=2.5.0, <5" zipp = "^3.4.0" -nautobot = "^2.2.3" +nautobot = "^2.3.1" nautobot-ssot = "^3.0.0" nautobot-plugin-nornir = "^2.0.0" jdiff = ">=0.0.6,<1.0.0"