Skip to content
Snippets Groups Projects
Commit bad770dd authored by Erik Reid's avatar Erik Reid
Browse files

handle repeated v6 interface addresses with same name

parent 75b01fc8
Branches
No related tags found
No related merge requests found
...@@ -165,7 +165,23 @@ def get_router_interfaces(router): ...@@ -165,7 +165,23 @@ def get_router_interfaces(router):
"v4InterfaceName": v4InterfaceName "v4InterfaceName": v4InterfaceName
}) })
print(interfaces)
v6IfcNames = {}
for v6InterfaceName in details["v6InterfaceName"]:
m = re.match(r'.*\.(\d+)$', v6InterfaceName["oid"])
assert m
v6IfcNames[m.group(1)] = v6InterfaceName["value"]
for v6AddressAndMask in details["v6AddressAndMask"]:
oid = v6AddressAndMask["oid"]
oid_info = oid[len(oid_map["v6AddressAndMask"]):]
m = re.match(r'^\.(\d+)\.(.+)$', oid_info)
assert m
interfaces.append({
"v6Address": m.group(2),
"v6Mask": v6AddressAndMask["value"],
"v6InterfaceName": v6IfcNames[m.group(1)]
})
return interfaces return interfaces
""" """
...@@ -203,7 +219,8 @@ def cli(config): ...@@ -203,7 +219,8 @@ def cli(config):
with connection(config["alarms-db"]) as c: with connection(config["alarms-db"]) as c:
_db_test(c, r) _db_test(c, r)
get_router_interfaces(r) for i in get_router_interfaces(r):
print(i)
break break
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment