Skip to content

Commit

Permalink
Merge pull request FRRouting#16415 from nabahr/ospfv3_hello_tests
Browse files Browse the repository at this point in the history
tests: OSPFv3 hello tests investigation, make assert output unique
  • Loading branch information
riw777 authored Jul 18, 2024
2 parents 272077d + ddc1c2e commit f0ae1e8
Showing 1 changed file with 69 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@ def test_ospfv3_hello_tc10_p0(request):
step("Bring up the base config as per the topology")
reset_config_on_routers(tgen)

ospf_covergence = verify_ospf6_neighbor(tgen)
assert (
ospf_covergence is True
), "Testcase {} [01]: Reset Failed \n Error: {}".format(tc_name, ospf_covergence)

step("modify hello timer from default value to some other value on r1")

topo1 = {
Expand All @@ -402,7 +407,9 @@ def test_ospfv3_hello_tc10_p0(request):
}

result = create_interfaces_cfg(tgen, topo1)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [02]: Failed \n Error: {}".format(
tc_name, result
)

step(
"verify that new timer value is configured and applied using "
Expand All @@ -422,7 +429,9 @@ def test_ospfv3_hello_tc10_p0(request):
}
}
result = verify_ospf6_interface(tgen, topo, dut=dut, input_dict=input_dict)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [03]: Failed \n Error: {}".format(
tc_name, result
)

step("modify hello timer from default value to r1 hello timer on r2")

Expand All @@ -438,7 +447,9 @@ def test_ospfv3_hello_tc10_p0(request):
}

result = create_interfaces_cfg(tgen, topo1)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [04]: Failed \n Error: {}".format(
tc_name, result
)

step("verify that new timer value is configured.")
input_dict = {
Expand All @@ -455,12 +466,14 @@ def test_ospfv3_hello_tc10_p0(request):
}
dut = "r0"
result = verify_ospf6_interface(tgen, topo, dut=dut, input_dict=input_dict)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [05]: Failed \n Error: {}".format(
tc_name, result
)

step("verify that ospf neighbours are full")
ospf_covergence = verify_ospf6_neighbor(tgen, topo, dut=dut)
assert ospf_covergence is True, "Testcase Failed \n Error: {}".format(
ospf_covergence
assert ospf_covergence is True, "Testcase {} [06]: Failed \n Error: {}".format(
tc_name, ospf_covergence
)

step("reconfigure the default hello timer value to default on r1 and r2")
Expand All @@ -477,7 +490,9 @@ def test_ospfv3_hello_tc10_p0(request):
}

result = create_interfaces_cfg(tgen, topo1)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [07]: Failed \n Error: {}".format(
tc_name, result
)

topo1 = {
"r1": {
Expand All @@ -491,7 +506,9 @@ def test_ospfv3_hello_tc10_p0(request):
}

result = create_interfaces_cfg(tgen, topo1)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [08]: Failed \n Error: {}".format(
tc_name, result
)

step("verify that new timer value is configured.")
input_dict = {
Expand All @@ -508,12 +525,14 @@ def test_ospfv3_hello_tc10_p0(request):
}
dut = "r0"
result = verify_ospf6_interface(tgen, topo, dut=dut, input_dict=input_dict)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [09]: Failed \n Error: {}".format(
tc_name, result
)

step("verify that ospf neighbours are full")
ospf_covergence = verify_ospf6_neighbor(tgen, topo, dut=dut)
assert ospf_covergence is True, "Testcase Failed \n Error: {}".format(
ospf_covergence
assert ospf_covergence is True, "Testcase {} [10]: Failed \n Error: {}".format(
tc_name, ospf_covergence
)

step("reconfigure the default hello timer value to default on r1 and r2")
Expand All @@ -530,7 +549,9 @@ def test_ospfv3_hello_tc10_p0(request):
}

result = create_interfaces_cfg(tgen, topo1)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [11]: Failed \n Error: {}".format(
tc_name, result
)

topo1 = {
"r1": {
Expand All @@ -544,7 +565,9 @@ def test_ospfv3_hello_tc10_p0(request):
}

result = create_interfaces_cfg(tgen, topo1)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [12]: Failed \n Error: {}".format(
tc_name, result
)

step("verify that new timer value is configured.")
input_dict = {
Expand All @@ -561,12 +584,14 @@ def test_ospfv3_hello_tc10_p0(request):
}
dut = "r0"
result = verify_ospf6_interface(tgen, topo, dut=dut, input_dict=input_dict)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [13]: Failed \n Error: {}".format(
tc_name, result
)

step("verify that ospf neighbours are full")
ospf_covergence = verify_ospf6_neighbor(tgen, topo, dut=dut)
assert ospf_covergence is True, "Testcase Failed \n Error: {}".format(
ospf_covergence
assert ospf_covergence is True, "Testcase {} [14]: Failed \n Error: {}".format(
tc_name, ospf_covergence
)

step("configure hello timer = 1 on r1 and r2")
Expand All @@ -582,7 +607,9 @@ def test_ospfv3_hello_tc10_p0(request):
}

result = create_interfaces_cfg(tgen, topo1)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [15]: Failed \n Error: {}".format(
tc_name, result
)

topo1 = {
"r1": {
Expand All @@ -596,7 +623,9 @@ def test_ospfv3_hello_tc10_p0(request):
}

result = create_interfaces_cfg(tgen, topo1)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [16]: Failed \n Error: {}".format(
tc_name, result
)

step("verify that new timer value is configured.")
input_dict = {
Expand All @@ -613,12 +642,14 @@ def test_ospfv3_hello_tc10_p0(request):
}
dut = "r0"
result = verify_ospf6_interface(tgen, topo, dut=dut, input_dict=input_dict)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [17]: Failed \n Error: {}".format(
tc_name, result
)

step("verify that ospf neighbours are full")
ospf_covergence = verify_ospf6_neighbor(tgen, topo, dut=dut)
assert ospf_covergence is True, "Testcase Failed \n Error: {}".format(
ospf_covergence
assert ospf_covergence is True, "Testcase {} [18]: Failed \n Error: {}".format(
tc_name, ospf_covergence
)

step(" Configure hello timer = 65535")
Expand All @@ -634,7 +665,9 @@ def test_ospfv3_hello_tc10_p0(request):
}

result = create_interfaces_cfg(tgen, topo1)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [19]: Failed \n Error: {}".format(
tc_name, result
)

topo1 = {
"r1": {
Expand All @@ -648,7 +681,9 @@ def test_ospfv3_hello_tc10_p0(request):
}

result = create_interfaces_cfg(tgen, topo1)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [20]: Failed \n Error: {}".format(
tc_name, result
)

step("verify that new timer value is configured.")
input_dict = {
Expand All @@ -665,11 +700,13 @@ def test_ospfv3_hello_tc10_p0(request):
}
dut = "r0"
result = verify_ospf6_interface(tgen, topo, dut=dut, input_dict=input_dict)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [21]: Failed \n Error: {}".format(
tc_name, result
)

step("verify that ospf neighbours are full")
ospf_covergence = verify_ospf6_neighbor(tgen, topo, dut=dut)
assert ospf_covergence is True, "Testcase {} : Failed \n Error: {}".format(
assert ospf_covergence is True, "Testcase {} [22]: Failed \n Error: {}".format(
tc_name, ospf_covergence
)
step(" Try configuring timer values outside range for example 65536")
Expand All @@ -687,7 +724,7 @@ def test_ospfv3_hello_tc10_p0(request):
result = create_interfaces_cfg(tgen, topo1)
assert (
result is not True
), "Testcase {} : Failed \n Create interface failed. Error: {}".format(
), "Testcase {} [23]: Failed \n Create interface failed. Error: {}".format(
tc_name, result
)

Expand All @@ -706,13 +743,17 @@ def test_ospfv3_hello_tc10_p0(request):
}

result = create_interfaces_cfg(tgen, topo1)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [24]: Failed \n Error: {}".format(
tc_name, result
)

step("Verify that timer value is deleted from intf & set to default value 40 sec.")
input_dict = {"r1": {"links": {"r0": {"ospf6": {"timerIntervalsConfigHello": 10}}}}}
dut = "r1"
result = verify_ospf6_interface(tgen, topo, dut=dut, input_dict=input_dict)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} [25]: Failed \n Error: {}".format(
tc_name, result
)

write_test_footer(tc_name)

Expand Down

0 comments on commit f0ae1e8

Please sign in to comment.