Do not permit duplicate IP addresses for device

FIXES #177

Apply the change suggested in the issue body: UISP can report
devices with duplicate IP addresses across interfaces. Check
that an IP address is unique before applying it.

Changed for both Flat and Hierarchy networks.
This commit is contained in:
Herbert Wolverson 2022-12-17 08:16:35 -06:00
parent b9b344464c
commit 85becbd5c6

View File

@ -54,7 +54,9 @@ def buildFlatGraph():
for ip in interface["addresses"]:
ip = ip["cidr"]
if isIpv4Permitted(ip):
ipv4.append(fixSubnet(ip))
ip = fixSubnet(ip)
if ip not in ipv4:
ipv4.append(ip)
# TODO: Figure out Mikrotik IPv6?
mac = device['identification']['mac']
@ -157,7 +159,9 @@ def buildFullGraph():
for ip in interface["addresses"]:
ip = ip["cidr"]
if isIpv4Permitted(ip):
ipv4.append(fixSubnet(ip))
ip = fixSubnet(ip)
if ip not in ipv4:
ipv4.append(ip)
# TODO: Figure out Mikrotik IPv6?
mac = device['identification']['mac']