Skip to content

Commit

Permalink
Merge pull request #413 from nautobot/jacobm/ipfabric/fix-technology-…
Browse files Browse the repository at this point in the history
…calls

Fix IPFabric technology calls to us `all`
  • Loading branch information
Kircheneer authored Apr 4, 2024
2 parents 6e4c42b + 4780efb commit 04b9110
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions changes/413.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed method of retrieving objects from IPFabric's technology categories.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def load(self): # pylint: disable=too-many-locals,too-many-statements
interfaces = self.client.inventory.interfaces.all()
vlans = self.client.fetch_all("tables/vlan/site-summary")
networks = defaultdict(list)
for network in self.client.technology.managed_networks.networks.fetch(
for network in self.client.technology.managed_networks.networks.all(
filters={"net": ["empty", False], "siteName": ["empty", False]},
columns=["net", "siteName"],
):
Expand Down Expand Up @@ -151,7 +151,7 @@ def load(self): # pylint: disable=too-many-locals,too-many-statements
location_devices = [device for device in devices if device["siteName"] == location.name]
for device in location_devices:
device_name = device["hostname"]
stack_members = self.client.technology.platforms.stacks_members.fetch(
stack_members = self.client.technology.platforms.stacks_members.all(
filters={"master": ["eq", device_name], "siteName": ["eq", location.name]},
columns=["master", "member", "memberSn", "pn"],
)
Expand Down
4 changes: 2 additions & 2 deletions nautobot_ssot/tests/ipfabric/test_ipfabric_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def setUp(self):
side_effect=(lambda x: VLAN_FIXTURE if x == "tables/vlan/site-summary" else "")
)
ipfabric_client.inventory.interfaces.all.return_value = INTERFACE_FIXTURE
ipfabric_client.technology.managed_networks.networks.fetch.return_value = NETWORKS_FIXTURE
ipfabric_client.technology.platforms.stacks_members.fetch.side_effect = [[] for site in SITE_FIXTURE[:-1]] + [
ipfabric_client.technology.managed_networks.networks.all.return_value = NETWORKS_FIXTURE
ipfabric_client.technology.platforms.stacks_members.all.side_effect = [[] for site in SITE_FIXTURE[:-1]] + [
STACKS_FIXTURE
]

Expand Down
1 change: 1 addition & 0 deletions nautobot_ssot/tests/test_contrib_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ class Adapter(NautobotAdapter):
top_level = ["vlan_group"]

location_type = dcim_models.LocationType.objects.create(name="Building")
location_type.content_types.add(ContentType.objects.get_for_model(ipam_models.VLAN))
location = dcim_models.Location.objects.create(
name="Example Building", location_type=location_type, status=extras_models.Status.objects.get(name="Active")
)
Expand Down

0 comments on commit 04b9110

Please sign in to comment.