Skip to content

Commit

Permalink
bug fix sorting
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyschulman committed Aug 17, 2023
1 parent 3513553 commit bbf18c6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions netcad/topology/checks/check_device_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ class DeviceInterfaceInfo(BaseModel):
def _interfaces_as_dict(device: Device) -> dict:
as_dict = dict()

for if_name, iface in device.interfaces.items():
for iface in sorted(device.interfaces.values()):
iface = device.interfaces[iface.name]
if not iface.used:
as_dict[if_name] = DeviceInterfaceInfo(
used=False, name=if_name, enabled=iface.enabled, desc=iface.desc
as_dict[iface.name] = DeviceInterfaceInfo(
used=False, name=iface.name, enabled=iface.enabled, desc=iface.desc
)
continue

Expand All @@ -99,9 +100,9 @@ def _interfaces_as_dict(device: Device) -> dict:

flags = if_prof.profile_flags

as_dict[if_name] = DeviceInterfaceInfo(
as_dict[iface.name] = DeviceInterfaceInfo(
used=True,
name=if_name,
name=iface.name,
enabled=iface.enabled,
desc=iface.desc,
port_type=port_type,
Expand Down
2 changes: 1 addition & 1 deletion netcad/topology/checks/check_ipaddrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class IPInterfacesCheckCollection(CheckCollection):
def build(cls, device: Device, **kwargs) -> Optional["IPInterfacesCheckCollection"]:
if_l3_list = [
iface
for iface in device.interfaces.used().values()
for iface in sorted(device.interfaces.used().values())
if isinstance(iface.profile, InterfaceL3)
and (iface.profile.if_ipaddr or iface.profile.is_reserved)
]
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 = "netcad"
version = "0.10.0"
version = "0.10.1"
description = "NetCAD/CAM - Network Automation by Design"
authors = ["Jeremy Schulman"]
readme = "README.md"
Expand Down

0 comments on commit bbf18c6

Please sign in to comment.