nautobot-app-ssot icon indicating copy to clipboard operation
nautobot-app-ssot copied to clipboard

Mgmt0 interface not created for APIC devices

Open jasonjuenger opened this issue 2 years ago • 0 comments

Environment

  • Python version: 3.7.15
  • Nautobot version: 1.5.4
  • nautobot-ssot-aci version: 1.0.0

Expected Behavior

Plugin should create mgmt0 interface object for Cisco ACI APIC devices so an IP Address object can be correctly created and assigned to the interface.

Observed Behavior

Create() method in NautobotIPAddress class queries for the interface(s) belonging to an APIC device in order to create an IP Address object and associate it with the relevant APIC interface. The plugin does not currently create Interface objects for APICs, specifically mgmt0, so the query for the device interfaces fails resulting in the following error.

  File "/usr/local/lib/python3.7/site-packages/nautobot_ssot/jobs/base.py", line 332, in run
    self.sync_data()
  File "/usr/local/lib/python3.7/site-packages/nautobot_ssot/jobs/base.py", line 167, in sync_data
    self.execute_sync()
  File "/usr/local/lib/python3.7/site-packages/nautobot_ssot/jobs/base.py", line 95, in execute_sync
    self.source_adapter.sync_to(self.target_adapter, flags=self.diffsync_flags)
  File "/usr/local/lib/python3.7/site-packages/diffsync/__init__.py", line 579, in sync_to
    target.sync_from(self, diff_class=diff_class, flags=flags, callback=callback, diff=diff)
  File "/usr/local/lib/python3.7/site-packages/diffsync/__init__.py", line 557, in sync_from
    result = syncer.perform_sync()
  File "/usr/local/lib/python3.7/site-packages/diffsync/helpers.py", line 327, in perform_sync
    changed |= self.sync_diff_element(element)
  File "/usr/local/lib/python3.7/site-packages/diffsync/helpers.py", line 367, in sync_diff_element
    changed, modified_model = self.sync_model(src_model=src_model, dst_model=dst_model, ids=ids, attrs=attrs)
  File "/usr/local/lib/python3.7/site-packages/diffsync/helpers.py", line 416, in sync_model
    dst_model = self.model_class.create(diffsync=self.dst_diffsync, ids=ids, attrs=attrs)
  File "/usr/local/lib/python3.7/site-packages/nautobot_ssot_aci/diffsync/models/nautobot.py", line 347, in create
    .interfaces.get(name=attrs["interface"])
  File "/usr/local/lib/python3.7/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/cacheops/query.py", line 351, in get
    return qs._no_monkey.get(qs, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/django/db/models/query.py", line 437, in get
    self.model._meta.object_name
nautobot.dcim.models.device_components.Interface.DoesNotExist: Interface matching query does not exist.

Steps to Reproduce

  1. Discover an ACI fabric with dry-run disabled and at least 1 physical APIC (not tested against ACI Simulator)

jasonjuenger avatar Dec 09 '22 21:12 jasonjuenger