Commit d4e489d0 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Merge branch 'backport-5764' into 'release-20.4'

release-20.4:Backport!5764 Fix IPv6 addresses discovery on DHCP error.

See merge request noc/noc!5773
parents e6e4068d 026d0ab9
...@@ -16,7 +16,7 @@ from noc.ip.models.address import Address ...@@ -16,7 +16,7 @@ from noc.ip.models.address import Address
from noc.core.perf import metrics from noc.core.perf import metrics
from noc.core.handler import get_handler from noc.core.handler import get_handler
from noc.core.validators import is_fqdn from noc.core.validators import is_fqdn
from noc.core.ip import IP, IPv4, PrefixDB from noc.core.ip import IP, PrefixDB
DiscoveredAddress = namedtuple( DiscoveredAddress = namedtuple(
...@@ -201,7 +201,7 @@ class AddressCheck(DiscoveryCheck): ...@@ -201,7 +201,7 @@ class AddressCheck(DiscoveryCheck):
def get_vpn_id(ip): def get_vpn_id(ip):
try: try:
return vpn_db[IPv4(ip)] return vpn_db[IP.prefix(ip)]
except KeyError: except KeyError:
pass pass
if self.object.vrf: if self.object.vrf:
...@@ -224,7 +224,7 @@ class AddressCheck(DiscoveryCheck): ...@@ -224,7 +224,7 @@ class AddressCheck(DiscoveryCheck):
return [] return []
vpn_db = PrefixDB() vpn_db = PrefixDB()
for a in addresses: for a in addresses:
vpn_db[IPv4(a["address"]).first] = a["vpn_id"] vpn_db[IP.prefix(a["address"]).first] = a["vpn_id"]
# #
self.logger.debug("Getting DHCP addresses") self.logger.debug("Getting DHCP addresses")
leases = self.object.scripts.get_dhcp_binding() leases = self.object.scripts.get_dhcp_binding()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment