Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
Merge pull request #148 from nautobot/develop
Browse files Browse the repository at this point in the history
v1.5.1 release
  • Loading branch information
qduk authored Feb 24, 2023
2 parents 01fef44 + 1c36203 commit 03461dd
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 6 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## v1.5.1 - 2023-02-24

### Added

- #134 - Added CVP Fields for Topology Pod and Rack. Addresses #126.

### Fixed

- #144 - Fix CustomField creation and CVP Version. Addresses #143 and #133

## v1.5.0 - 2023-01-13

### Added
Expand Down
10 changes: 9 additions & 1 deletion nautobot_ssot_aristacv/diffsync/adapters/cloudvision.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,20 @@ def load_devices(self):
"""Load devices from CloudVision."""
PLUGIN_SETTINGS = settings.PLUGINS_CONFIG["nautobot_ssot_aristacv"]
if PLUGIN_SETTINGS.get("create_controller"):
cvp_version = cloudvision.get_cvp_version()
cvp_ver_cf = self.cf(name="arista_eos", value=cvp_version, device_name="CloudVision")
try:
self.add(cvp_ver_cf)
except ObjectAlreadyExists as err:
self.job.log_warning(
message=f"Unable to add CustomField for EOS Version for CloudVision device as already exists. {err}"
)
new_cvp = self.device(
name="CloudVision",
serial="",
status="active",
device_model="CloudVision",
version=cloudvision.get_cvp_version(),
version=cvp_version,
uuid=None,
)
try:
Expand Down
16 changes: 13 additions & 3 deletions nautobot_ssot_aristacv/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,18 @@ def post_migrate_create_custom_fields(apps=global_apps, **kwargs):
"label": "Topology Network Type",
},
{"name": "arista_topology_type", "type": CustomFieldTypeChoices.TYPE_TEXT, "label": "Topology Type"},
{
"name": "arista_topology_rack",
"type": CustomFieldTypeChoices.TYPE_TEXT,
"label": "Topology Rack",
},
{
"name": "arista_topology_pod",
"type": CustomFieldTypeChoices.TYPE_TEXT,
"label": "Topology Pod",
},
]:
field, _ = CustomField.objects.get_or_create(
field, _ = CustomField.objects.update_or_create(
name=device_cf_dict["name"], defaults=device_cf_dict, slug=device_cf_dict["name"]
)
field.content_types.set([ContentType.objects.get_for_model(Device)])
Expand All @@ -89,7 +99,7 @@ def post_migrate_create_custom_fields(apps=global_apps, **kwargs):
def post_migrate_create_manufacturer(apps=global_apps, **kwargs):
"""Callback function for post_migrate() -- create Arista Manufacturer."""
Manufacturer = apps.get_model("dcim", "Manufacturer")
Manufacturer.objects.get_or_create(name="Arista", slug="arista")
Manufacturer.objects.update_or_create(name="Arista", slug="arista")


def post_migrate_create_platform(apps=global_apps, **kwargs):
Expand Down Expand Up @@ -125,4 +135,4 @@ def post_migrate_create_controller_relationship(apps=global_apps, **kwargs):
"destination_type": ContentType.objects.get_for_model(Device),
"destination_label": "Device",
}
Relationship.objects.get_or_create(name=relationship_dict["name"], defaults=relationship_dict)
Relationship.objects.update_or_create(name=relationship_dict["name"], defaults=relationship_dict)
2 changes: 1 addition & 1 deletion nautobot_ssot_aristacv/utils/nautobot.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def get_device_version(device):
except IndexError:
pass
else:
version = device.custom_field_data["arista_eos"]
version = device.custom_field_data["arista_eos"] if device.custom_field_data.get("arista_eos") else ""
return version


Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nautobot-ssot-aristacv"
version = "1.5.0"
version = "1.5.1"
description = "Nautobot SSoT Arista CloudVision"
authors = ["Network to Code, LLC <[email protected]>"]

Expand Down

0 comments on commit 03461dd

Please sign in to comment.