From e5369c471b46c081dc4a2fc8bf114910797c089f Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Fri, 22 Oct 2021 14:18:33 -0400 Subject: [PATCH] tests: Make test_ldp_topo1.py aware of how many neighbors it needs On a local CI run. The test_ldp_topo1.py showed fail to converge on r3. r3 has 2 neighbors but only 1 was up when we got to further steps in the test suites. Modify the neighbor checking to `know` how many neighbors should be operational and continue looking for them until they are up and running. Signed-off-by: Donald Sharp --- tests/topotests/ldp_topo1/test_ldp_topo1.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/topotests/ldp_topo1/test_ldp_topo1.py b/tests/topotests/ldp_topo1/test_ldp_topo1.py index 834205f653..4a33edb9d1 100644 --- a/tests/topotests/ldp_topo1/test_ldp_topo1.py +++ b/tests/topotests/ldp_topo1/test_ldp_topo1.py @@ -64,6 +64,7 @@ import re import sys import pytest from time import sleep +from lib.topolog import logger sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from lib import topotest @@ -225,6 +226,13 @@ def test_mpls_ldp_neighbor_establish(): if fatal_error != "": pytest.skip(fatal_error) + neighbors_operational = { + 1: 1, + 2: 3, + 3: 2, + 4: 2, + } + # Wait for MPLS LDP neighbors to establish. print("\n\n** Verify MPLS LDP neighbors to establish") print("******************************************\n") @@ -254,9 +262,14 @@ def test_mpls_ldp_neighbor_establish(): established = "" # Empty string shows NOT established if re.search(operational, lines[j]): found_operational += 1 + + logger.info("Found operational %d" % found_operational) if found_operational < 1: # Need at least one operational neighbor established = "" # Empty string shows NOT established + else: + if found_operational != neighbors_operational[i]: + established = "" if not established: print("Waiting for r%s" % i) sys.stdout.flush() -- 2.39.5