Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions tests/test_lldp.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from ansible_host import AnsibleHost

import logging
logger = logging.getLogger(__name__)

def test_lldp(localhost, ansible_adhoc, testbed):
""" verify the LLDP message on DUT """
Expand Down Expand Up @@ -39,12 +40,20 @@ def test_lldp_neighbor(localhost, ansible_adhoc, testbed, eos):
host_facts = ans_host.setup()['ansible_facts']
lhost = AnsibleHost(ansible_adhoc, 'localhost', True)

config_facts = ans_host.config_facts(host=hostname, source="running")['ansible_facts']
nei_meta = config_facts.get('DEVICE_NEIGHBOR_METADATA', {})

for k, v in lldp_facts['lldp'].items():
if k == 'eth0':
# skip test on management interface
continue

hostip = v['chassis']['mgmt-ip']
try:
hostip = v['chassis']['mgmt-ip']
except:
logger.info("Neighbor device {} does not sent management IP via lldp".format(v['chassis']['name']))
hostip = nei_meta[v['chassis']['name']]['mgmt_addr']

nei_lldp_facts = lhost.lldp_facts(host=hostip, version='v2c', community=eos['snmp_rocommunity'])['ansible_facts']
print nei_lldp_facts
neighbor_interface = v['port']['ifname']
Expand Down