|
|
@ -128,7 +128,7 @@ ansible_net_interfaces:
|
|
|
|
returned: when interfaces is configured
|
|
|
|
returned: when interfaces is configured
|
|
|
|
type: dict
|
|
|
|
type: dict
|
|
|
|
ansible_net_neighbors:
|
|
|
|
ansible_net_neighbors:
|
|
|
|
description: The list of LLDP neighbors from the remote device
|
|
|
|
description: The list of LLDP/CDP neighbors from the remote device
|
|
|
|
returned: when interfaces is configured
|
|
|
|
returned: when interfaces is configured
|
|
|
|
type: dict
|
|
|
|
type: dict
|
|
|
|
|
|
|
|
|
|
|
@ -297,6 +297,10 @@ class Interfaces(FactsBase):
|
|
|
|
if data:
|
|
|
|
if data:
|
|
|
|
self.facts['neighbors'] = self.populate_neighbors(data)
|
|
|
|
self.facts['neighbors'] = self.populate_neighbors(data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data = self.run('show cdp neighbors detail', 'json')
|
|
|
|
|
|
|
|
if data:
|
|
|
|
|
|
|
|
self.facts['neighbors'] = self.populate_neighbors_cdp(data)
|
|
|
|
|
|
|
|
|
|
|
|
def populate_interfaces(self, data):
|
|
|
|
def populate_interfaces(self, data):
|
|
|
|
interfaces = dict()
|
|
|
|
interfaces = dict()
|
|
|
|
for item in data['TABLE_interface']['ROW_interface']:
|
|
|
|
for item in data['TABLE_interface']['ROW_interface']:
|
|
|
@ -347,6 +351,23 @@ class Interfaces(FactsBase):
|
|
|
|
|
|
|
|
|
|
|
|
return objects
|
|
|
|
return objects
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def populate_neighbors_cdp(self, data):
|
|
|
|
|
|
|
|
objects = dict()
|
|
|
|
|
|
|
|
data = data['TABLE_cdp_neighbor_detail_info']['ROW_cdp_neighbor_detail_info']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if isinstance(data, dict):
|
|
|
|
|
|
|
|
data = [data]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for item in data:
|
|
|
|
|
|
|
|
local_intf = item['intf_id']
|
|
|
|
|
|
|
|
objects[local_intf] = list()
|
|
|
|
|
|
|
|
nbor = dict()
|
|
|
|
|
|
|
|
nbor['port'] = item['port_id']
|
|
|
|
|
|
|
|
nbor['sysname'] = item['device_id']
|
|
|
|
|
|
|
|
objects[local_intf].append(nbor)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return objects
|
|
|
|
|
|
|
|
|
|
|
|
def parse_ipv6_interfaces(self, data):
|
|
|
|
def parse_ipv6_interfaces(self, data):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
data = data['TABLE_intf']
|
|
|
|
data = data['TABLE_intf']
|
|
|
|