1. Removed static sleeps.
Signed-off-by: naveen <nguggarigoud@vmware.com>
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
)
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
)
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.
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
)
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
)
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 = {
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
)
)
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
)
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
)
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__))
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
)
import time
import pytest
import json
-from time import sleep
from copy import deepcopy
import ipaddress
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__))
import time
import pytest
import json
-from time import sleep
from copy import deepcopy
# Save the Current Working Directory to find configuration files.
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
)
import sys
import time
import pytest
-from time import sleep
import ipaddress
import json
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
)
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)
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
)
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)
import time
import pytest
import json
-from time import sleep
from copy import deepcopy
from ipaddress import IPv4Address
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 = {
"links": {
"r0": {
"interface": topo["routers"]["r1"]["links"]["r0"]["interface"],
- "ospf": {"hello_interval": 12, "dead_interval": 48},
+ "ospf": {"hello_interval": 2, "dead_interval": 8},
}
}
}
"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": {