]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: Optimising a step for not true case. 6814/head
authornguggarigoud <nguggarigoud@vmware.com>
Fri, 18 Sep 2020 09:40:54 +0000 (15:10 +0530)
committernguggarigoud <nguggarigoud@vmware.com>
Fri, 18 Sep 2020 09:43:46 +0000 (15:13 +0530)
1. Optimising a step for not true case.
2. Fixing a timing issue in route calculation script.

Signed-off-by: nguggarigoud <nguggarigoud@vmware.com>
tests/topotests/ospf_basic_functionality/test_ospf_lan.py
tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py

index 968cb608e8cdaada205b9245ce30cce171b23184..f2611042069b6080480adf13d6f871807a0c32f3 100644 (file)
@@ -431,7 +431,7 @@ def test_ospf_lan_tc1_p0(request):
     intf = topo["routers"]["r0"]["links"]["s1"]["interface"]
     shutdown_bringup_interface(tgen, dut, intf, False)
 
-    result = verify_ospf_neighbor(tgen, topo, dut, lan=True)
+    result = verify_ospf_neighbor(tgen, topo, dut, lan=True, expected=False)
     assert result is not True, "Testcase {} : Failed \n Error: {}".format(
         tc_name, result
     )
index 5e0e35854ee576fa6c45e9fdd8e2f4878cce16a7..2c6bcf0162997e839e4d410e91cd0ec9ab962e8d 100644 (file)
@@ -65,6 +65,10 @@ from lib.ospf import (
 
 # Global variables
 topo = None
+
+# number of retries.
+nretry = 5
+
 # Reading the data from JSON File for topology creation
 jsonFile = "{}/ospf_rte_calc.json".format(CWD)
 try:
@@ -220,7 +224,6 @@ def red_connected(dut, config=True):
 # ##################################
 
 
-@pytest.mark.precommit
 def test_ospf_redistribution_tc5_p0(request):
     """Test OSPF intra area route calculations."""
     tc_name = request.node.name
@@ -257,7 +260,7 @@ def test_ospf_redistribution_tc5_p0(request):
     result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh)
     assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
 
-    step("Delete the ip address on newly configured loopback of R0")
+    step("Delete the ip address on newly configured interface of R0")
     topo1 = {
         "r0": {
             "links": {
@@ -274,9 +277,12 @@ def test_ospf_redistribution_tc5_p0(request):
     assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
 
     dut = "r1"
-    result = verify_ospf_rib(
-        tgen, dut, input_dict, next_hop=nh, attempts=5, expected=False
-    )
+    for num in range(0, nretry):
+        result = verify_ospf_rib(
+            tgen, dut, input_dict, next_hop=nh, expected=False)
+        if result is not True:
+            break
+
     assert result is not True, "Testcase {} : Failed \n Error: {}".format(
         tc_name, result
     )
@@ -392,9 +398,11 @@ def test_ospf_redistribution_tc6_p0(request):
     assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
 
     dut = "r1"
-    result = verify_ospf_rib(
-        tgen, dut, input_dict, next_hop=nh, attempts=5, expected=False
-    )
+    for num in range(0, nretry):
+        result = verify_ospf_rib(
+            tgen, dut, input_dict, next_hop=nh, expected=False)
+        if result is not True:
+            break
     assert result is not True, "Testcase {} : Failed \n Error: {}".format(
         tc_name, result
     )
@@ -407,7 +415,6 @@ def test_ospf_redistribution_tc6_p0(request):
         input_dict,
         protocol=protocol,
         next_hop=nh,
-        attempts=5,
         expected=False,
     )
     assert result is not True, "Testcase {} : Failed \n Error: {}".format(