summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authornaveen <nguggarigoud@vmware.com>2020-08-18 12:28:34 +0200
committernguggarigoud <nguggarigoud@vmware.com>2020-09-18 11:43:46 +0200
commita81774ec7d67f36f1380b9130cbc45a7e8001d1b (patch)
tree424af6c82eb593923d574ece6efa723151ac4e4e /tests
parenttests: ospf_basic_functionality topojson testcases. (diff)
downloadfrr-a81774ec7d67f36f1380b9130cbc45a7e8001d1b.tar.xz
frr-a81774ec7d67f36f1380b9130cbc45a7e8001d1b.zip
tests: ospf basic functionality topojson testcases.
1. Removed static sleeps. Signed-off-by: naveen <nguggarigoud@vmware.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_authentication.py46
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py26
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py18
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_lan.py1
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_nssa.py2
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py7
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py63
-rw-r--r--tests/topotests/ospf_basic_functionality/test_ospf_single_area.py71
8 files changed, 90 insertions, 144 deletions
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py b/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py
index 5f6412c99..e6485de25 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_authentication.py
@@ -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
)
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py
index 51be52bd2..30f50a78c 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp.py
@@ -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
)
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py
index b663b224e..c31f7f2bf 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_ecmp_lan.py
@@ -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
)
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_lan.py b/tests/topotests/ospf_basic_functionality/test_ospf_lan.py
index 6f49e782b..f1c24ae50 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_lan.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_lan.py
@@ -27,7 +27,6 @@ import sys
import time
import pytest
import json
-from time import sleep
from copy import deepcopy
import ipaddress
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py b/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py
index 728fc2b8f..557549db7 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_nssa.py
@@ -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__))
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py b/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py
index 373dcc29b..ee7acf535 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_routemaps.py
@@ -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
)
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py b/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py
index aceae4ae2..a46fa6fcc 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_rte_calc.py
@@ -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)
diff --git a/tests/topotests/ospf_basic_functionality/test_ospf_single_area.py b/tests/topotests/ospf_basic_functionality/test_ospf_single_area.py
index 87b1b22c0..29f61827f 100644
--- a/tests/topotests/ospf_basic_functionality/test_ospf_single_area.py
+++ b/tests/topotests/ospf_basic_functionality/test_ospf_single_area.py
@@ -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": {