Verified Commit 50b94f12 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Fix typo.

parent 6e7ce0f8
Pipeline #35969 passed with stages
in 17 minutes and 17 seconds
...@@ -49,12 +49,12 @@ class DiscoveryID(Document): ...@@ -49,12 +49,12 @@ class DiscoveryID(Document):
"collection": "noc.inv.discovery_id", "collection": "noc.inv.discovery_id",
"strict": False, "strict": False,
"auto_create_index": False, "auto_create_index": False,
"indexes": ["object", "hostname", "udld_id", "macs"], "indexes": ["object", "hostname", "hostname_id", "udld_id", "macs"],
} }
object = ForeignKeyField(ManagedObject) object = ForeignKeyField(ManagedObject)
chassis_mac = ListField(EmbeddedDocumentField(MACRange)) chassis_mac = ListField(EmbeddedDocumentField(MACRange))
hostname = StringField() hostname = StringField()
hostname_raw = StringField() hostname_id = StringField()
router_id = StringField() router_id = StringField()
udld_id = StringField() # UDLD local identifier udld_id = StringField() # UDLD local identifier
# #
...@@ -115,8 +115,8 @@ class DiscoveryID(Document): ...@@ -115,8 +115,8 @@ class DiscoveryID(Document):
if o: if o:
old_macs = set(m.first_mac for m in o.chassis_mac) old_macs = set(m.first_mac for m in o.chassis_mac)
o.chassis_mac = ranges o.chassis_mac = ranges
o.hostname = hostname.lower() o.hostname = hostname
o.hostname_raw = hostname o.hostname_id = hostname.lower()
o.router_id = router_id o.router_id = router_id
old_macs -= set(m.first_mac for m in o.chassis_mac) old_macs -= set(m.first_mac for m in o.chassis_mac)
if old_macs: if old_macs:
...@@ -128,8 +128,8 @@ class DiscoveryID(Document): ...@@ -128,8 +128,8 @@ class DiscoveryID(Document):
cls( cls(
object=object, object=object,
chassis_mac=ranges, chassis_mac=ranges,
hostname=hostname.lower(), hostname=hostname,
hostname_raw=hostname, hostname_id=hostname.lower(),
router_id=router_id, router_id=router_id,
macs=macs, macs=macs,
).save() ).save()
......
...@@ -1003,7 +1003,7 @@ class TopologyDiscoveryCheck(DiscoveryCheck): ...@@ -1003,7 +1003,7 @@ class TopologyDiscoveryCheck(DiscoveryCheck):
""" """
hostname = hostname.lower() hostname = hostname.lower()
if hostname not in self.neighbor_hostname_cache: if hostname not in self.neighbor_hostname_cache:
hosts = DiscoveryID.objects.filter(hostname=hostname)[:2] hosts = DiscoveryID.objects.filter(hostname_id=hostname)[:2]
n = None n = None
if len(hosts) == 1: if len(hosts) == 1:
n = hosts[0].object n = hosts[0].object
...@@ -1012,7 +1012,7 @@ class TopologyDiscoveryCheck(DiscoveryCheck): ...@@ -1012,7 +1012,7 @@ class TopologyDiscoveryCheck(DiscoveryCheck):
# Try to resolve anyway # Try to resolve anyway
m = list( m = list(
DiscoveryID.objects.filter( DiscoveryID.objects.filter(
hostname__istartswith=hostname + "." if "." not in hostname else hostname hostname_id__istartswith=hostname + "." if "." not in hostname else hostname
) )
) )
if len(m) == 1: if len(m) == 1:
......
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