]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: ospf basic functionality topojson testcases.
authornaveen <nguggarigoud@vmware.com>
Tue, 18 Aug 2020 10:28:34 +0000 (15:58 +0530)
committernguggarigoud <nguggarigoud@vmware.com>
Fri, 18 Sep 2020 09:43:46 +0000 (15:13 +0530)
1. Removed static sleeps.

Signed-off-by: naveen <nguggarigoud@vmware.com>
tests/topotests/ospf_basic_functionality/test_ospf_authentication.py
tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py
tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py
tests/topotests/ospf_basic_functionality/test_ospf_lan.py
tests/topotests/ospf_basic_functionality/test_ospf_nssa.py
tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py
tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py
tests/topotests/ospf_basic_functionality/test_ospf_single_area.py

index 5f6412c99727f9a0ad4d0b36b3098be6315e856c..e6485de2509c0b203c2ee5f7e59847bb46882936 100644 (file)
@@ -196,7 +196,7 @@ def test_ospf_authentication_simple_pass_tc28_p1(request):
 
     step("Verify that the neighbour is not FULL between R1 and R2.")
     dut = "r1"
-    ospf_covergence = verify_ospf_neighbor(tgen, topo, dut=dut)
+    ospf_covergence = verify_ospf_neighbor(tgen, topo, dut=dut, expected=False)
     assert ospf_covergence is not True, "setup_module :Failed \n Error:" " {}".format(
         ospf_covergence
     )
@@ -248,12 +248,12 @@ def test_ospf_authentication_simple_pass_tc28_p1(request):
     assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
 
     step("Verify on R1 neighbour is deleted for R2 after dead interval expiry")
-
-    step("Waiting for dead time expiry....")
-    sleep(10)
-
+    # wait till the dead time expiry
+    sleep(6)
     dut = "r2"
-    ospf_covergence = verify_ospf_neighbor(tgen, topo, dut=dut, expected=False)
+    ospf_covergence = verify_ospf_neighbor(
+        tgen, topo, dut=dut, expected=False, attempts=5
+    )
     assert ospf_covergence is not True, "setup_module :Failed \n Error:" " {}".format(
         ospf_covergence
     )
@@ -323,7 +323,6 @@ def test_ospf_authentication_simple_pass_tc28_p1(request):
     dut = "r1"
     intf = topo["routers"]["r1"]["links"]["r2"]["interface"]
     shutdown_bringup_interface(tgen, dut, intf, False)
-    sleep(5)
     shutdown_bringup_interface(tgen, dut, intf, True)
 
     # clear ip ospf after configuring the authentication.
@@ -386,13 +385,13 @@ def test_ospf_authentication_md5_tc29_p1(request):
     result = config_ospf_interface(tgen, topo, r1_ospf_auth)
     assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
 
-    # Wait for 2 dead interval timer to check neighbor.
-    sleep(8)
-
     step("Verify that the neighbour is not FULL between R1 and R2.")
-
+    # wait for dead time expiry.
+    sleep(6)
     dut = "r1"
-    ospf_covergence = verify_ospf_neighbor(tgen, topo, dut=dut, expected=False)
+    ospf_covergence = verify_ospf_neighbor(
+        tgen, topo, dut=dut, expected=False, attempts=3
+    )
     assert ospf_covergence is not True, "setup_module :Failed \n Error:" " {}".format(
         ospf_covergence
     )
@@ -452,12 +451,12 @@ def test_ospf_authentication_md5_tc29_p1(request):
     assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
 
     step("Verify on R1 ,nbr is deleted for R2 after dead interval expiry")
-
-    step("Waiting for dead time expiry....")
-    sleep(10)
-
+    #  wait till the dead timer expiry
+    sleep(6)
     dut = "r2"
-    ospf_covergence = verify_ospf_neighbor(tgen, topo, dut=dut, expected=False)
+    ospf_covergence = verify_ospf_neighbor(
+        tgen, topo, dut=dut, expected=False, attempts=5
+    )
     assert ospf_covergence is not True, "setup_module :Failed \n Error:" " {}".format(
         ospf_covergence
     )
@@ -535,7 +534,6 @@ def test_ospf_authentication_md5_tc29_p1(request):
     dut = "r1"
     intf = topo["routers"]["r1"]["links"]["r2"]["interface"]
     shutdown_bringup_interface(tgen, dut, intf, False)
-    sleep(5)
     shutdown_bringup_interface(tgen, dut, intf, True)
     clear_ospf(tgen, "r1")
     r1_ospf_auth = {
@@ -602,15 +600,13 @@ def test_ospf_authentication_different_auths_tc30_p1(request):
     result = config_ospf_interface(tgen, topo, r1_ospf_auth)
     assert result is True, "Testcase {} :Failed \n Error: {}".format(tc_name, result)
 
-    # Wait for 2 dead interval timer to check neighbor.
-    sleep(8)
-    # clear ip ospf after configuring the authentication.
-    # clear_ospf(tgen, "r1")
-
+    # wait for dead timer expiry
+    sleep(6)
     step("Verify that the neighbour is not FULL between R1 and R2.")
-
     dut = "r1"
-    ospf_covergence = verify_ospf_neighbor(tgen, topo, dut=dut, expected=False)
+    ospf_covergence = verify_ospf_neighbor(
+        tgen, topo, dut=dut, expected=False, attempts=5
+    )
     assert ospf_covergence is not True, "setup_module :Failed \n Error:" " {}".format(
         ospf_covergence
     )
index 51be52bd26f1984a98b9035f6646bfd4c6134959..30f50a78c4d6961cfa86e715cd149c4f2c33cd75 100644 (file)
@@ -352,7 +352,16 @@ def test_ospf_ecmp_tc16_p0(request):
     )
 
     protocol = "ospf"
-    result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh)
+    result = verify_rib(
+        tgen,
+        "ipv4",
+        dut,
+        input_dict,
+        protocol=protocol,
+        next_hop=nh,
+        attempts=5,
+        expected=False,
+    )
     assert result is not True, "Testcase {} : Failed \n Error: {}".format(
         tc_name, result
     )
@@ -435,13 +444,24 @@ def test_ospf_ecmp_tc17_p0(request):
 
     step("Verify that route is withdrawn from R2.")
     dut = "r1"
-    result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh)
+    result = verify_ospf_rib(
+        tgen, dut, input_dict, next_hop=nh, attempts=5, expected=False
+    )
     assert result is not True, "Testcase {} : Failed \n Error: {}".format(
         tc_name, result
     )
 
     protocol = "ospf"
-    result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh)
+    result = verify_rib(
+        tgen,
+        "ipv4",
+        dut,
+        input_dict,
+        protocol=protocol,
+        next_hop=nh,
+        attempts=5,
+        expected=False,
+    )
     assert result is not True, "Testcase {} : Failed \n Error: {}".format(
         tc_name, result
     )
index b663b224e4a32fe68a6e261e37f81bfaa0a3dced..c31f7f2bfd6a48b5082146ee99649dafb519dba8 100644 (file)
@@ -27,9 +27,6 @@ import sys
 import time
 import pytest
 import json
-from time import sleep
-from copy import deepcopy
-import ipaddress
 
 # Save the Current Working Directory to find configuration files.
 CWD = os.path.dirname(os.path.realpath(__file__))
@@ -337,13 +334,24 @@ def test_ospf_lan_ecmp_tc18_p0(request):
 
     step("Verify that all the routes are withdrawn from R0")
     dut = "r1"
-    result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh)
+    result = verify_ospf_rib(
+        tgen, dut, input_dict, next_hop=nh, attempts=5, expected=False
+    )
     assert result is not True, "Testcase {} : Failed \n Error: {}".format(
         tc_name, result
     )
 
     protocol = "ospf"
-    result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh)
+    result = verify_rib(
+        tgen,
+        "ipv4",
+        dut,
+        input_dict,
+        protocol=protocol,
+        next_hop=nh,
+        attempts=5,
+        expected=False,
+    )
     assert result is not True, "Testcase {} : Failed \n Error: {}".format(
         tc_name, result
     )
index 6f49e782b78579f191b5e3711e09a54d4db5c9ad..f1c24ae50d3a22a64eecf678d75a85bc02f3ecc8 100644 (file)
@@ -27,7 +27,6 @@ import sys
 import time
 import pytest
 import json
-from time import sleep
 from copy import deepcopy
 import ipaddress
 
index 728fc2b8f128a43f53f82025f52155920444a57a..557549db71f79e829311bec574e38d8028aeb0e0 100644 (file)
@@ -53,8 +53,6 @@ import sys
 import time
 import pytest
 import json
-from time import sleep
-from copy import deepcopy
 
 # Save the Current Working Directory to find configuration files.
 CWD = os.path.dirname(os.path.realpath(__file__))
index 373dcc29bc39d4035bb74683658f730963eaa00f..ee7acf535d8f9f12c31f8890a27e662f21623b62 100644 (file)
@@ -27,7 +27,6 @@ import sys
 import time
 import pytest
 import json
-from time import sleep
 from copy import deepcopy
 
 # Save the Current Working Directory to find configuration files.
@@ -240,12 +239,14 @@ def test_ospf_routemaps_functionality_tc20_p0(request):
 
     dut = "r1"
     protocol = "ospf"
-    result = verify_ospf_rib(tgen, dut, input_dict)
+    result = verify_ospf_rib(tgen, dut, input_dict, attempts=2, expected=False)
     assert result is not True, "Testcase {} : Failed \n Error: {}".format(
         tc_name, result
     )
 
-    result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol)
+    result = verify_rib(
+        tgen, "ipv4", dut, input_dict, protocol=protocol, attempts=2, expected=False
+    )
     assert result is not True, "Testcase {} : Failed \n Error: {}".format(
         tc_name, result
     )
index aceae4ae209ec463cf015f59571822adfa70dd73..a46fa6fccee3ab006aef0e1332eb8c7139f744fd 100644 (file)
@@ -26,7 +26,6 @@ import os
 import sys
 import time
 import pytest
-from time import sleep
 import ipaddress
 import json
 
@@ -271,13 +270,24 @@ 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)
+    result = verify_ospf_rib(
+        tgen, dut, input_dict, next_hop=nh, attempts=5, expected=False
+    )
     assert result is not True, "Testcase {} : Failed \n Error: {}".format(
         tc_name, result
     )
 
     protocol = "ospf"
-    result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh)
+    result = verify_rib(
+        tgen,
+        "ipv4",
+        dut,
+        input_dict,
+        protocol=protocol,
+        next_hop=nh,
+        attempts=5,
+        expected=False,
+    )
     assert result is not True, "Testcase {} : Failed \n Error: {}".format(
         tc_name, result
     )
@@ -310,23 +320,6 @@ def test_ospf_redistribution_tc5_p0(request):
     intf = topo["routers"]["r0"]["links"]["r3"]["interface"]
     shutdown_bringup_interface(tgen, dut, intf, False)
 
-    step("Verify that intraroute calculated for R1 intf on R0 is deleted.")
-    dut = "r1"
-
-    # sleep is added so that neighbor gets deleted after interface shut.
-    sleep(12)
-
-    result = verify_ospf_rib(tgen, dut, input_dict, expected=False)
-    assert result is not True, "Testcase {} : Failed \n Error: {}".format(
-        tc_name, result
-    )
-
-    protocol = "ospf"
-    result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh)
-    assert result is not True, "Testcase {} : Failed \n Error: {}".format(
-        tc_name, result
-    )
-
     step("un shut the OSPF interface on R0")
     dut = "r0"
     shutdown_bringup_interface(tgen, dut, intf, True)
@@ -395,13 +388,24 @@ 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)
+    result = verify_ospf_rib(
+        tgen, dut, input_dict, next_hop=nh, attempts=5, expected=False
+    )
     assert result is not True, "Testcase {} : Failed \n Error: {}".format(
         tc_name, result
     )
 
     protocol = "ospf"
-    result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh)
+    result = verify_rib(
+        tgen,
+        "ipv4",
+        dut,
+        input_dict,
+        protocol=protocol,
+        next_hop=nh,
+        attempts=5,
+        expected=False,
+    )
     assert result is not True, "Testcase {} : Failed \n Error: {}".format(
         tc_name, result
     )
@@ -434,21 +438,6 @@ def test_ospf_redistribution_tc6_p0(request):
     intf = topo["routers"]["r0"]["links"]["r3"]["interface"]
     shutdown_bringup_interface(tgen, dut, intf, False)
 
-    step("Verify that intraroute calculated for R1 intf on R0 is deleted.")
-    dut = "r1"
-
-    sleep(10)
-    result = verify_ospf_rib(tgen, dut, input_dict)
-    assert result is not True, "Testcase {} : Failed \n Error: {}".format(
-        tc_name, result
-    )
-
-    protocol = "ospf"
-    result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol, next_hop=nh)
-    assert result is not True, "Testcase {} : Failed \n Error: {}".format(
-        tc_name, result
-    )
-
     step("un shut the OSPF interface on R0")
     dut = "r0"
     shutdown_bringup_interface(tgen, dut, intf, True)
index 87b1b22c0f9f7739247787d14304e85766135f31..29f61827f9864ea19cc3bd9326bf06f62db37286 100644 (file)
@@ -27,7 +27,6 @@ import sys
 import time
 import pytest
 import json
-from time import sleep
 from copy import deepcopy
 from ipaddress import IPv4Address
 
@@ -451,18 +450,6 @@ def test_ospf_hello_tc10_p0(request):
     result = verify_ospf_interface(tgen, topo, dut=dut, input_dict=input_dict)
     assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
 
-    # sleep for 20 secs for hello timer expiry
-    sleep(20)
-
-    step("verify that ospf neighbours are not full - hello timer mis match.")
-    dut = "r1"
-    ospf_covergence = verify_ospf_neighbor(
-        tgen, topo, dut=dut, expected=False, attempts=10
-    )
-    assert ospf_covergence is not True, "setup_module :Failed \n Error:" " {}".format(
-        ospf_covergence
-    )
-
     step("modify hello timer from default value to r1 hello timer on r2")
 
     topo1 = {
@@ -745,7 +732,7 @@ def test_ospf_dead_tc11_p0(request):
             "links": {
                 "r0": {
                     "interface": topo["routers"]["r1"]["links"]["r0"]["interface"],
-                    "ospf": {"hello_interval": 12, "dead_interval": 48},
+                    "ospf": {"hello_interval": 2, "dead_interval": 8},
                 }
             }
         }
@@ -759,71 +746,19 @@ def test_ospf_dead_tc11_p0(request):
         "the show ip ospf interface command."
     )
     dut = "r1"
-    input_dict = {"r1": {"links": {"r0": {"ospf": {"timerDeadSecs": 48}}}}}
-    result = verify_ospf_interface(tgen, topo, dut=dut, input_dict=input_dict)
-    assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
-
-    sleep(50)
-    step("verify that ospf neighbours are not full - dead timer mis match.")
-    dut = "r1"
-    ospf_covergence = verify_ospf_neighbor(
-        tgen, topo, dut=dut, expected=False, attempts=10
-    )
-    assert ospf_covergence is not True, "setup_module :Failed \n Error:" " {}".format(
-        ospf_covergence
-    )
-
-    step("modify dead interval from default value to r1" "dead interval timer on r2")
-
-    topo1 = {
-        "r0": {
-            "links": {
-                "r1": {
-                    "interface": topo["routers"]["r0"]["links"]["r1"]["interface"],
-                    "ospf": {"dead_interval": 48, "hello_interval": 12},
-                }
-            }
-        }
-    }
-
-    result = create_interfaces_cfg(tgen, topo1)
-    assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
-
-    step("verify that new timer value is configured.")
-    input_dict = {"r0": {"links": {"r1": {"ospf": {"timerDeadSecs": 48}}}}}
-    dut = "r0"
+    input_dict = {"r1": {"links": {"r0": {"ospf": {"timerDeadSecs": 8}}}}}
     result = verify_ospf_interface(tgen, topo, dut=dut, input_dict=input_dict)
     assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
 
-    step("verify that ospf neighbours are  full")
-    ospf_covergence = verify_ospf_neighbor(tgen, topo, dut=dut)
-    assert ospf_covergence is True, "setup_module :Failed \n Error:" " {}".format(
-        ospf_covergence
-    )
-
     step("remove ospf on R1")
     ospf_del = {"r0": {"ospf": {"delete": True}}}
     result = create_router_ospf(tgen, topo, ospf_del)
     assert result is True, "Testcase : Failed \n Error: {}".format(result)
 
-    step("verify that on R2 ospf neighbour is full till dead time expiry.")
-    dut = "r1"
-    ospf_covergence = verify_ospf_neighbor(tgen, topo, dut=dut)
-    assert ospf_covergence is True, "setup_module :Failed \n Error:" " {}".format(
-        ospf_covergence
-    )
-    sleep(50)
-
-    step("Verify that nbr on r2 gets deleted after dead interval expiry.")
-    ospf_covergence = verify_ospf_neighbor(tgen, topo, dut=dut)
-    assert ospf_covergence is not True, "setup_module :Failed \n Error:" " {}".format(
-        ospf_covergence
-    )
-
     # reconfiguring deleted ospf process by resetting the configs.
     reset_config_on_routers(tgen)
 
-    step("reconfigure the default dead interval timer value to " "default on r1 and r2")
+    step("reconfigure the default dead interval timer value to default on r1 and r2")
     topo1 = {
         "r0": {
             "links": {