summaryrefslogtreecommitdiff
path: root/tests/topotests/bgp_default_originate
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2024-04-27 23:19:32 +0300
committerDonatas Abraitis <donatas@opensourcerouting.org>2024-04-27 23:19:32 +0300
commit1a1c2a9f84d0ad1bdadc0cb47d6175d4ccc32544 (patch)
tree12cf52e17d2b48a7090f9b6ffa06acc7fe49fbd7 /tests/topotests/bgp_default_originate
parent086df4bfaabdeafdc6643f94f68d17b3e069187a (diff)
tests: Apply black formatting for all tests/topotests
It's just annoying when the linter tells to apply the formatting for the code you didn't touch. Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
Diffstat (limited to 'tests/topotests/bgp_default_originate')
-rw-r--r--tests/topotests/bgp_default_originate/test_bgp_default_originate_topo1_1.py282
-rw-r--r--tests/topotests/bgp_default_originate/test_bgp_default_originate_topo1_2.py78
-rw-r--r--tests/topotests/bgp_default_originate/test_default_originate_conditional_routemap.py354
3 files changed, 454 insertions, 260 deletions
diff --git a/tests/topotests/bgp_default_originate/test_bgp_default_originate_topo1_1.py b/tests/topotests/bgp_default_originate/test_bgp_default_originate_topo1_1.py
index 6156968ded..50a1938ae3 100644
--- a/tests/topotests/bgp_default_originate/test_bgp_default_originate_topo1_1.py
+++ b/tests/topotests/bgp_default_originate/test_bgp_default_originate_topo1_1.py
@@ -325,12 +325,14 @@ def teardown_module():
)
logger.info("=" * 40)
+
#####################################################
#
# Testcases
#
#####################################################
+
def test_verify_bgp_default_originate_in_IBGP_p0(request):
"""
Verify BGP default-originate route with IBGP peer
@@ -396,7 +398,9 @@ def test_verify_bgp_default_originate_in_IBGP_p0(request):
step("After changing the BGP AS Path Verify the BGP Convergence")
BGP_CONVERGENCE = verify_bgp_convergence(tgen, topo)
- assert BGP_CONVERGENCE is True, " Complete Convergence is expected after changing the ASN but failed to converge --> :Failed \n Error: {}".format(
+ assert (
+ BGP_CONVERGENCE is True
+ ), " Complete Convergence is expected after changing the ASN but failed to converge --> :Failed \n Error: {}".format(
BGP_CONVERGENCE
)
@@ -413,8 +417,10 @@ def test_verify_bgp_default_originate_in_IBGP_p0(request):
}
}
result = create_static_routes(tgen, static_routes_input)
- assert result is True, "Testcase {} : Failed to configure the static routes {} on router R1 \n Error: {}".format(
- tc_name,static_routes_input, result
+ assert (
+ result is True
+ ), "Testcase {} : Failed to configure the static routes {} on router R1 \n Error: {}".format(
+ tc_name, static_routes_input, result
)
step("verify IPv4 and IPv6 static route are configured and up on R1")
for addr_type in ADDR_TYPES:
@@ -429,8 +435,10 @@ def test_verify_bgp_default_originate_in_IBGP_p0(request):
}
}
result = verify_fib_routes(tgen, addr_type, "r1", static_routes_input)
- assert result is True, "Testcase {} : Failed \n After configuring the static routes {} , the routes are not found in FIB \n Error: {}".format(
- tc_name,static_routes_input, result
+ assert (
+ result is True
+ ), "Testcase {} : Failed \n After configuring the static routes {} , the routes are not found in FIB \n Error: {}".format(
+ tc_name, static_routes_input, result
)
step(
@@ -483,7 +491,11 @@ def test_verify_bgp_default_originate_in_IBGP_p0(request):
},
}
result = create_router_bgp(tgen, topo, redistribute_static)
- assert result is True, "Testcase {} : Failed to configure the redistribute static configuration \n Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to configure the redistribute static configuration \n Error: {}".format(
+ tc_name, result
+ )
step(
"After configuring redistribute command , verify static and connected routes ( loopback connected routes) are advertised on R2"
@@ -517,13 +529,17 @@ def test_verify_bgp_default_originate_in_IBGP_p0(request):
}
}
result = verify_fib_routes(tgen, addr_type, "r2", static_routes_input)
- assert result is True, "Testcase {} : After redistributing static routes the routes {} expected in FIB but NOT FOUND ......! \n Error: {}".format(
- tc_name, static_routes_input,result
+ assert (
+ result is True
+ ), "Testcase {} : After redistributing static routes the routes {} expected in FIB but NOT FOUND ......! \n Error: {}".format(
+ tc_name, static_routes_input, result
)
result = verify_bgp_rib(tgen, addr_type, "r2", static_routes_input)
- assert result is True, "Testcase {} : After redistributing static routes the routes {} expected in RIB but NOT FOUND ......! \n Error: {}".format(
- tc_name, static_routes_input , result
+ assert (
+ result is True
+ ), "Testcase {} : After redistributing static routes the routes {} expected in RIB but NOT FOUND ......! \n Error: {}".format(
+ tc_name, static_routes_input, result
)
step(
@@ -547,7 +563,11 @@ def test_verify_bgp_default_originate_in_IBGP_p0(request):
}
}
result = create_router_bgp(tgen, topo, default_originate_config)
- assert result is True, "Testcase {} : Failed Configuring default originate configuration. \n Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed Configuring default originate configuration. \n Error: {}".format(
+ tc_name, result
+ )
step(
"After configuring default-originate command , verify default routes are advertised on R2 "
@@ -574,12 +594,16 @@ def test_verify_bgp_default_originate_in_IBGP_p0(request):
}
result = verify_fib_routes(tgen, addr_type, "r2", static_routes_input)
- assert result is True, "Testcase {} : post configuring the BGP Default originate configuration static and connected routes should not be effected but impacted on FIB .......! FAILED \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : post configuring the BGP Default originate configuration static and connected routes should not be effected but impacted on FIB .......! FAILED \n Error: {}".format(
tc_name, result
)
result = verify_bgp_rib(tgen, addr_type, "r2", static_routes_input)
- assert result is True, "Testcase {} : Failedpost configuring the BGP Default originate configuration static and connected routes should not be effected but impacted on RIB......! FAILED \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : Failedpost configuring the BGP Default originate configuration static and connected routes should not be effected but impacted on RIB......! FAILED \n Error: {}".format(
tc_name, result
)
step(
@@ -686,7 +710,9 @@ def test_verify_bgp_default_originate_in_EBGP_p0(request):
step("After changing the BGP AS Path Verify the BGP Convergence")
BGP_CONVERGENCE = verify_bgp_convergence(tgen, topo)
- assert BGP_CONVERGENCE is True, "Complete convergence is expeceted after changing the ASN os the routes ..! :Failed \n Error: {}".format(
+ assert (
+ BGP_CONVERGENCE is True
+ ), "Complete convergence is expeceted after changing the ASN os the routes ..! :Failed \n Error: {}".format(
BGP_CONVERGENCE
)
@@ -703,7 +729,9 @@ def test_verify_bgp_default_originate_in_EBGP_p0(request):
}
}
result = create_static_routes(tgen, static_routes_input)
- assert result is True, "Testcase {} : Failed to configure the static routes ....! Failed \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : Failed to configure the static routes ....! Failed \n Error: {}".format(
tc_name, result
)
step("verify IPv4 and IPv6 static route are configured and up on R1")
@@ -719,8 +747,10 @@ def test_verify_bgp_default_originate_in_EBGP_p0(request):
}
}
result = verify_fib_routes(tgen, addr_type, "r3", static_routes_input)
- assert result is True, "Testcase {} : Route is not found in {} in FIB ......! Failed \n Error: {}".format(
- tc_name, static_routes_input,result
+ assert (
+ result is True
+ ), "Testcase {} : Route is not found in {} in FIB ......! Failed \n Error: {}".format(
+ tc_name, static_routes_input, result
)
step(
@@ -773,7 +803,11 @@ def test_verify_bgp_default_originate_in_EBGP_p0(request):
},
}
result = create_router_bgp(tgen, topo, redistribute_static)
- assert result is True, "Testcase {} : Failed to configure redistribute configuratin \n Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to configure redistribute configuratin \n Error: {}".format(
+ tc_name, result
+ )
step(
"After configuring redistribute command , verify static and connected routes ( loopback connected routes) are advertised on R2"
@@ -806,11 +840,15 @@ def test_verify_bgp_default_originate_in_EBGP_p0(request):
}
}
result = verify_fib_routes(tgen, addr_type, "r2", static_routes_input)
- assert result is True, "Testcase {} : static & and connected routes are expected but not found in FIB .... ! \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : static & and connected routes are expected but not found in FIB .... ! \n Error: {}".format(
tc_name, result
)
result = verify_bgp_rib(tgen, addr_type, "r2", static_routes_input)
- assert result is True, "Testcase {} : static & and connected routes are expected but not found in RIB .... ! \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : static & and connected routes are expected but not found in RIB .... ! \n Error: {}".format(
tc_name, result
)
snapshot1 = get_prefix_count_route(tgen, topo, dut="r2", peer="r3")
@@ -830,7 +868,11 @@ def test_verify_bgp_default_originate_in_EBGP_p0(request):
}
}
result = create_router_bgp(tgen, topo, default_originate_config)
- assert result is True, "Testcase {} : Failed to configure the default originate configuration \n Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to configure the default originate configuration \n Error: {}".format(
+ tc_name, result
+ )
step(
"After configuring default-originate command , verify default routes are advertised on R2 on both BGP RIB and FIB"
@@ -853,13 +895,17 @@ def test_verify_bgp_default_originate_in_EBGP_p0(request):
}
result = verify_fib_routes(tgen, addr_type, "r2", static_routes_input)
- assert result is True, "Testcase {} : static route from R1 {} and default route from R3 is expected in R2 FIB .....! NOT FOUND \n Error: {}".format(
- tc_name, NETWORK1_1,result
+ assert (
+ result is True
+ ), "Testcase {} : static route from R1 {} and default route from R3 is expected in R2 FIB .....! NOT FOUND \n Error: {}".format(
+ tc_name, NETWORK1_1, result
)
result = verify_bgp_rib(tgen, addr_type, "r2", static_routes_input)
- assert result is True, "Testcase {} : static route from R1 {} and default route from R3 is expected in R2 RIB .....! NOT FOUND \n Error: {}".format(
- tc_name,NETWORK1_1, result
+ assert (
+ result is True
+ ), "Testcase {} : static route from R1 {} and default route from R3 is expected in R2 RIB .....! NOT FOUND \n Error: {}".format(
+ tc_name, NETWORK1_1, result
)
step(
@@ -875,7 +921,11 @@ def test_verify_bgp_default_originate_in_EBGP_p0(request):
metric=0,
expected_aspath="4000",
)
- assert result is True, "Testcase {} : Default route from R3 is expected with attributes in R2 RIB .....! NOT FOUND Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Default route from R3 is expected with attributes in R2 RIB .....! NOT FOUND Error: {}".format(
+ tc_name, result
+ )
step(
"Taking the snapshot2 of the prefix count after configuring the default originate"
@@ -968,7 +1018,9 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
step("After changing the BGP AS Path Verify the BGP Convergence")
BGP_CONVERGENCE = verify_bgp_convergence(tgen, topo)
- assert BGP_CONVERGENCE is True, "Complete convergence is expected after changing ASN ....! ERROR :Failed \n Error: {}".format(
+ assert (
+ BGP_CONVERGENCE is True
+ ), "Complete convergence is expected after changing ASN ....! ERROR :Failed \n Error: {}".format(
BGP_CONVERGENCE
)
@@ -989,7 +1041,9 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
}
}
result = create_static_routes(tgen, static_routes_input)
- assert result is True, "Testcase {} : Static Configuration is Failed \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : Static Configuration is Failed \n Error: {}".format(
tc_name, result
)
@@ -1010,8 +1064,10 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
}
}
result = verify_fib_routes(tgen, addr_type, "r0", static_routes_input)
- assert result is True, "Testcase {} : routes {} unable is not found in R0 FIB \n Error: {}".format(
- tc_name, static_routes_input,result
+ assert (
+ result is True
+ ), "Testcase {} : routes {} unable is not found in R0 FIB \n Error: {}".format(
+ tc_name, static_routes_input, result
)
step(
@@ -1028,7 +1084,11 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
}
}
result = create_router_bgp(tgen, topo, redistribute_static)
- assert result is True, "Testcase {} : Failed to configure redistribute static configuration....! \n Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to configure redistribute static configuration....! \n Error: {}".format(
+ tc_name, result
+ )
step("verify IPv4 and IPv6 static route are configured and up on R1")
for addr_type in ADDR_TYPES:
@@ -1047,13 +1107,17 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
}
}
result = verify_fib_routes(tgen, addr_type, "r1", static_routes_input)
- assert result is True, "Testcase {} : Failed... Routes {} expected in r0 FIB after configuring the redistribute config \n Error: {}".format(
- tc_name,static_routes_input, result
+ assert (
+ result is True
+ ), "Testcase {} : Failed... Routes {} expected in r0 FIB after configuring the redistribute config \n Error: {}".format(
+ tc_name, static_routes_input, result
)
result = verify_bgp_rib(tgen, addr_type, "r1", static_routes_input)
- assert result is True, "Testcase {} : Failed... Routes {} expected in r0 RIB after configuring the redistribute config \n Error: {}".format(
- tc_name, static_routes_input,result
+ assert (
+ result is True
+ ), "Testcase {} : Failed... Routes {} expected in r0 RIB after configuring the redistribute config \n Error: {}".format(
+ tc_name, static_routes_input, result
)
step(
@@ -1094,7 +1158,11 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
}
}
result = create_prefix_lists(tgen, input_dict_3)
- assert result is True, "Testcase {} : Failed to configure the prefix list \n Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to configure the prefix list \n Error: {}".format(
+ tc_name, result
+ )
step(
"Configure IPV4 and IPv6 route-map (RMv4 and RMv6 ) matching prefix-list (Pv4 and Pv6) respectively on R1"
@@ -1120,7 +1188,11 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
}
}
result = create_route_maps(tgen, input_dict_3)
- assert result is True, "Testcase {} : Failed to configure the route map \n Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to configure the route map \n Error: {}".format(
+ tc_name, result
+ )
step(
"Configure default-originate with route-map (RMv4 and RMv6) on R1, on BGP IPv4 and IPv6 address family "
@@ -1142,7 +1214,11 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
}
}
result = create_router_bgp(tgen, topo, default_originate_config)
- assert result is True, "Testcase {} : Failed to configure the default originate \n Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to configure the default originate \n Error: {}".format(
+ tc_name, result
+ )
step("Verify the default route is received in BGP RIB and FIB")
step(
@@ -1167,7 +1243,9 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
static_routes_input,
next_hop=DEFAULT_ROUTE_NXT_HOP_R1[addr_type],
)
- assert result is True, "Testcase {} : Failed...! Expected default route from R1 not found in FIB \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : Failed...! Expected default route from R1 not found in FIB \n Error: {}".format(
tc_name, result
)
@@ -1178,7 +1256,9 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
static_routes_input,
next_hop=DEFAULT_ROUTE_NXT_HOP_R1[addr_type],
)
- assert result is True, "Testcase {} : Failed...! Expected default route from R1 not found in RIB \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : Failed...! Expected default route from R1 not found in RIB \n Error: {}".format(
tc_name, result
)
step("Remove route-map RMv4 and RMv6 from default-originate command in R1")
@@ -1196,7 +1276,11 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
}
}
result = create_router_bgp(tgen, topo, default_originate_config)
- assert result is True, "Testcase {} : Failed to remove the default originate conditional route-map \n Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to remove the default originate conditional route-map \n Error: {}".format(
+ tc_name, result
+ )
step(
"Verify BGP RIB and FIB After removing route-map , default route still present on R2"
@@ -1221,7 +1305,9 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
static_routes_input,
next_hop=DEFAULT_ROUTE_NXT_HOP_R1[addr_type],
)
- assert result is True, "Testcase {} : Failed Default route from R1 is not found in FIB \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : Failed Default route from R1 is not found in FIB \n Error: {}".format(
tc_name, result
)
@@ -1232,7 +1318,9 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
static_routes_input,
next_hop=DEFAULT_ROUTE_NXT_HOP_R1[addr_type],
)
- assert result is True, "Testcase {} : Failed Default route from R1 is not found in RIB \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : Failed Default route from R1 is not found in RIB \n Error: {}".format(
tc_name, result
)
@@ -1266,7 +1354,11 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
}
}
result = create_router_bgp(tgen, topo, default_originate_config)
- assert result is True, "Testcase {} : Failed to configure the Default originate route-map \n Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to configure the Default originate route-map \n Error: {}".format(
+ tc_name, result
+ )
step(
"After configuring default-originate command , verify default routes are advertised on R2 "
@@ -1290,7 +1382,9 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
static_routes_input,
next_hop=DEFAULT_ROUTE_NXT_HOP_R1[addr_type],
)
- assert result is True, "Testcase {} : Failed Default Route from R1 is not found in FIB \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : Failed Default Route from R1 is not found in FIB \n Error: {}".format(
tc_name, result
)
@@ -1301,7 +1395,9 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
static_routes_input,
next_hop=DEFAULT_ROUTE_NXT_HOP_R1[addr_type],
)
- assert result is True, "Testcase {} : Failed Default Route from R1 is not found in RIB \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : Failed Default Route from R1 is not found in RIB \n Error: {}".format(
tc_name, result
)
@@ -1345,7 +1441,11 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
}
}
result = create_prefix_lists(tgen, input_dict_3)
- assert result is True, "Testcase {} : Failed to delete the prefix list Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to delete the prefix list Error: {}".format(
+ tc_name, result
+ )
step(
"Verify BGP RIB and FIB After deleting prefix-list , verify IPv4 and IPv6 default route got removed from DUT "
@@ -1426,7 +1526,11 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
}
}
result = create_prefix_lists(tgen, input_dict_3)
- assert result is True, "Testcase {} : Failed to configure the prefix lists Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to configure the prefix lists Error: {}".format(
+ tc_name, result
+ )
step(
"After configuring the Prefixlist cross checking the BGP Default route is configured again , before deleting the route map"
@@ -1452,7 +1556,9 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
next_hop=DEFAULT_ROUTE_NXT_HOP_R1[addr_type],
expected=True,
)
- assert result is True, "Testcase {} : Failed Default route from R1 is expected in FIB but not found \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : Failed Default route from R1 is expected in FIB but not found \n Error: {}".format(
tc_name, result
)
@@ -1464,14 +1570,20 @@ def test_verify_bgp_default_originate_in_IBGP_with_route_map_p0(request):
next_hop=DEFAULT_ROUTE_NXT_HOP_R1[addr_type],
expected=True,
)
- assert result is True, "Testcase {} : Failed Default route from R1 is expected in RIB but not found \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : Failed Default route from R1 is expected in RIB but not found \n Error: {}".format(
tc_name, result
)
step("Deleting the routemap")
input_dict = {"r1": {"route_maps": ["RMv4", "RMv6"]}}
result = delete_route_maps(tgen, input_dict)
- assert result is True, "Testcase {} : Failed to delete the Route-map \n Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to delete the Route-map \n Error: {}".format(
+ tc_name, result
+ )
step(
"Verify BGP RIB and FIB ,After deleting route-map , verify IPv4 and IPv6 default route got removed from DUT"
@@ -1605,7 +1717,9 @@ def test_verify_bgp_default_originate_in_EBGP_with_route_map_p0(request):
}
}
result = create_static_routes(tgen, static_routes_input)
- assert result is True, "Testcase {} : Failed to configure the static routes \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : Failed to configure the static routes \n Error: {}".format(
tc_name, result
)
step("verify IPv4 and IPv6 static route are configured and up on R4")
@@ -1625,8 +1739,10 @@ def test_verify_bgp_default_originate_in_EBGP_with_route_map_p0(request):
}
}
result = verify_fib_routes(tgen, addr_type, "r4", static_routes_input)
- assert result is True, "Testcase {} : Failed Static route {} is not found in R4 FIB \n Error: {}".format(
- tc_name, static_routes_input,result
+ assert (
+ result is True
+ ), "Testcase {} : Failed Static route {} is not found in R4 FIB \n Error: {}".format(
+ tc_name, static_routes_input, result
)
step(
@@ -1643,7 +1759,11 @@ def test_verify_bgp_default_originate_in_EBGP_with_route_map_p0(request):
}
}
result = create_router_bgp(tgen, topo, redistribute_static)
- assert result is True, "Testcase {} : Failed to configure the redistribute static \n Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to configure the redistribute static \n Error: {}".format(
+ tc_name, result
+ )
step("verify IPv4 and IPv6 static route are configured and up on R3")
for addr_type in ADDR_TYPES:
@@ -1662,11 +1782,15 @@ def test_verify_bgp_default_originate_in_EBGP_with_route_map_p0(request):
}
}
result = verify_fib_routes(tgen, addr_type, "r3", static_routes_input)
- assert result is True, "Testcase {} : Failed static routes from R1 and R3 is not found in FIB \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : Failed static routes from R1 and R3 is not found in FIB \n Error: {}".format(
tc_name, result
)
result = verify_bgp_rib(tgen, addr_type, "r3", static_routes_input)
- assert result is True, "Testcase {} : Failed static routes from R1 and R3 is not found in RIB \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : Failed static routes from R1 and R3 is not found in RIB \n Error: {}".format(
tc_name, result
)
@@ -1698,12 +1822,20 @@ def test_verify_bgp_default_originate_in_EBGP_with_route_map_p0(request):
}
}
result = create_prefix_lists(tgen, input_dict_3)
- assert result is True, "Testcase {} : Failed to configure the prefix lists \n Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to configure the prefix lists \n Error: {}".format(
+ tc_name, result
+ )
step("verify IPv4 and IPv6 Prefix list got configured on R3")
input_dict = {"r3": {"prefix_lists": ["Pv4", "Pv6"]}}
result = verify_prefix_lists(tgen, input_dict)
- assert result is True, "Testcase {} : Failed ..! configured prefix lists {} are not found \n Error: {}".format(tc_name,input_dict, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed ..! configured prefix lists {} are not found \n Error: {}".format(
+ tc_name, input_dict, result
+ )
step(
"Configure IPv4 and IPv6 route-map ( RMv4 and RMv6 ) matching prefix-list (Pv4 and Pv6 ) respectively on R3"
@@ -1729,7 +1861,11 @@ def test_verify_bgp_default_originate_in_EBGP_with_route_map_p0(request):
}
}
result = create_route_maps(tgen, input_dict_3)
- assert result is True, "Testcase {} : Failed to configure the route-map \n Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to configure the route-map \n Error: {}".format(
+ tc_name, result
+ )
step(
"Taking the snapshot of the prefix count before configuring the default originate"
)
@@ -1754,7 +1890,11 @@ def test_verify_bgp_default_originate_in_EBGP_with_route_map_p0(request):
}
}
result = create_router_bgp(tgen, topo, default_originate_config)
- assert result is True, "Testcase {} : Failed to configure default-originate \n Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to configure default-originate \n Error: {}".format(
+ tc_name, result
+ )
step("Verify the default route is NOT received in BGP RIB and FIB on R2 ")
step(
@@ -1836,7 +1976,11 @@ def test_verify_bgp_default_originate_in_EBGP_with_route_map_p0(request):
}
}
result = create_prefix_lists(tgen, input_dict_3)
- assert result is True, "Testcase {} : Failed to configure the prefix lists Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to configure the prefix lists Error: {}".format(
+ tc_name, result
+ )
step("Verify BGP default route for IPv4 and IPv6 is received on R2")
@@ -1859,7 +2003,9 @@ def test_verify_bgp_default_originate_in_EBGP_with_route_map_p0(request):
static_routes_input,
next_hop=DEFAULT_ROUTE_NXT_HOP_R3[addr_type],
)
- assert result is True, "Testcase {} : Failed Default routes are expected in R2 FIB from R3 but not found ....! \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : Failed Default routes are expected in R2 FIB from R3 but not found ....! \n Error: {}".format(
tc_name, result
)
@@ -1870,7 +2016,9 @@ def test_verify_bgp_default_originate_in_EBGP_with_route_map_p0(request):
static_routes_input,
next_hop=DEFAULT_ROUTE_NXT_HOP_R3[addr_type],
)
- assert result is True, "Testcase {} : Failed Default routes are expected in R2 RIB from R3 but not found ....! \n Error: {}".format(
+ assert (
+ result is True
+ ), "Testcase {} : Failed Default routes are expected in R2 RIB from R3 but not found ....! \n Error: {}".format(
tc_name, result
)
@@ -1914,7 +2062,11 @@ def test_verify_bgp_default_originate_in_EBGP_with_route_map_p0(request):
}
}
result = create_prefix_lists(tgen, input_dict_3)
- assert result is True, "Testcase {} : Failed to remove prefix-lists from R3 Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Failed to remove prefix-lists from R3 Error: {}".format(
+ tc_name, result
+ )
step(
"After Removing route BGP default route for IPv4 and IPv6 is NOT received on R2"
diff --git a/tests/topotests/bgp_default_originate/test_bgp_default_originate_topo1_2.py b/tests/topotests/bgp_default_originate/test_bgp_default_originate_topo1_2.py
index 59f833b93c..4e8bda55cf 100644
--- a/tests/topotests/bgp_default_originate/test_bgp_default_originate_topo1_2.py
+++ b/tests/topotests/bgp_default_originate/test_bgp_default_originate_topo1_2.py
@@ -955,6 +955,7 @@ def test_verify_bgp_default_originate_route_map_in_OUT_p1(request):
write_test_footer(tc_name)
+
def test_verify_bgp_default_originate_route_map_in_IN_p1(request):
"""Verify BGP default originate route-map with IN route-map"""
tgen = get_topogen()
@@ -1472,6 +1473,7 @@ def test_verify_bgp_default_originate_route_map_in_IN_p1(request):
)
write_test_footer(tc_name)
+
def test_verify_default_originate_after_removing_default_originate_p1(request):
"""Verify BGP default route after removing default-originate"""
@@ -2232,9 +2234,9 @@ def test_verify_default_originate_after_removing_default_originate_p1(request):
)
write_test_footer(tc_name)
+
def test_verify_default_originate_route_with_GR_p1(request):
- """ "Verify default-originate route with GR "
- """
+ """ "Verify default-originate route with GR " """
tgen = get_topogen()
global BGP_CONVERGENCE
global topo
@@ -2250,14 +2252,13 @@ def test_verify_default_originate_route_with_GR_p1(request):
if BGP_CONVERGENCE != True:
pytest.skip("skipped because of BGP Convergence failure")
-
step("Configure IPV4 and IPV6 IBGP between R1 and R2 ")
step("Configure IPV4 and IPV6 EBGP between R2 to R3 ")
- r0_local_as = topo['routers']['r0']['bgp']['local_as']
- r1_local_as = topo['routers']['r1']['bgp']['local_as']
- r2_local_as = topo['routers']['r2']['bgp']['local_as']
- r3_local_as = topo['routers']['r3']['bgp']['local_as']
- r4_local_as = topo['routers']['r4']['bgp']['local_as']
+ r0_local_as = topo["routers"]["r0"]["bgp"]["local_as"]
+ r1_local_as = topo["routers"]["r1"]["bgp"]["local_as"]
+ r2_local_as = topo["routers"]["r2"]["bgp"]["local_as"]
+ r3_local_as = topo["routers"]["r3"]["bgp"]["local_as"]
+ r4_local_as = topo["routers"]["r4"]["bgp"]["local_as"]
input_dict = {
"r0": {
"bgp": {
@@ -2336,33 +2337,14 @@ def test_verify_default_originate_route_with_GR_p1(request):
"bgp": {
"local_as": local_as,
"address_family": {
- "ipv4": {
- "unicast": {
- "default_originate":{
- "r2":{
-
- }
-
- }
-
- }
- }, "ipv6": {
- "unicast": {
- "default_originate":{
- "r2":{
-
- }
-
- }
- }
- }
- }
+ "ipv4": {"unicast": {"default_originate": {"r2": {}}}},
+ "ipv6": {"unicast": {"default_originate": {"r2": {}}}},
+ },
}
}
}
result = create_router_bgp(tgen, topo, default_originate_config)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(
- tc_name, result)
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
step(
"R2 received default-originate routes and advertised it to R3 , verify on R2 and R3"
@@ -2383,17 +2365,28 @@ def test_verify_default_originate_route_with_GR_p1(request):
}
}
- result = verify_fib_routes(tgen, addr_type, "r2", static_routes_input,next_hop=DEFAULT_ROUTE_NXT_HOP_R1[addr_type])
+ result = verify_fib_routes(
+ tgen,
+ addr_type,
+ "r2",
+ static_routes_input,
+ next_hop=DEFAULT_ROUTE_NXT_HOP_R1[addr_type],
+ )
assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result
)
- result = verify_bgp_rib(tgen, addr_type, "r2", static_routes_input,next_hop=DEFAULT_ROUTE_NXT_HOP_R1[addr_type])
+ result = verify_bgp_rib(
+ tgen,
+ addr_type,
+ "r2",
+ static_routes_input,
+ next_hop=DEFAULT_ROUTE_NXT_HOP_R1[addr_type],
+ )
assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result
)
-
step(" Kill BGPd session on R2")
kill_router_daemons(tgen, "r2", ["bgpd"])
start_router_daemons(tgen, "r2", ["bgpd"])
@@ -2411,17 +2404,30 @@ def test_verify_default_originate_route_with_GR_p1(request):
}
}
- result = verify_fib_routes(tgen, addr_type, "r2", static_routes_input,next_hop=DEFAULT_ROUTE_NXT_HOP_R1[addr_type])
+ result = verify_fib_routes(
+ tgen,
+ addr_type,
+ "r2",
+ static_routes_input,
+ next_hop=DEFAULT_ROUTE_NXT_HOP_R1[addr_type],
+ )
assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result
)
- result = verify_bgp_rib(tgen, addr_type, "r2", static_routes_input,next_hop=DEFAULT_ROUTE_NXT_HOP_R1[addr_type])
+ result = verify_bgp_rib(
+ tgen,
+ addr_type,
+ "r2",
+ static_routes_input,
+ next_hop=DEFAULT_ROUTE_NXT_HOP_R1[addr_type],
+ )
assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result
)
write_test_footer(tc_name)
+
if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args))
diff --git a/tests/topotests/bgp_default_originate/test_default_originate_conditional_routemap.py b/tests/topotests/bgp_default_originate/test_default_originate_conditional_routemap.py
index 82c4e7e0ab..f67a431c7e 100644
--- a/tests/topotests/bgp_default_originate/test_default_originate_conditional_routemap.py
+++ b/tests/topotests/bgp_default_originate/test_default_originate_conditional_routemap.py
@@ -75,6 +75,7 @@ NETWORK1_1 = {"ipv4": "198.51.1.1/32", "ipv6": "2001:DB8::1:1/128"}
DEFAULT_ROUTES = {"ipv4": "0.0.0.0/0", "ipv6": "0::0/0"}
NEXT_HOP_IP = {"ipv4": "Null0", "ipv6": "Null0"}
+
def setup_module(mod):
"""
Sets up the pytest environment
@@ -818,11 +819,11 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
step("Configure IPv4 and IPv6 , EBGP neighbor between R3 and R2")
step("Configure IPv4 and IPv6 IBGP neighbor between R3 and R4")
- r0_local_as = topo['routers']['r0']['bgp']['local_as']
- r1_local_as = topo['routers']['r1']['bgp']['local_as']
- r2_local_as = topo['routers']['r2']['bgp']['local_as']
- r3_local_as = topo['routers']['r3']['bgp']['local_as']
- r4_local_as = topo['routers']['r4']['bgp']['local_as']
+ r0_local_as = topo["routers"]["r0"]["bgp"]["local_as"]
+ r1_local_as = topo["routers"]["r1"]["bgp"]["local_as"]
+ r2_local_as = topo["routers"]["r2"]["bgp"]["local_as"]
+ r3_local_as = topo["routers"]["r3"]["bgp"]["local_as"]
+ r4_local_as = topo["routers"]["r4"]["bgp"]["local_as"]
input_dict = {
"r0": {
"bgp": {
@@ -1026,22 +1027,21 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
"action": "permit",
"seq_id": "1",
"set": {
- "path": {
- "as_num": "200",
- "as_action": "prepend",
- }
+ "path": {
+ "as_num": "200",
+ "as_action": "prepend",
}
-
+ },
},
{
"action": "permit",
"seq_id": "2",
"set": {
- "path": {
- "as_num": "300",
- "as_action": "prepend",
- }
+ "path": {
+ "as_num": "300",
+ "as_action": "prepend",
}
+ },
},
],
"RMv6": [
@@ -1049,21 +1049,21 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
"action": "permit",
"seq_id": "1",
"set": {
- "path": {
- "as_num": "200",
- "as_action": "prepend",
- }
+ "path": {
+ "as_num": "200",
+ "as_action": "prepend",
}
+ },
},
{
"action": "permit",
"seq_id": "2",
"set": {
- "path": {
- "as_num": "300",
- "as_action": "prepend",
- }
+ "path": {
+ "as_num": "300",
+ "as_action": "prepend",
}
+ },
},
],
}
@@ -1122,22 +1122,21 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
"action": "permit",
"seq_id": "1",
"set": {
- "path": {
- "as_num": "500",
- "as_action": "prepend",
- }
+ "path": {
+ "as_num": "500",
+ "as_action": "prepend",
}
-
+ },
},
{
"action": "permit",
"seq_id": "2",
"set": {
- "path": {
- "as_num": "600",
- "as_action": "prepend",
- }
+ "path": {
+ "as_num": "600",
+ "as_action": "prepend",
}
+ },
},
],
"RMv6": [
@@ -1145,21 +1144,21 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
"action": "permit",
"seq_id": "1",
"set": {
- "path": {
- "as_num": "500",
- "as_action": "prepend",
- }
+ "path": {
+ "as_num": "500",
+ "as_action": "prepend",
}
+ },
},
{
"action": "permit",
"seq_id": "2",
"set": {
- "path": {
- "as_num": "600",
- "as_action": "prepend",
- }
+ "path": {
+ "as_num": "600",
+ "as_action": "prepend",
}
+ },
},
],
}
@@ -1170,7 +1169,6 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
assert result is True, "Test case {} : Failed \n Error: {}".format(tc_name, result)
assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
-
step("As path 500 added to IPv4 and IPv6 default -originate route received on R2")
result = verify_rib_default_route(
tgen,
@@ -1232,7 +1230,6 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
"Verify Configured metric value received on R2 along with as-path for IPv4 and IPv6 default routes "
)
-
DEFAULT_ROUTES = {"ipv4": "0.0.0.0/0", "ipv6": "::/0"}
result = verify_rib_default_route(
tgen,
@@ -1244,7 +1241,6 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
expected_aspath="4000 500",
)
-
step(
"Modify route-map seq1 configure metric 50 and route-map seq2 configure metric 100 IPv4 and IPv6 route-map "
)
@@ -1294,7 +1290,6 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
"Verify Configured metric value received on R2 along with as-path for IPv4 and IPv6 default routes "
)
-
result = verify_rib_default_route(
tgen,
topo,
@@ -1314,7 +1309,6 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
{
"action": "permit",
"seq_id": "1",
-
"set": {
"path": {
"as_num": "500",
@@ -1374,9 +1368,6 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
"Verify AS-prepend is deleted from default originate route and metric value only present on R2 for IPv4 and IPv6 default routes "
)
-
-
-
result = verify_rib_default_route(
tgen,
topo,
@@ -1388,7 +1379,6 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
)
assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
-
step("Delete metric value from IP4 and IPv6 route-map configured on R3 ")
route_map = {
"r3": {
@@ -1428,8 +1418,6 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
"Verify Metric value deleted from IPv4 and IPv6 default route on R2 ,verify default routes "
)
-
-
result = verify_rib_default_route(
tgen,
topo,
@@ -1443,11 +1431,11 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
step("Change IPv4 and IPv6 , EBGP to IBGP neighbor between R3 and R2")
step("Change IPv4 and IPv6 IBGP to EBGP neighbor between R3 and R4")
- r0_local_as = topo['routers']['r0']['bgp']['local_as']
- r1_local_as = topo['routers']['r1']['bgp']['local_as']
- r2_local_as = topo['routers']['r2']['bgp']['local_as']
- r3_local_as = topo['routers']['r3']['bgp']['local_as']
- r4_local_as = topo['routers']['r4']['bgp']['local_as']
+ r0_local_as = topo["routers"]["r0"]["bgp"]["local_as"]
+ r1_local_as = topo["routers"]["r1"]["bgp"]["local_as"]
+ r2_local_as = topo["routers"]["r2"]["bgp"]["local_as"]
+ r3_local_as = topo["routers"]["r3"]["bgp"]["local_as"]
+ r4_local_as = topo["routers"]["r4"]["bgp"]["local_as"]
input_dict = {
"r0": {
"bgp": {
@@ -1459,7 +1447,6 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
"local_as": r1_local_as,
}
},
-
"r2": {
"bgp": {
"local_as": 1111,
@@ -1645,8 +1632,6 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
"Verify Configured metric value received on R2 along with as-path for IPv4 and IPv6 default routes "
)
-
-
result = verify_rib_default_route(
tgen,
topo,
@@ -1656,7 +1641,6 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
locPrf=50,
)
-
assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
step(
@@ -1708,9 +1692,6 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
"Verify Modified local-preference value received on R2 for IPv4 and IPv6 default routes "
)
-
-
-
DEFAULT_ROUTES = {"ipv4": "0.0.0.0/0", "ipv6": "::/0"}
result = verify_rib_default_route(
tgen,
@@ -1724,13 +1705,15 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
assert result is True, "Testcase {} : Failed Error: {}".format(tc_name, result)
# updating the topology with the updated AS-Number to avoid conflict in con configuring the AS
updated_topo = topo
- updated_topo['routers']['r0']['bgp']['local_as']=get_dut_as_number(tgen,"r0")
- updated_topo['routers']['r1']['bgp']['local_as']=get_dut_as_number(tgen,"r1")
- updated_topo['routers']['r2']['bgp']['local_as']=get_dut_as_number(tgen,"r2")
- updated_topo['routers']['r3']['bgp']['local_as']=get_dut_as_number(tgen,"r3")
- updated_topo['routers']['r4']['bgp']['local_as']=get_dut_as_number(tgen,"r4")
+ updated_topo["routers"]["r0"]["bgp"]["local_as"] = get_dut_as_number(tgen, "r0")
+ updated_topo["routers"]["r1"]["bgp"]["local_as"] = get_dut_as_number(tgen, "r1")
+ updated_topo["routers"]["r2"]["bgp"]["local_as"] = get_dut_as_number(tgen, "r2")
+ updated_topo["routers"]["r3"]["bgp"]["local_as"] = get_dut_as_number(tgen, "r3")
+ updated_topo["routers"]["r4"]["bgp"]["local_as"] = get_dut_as_number(tgen, "r4")
- step("Shut IPv4/IPv6 BGP neighbor from R4 ( R4-R3) using 'neighbor x.x.x.x shut' command ")
+ step(
+ "Shut IPv4/IPv6 BGP neighbor from R4 ( R4-R3) using 'neighbor x.x.x.x shut' command "
+ )
local_as = get_dut_as_number(tgen, dut="r4")
shut_neighbor = {
"r4": {
@@ -1740,46 +1723,41 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
"ipv4": {
"unicast": {
"neighbor": {
- "r3": {
- "dest_link": {
- "r4": {"shutdown":True}
- }
- }
+ "r3": {"dest_link": {"r4": {"shutdown": True}}}
}
}
},
"ipv6": {
"unicast": {
"neighbor": {
- "r3": {
- "dest_link": {
- "r4": {"shutdown":True}
- }
- }
+ "r3": {"dest_link": {"r4": {"shutdown": True}}}
}
}
- }
- }
+ },
+ },
}
}
}
result = create_router_bgp(tgen, updated_topo, shut_neighbor)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
- interface = topo['routers']['r3']['links']['r4']['interface']
- input_dict = {
- "r1": {
- "interface_list": [interface],
- "status": "down"
- }
- }
+ interface = topo["routers"]["r3"]["links"]["r4"]["interface"]
+ input_dict = {"r1": {"interface_list": [interface], "status": "down"}}
result = interface_status(tgen, topo, input_dict)
- assert result is True, "Testcase {} : Shut down the interface failed ! \n Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Shut down the interface failed ! \n Error: {}".format(
+ tc_name, result
+ )
step("After shutting the interface verify the BGP convergence")
- result = verify_bgp_convergence(tgen,topo,expected=False)
- assert result is not True, "Testcase {} : Failed \n After shutting Down BGP convergence should Fail and return False \n Error: {}".format(tc_name, result)
+ result = verify_bgp_convergence(tgen, topo, expected=False)
+ assert (
+ result is not True
+ ), "Testcase {} : Failed \n After shutting Down BGP convergence should Fail and return False \n Error: {}".format(
+ tc_name, result
+ )
step("verify default route deleted from R2 ")
result = verify_rib_default_route(
@@ -1788,8 +1766,13 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
dut="r2",
routes=DEFAULT_ROUTES,
expected_nexthop=DEFAULT_ROUTE_NXT_HOP_R3,
- expected=False)
- assert result is not True, "Testcase {} : Failed \n Error: After Shut down interface the default route is NOT expected but found in RIB -> {}".format( tc_name, result)
+ expected=False,
+ )
+ assert (
+ result is not True
+ ), "Testcase {} : Failed \n Error: After Shut down interface the default route is NOT expected but found in RIB -> {}".format(
+ tc_name, result
+ )
result = verify_fib_default_route(
tgen,
@@ -1797,11 +1780,17 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
dut="r2",
routes=DEFAULT_ROUTES,
expected_nexthop=DEFAULT_ROUTE_NXT_HOP_R3,
- expected=False)
- assert result is not True, "Testcase {} : Failed \n Error: After Shut down interface the default route is NOT expected but found in FIB -> {}".format( tc_name, result)
-
+ expected=False,
+ )
+ assert (
+ result is not True
+ ), "Testcase {} : Failed \n Error: After Shut down interface the default route is NOT expected but found in FIB -> {}".format(
+ tc_name, result
+ )
- step("no Shut IPv4/IPv6 BGP neighbor from R4 ( R4-R3) using 'neighbor x.x.x.x shut' command ")
+ step(
+ "no Shut IPv4/IPv6 BGP neighbor from R4 ( R4-R3) using 'neighbor x.x.x.x shut' command "
+ )
local_as = get_dut_as_number(tgen, dut="r4")
shut_neighbor = {
"r4": {
@@ -1811,46 +1800,39 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
"ipv4": {
"unicast": {
"neighbor": {
- "r3": {
- "dest_link": {
- "r4": {"shutdown":False}
- }
- }
+ "r3": {"dest_link": {"r4": {"shutdown": False}}}
}
}
},
"ipv6": {
"unicast": {
"neighbor": {
- "r3": {
- "dest_link": {
- "r4": {"shutdown":False}
- }
- }
+ "r3": {"dest_link": {"r4": {"shutdown": False}}}
}
}
- }
- }
+ },
+ },
}
}
}
result = create_router_bgp(tgen, updated_topo, shut_neighbor)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
- interface = topo['routers']['r3']['links']['r4']['interface']
- input_dict = {
- "r1": {
- "interface_list": [interface],
- "status": "up"
- }
- }
+ interface = topo["routers"]["r3"]["links"]["r4"]["interface"]
+ input_dict = {"r1": {"interface_list": [interface], "status": "up"}}
result = interface_status(tgen, topo, input_dict)
- assert result is True, "Testcase {} : Bring up interface failed ! \n Error: {}".format(tc_name, result)
+ assert (
+ result is True
+ ), "Testcase {} : Bring up interface failed ! \n Error: {}".format(tc_name, result)
step("After no shutting the interface verify the BGP convergence")
- result = verify_bgp_convergence(tgen,topo,expected=True)
- assert result is True, "Testcase {} : Failed \n After shutting Down BGP convergence should Fail and return False \n Error: {}".format(tc_name, result)
+ result = verify_bgp_convergence(tgen, topo, expected=True)
+ assert (
+ result is True
+ ), "Testcase {} : Failed \n After shutting Down BGP convergence should Fail and return False \n Error: {}".format(
+ tc_name, result
+ )
step("After no shut neighbor , verify default route relearn on R2")
result = verify_rib_default_route(
@@ -1859,8 +1841,13 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
dut="r2",
routes=DEFAULT_ROUTES,
expected_nexthop=DEFAULT_ROUTE_NXT_HOP_R3,
- expected=True)
- assert result is True, "Testcase {} : Failed \n Error: After no Shut down interface the default route is expected but found in RIB -> {}".format( tc_name, result)
+ expected=True,
+ )
+ assert (
+ result is True
+ ), "Testcase {} : Failed \n Error: After no Shut down interface the default route is expected but found in RIB -> {}".format(
+ tc_name, result
+ )
result = verify_fib_default_route(
tgen,
@@ -1868,10 +1855,13 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
dut="r2",
routes=DEFAULT_ROUTES,
expected_nexthop=DEFAULT_ROUTE_NXT_HOP_R3,
- expected=True)
- assert result is True, "Testcase {} : Failed \n Error: After Shut down interface the default route is expected but found in FIB -> {}".format( tc_name, result)
-
-
+ expected=True,
+ )
+ assert (
+ result is True
+ ), "Testcase {} : Failed \n Error: After Shut down interface the default route is expected but found in FIB -> {}".format(
+ tc_name, result
+ )
step("Remove IPv4/IPv6 static route configure on R4")
for addr_type in ADDR_TYPES:
@@ -1881,7 +1871,7 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
{
"network": [NETWORK1_1[addr_type]],
"next_hop": NEXT_HOP_IP[addr_type],
- "delete": True
+ "delete": True,
}
]
}
@@ -1902,12 +1892,16 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
]
}
}
- result = verify_fib_routes(tgen, addr_type, "r4", static_routes_input, expected=False)
- assert result is not True, "Testcase {} : Failed \n Error: {}".format(
+ result = verify_fib_routes(
+ tgen, addr_type, "r4", static_routes_input, expected=False
+ )
+ assert result is not True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result
)
- result = verify_bgp_rib(tgen, addr_type, "r4", static_routes_input, expected=False)
- assert result is not True, "Testcase {} : Failed \n Error: {}".format(
+ result = verify_bgp_rib(
+ tgen, addr_type, "r4", static_routes_input, expected=False
+ )
+ assert result is not True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result
)
@@ -1918,8 +1912,13 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
dut="r2",
routes=DEFAULT_ROUTES,
expected_nexthop=DEFAULT_ROUTE_NXT_HOP_R3,
- expected= False)
- assert result is not True, "Testcase {} : Failed \n Error: After removing static the default route is NOT expected but found in RIB -> {}".format( tc_name, result)
+ expected=False,
+ )
+ assert (
+ result is not True
+ ), "Testcase {} : Failed \n Error: After removing static the default route is NOT expected but found in RIB -> {}".format(
+ tc_name, result
+ )
result = verify_fib_default_route(
tgen,
@@ -1927,9 +1926,13 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
dut="r2",
routes=DEFAULT_ROUTES,
expected_nexthop=DEFAULT_ROUTE_NXT_HOP_R3,
- expected= False)
- assert result is not True, "Testcase {} : Failed \n Error: After removing static the default route is NOT expected but found in FIB -> {}".format( tc_name, result)
-
+ expected=False,
+ )
+ assert (
+ result is not True
+ ), "Testcase {} : Failed \n Error: After removing static the default route is NOT expected but found in FIB -> {}".format(
+ tc_name, result
+ )
step("Configuring the static route back in r4")
for addr_type in ADDR_TYPES:
@@ -1959,12 +1962,16 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
]
}
}
- result = verify_fib_routes(tgen, addr_type, "r4", static_routes_input, expected=True)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ result = verify_fib_routes(
+ tgen, addr_type, "r4", static_routes_input, expected=True
+ )
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result
)
- result = verify_bgp_rib(tgen, addr_type, "r4", static_routes_input, expected=True)
- assert result is True, "Testcase {} : Failed \n Error: {}".format(
+ result = verify_bgp_rib(
+ tgen, addr_type, "r4", static_routes_input, expected=True
+ )
+ assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result
)
@@ -1975,8 +1982,13 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
dut="r2",
routes=DEFAULT_ROUTES,
expected_nexthop=DEFAULT_ROUTE_NXT_HOP_R3,
- expected= True)
- assert result is True, "Testcase {} : Failed \n Error: After removing static the default route is expected but found in RIB -> {}".format( tc_name, result)
+ expected=True,
+ )
+ assert (
+ result is True
+ ), "Testcase {} : Failed \n Error: After removing static the default route is expected but found in RIB -> {}".format(
+ tc_name, result
+ )
result = verify_fib_default_route(
tgen,
@@ -1984,8 +1996,13 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
dut="r2",
routes=DEFAULT_ROUTES,
expected_nexthop=DEFAULT_ROUTE_NXT_HOP_R3,
- expected= True)
- assert result is True, "Testcase {} : Failed \n Error: After removing static the default route is expected but found in FIB -> {}".format( tc_name, result)
+ expected=True,
+ )
+ assert (
+ result is True
+ ), "Testcase {} : Failed \n Error: After removing static the default route is expected but found in FIB -> {}".format(
+ tc_name, result
+ )
step("Deactivate IPv4 and IPv6 neighbor configured from R4 ( R4-R3)")
@@ -1999,15 +2016,14 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
"r3": {"dest_link": {"r4": {"deactivate": "ipv4"}}}
}
},
-
- },"ipv6": {
+ },
+ "ipv6": {
"unicast": {
"neighbor": {
"r3": {"dest_link": {"r4": {"deactivate": "ipv6"}}}
}
},
-
- }
+ },
}
}
}
@@ -2022,8 +2038,13 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
dut="r2",
routes=DEFAULT_ROUTES,
expected_nexthop=DEFAULT_ROUTE_NXT_HOP_R3,
- expected= False)
- assert result is not True, "Testcase {} : Failed \n Error: After Deactivating the BGP neighbor the default route is NOT expected but found in RIB -> {}".format( tc_name, result)
+ expected=False,
+ )
+ assert (
+ result is not True
+ ), "Testcase {} : Failed \n Error: After Deactivating the BGP neighbor the default route is NOT expected but found in RIB -> {}".format(
+ tc_name, result
+ )
result = verify_fib_default_route(
tgen,
@@ -2031,8 +2052,13 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
dut="r2",
routes=DEFAULT_ROUTES,
expected_nexthop=DEFAULT_ROUTE_NXT_HOP_R3,
- expected= False)
- assert result is not True, "Testcase {} : Failed \n Error: After Deactivating the BGP neighbor the default route is NOT expected but found in FIB -> {}".format( tc_name, result)
+ expected=False,
+ )
+ assert (
+ result is not True
+ ), "Testcase {} : Failed \n Error: After Deactivating the BGP neighbor the default route is NOT expected but found in FIB -> {}".format(
+ tc_name, result
+ )
step("Activate IPv4 and IPv6 neighbor configured from R4 ( R4-R3)")
@@ -2046,15 +2072,14 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
"r3": {"dest_link": {"r4": {"activate": "ipv4"}}}
}
},
-
- },"ipv6": {
+ },
+ "ipv6": {
"unicast": {
"neighbor": {
"r3": {"dest_link": {"r4": {"activate": "ipv6"}}}
}
},
-
- }
+ },
}
}
}
@@ -2064,7 +2089,7 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
step("Verify bgp convergence.")
bgp_convergence = verify_bgp_convergence(tgen, updated_topo)
- assert bgp_convergence is True, "Testcase {} : Failed \n Error: {}".format(
+ assert bgp_convergence is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, bgp_convergence
)
step("After Activating the BGP neighbor , verify default route learned on R2")
@@ -2074,8 +2099,13 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
dut="r2",
routes=DEFAULT_ROUTES,
expected_nexthop=DEFAULT_ROUTE_NXT_HOP_R3,
- expected= True)
- assert result is True, "Testcase {} : Failed \n Error: After Deactivating the BGP neighbor the default route is expected but found in RIB -> {}".format( tc_name, result)
+ expected=True,
+ )
+ assert (
+ result is True
+ ), "Testcase {} : Failed \n Error: After Deactivating the BGP neighbor the default route is expected but found in RIB -> {}".format(
+ tc_name, result
+ )
result = verify_fib_default_route(
tgen,
@@ -2083,10 +2113,16 @@ def test_verify_default_originate_after_BGP_attributes_p1(request):
dut="r2",
routes=DEFAULT_ROUTES,
expected_nexthop=DEFAULT_ROUTE_NXT_HOP_R3,
- expected= True)
- assert result is True, "Testcase {} : Failed \n Error: After Deactivating the BGP neighbor the default route is expected but found in FIB -> {}".format( tc_name, result)
+ expected=True,
+ )
+ assert (
+ result is True
+ ), "Testcase {} : Failed \n Error: After Deactivating the BGP neighbor the default route is expected but found in FIB -> {}".format(
+ tc_name, result
+ )
write_test_footer(tc_name)
+
if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args))