Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Enhance error msgs for static route automation. #12816

Merged
merged 1 commit into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
), "Testcase {} : Failed \nError: Routes are missing in RIB".format(tc_name)

step("Configure redistribute static in BGP on R2 router")
for addr_type in ADDR_TYPES:
Expand All @@ -319,7 +319,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
), "Testcase {} : Failed \nError: Routes are missing in RIB".format(tc_name)

step(
"Remove the static route configured with nexthop N1 to N8, one"
Expand Down Expand Up @@ -366,7 +366,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
)
assert (
result is not True
), "Testcase {} : Failed\nError: Routes is" " still present in RIB".format(
), "Testcase {} : Failed\nError: routes are still present in RIB".format(
tc_name
)

Expand Down Expand Up @@ -395,17 +395,15 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
)
assert (
result is True
), "Testcase {} : Failed\nError: Routes are" " missing in RIB".format(
tc_name
)
), "Testcase {} : Failed\nError: Routes are missing in RIB".format(tc_name)

protocol = "static"
step("Random shut of the nexthop interfaces")
randnum = random.randint(0, 7)
# Shutdown interface
dut = "r2"
step(
" interface which is about to be shut no shut between r1 and r2 is " "%s",
" interface which is about to be shut no shut between r1 and r2 is %s",
topo["routers"]["r2"]["links"]["r1-link{}".format(randnum)]["interface"],
)
intf = topo["routers"]["r2"]["links"]["r1-link{}".format(randnum)]["interface"]
Expand Down Expand Up @@ -443,7 +441,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
), "Testcase {} : Failed \nError: Routes are missing in RIB".format(tc_name)

step("Remove random static route with all the nexthop")
dut = "r2"
Expand Down Expand Up @@ -482,7 +480,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
), "Testcase {} : Failed \nError: Routes are missing in RIB".format(tc_name)

for addr_type in ADDR_TYPES:
input_dict_4 = {
Expand Down Expand Up @@ -536,7 +534,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
), "Testcase {} : Failed \nError: Routes are missing in RIB".format(tc_name)

step("Remove the redistribute static knob")
for addr_type in ADDR_TYPES:
Expand Down Expand Up @@ -571,7 +569,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format(
), "Testcase {} : Failed \nError: Routes are still present in RIB".format(
tc_name
)

Expand Down Expand Up @@ -655,7 +653,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
), "Testcase {} : Failed \nError: Routes are missing in RIB".format(tc_name)

nh = []
for nhp in range(2, 9):
Expand All @@ -673,7 +671,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name)
), "Testcase {} : Failed \nError: Routes are missing in RIB".format(tc_name)

step(
"Remove the static route configured with nexthop N1 to N8, one"
Expand Down Expand Up @@ -718,9 +716,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format(
tc_name
)
), "Testcase {} : Failed \nError: Routes are still present in RIB".format(tc_name)

step("Configure the static route with nexthop N1 to N8, one by one")

Expand Down Expand Up @@ -768,7 +764,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
), "Testcase {} : Failed \nError: Routes are missing in RIB".format(tc_name)
nh = []
for nhp in range(2, 9):
nh.append(NEXT_HOP_IP["nh" + str(nhp)][addr_type])
Expand All @@ -785,7 +781,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name)
), "Testcase {} : Failed \nError: Routes are missing in RIB".format(tc_name)

step("Random shut of the nexthop interfaces")
randnum = random.randint(0, 7)
Expand Down Expand Up @@ -814,7 +810,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
)
assert (
result is not True
), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format(
), "Testcase {} : Failed \n Error: Routes are still present in RIB".format(
tc_name
)

Expand All @@ -828,7 +824,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name)
), "Testcase {} : Failed \n Error: Routes are missing in RIB".format(tc_name)

dut = "r2"
protocol = "static"
Expand All @@ -837,7 +833,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
assert (
result is True
), "Testcase {}: Failed \n " "Error: Routes are missing in RIB".format(tc_name)
), "Testcase {}: Failed \n Error: Routes are missing in RIB".format(tc_name)

protocol = "bgp"
dut = "r3"
Expand All @@ -846,7 +842,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
assert (
result is True
), "Testcase {}: Failed \n " "Error: Routes are missing in RIB".format(tc_name)
), "Testcase {}: Failed \n Error: Routes are missing in RIB".format(tc_name)

step("Reload the FRR router")
# stop/start -> restart FRR router and verify
Expand All @@ -859,7 +855,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format(
), "Testcase {} : Failed \n Error: Routes are still present in RIB".format(
tc_name
)

Expand Down Expand Up @@ -958,7 +954,7 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request):
)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
), "Testcase {} : Failed \nError: Routes are missing in RIB".format(tc_name)

nh = []
for nhp in range(2, 9):
Expand All @@ -975,7 +971,7 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request):
)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name)
), "Testcase {} : Failed \nError: Routes are missing in RIB".format(tc_name)

step(
"Remove the static route configured with nexthop N1 to N8, one"
Expand Down Expand Up @@ -1020,9 +1016,7 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request):
)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format(
tc_name
)
), "Testcase {} : Failed \nError: Routes are still present in RIB".format(tc_name)

step("Configure the static route with nexthop N1 to N8, one by one")

Expand Down Expand Up @@ -1070,7 +1064,7 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request):
)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
), "Testcase {} : Failed \nError: Routes are missing in RIB".format(tc_name)
nh = []
for nhp in range(2, 9):
nh.append(NEXT_HOP_IP["nh" + str(nhp)][addr_type])
Expand All @@ -1086,7 +1080,7 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request):
)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name)
), "Testcase {} : Failed \nError: Routes are missing in RIB".format(tc_name)

step("Random shut of the nexthop interfaces")
randnum = random.randint(0, 7)
Expand Down Expand Up @@ -1115,7 +1109,7 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request):
)
assert (
result is not True
), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format(
), "Testcase {} : Failed \n Error: Routes are still present in RIB".format(
tc_name
)

Expand All @@ -1129,7 +1123,7 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request):
)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name)
), "Testcase {} : Failed \n Error: Routes are missing in RIB".format(tc_name)

dut = "r2"
protocol = "static"
Expand All @@ -1145,7 +1139,7 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request):
result = verify_rib(tgen, addr_type, dut, input_dict_4, protocol=protocol)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format(
), "Testcase {} : Failed \n Error: Routes are still present in RIB".format(
tc_name
)

Expand Down Expand Up @@ -1244,7 +1238,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
), "Testcase {} : Failed \nError: Routes are missing in RIB".format(tc_name)

step("Verify that highest AD nexthop are inactive")
nh = []
Expand All @@ -1263,7 +1257,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name)
), "Testcase {} : Failed \nError: Routes are missing in RIB".format(tc_name)

step("Configure redistribute static in BGP on R2 router")
for addr_type in ADDR_TYPES:
Expand Down Expand Up @@ -1327,7 +1321,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format(
), "Testcase {} : Failed \nError: Routes are still present in RIB".format(
tc_name
)

Expand Down Expand Up @@ -1358,15 +1352,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
" value and all the nexthop populated in RIB and FIB again"
)
for addr_type in ADDR_TYPES:
input_dict_4 = {
"r2": {
"static_routes": [
{
"network": PREFIX1[addr_type],
}
]
}
}
input_dict_4 = {"r2": {"static_routes": [{"network": PREFIX1[addr_type]}]}}
nh = NEXT_HOP_IP["nh1"][addr_type]
result = verify_rib(
tgen, addr_type, dut, input_dict_4, next_hop=nh, protocol=protocol, fib=True
Expand Down Expand Up @@ -1403,7 +1389,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
)
assert (
result is not True
), "Testcase {} : Failed \n" "Error: Routes are still present in RIB".format(
), "Testcase {} : Failed \n Error: Routes are still present in RIB".format(
tc_name
)

Expand All @@ -1417,7 +1403,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
)
assert (
result is True
), "Testcase {} : Failed \n" "Error: Routes are missing in RIB".format(tc_name)
), "Testcase {} : Failed \n Error: Routes are missing in RIB".format(tc_name)

step("Remove random static route with all the nexthop")
for addr_type in ADDR_TYPES:
Expand Down Expand Up @@ -1507,9 +1493,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
)
assert (
result is True
), "Testcase {} : Failed \nError: Route " " is missing in RIB".format(
tc_name
)
), "Testcase {} : Failed \nError: Route is missing in RIB".format(tc_name)

write_test_footer(tc_name)

Expand Down Expand Up @@ -1605,7 +1589,7 @@ def test_static_route_delete_p0_tc11_ebgp(request):
)
assert (
result is True
), "Testcase {} : Failed \nError: Routes are" " missing in RIB".format(tc_name)
), "Testcase {} : Failed \nError: Routes are missing in RIB".format(tc_name)

step("Verify that highest AD nexthop are inactive")
nh = []
Expand All @@ -1623,7 +1607,7 @@ def test_static_route_delete_p0_tc11_ebgp(request):
)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes " " are missing in RIB".format(tc_name)
), "Testcase {} : Failed \nError: Routes are missing in RIB".format(tc_name)

step("Configure redistribute static in BGP on R2 router")
for addr_type in ADDR_TYPES:
Expand Down Expand Up @@ -1677,7 +1661,7 @@ def test_static_route_delete_p0_tc11_ebgp(request):
)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes are" " still present in RIB".format(
), "Testcase {} : Failed \nError: Routes are still present in RIB".format(
tc_name
)

Expand Down Expand Up @@ -1748,7 +1732,7 @@ def test_static_route_delete_p0_tc11_ebgp(request):
)
assert (
result is not True
), "Testcase {} : Failed \nError: Routes are" " still active in RIB".format(
), "Testcase {} : Failed \nError: Routes are still active in RIB".format(
tc_name
)

Expand Down
Loading