write_test_footer(tc_name)
+def test_BGP_config_with_invalid_ASN_p2(request):
+ """
+ Configure BGP with invalid ASN(ex - 0, reserved ASN) and verify test case
+ ended up with error
+ """
+
+ tgen = get_topogen()
+ global BGP_CONVERGENCE
+
+ if BGP_CONVERGENCE != True:
+ pytest.skip('skipped because of BGP Convergence failure')
+
+ # test case name
+ tc_name = request.node.name
+ write_test_header(tc_name)
+
+ # Api call to modify AS number
+ input_dict = {
+ "r1": {
+ "bgp":{
+ "local_as": 0,
+ }
+ },
+ "r2": {
+ "bgp":{
+ "local_as": 0,
+ }
+ },
+ "r3": {
+ "bgp":{
+ "local_as": 0,
+ }
+ },
+ "r4": {
+ "bgp":{
+ "local_as": 64000,
+ }
+ }
+ }
+ result = modify_as_number(tgen, topo, input_dict)
+ try:
+ assert result is True
+ except AssertionError:
+ logger.info("Expected behaviour: {}".format(result))
+ logger.info("BGP config is not created because of invalid ASNs")
+
+ write_test_footer(tc_name)
+
+
+def test_BGP_config_with_2byteAS_and_4byteAS_number_p1(request):
+ """
+ Configure BGP with 4 byte and 2 byte ASN and verify BGP is converged
+ """
+
+ tgen = get_topogen()
+ global BGP_CONVERGENCE
+
+ if BGP_CONVERGENCE != True:
+ pytest.skip('skipped because of BGP Convergence failure')
+
+ # test case name
+ tc_name = request.node.name
+ write_test_header(tc_name)
+
+ # Api call to modify AS number
+ input_dict = {
+ "r1": {
+ "bgp":{
+ "local_as": 131079
+ }
+ },
+ "r2": {
+ "bgp":{
+ "local_as": 131079
+ }
+ },
+ "r3": {
+ "bgp":{
+ "local_as": 131079
+ }
+ },
+ "r4": {
+ "bgp":{
+ "local_as": 111
+ }
+ }
+ }
+ result = modify_as_number(tgen, topo, input_dict)
+ if result != True:
+ assert False, "Testcase " + tc_name + " :Failed \n Error: {}".\
+ format(result)
+
+ result = verify_as_numbers(tgen, topo, input_dict)
+ if result != True:
+ assert False, "Testcase " + tc_name + " :Failed \n Error: {}".\
+ format(result)
+
+ # Api call verify whether BGP is converged
+ result = verify_bgp_convergence(tgen, topo)
+ if result != True:
+ assert False, "Testcase " + tc_name + " :Failed \n Error: {}".\
+ format(result)
+
+ write_test_footer(tc_name)
+
+
def test_bgp_timers_functionality(request):
"""
Test to modify bgp timers and verify timers functionality.
write_test_footer(tc_name)
-def test_ecmp_after_clear_bgp(request):
+@pytest.mark.parametrize("test_type", ["redist_static", "advertise_nw"])
+def test_ecmp_after_clear_bgp(request, test_type):
""" Verify BGP table and RIB in DUT after clear BGP routes and neighbors"""
tc_name = request.node.name
dut = "r3"
protocol = "bgp"
- static_or_nw(tgen, topo, tc_name, "redist_static", "r2")
+ static_or_nw(tgen, topo, tc_name, test_type, "r2")
for addr_type in ADDR_TYPES:
input_dict_1 = {"r3": {"static_routes": [{"network": NETWORK[addr_type]}]}}
write_test_footer(tc_name)
-def test_ecmp_shut_bgp_neighbor(request):
- """
- Disable/Shut selected paths nexthops and verify other next are installed in
- the RIB of DUT. Enable interfaces and verify RIB count.
-
- Shut BGP neigbors one by one and verify BGP and routing table updated
- accordingly in DUT
- """
+@pytest.mark.parametrize("test_type", ["redist_static", "advertise_nw"])
+def test_ecmp_shut_bgp_neighbor(request, test_type):
+ """ Shut BGP neigbors one by one and verify BGP and routing table updated
+ accordingly in DUT """
tc_name = request.node.name
write_test_header(tc_name)
protocol = "bgp"
reset_config_on_routers(tgen)
- static_or_nw(tgen, topo, tc_name, "redist_static", "r2")
+ static_or_nw(tgen, topo, tc_name, test_type, "r2")
for addr_type in ADDR_TYPES:
input_dict = {"r3": {"static_routes": [{"network": NETWORK[addr_type]}]}}
result = interface_status(tgen, topo, input_dict_1)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
- static_or_nw(tgen, topo, tc_name, "redist_static", "r2")
+ static_or_nw(tgen, topo, tc_name, test_type, "r2")
for addr_type in ADDR_TYPES:
input_dict = {"r3": {"static_routes": [{"network": NETWORK[addr_type]}]}}
write_test_footer(tc_name)
-def test_ecmp_after_clear_bgp(request):
+@pytest.mark.parametrize("test_type", ["redist_static", "advertise_nw"])
+def test_ecmp_after_clear_bgp(request, test_type):
""" Verify BGP table and RIB in DUT after clear BGP routes and neighbors"""
tc_name = request.node.name
dut = "r3"
protocol = "bgp"
- static_or_nw(tgen, topo, tc_name, "redist_static", "r2")
+ static_or_nw(tgen, topo, tc_name, test_type, "r2")
for addr_type in ADDR_TYPES:
input_dict_1 = {"r3": {"static_routes": [{"network": NETWORK[addr_type]}]}}
write_test_footer(tc_name)
-def test_ecmp_shut_bgp_neighbor(request):
+@pytest.mark.parametrize("test_type", ["redist_static", "advertise_nw"])
+def test_ecmp_shut_bgp_neighbor(request, test_type):
""" Shut BGP neigbors one by one and verify BGP and routing table updated
accordingly in DUT """
protocol = "bgp"
reset_config_on_routers(tgen)
- static_or_nw(tgen, topo, tc_name, "redist_static", "r2")
+ static_or_nw(tgen, topo, tc_name, test_type, "r2")
for addr_type in ADDR_TYPES:
input_dict = {"r3": {"static_routes": [{"network": NETWORK[addr_type]}]}}
result = interface_status(tgen, topo, input_dict_1)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
- static_or_nw(tgen, topo, tc_name, "redist_static", "r2")
+ static_or_nw(tgen, topo, tc_name, test_type, "r2")
for addr_type in ADDR_TYPES:
input_dict = {"r3": {"static_routes": [{"network": NETWORK[addr_type]}]}}