add host key as alias for sysname neighbors facts (#49827)

Signed-off-by: Trishna Guha <trishnaguha17@gmail.com>
This commit is contained in:
Trishna Guha 2018-12-13 18:11:14 +05:30 committed by GitHub
parent 2adb9f32ae
commit e944dba166
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -495,7 +495,7 @@ class Interfaces(FactsBase):
objects[local_intf] = list()
nbor = dict()
nbor['port'] = item['port_id']
nbor['sysname'] = item['chassis_id']
nbor['host'] = nbor['sysname'] = item['chassis_id']
objects[local_intf].append(nbor)
return objects
@ -512,7 +512,7 @@ class Interfaces(FactsBase):
objects[local_intf] = list()
nbor = dict()
nbor['port'] = item['port_id']
nbor['sysname'] = item['device_id']
nbor['host'] = nbor['sysname'] = item['device_id']
objects[local_intf].append(nbor)
return objects
@ -645,7 +645,9 @@ class Interfaces(FactsBase):
for item in data.split('\n')[4:-1]:
match = regex.match(item)
if match:
nbor = {'host': match.group(1), 'port': match.group(3)}
nbor = dict()
nbor['host'] = nbor['sysname'] = match.group(1)
nbor['port'] = match.group(3)
local_intf = normalize_interface(match.group(2))
if local_intf not in objects:
objects[local_intf] = []