]> git.proxmox.com Git - mirror_frr.git/commitdiff
tests: Make test_ldp_topo1.py aware of how many neighbors it needs
authorDonald Sharp <sharpd@nvidia.com>
Fri, 22 Oct 2021 18:18:33 +0000 (14:18 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Fri, 22 Oct 2021 18:18:33 +0000 (14:18 -0400)
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 <sharpd@nvidia.com>
tests/topotests/ldp_topo1/test_ldp_topo1.py

index 834205f653545fcd249bc5d1c1d912da935938cf..4a33edb9d13751f614cdba296ae824885f98c180 100644 (file)
@@ -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()