Skip to content

Commit

Permalink
Merge pull request #594 from nautobot/patch-fix_593
Browse files Browse the repository at this point in the history
Various Bugfixes
  • Loading branch information
jdrew82 authored Nov 11, 2024
2 parents d3f5a7a + 438b7fd commit 3dcebeb
Show file tree
Hide file tree
Showing 15 changed files with 335 additions and 186 deletions.
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
/nautobot_ssot/integrations/aristacv/ @qduk @jdrew82 @nautobot/plugin-ssot
/nautobot_ssot/integrations/bootstrap/ @bile0026 @nautobot/plugin-ssot
/nautobot_ssot/integrations/device42/ @jdrew82 @nautobot/plugin-ssot
/nautobot_ssot/integrations/dna_center/ @jdrew82 @nautobot/plugin-ssot
/nautobot_ssot/integrations/infoblox/ @qduk @jdrew82 @nautobot/plugin-ssot
/nautobot_ssot/integrations/ipfabric/ @alhogan @nautobot/plugin-ssot
/nautobot_ssot/integrations/itential/ @jtdub @nautobot/plugin-ssot
/nautobot_ssot/integrations/meraki/ @jdrew82 @nautobot/plugin-ssot
/nautobot_ssot/integrations/servicenow/ @glennmatthews @qduk @nautobot/plugin-ssot
2 changes: 2 additions & 0 deletions changes/593.added
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Added ability to rename Network in Meraki and Datacenter in DNA Center integrations using location_map.
Added support for SoftwareVersion in Bootstrap integration.
5 changes: 5 additions & 0 deletions changes/593.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Fixed Meraki loading of Nautobot Prefixes that have multiple Locations assigned.
Fixed DNA Center loading incorrect location names for Devices.
Fixed KeyError being thrown when port is missing from uplink_settings dict in Meraki integration.
Fixed error in Bootstrap integration in loading ValidatedSoftwareLCM when SoftwareLCM doesn't exist.
Fixed DoesNotExist thrown when attempting to load ContentType that doesn't exist in Bootstrap integration.
1 change: 1 addition & 0 deletions changes/593.housekeeping
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add code owners for DNA Center, Meraki, and Itential integrations.
93 changes: 41 additions & 52 deletions nautobot_ssot/integrations/bootstrap/diffsync/adapters/nautobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1252,59 +1252,48 @@ def load_validated_software(self):
for nb_validated_software in ORMValidatedSoftware.objects.all():
if self.job.debug:
self.job.logger.debug(f"Loading Nautobot ValidatedSoftwareLCM {nb_validated_software}")
try:
_software = ORMSoftware.objects.get(
version=nb_validated_software.software.version,
device_platform=nb_validated_software.software.device_platform.id,
)
self.get(
self.validated_software,
{
"software": {nb_validated_software.software},
"valid_since": {nb_validated_software.start},
"valid_until": {nb_validated_software.end},
},
)
except ObjectNotFound:
_val_software = ORMValidatedSoftware.objects.get(
software=_software,
start=nb_validated_software.start,
end=nb_validated_software.end,
)
_tags = sorted(list(_val_software.tags.all().values_list("name", flat=True)))
_devices = sorted(list(_val_software.devices.all().values_list("name", flat=True)))
_device_types = sorted(list(_val_software.device_types.all().values_list("model", flat=True)))
_device_roles = sorted(list(_val_software.device_roles.all().values_list("name", flat=True)))
_inventory_items = sorted(list(_val_software.inventory_items.all().values_list("name", flat=True)))
_object_tags = sorted(list(_val_software.object_tags.all().values_list("name", flat=True)))
_sor = ""
if "system_of_record" in nb_validated_software.custom_field_data:
_sor = (
nb_validated_software.custom_field_data["system_of_record"]
if nb_validated_software.custom_field_data["system_of_record"] is not None
else ""
)
new_validated_software = self.validated_software(
software=f"{nb_validated_software.software.device_platform} - {nb_validated_software.software.version}",
software_version=nb_validated_software.software.version,
platform=nb_validated_software.software.device_platform.name,
valid_since=nb_validated_software.start,
valid_until=nb_validated_software.end,
preferred_version=nb_validated_software.preferred,
devices=_devices,
device_types=_device_types,
device_roles=_device_roles,
inventory_items=_inventory_items,
object_tags=_object_tags,
tags=_tags,
system_of_record=_sor,
uuid=nb_validated_software.id,
)

if not check_sor_field(nb_validated_software):
new_validated_software.model_flags = DiffSyncModelFlags.SKIP_UNMATCHED_DST

self.add(new_validated_software)
_tags = sorted(list(nb_validated_software.tags.all().values_list("name", flat=True)))
_devices = sorted(list(nb_validated_software.devices.all().values_list("name", flat=True)))
_device_types = sorted(list(nb_validated_software.device_types.all().values_list("model", flat=True)))
_device_roles = sorted(list(nb_validated_software.device_roles.all().values_list("name", flat=True)))
_inventory_items = sorted(list(nb_validated_software.inventory_items.all().values_list("name", flat=True)))
_object_tags = sorted(list(nb_validated_software.object_tags.all().values_list("name", flat=True)))
_sor = ""
if "system_of_record" in nb_validated_software.custom_field_data:
_sor = (
nb_validated_software.custom_field_data["system_of_record"]
if nb_validated_software.custom_field_data["system_of_record"] is not None
else ""
)
if hasattr(nb_validated_software.software, "device_platform"):
platform = nb_validated_software.software.device_platform.name
else:
platform = nb_validated_software.software.platform.name
new_validated_software, _ = self.get_or_instantiate(
self.validated_software,
ids={
"software": str(nb_validated_software.software),
"valid_since": nb_validated_software.start,
"valid_until": nb_validated_software.end,
},
attrs={
"software_version": nb_validated_software.software.version,
"platform": platform,
"preferred_version": nb_validated_software.preferred,
"devices": _devices,
"device_types": _device_types,
"device_roles": _device_roles,
"inventory_items": _inventory_items,
"object_tags": _object_tags,
"tags": _tags,
"system_of_record": _sor,
"uuid": nb_validated_software.id,
},
)

if not check_sor_field(nb_validated_software):
new_validated_software.model_flags = DiffSyncModelFlags.SKIP_UNMATCHED_DST

def load(self):
"""Load data from Nautobot into DiffSync models."""
Expand Down
Loading

0 comments on commit 3dcebeb

Please sign in to comment.