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
10 changes: 7 additions & 3 deletions tests/test_nbr_health.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import json
import pytest
import logging

from common.helpers.assertions import pytest_assert

logger = logging.getLogger(__name__)

pytestmark = [
Expand Down Expand Up @@ -49,10 +52,11 @@ def check_bgp_facts(hostname, host):
if not res.has_key('stdout_lines') or u'BGP summary' not in res['stdout_lines'][0][0]:
return "neighbor {} bgp not configured correctly".format(hostname)

def test_neighbors_health(duthost, localhost, nbrhosts, eos):
def test_neighbors_health(duthosts, localhost, nbrhosts, eos, dut_hostname):
"""Check each neighbor device health"""

fails = []
duthost = duthosts[dut_hostname]
config_facts = duthost.config_facts(host=duthost.hostname, source="running")['ansible_facts']
nei_meta = config_facts.get('DEVICE_NEIGHBOR_METADATA', {})
for k, v in nei_meta.items():
Expand All @@ -70,5 +74,5 @@ def test_neighbors_health(duthost, localhost, nbrhosts, eos):
fails.append(failmsg)

# TODO: check link, bgp, etc. on
if len(fails) > 0:
pytest.fail("\n".join(fails))

pytest_assert(len(fails) == 0, "\n".join(fails))