Skip to content

Commit

Permalink
Removed lo_interface
Browse files Browse the repository at this point in the history
  • Loading branch information
johannwagner committed Nov 19, 2024
1 parent 2bbb558 commit dcc1f62
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cosmo.yml
leaf*.json

cosmo_data.yaml
machines/test0001/*
machines/**

.coverage
*~
5 changes: 1 addition & 4 deletions cosmo/serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,10 @@ def __init__(self, cfg, device, l2vpn_list, vrfs, loopbacks):
self.mgmt_routing_instance = "mgmt_junos"
self.mgmt_interface = "fxp0"
self.bmc_interface = None
self.lo_interface = "lo0"
case 'rtbrick':
self.mgmt_routing_instance = "mgmt"
self.mgmt_interface = "ma1"
self.bmc_interface = "bmc0"
self.lo_interface = "lo-0/0/0"
case other:
raise DeviceSerializationError(f"unsupported platform vendor: {other}")
return
Expand Down Expand Up @@ -535,8 +533,7 @@ def serialize(self):
}
}

if interfaces.get(self.lo_interface, {}).get("units", {}).get(0):
router_id = next(iter(interfaces[self.lo_interface]["units"][0]["families"]["inet"]["address"].keys())).split("/")[0]
router_id = str(ipaddress.ip_interface(self.loopbacks[self.device['name']]['ipv4']).ip)

for _, l2vpn in self.l2vpns.items():
if l2vpn['type'].lower() in ["vxlan_evpn", "vxlan-evpn"]:
Expand Down
2 changes: 0 additions & 2 deletions cosmo/tests/test_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,11 @@ def test_router_platforms():
assert juniper_s.mgmt_routing_instance == "mgmt_junos"
assert juniper_s.mgmt_interface == "fxp0"
assert juniper_s.bmc_interface == None
assert juniper_s.lo_interface == "lo0"

[rtbrick_s] = get_router_s_from_path("./test_case_l3vpn.yml")
assert rtbrick_s.mgmt_routing_instance == "mgmt"
assert rtbrick_s.mgmt_interface == "ma1"
assert rtbrick_s.bmc_interface == "bmc0"
assert rtbrick_s.lo_interface == "lo-0/0/0"

with pytest.raises(Exception, match="unsupported platform vendor: ACME"):
get_router_s_from_path("./test_case_vendor_unknown.yaml")
Expand Down

0 comments on commit dcc1f62

Please sign in to comment.