tests: Enchanced static routing testsuits

1. BGP timers are modified to reduce the run time.
2. Static sleeps are removed from the scripts.

Signed-off-by: naveen <nguggarigoud@vmware.com>
This commit is contained in:
naveen 2020-04-14 12:04:36 +05:30 committed by Vijay Kumar Gupta
parent 0705f3120d
commit ee51a3d9ec
16 changed files with 364 additions and 581 deletions

View File

@ -312,9 +312,9 @@ def test_modify_ecmp_max_paths(request, ecmp_num, test_type):
write_test_footer(tc_name) write_test_footer(tc_name)
@pytest.mark.parametrize("ecmp_num", ["8", "16", "32"])
@pytest.mark.parametrize("test_type", ["redist_static", "advertise_nw"]) @pytest.mark.parametrize("test_type", ["redist_static", "advertise_nw"])
def test_ecmp_after_clear_bgp(request, test_type): def test_ecmp_after_clear_bgp(request, ecmp_num, test_type):
""" Verify BGP table and RIB in DUT after clear BGP routes and neighbors""" """ Verify BGP table and RIB in DUT after clear BGP routes and neighbors"""
tc_name = request.node.name tc_name = request.node.name
@ -337,7 +337,7 @@ def test_ecmp_after_clear_bgp(request, test_type):
addr_type, addr_type,
dut, dut,
input_dict_1, input_dict_1,
next_hop=NEXT_HOPS[addr_type], next_hop=NEXT_HOPS[addr_type][:int(ecmp_num)],
protocol=protocol, protocol=protocol,
) )
assert result is True, "Testcase {} : Failed \n Error: {}".format( assert result is True, "Testcase {} : Failed \n Error: {}".format(
@ -360,7 +360,7 @@ def test_ecmp_after_clear_bgp(request, test_type):
addr_type, addr_type,
dut, dut,
input_dict_1, input_dict_1,
next_hop=NEXT_HOPS[addr_type], next_hop=NEXT_HOPS[addr_type][:int(ecmp_num)],
protocol=protocol, protocol=protocol,
) )
assert result is True, "Testcase {} : Failed \n Error: {}".format( assert result is True, "Testcase {} : Failed \n Error: {}".format(

View File

@ -313,9 +313,9 @@ def test_modify_ecmp_max_paths(request, ecmp_num, test_type):
write_test_footer(tc_name) write_test_footer(tc_name)
@pytest.mark.parametrize("ecmp_num", ["8", "16", "32"])
@pytest.mark.parametrize("test_type", ["redist_static", "advertise_nw"]) @pytest.mark.parametrize("test_type", ["redist_static", "advertise_nw"])
def test_ecmp_after_clear_bgp(request, test_type): def test_ecmp_after_clear_bgp(request, ecmp_num, test_type):
""" Verify BGP table and RIB in DUT after clear BGP routes and neighbors""" """ Verify BGP table and RIB in DUT after clear BGP routes and neighbors"""
tc_name = request.node.name tc_name = request.node.name
@ -338,7 +338,7 @@ def test_ecmp_after_clear_bgp(request, test_type):
addr_type, addr_type,
dut, dut,
input_dict_1, input_dict_1,
next_hop=NEXT_HOPS[addr_type], next_hop=NEXT_HOPS[addr_type][:int(ecmp_num)],
protocol=protocol, protocol=protocol,
) )
assert result is True, "Testcase {} : Failed \n Error: {}".format( assert result is True, "Testcase {} : Failed \n Error: {}".format(
@ -361,7 +361,7 @@ def test_ecmp_after_clear_bgp(request, test_type):
addr_type, addr_type,
dut, dut,
input_dict_1, input_dict_1,
next_hop=NEXT_HOPS[addr_type], next_hop=NEXT_HOPS[addr_type][:int(ecmp_num)],
protocol=protocol, protocol=protocol,
) )
assert result is True, "Testcase {} : Failed \n Error: {}".format( assert result is True, "Testcase {} : Failed \n Error: {}".format(

View File

@ -73,7 +73,10 @@
"neighbor": { "neighbor": {
"r3": { "r3": {
"dest_link": { "dest_link": {
"r2": {} "r2": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }
@ -84,7 +87,10 @@
"neighbor": { "neighbor": {
"r3": { "r3": {
"dest_link": { "dest_link": {
"r2": {} "r2": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }
@ -121,7 +127,10 @@
"neighbor": { "neighbor": {
"r2": { "r2": {
"dest_link": { "dest_link": {
"r3": {} "r3": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }
@ -132,7 +141,10 @@
"neighbor": { "neighbor": {
"r2": { "r2": {
"dest_link": { "dest_link": {
"r3": {} "r3": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }

View File

@ -141,14 +141,38 @@
"neighbor": { "neighbor": {
"r3": { "r3": {
"dest_link": { "dest_link": {
"r2-link0": {}, "r2-link0": {
"r2-link1": {}, "keepalivetimer": 1,
"r2-link2": {}, "holddowntimer": 4
"r2-link3": {}, },
"r2-link4": {}, "r2-link1": {
"r2-link5": {}, "keepalivetimer": 1,
"r2-link6": {}, "holddowntimer": 4
"r2-link7": {} },
"r2-link2": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link3": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link4": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link5": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link6": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link7": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
}, },
@ -162,14 +186,38 @@
"neighbor": { "neighbor": {
"r3": { "r3": {
"dest_link": { "dest_link": {
"r2-link0": {}, "r2-link0": {
"r2-link1": {}, "keepalivetimer": 1,
"r2-link2": {}, "holddowntimer": 4
"r2-link3": {}, },
"r2-link4": {}, "r2-link1": {
"r2-link5": {}, "keepalivetimer": 1,
"r2-link6": {}, "holddowntimer": 4
"r2-link7": {} },
"r2-link2": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link3": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link4": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link5": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link6": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link7": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
}, },
@ -229,14 +277,38 @@
"neighbor": { "neighbor": {
"r2": { "r2": {
"dest_link": { "dest_link": {
"r3-link0": {}, "r3-link0": {
"r3-link1": {}, "keepalivetimer": 1,
"r3-link2": {}, "holddowntimer": 4
"r3-link3": {}, },
"r3-link4": {}, "r3-link1": {
"r3-link5": {}, "keepalivetimer": 1,
"r3-link6": {}, "holddowntimer": 4
"r3-link7": {} },
"r3-link2": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link3": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link4": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link5": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link6": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link7": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }
@ -247,14 +319,38 @@
"neighbor": { "neighbor": {
"r2": { "r2": {
"dest_link": { "dest_link": {
"r3-link0": {}, "r3-link0": {
"r3-link1": {}, "keepalivetimer": 1,
"r3-link2": {}, "holddowntimer": 4
"r3-link3": {}, },
"r3-link4": {}, "r3-link1": {
"r3-link5": {}, "keepalivetimer": 1,
"r3-link6": {}, "holddowntimer": 4
"r3-link7": {} },
"r3-link2": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link3": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link4": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link5": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link6": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link7": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }

View File

@ -113,7 +113,10 @@
"neighbor": { "neighbor": {
"r3": { "r3": {
"dest_link": { "dest_link": {
"r2-link0": {} "r2-link0": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }
@ -124,7 +127,10 @@
"neighbor": { "neighbor": {
"r3": { "r3": {
"dest_link": { "dest_link": {
"r2-link0": {} "r2-link0": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }
@ -153,7 +159,10 @@
"neighbor": { "neighbor": {
"r2": { "r2": {
"dest_link": { "dest_link": {
"r3-link0": {} "r3-link0": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }
@ -164,7 +173,10 @@
"neighbor": { "neighbor": {
"r2": { "r2": {
"dest_link": { "dest_link": {
"r3-link0": {} "r3-link0": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }

View File

@ -35,7 +35,6 @@ import time
import os import os
import pytest import pytest
import ipaddr import ipaddr
from time import sleep
# Save the Current Working Directory to find configuration files. # Save the Current Working Directory to find configuration files.
CWD = os.path.dirname(os.path.realpath(__file__)) CWD = os.path.dirname(os.path.realpath(__file__))
@ -533,7 +532,7 @@ def test_static_route_2nh_p0_tc_1_ebgp(request):
step("Reload the FRR router") step("Reload the FRR router")
# stop/start -> restart FRR router and verify # stop/start -> restart FRR router and verify
stop_router(tgen, "r2") stop_router(tgen, "r2")
sleep(5)
start_router(tgen, "r2") start_router(tgen, "r2")
dut = "r2" dut = "r2"
@ -990,7 +989,7 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ebgp(request):
step("Reload the FRR router") step("Reload the FRR router")
# stop/start -> restart FRR router and verify # stop/start -> restart FRR router and verify
stop_router(tgen, "r2") stop_router(tgen, "r2")
sleep(5)
start_router(tgen, "r2") start_router(tgen, "r2")
step( step(

View File

@ -471,7 +471,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
intf = topo["routers"]["r2"]["links"]["r1-link{}".format(randnum)]["interface"] intf = topo["routers"]["r2"]["links"]["r1-link{}".format(randnum)]["interface"]
shutdown_bringup_interface(tgen, dut, intf, False) shutdown_bringup_interface(tgen, dut, intf, False)
sleep(5)
step("Random no shut of the nexthop interfaces") step("Random no shut of the nexthop interfaces")
# Bringup interface # Bringup interface
@ -564,7 +564,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
step("Reload the FRR router") step("Reload the FRR router")
# stop/start -> restart FRR router and verify # stop/start -> restart FRR router and verify
stop_router(tgen, "r2") stop_router(tgen, "r2")
sleep(5)
start_router(tgen, "r2") start_router(tgen, "r2")
step( step(
@ -607,7 +607,8 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ebgp(request):
intf = topo["routers"]["r2"]["links"]["r3-link{}".format(intfr)]["interface"] intf = topo["routers"]["r2"]["links"]["r3-link{}".format(intfr)]["interface"]
shutdown_bringup_interface(tgen, dut, intf, False) shutdown_bringup_interface(tgen, dut, intf, False)
sleep(200) # sleep for twice the holddowntimer so that bgp deletes the neighbors.
sleep(8)
step("verify bgp convergence as all interface are shut") step("verify bgp convergence as all interface are shut")
@ -1046,7 +1047,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ebgp(request):
step("Reload the FRR router") step("Reload the FRR router")
# stop/start -> restart FRR router and verify # stop/start -> restart FRR router and verify
stop_router(tgen, "r2") stop_router(tgen, "r2")
sleep(5)
start_router(tgen, "r2") start_router(tgen, "r2")
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
@ -1511,7 +1512,7 @@ def test_static_route_8nh_diff_AD_ebgp_ecmp_p1_tc8_ebgp(request):
step("Reload the FRR router") step("Reload the FRR router")
# stop/start -> restart FRR router and verify # stop/start -> restart FRR router and verify
stop_router(tgen, "r2") stop_router(tgen, "r2")
sleep(5)
start_router(tgen, "r2") start_router(tgen, "r2")
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
@ -1950,7 +1951,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
step("Reload the FRR router") step("Reload the FRR router")
# stop/start -> restart FRR router and verify # stop/start -> restart FRR router and verify
stop_router(tgen, "r2") stop_router(tgen, "r2")
sleep(5)
start_router(tgen, "r2") start_router(tgen, "r2")
step("After reloading, verify that routes are still present in R2.") step("After reloading, verify that routes are still present in R2.")
@ -1981,7 +1982,8 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
"interface" "interface"
] ]
shutdown_bringup_interface(tgen, dut, intf, False) shutdown_bringup_interface(tgen, dut, intf, False)
sleep(180) # sleep for twice the holddowntimer so that bgp deletes the neighbors.
sleep(8)
step("verify bgp convergence as all interface are shut") step("verify bgp convergence as all interface are shut")
bgp_convergence = verify_bgp_convergence(tgen, topo) bgp_convergence = verify_bgp_convergence(tgen, topo)
@ -2032,7 +2034,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
assert result is not True, "Testcase {} : Failed \nError: Routes " assert result is not True, "Testcase {} : Failed \nError: Routes "
" are still present in RIB after BGP nbr is down".format(tc_name) " are still present in RIB after BGP nbr is down".format(tc_name)
sleep(5)
dut = "r2" dut = "r2"
for intfr in range(0, 8): for intfr in range(0, 8):
intf = topo["routers"]["r2"]["links"]["r3-link{}".format(intfr)][ intf = topo["routers"]["r2"]["links"]["r3-link{}".format(intfr)][
@ -2040,7 +2042,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ebgp(request):
] ]
shutdown_bringup_interface(tgen, dut, intf, True) shutdown_bringup_interface(tgen, dut, intf, True)
sleep(5)
dut = "r3" dut = "r3"
for intfr in range(0, 8): for intfr in range(0, 8):
intf = topo["routers"]["r3"]["links"]["r2-link{}".format(intfr)][ intf = topo["routers"]["r3"]["links"]["r2-link{}".format(intfr)][

View File

@ -36,7 +36,6 @@ import time
import os import os
import pytest import pytest
import ipaddr import ipaddr
from time import sleep
from copy import deepcopy from copy import deepcopy
import random import random
from re import search as re_search from re import search as re_search
@ -447,7 +446,6 @@ def test_staticroute_with_ecmp_p0_tc3_ebgp(request):
step("Reload the FRR router") step("Reload the FRR router")
# stop/start -> restart FRR router and verify # stop/start -> restart FRR router and verify
stop_router(tgen, "r2") stop_router(tgen, "r2")
sleep(5)
start_router(tgen, "r2") start_router(tgen, "r2")
result = verify_rib( result = verify_rib(
@ -801,7 +799,6 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ebgp(request):
step("Reload the FRR router") step("Reload the FRR router")
# stop/start -> restart FRR router and verify # stop/start -> restart FRR router and verify
stop_router(tgen, "r2") stop_router(tgen, "r2")
sleep(5)
start_router(tgen, "r2") start_router(tgen, "r2")
step( step(

View File

@ -36,7 +36,6 @@ import os
import pytest import pytest
import ipaddr import ipaddr
import ipaddress import ipaddress
from time import sleep
from copy import deepcopy from copy import deepcopy
# Save the Current Working Directory to find configuration files. # Save the Current Working Directory to find configuration files.

View File

@ -73,7 +73,10 @@
"neighbor": { "neighbor": {
"r3": { "r3": {
"dest_link": { "dest_link": {
"r2": {} "r2": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }
@ -84,7 +87,10 @@
"neighbor": { "neighbor": {
"r3": { "r3": {
"dest_link": { "dest_link": {
"r2": {} "r2": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }
@ -121,7 +127,10 @@
"neighbor": { "neighbor": {
"r2": { "r2": {
"dest_link": { "dest_link": {
"r3": {} "r3": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }
@ -132,7 +141,10 @@
"neighbor": { "neighbor": {
"r2": { "r2": {
"dest_link": { "dest_link": {
"r3": {} "r3": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }

View File

@ -140,15 +140,41 @@
"unicast": { "unicast": {
"neighbor": { "neighbor": {
"r3": { "r3": {
"dest_link": { "dest_link": {
"r2-link0": {}, "r2-link0": {
"r2-link1": {}, "keepalivetimer": 1,
"r2-link2": {}, "holddowntimer": 4
"r2-link3": {}, },
"r2-link4": {}, "r2-link1": {
"r2-link5": {}, "keepalivetimer": 1,
"r2-link6": {}, "holddowntimer": 4
"r2-link7": {} },
"r2-link2": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link3": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link4": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link5": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link6": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link7": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
}, },
@ -161,15 +187,41 @@
"unicast": { "unicast": {
"neighbor": { "neighbor": {
"r3": { "r3": {
"dest_link": { "dest_link": {
"r2-link0": {}, "r2-link0": {
"r2-link1": {}, "keepalivetimer": 1,
"r2-link2": {}, "holddowntimer": 4
"r2-link3": {}, },
"r2-link4": {}, "r2-link1": {
"r2-link5": {}, "keepalivetimer": 1,
"r2-link6": {}, "holddowntimer": 4
"r2-link7": {} },
"r2-link2": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link3": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link4": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link5": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link6": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r2-link7": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
}, },
@ -228,15 +280,41 @@
"unicast": { "unicast": {
"neighbor": { "neighbor": {
"r2": { "r2": {
"dest_link": { "dest_link": {
"r3-link0": {}, "r3-link0": {
"r3-link1": {}, "keepalivetimer": 1,
"r3-link2": {}, "holddowntimer": 4
"r3-link3": {}, },
"r3-link4": {}, "r3-link1": {
"r3-link5": {}, "keepalivetimer": 1,
"r3-link6": {}, "holddowntimer": 4
"r3-link7": {} },
"r3-link2": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link3": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link4": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link5": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link6": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link7": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }
@ -246,15 +324,41 @@
"unicast": { "unicast": {
"neighbor": { "neighbor": {
"r2": { "r2": {
"dest_link": { "dest_link": {
"r3-link0": {}, "r3-link0": {
"r3-link1": {}, "keepalivetimer": 1,
"r3-link2": {}, "holddowntimer": 4
"r3-link3": {}, },
"r3-link4": {}, "r3-link1": {
"r3-link5": {}, "keepalivetimer": 1,
"r3-link6": {}, "holddowntimer": 4
"r3-link7": {} },
"r3-link2": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link3": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link4": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link5": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link6": {
"keepalivetimer": 1,
"holddowntimer": 4
},
"r3-link7": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }

View File

@ -113,7 +113,10 @@
"neighbor": { "neighbor": {
"r3": { "r3": {
"dest_link": { "dest_link": {
"r2-link0": {} "r2-link0": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }
@ -124,7 +127,10 @@
"neighbor": { "neighbor": {
"r3": { "r3": {
"dest_link": { "dest_link": {
"r2-link0": {} "r2-link0": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }
@ -153,7 +159,10 @@
"neighbor": { "neighbor": {
"r2": { "r2": {
"dest_link": { "dest_link": {
"r3-link0": {} "r3-link0": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }
@ -164,7 +173,10 @@
"neighbor": { "neighbor": {
"r2": { "r2": {
"dest_link": { "dest_link": {
"r3-link0": {} "r3-link0": {
"keepalivetimer": 1,
"holddowntimer": 4
}
} }
} }
} }

View File

@ -35,7 +35,6 @@ import time
import os import os
import pytest import pytest
import ipaddr import ipaddr
from time import sleep
from copy import deepcopy from copy import deepcopy
# Save the Current Working Directory to find configuration files. # Save the Current Working Directory to find configuration files.
@ -532,7 +531,7 @@ def test_static_route_2nh_p0_tc_1_ibgp(request):
step("Reload the FRR router") step("Reload the FRR router")
# stop/start -> restart FRR router and verify # stop/start -> restart FRR router and verify
stop_router(tgen, "r2") stop_router(tgen, "r2")
sleep(5)
start_router(tgen, "r2") start_router(tgen, "r2")
dut = "r2" dut = "r2"
@ -989,7 +988,7 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request):
step("Reload the FRR router") step("Reload the FRR router")
# stop/start -> restart FRR router and verify # stop/start -> restart FRR router and verify
stop_router(tgen, "r2") stop_router(tgen, "r2")
sleep(5)
start_router(tgen, "r2") start_router(tgen, "r2")
step( step(
@ -1071,243 +1070,6 @@ def test_static_route_2nh_admin_dist_p0_tc_2_ibgp(request):
write_test_footer(tc_name) write_test_footer(tc_name)
"""
def test_same_rte_from_bgp_static_P0_tc5(request):
#Verify RIB status when same route advertise via BGP and static
#route
tc_name = request.node.name
write_test_header(tc_name)
tgen = get_topogen()
# Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
NEXT_HOP_IP = populate_nh()
step('Configure iBGP IPv4 peering between R2 and R3 router.')
reset_config_on_routers(tgen)
step(
'Configure IPv4 static route (10.1.1.1/24) in R2 with next hop'
'N1 (28.1.1.2 ) and N2 (29.1.1.2) , Static route next-hop present'
'on R1')
for addr_type in ADDR_TYPES:
input_dict_4 = {
"r2": {
"static_routes": [
{
"network": NETWORK[addr_type],
"next_hop": NEXT_HOP_IP['nh1'][addr_type]
},
{
"network": NETWORK[addr_type],
"next_hop": NEXT_HOP_IP['nh2'][addr_type]
}
]
}
}
logger.info("Configure static routes")
result = create_static_routes(tgen, input_dict_4)
assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result)
step('Configure redistribute static in BGP.')
for addr_type in ADDR_TYPES:
input_dict_2 = {
"r2": {
"bgp": {
"address_family": {
addr_type: {
"unicast": {
"redistribute": [{
"redist_type": "static"
}]
}
}
}
}
}
}
result = create_router_bgp(tgen, topo, input_dict_2)
assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result)
step("Verify on R3 , route receive on R3 BGP table ")
dut = 'r3'
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
assert result is True, "Testcase {} : Failed \nError: Route is"
" still present in RIB".format(tc_name)
step("Verify route installed in the RIB and FIB of R3")
protocol = 'bgp'
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol)
assert result is True, "Testcase {} : Failed \nError: Route is"
" still present in RIB".format(tc_name)
step(
'Configure 2 links/interfaces between R1 and R3 , keep one'
'interface in shut (active) state and other interface in no shut'
'(inactive) state')
dut = 'r3'
intf = topo['routers']['r3']['links']['r1-link0']['interface']
shutdown_bringup_interface(tgen, dut, intf, False)
step(
'Configure same static route (10.1.1.1/24) in R3 with inactive'
'nexthop interface')
step(
'Configure same static route 10.1.1.1/24) again in R3 with'
'active nexthop interface')
for addr_type in ADDR_TYPES:
input_dict_4 = {
"r3": {
"static_routes": [
{
"network": NETWORK[addr_type],
"next_hop": topo['routers']['r1']['links']['r3-link0'][
addr_type]
},
{
"network": NETWORK[addr_type],
"next_hop": topo['routers']['r1']['links']['r3-link1'][
addr_type]
}
]
}
}
logger.info("Configure static routes")
result = create_static_routes(tgen, input_dict_4)
assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result)
step(
"Verify when static route configure with inactive nexthop , "
"verify BGP received route is active in the RIB and FIB")
dut = 'r3'
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
assert result is True, "Testcase {} : Failed \nError: Route is"
" missing in BGP RIB".format(tc_name)
protocol = 'bgp'
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, fib=True)
assert result is True, "Testcase {} : Failed \nError: Route is"
" missing in RIB".format(tc_name)
step('Remove the redistribute static knob from R2 router')
for addr_type in ADDR_TYPES:
input_dict_2 = {
"r2": {
"bgp": {
"address_family": {
addr_type: {
"unicast": {
"redistribute": [{
"redist_type": "static",
"delete": True
}]
}
}
}
}
}
}
result = create_router_bgp(tgen, topo, input_dict_2)
assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result)
step(
"After removing /adding the redistribute static knob , "
"BGP received route is deleted and added in RIB of R3 ")
dut = 'r3'
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
assert result is not True, "Testcase {} : Failed \nError: Route is"
" still present in RIB".format(tc_name)
protocol = 'bgp'
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, fib=True)
assert result is not True, "Testcase {} : Failed \nError: Route is"
" still present in RIB".format(tc_name)
step('Configure the redistribute static knob again on R2 router')
for addr_type in ADDR_TYPES:
input_dict_2 = {
"r2": {
"bgp": {
"address_family": {
addr_type: {
"unicast": {
"redistribute": [{
"redist_type": "static",
}]
}
}
}
}
}
}
result = create_router_bgp(tgen, topo, input_dict_2)
assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result)
dut = 'r3'
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
assert result is True, "Testcase {} : Failed \nError: Route is"
" missing in BGP RIB".format(tc_name)
protocol = 'bgp'
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, fib=True)
assert result is True, "Testcase {} : Failed \nError: Route is"
" missing in RIB".format(tc_name)
step(
'Remove the static route on R3 configured with active'
'interface')
for addr_type in ADDR_TYPES:
input_dict_4 = {
"r3": {
"static_routes": [
{
"network": NETWORK[addr_type],
"next_hop": topo['routers']['r1']['links']['r3-link0'][
addr_type],
"delete": True
},
{
"network": NETWORK[addr_type],
"next_hop": topo['routers']['r1']['links']['r3-link1'][
addr_type],
"delete": True
}
]
}
}
logger.info("Configure static routes")
result = create_static_routes(tgen, input_dict_4)
assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result)
step(
"After removing the static route with active nexthop verify "
"BGP received route is became active in RIB and FIB")
dut = 'r3'
result = verify_bgp_rib(tgen, addr_type, dut, input_dict_4)
assert result is True, "Testcase {} : Failed \nError: Route is"
" missing in BGP RIB".format(tc_name)
protocol = 'bgp'
result = verify_rib(
tgen, addr_type, dut, input_dict_4, protocol=protocol, fib=True)
assert result is True, "Testcase {} : Failed \nError: Route is"
" missing in RIB".format(tc_name)
write_test_footer(tc_name)
"""
if __name__ == "__main__": if __name__ == "__main__":
args = ["-s"] + sys.argv[1:] args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args)) sys.exit(pytest.main(args))

View File

@ -473,7 +473,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(request):
intf = topo["routers"]["r2"]["links"]["r1-link{}".format(randnum)]["interface"] intf = topo["routers"]["r2"]["links"]["r1-link{}".format(randnum)]["interface"]
shutdown_bringup_interface(tgen, dut, intf, False) shutdown_bringup_interface(tgen, dut, intf, False)
sleep(5)
step("Random no shut of the nexthop interfaces") step("Random no shut of the nexthop interfaces")
# Bringup interface # Bringup interface
@ -566,7 +566,7 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(request):
step("Reload the FRR router") step("Reload the FRR router")
# stop/start -> restart FRR router and verify # stop/start -> restart FRR router and verify
stop_router(tgen, "r2") stop_router(tgen, "r2")
sleep(5)
start_router(tgen, "r2") start_router(tgen, "r2")
step( step(
@ -609,7 +609,8 @@ def test_static_rte_with_8ecmp_nh_p1_tc9_ibgp(request):
intf = topo["routers"]["r2"]["links"]["r3-link{}".format(intfr)]["interface"] intf = topo["routers"]["r2"]["links"]["r3-link{}".format(intfr)]["interface"]
shutdown_bringup_interface(tgen, dut, intf, False) shutdown_bringup_interface(tgen, dut, intf, False)
sleep(200) # sleep for twice the holddowntimer so that bgp deletes the neighbors.
sleep(8)
step("verify bgp convergence as all interface are shut") step("verify bgp convergence as all interface are shut")
@ -1062,7 +1063,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc6_ibgp(request):
step("Reload the FRR router") step("Reload the FRR router")
# stop/start -> restart FRR router and verify # stop/start -> restart FRR router and verify
stop_router(tgen, "r2") stop_router(tgen, "r2")
sleep(5)
start_router(tgen, "r2") start_router(tgen, "r2")
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
@ -1530,7 +1531,7 @@ def test_static_route_8nh_diff_AD_ibgp_ecmp_p1_tc7_ibgp(request):
step("Reload the FRR router") step("Reload the FRR router")
# stop/start -> restart FRR router and verify # stop/start -> restart FRR router and verify
stop_router(tgen, "r2") stop_router(tgen, "r2")
sleep(5)
start_router(tgen, "r2") start_router(tgen, "r2")
for addr_type in ADDR_TYPES: for addr_type in ADDR_TYPES:
@ -1969,7 +1970,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request):
step("Reload the FRR router") step("Reload the FRR router")
# stop/start -> restart FRR router and verify # stop/start -> restart FRR router and verify
stop_router(tgen, "r2") stop_router(tgen, "r2")
sleep(5)
start_router(tgen, "r2") start_router(tgen, "r2")
step("After reloading, verify that routes are still present in R2.") step("After reloading, verify that routes are still present in R2.")
@ -2000,7 +2001,8 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request):
"interface" "interface"
] ]
shutdown_bringup_interface(tgen, dut, intf, False) shutdown_bringup_interface(tgen, dut, intf, False)
sleep(180) # sleep for twice the holddowntimer so that bgp deletes the neighbors.
sleep(8)
step("verify bgp convergence as all interface are shut") step("verify bgp convergence as all interface are shut")
bgp_convergence = verify_bgp_convergence(tgen, topo) bgp_convergence = verify_bgp_convergence(tgen, topo)
@ -2051,7 +2053,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request):
assert result is not True, "Testcase {} : Failed \nError: Routes " assert result is not True, "Testcase {} : Failed \nError: Routes "
" are still present in RIB after BGP nbr is down".format(tc_name) " are still present in RIB after BGP nbr is down".format(tc_name)
sleep(5)
dut = "r2" dut = "r2"
for intfr in range(0, 8): for intfr in range(0, 8):
intf = topo["routers"]["r2"]["links"]["r3-link{}".format(intfr)][ intf = topo["routers"]["r2"]["links"]["r3-link{}".format(intfr)][
@ -2059,7 +2061,7 @@ def test_static_route_8nh_diff_AD_bgp_ecmp_p1_tc10_ibgp(request):
] ]
shutdown_bringup_interface(tgen, dut, intf, True) shutdown_bringup_interface(tgen, dut, intf, True)
sleep(5)
dut = "r3" dut = "r3"
for intfr in range(0, 8): for intfr in range(0, 8):
intf = topo["routers"]["r3"]["links"]["r2-link{}".format(intfr)][ intf = topo["routers"]["r3"]["links"]["r2-link{}".format(intfr)][

View File

@ -36,7 +36,6 @@ import time
import os import os
import pytest import pytest
import ipaddr import ipaddr
from time import sleep
from copy import deepcopy from copy import deepcopy
import random import random
from re import search as re_search from re import search as re_search
@ -447,7 +446,7 @@ def test_staticroute_with_ecmp_p0_tc3_ibgp(request):
step("Reload the FRR router") step("Reload the FRR router")
# stop/start -> restart FRR router and verify # stop/start -> restart FRR router and verify
stop_router(tgen, "r2") stop_router(tgen, "r2")
sleep(5)
start_router(tgen, "r2") start_router(tgen, "r2")
result = verify_rib( result = verify_rib(
@ -801,7 +800,7 @@ def test_staticroute_with_ecmp_with_diff_AD_p0_tc4_ibgp(request):
step("Reload the FRR router") step("Reload the FRR router")
# stop/start -> restart FRR router and verify # stop/start -> restart FRR router and verify
stop_router(tgen, "r2") stop_router(tgen, "r2")
sleep(5)
start_router(tgen, "r2") start_router(tgen, "r2")
step( step(

View File

@ -26,7 +26,6 @@ Following tests are covered in the script.
- Verify static route are blocked from route-map and prefix-list - Verify static route are blocked from route-map and prefix-list
applied in BGP nbrs applied in BGP nbrs
- Verify Static route when FRR connected to 2 TOR
""" """
import sys import sys
@ -36,7 +35,6 @@ import os
import pytest import pytest
import ipaddr import ipaddr
import ipaddress import ipaddress
from time import sleep
from copy import deepcopy from copy import deepcopy
# Save the Current Working Directory to find configuration files. # Save the Current Working Directory to find configuration files.
@ -47,14 +45,12 @@ sys.path.append(os.path.join(CWD, "../lib/"))
# Import topogen and topotest helpers # Import topogen and topotest helpers
from mininet.topo import Topo from mininet.topo import Topo
from lib.topogen import Topogen, get_topogen from lib.topogen import Topogen, get_topogen
from time import sleep
from lib.common_config import ( from lib.common_config import (
start_topology, start_topology,
write_test_header, write_test_header,
write_test_footer, write_test_footer,
reset_config_on_routers, reset_config_on_routers,
verify_kernel_ping,
verify_rib, verify_rib,
create_static_routes, create_static_routes,
check_address_types, check_address_types,
@ -987,227 +983,6 @@ def test_static_routes_rmap_pfxlist_p0_tc7_ibgp(request):
write_test_footer(tc_name) write_test_footer(tc_name)
def test_static_routes_tor_p0_tc5_ibgp(request):
"""Verify Static route when FRR connected to 2 TOR."""
tc_name = request.node.name
write_test_header(tc_name)
tgen = get_topogen()
# Don't run this test if we have any failure.
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
step("Configure link between FRR to FRR1 & FRR2 as shown in the topology.")
step("Attach 2 VMs (vm1 & vm2) to FRR, vm3 to FRR1 ,vm4 to FRR2.")
step("Configure Ipv4 and ipv6 addresses on all the interfaces.")
reset_config_on_routers(tgen)
def_nw = {"ipv4": "0.0.0.0/0", "ipv6": "0::0/0"}
step(
"Configure the static route (ipv4 & ipv6) on FRR to vm3 and vm4 "
"with next hop as FRR1 and FRR2 respectively."
)
for addr_type in ADDR_TYPES:
# Enable static routes
for vm in ["vm1", "vm2", "vm3", "vm6"]:
input_dict_4 = {
vm: {
"static_routes": [
{
"network": def_nw[addr_type],
"next_hop": topo["routers"]["r2"]["links"][vm][
addr_type
].split("/")[0],
}
]
}
}
logger.info("Configure static routes")
result = create_static_routes(tgen, input_dict_4)
assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result
)
input_dict_4 = {
"vm4": {
"static_routes": [
{
"network": def_nw[addr_type],
"next_hop": topo["routers"]["r1"]["links"]["vm4"][
addr_type
].split("/")[0],
}
]
}
}
logger.info("Configure static routes")
result = create_static_routes(tgen, input_dict_4)
assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result
)
input_dict_4 = {
"vm5": {
"static_routes": [
{
"network": def_nw[addr_type],
"next_hop": topo["routers"]["r3"]["links"]["vm5"][
addr_type
].split("/")[0],
}
]
}
}
logger.info("Configure static routes")
result = create_static_routes(tgen, input_dict_4)
assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result
)
input_dict_4 = {
"r1": {
"static_routes": [
{
"network": topo["routers"]["vm1"]["links"]["r2"][
addr_type
].split("/")[0]
+ "/16",
"next_hop": topo["routers"]["r2"]["links"]["r1-link0"][
addr_type
].split("/")[0],
},
{
"network": topo["routers"]["vm2"]["links"]["r2"][
addr_type
].split("/")[0]
+ "/16",
"next_hop": topo["routers"]["r2"]["links"]["r1-link0"][
addr_type
].split("/")[0],
},
]
}
}
logger.info("Configure static routes")
result = create_static_routes(tgen, input_dict_4)
assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result
)
# Enable static routes
input_dict_4 = {
"r3": {
"static_routes": [
{
"network": topo["routers"]["vm3"]["links"]["r2"][
addr_type
].split("/")[0]
+ "/16",
"next_hop": topo["routers"]["r2"]["links"]["r3-link0"][
addr_type
].split("/")[0],
},
{
"network": topo["routers"]["vm6"]["links"]["r2"][
addr_type
].split("/")[0]
+ "/16",
"next_hop": topo["routers"]["r2"]["links"]["r3-link0"][
addr_type
].split("/")[0],
},
]
}
}
logger.info("Configure static routes")
result = create_static_routes(tgen, input_dict_4)
assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result
)
# Enable static routes
input_dict_4 = {
"r2": {
"static_routes": [
{
"network": topo["routers"]["vm4"]["links"]["r1"][
addr_type
].split("/")[0]
+ "/16",
"next_hop": topo["routers"]["r1"]["links"]["r2-link0"][
addr_type
].split("/")[0],
},
{
"network": topo["routers"]["vm5"]["links"]["r3"][
addr_type
].split("/")[0]
+ "/16",
"next_hop": topo["routers"]["r3"]["links"]["r2-link0"][
addr_type
].split("/")[0],
},
{
"network": topo["routers"]["vm4"]["links"]["r1"][addr_type],
"next_hop": topo["routers"]["r1"]["links"]["r2-link0"][
addr_type
].split("/")[0],
},
{
"network": topo["routers"]["vm5"]["links"]["r3"][addr_type],
"next_hop": topo["routers"]["r3"]["links"]["r2-link0"][
addr_type
].split("/")[0],
},
{
"network": topo["routers"]["r1"]["links"]["vm4"][addr_type],
"next_hop": topo["routers"]["r1"]["links"]["r2-link0"][
addr_type
].split("/")[0],
},
{
"network": topo["routers"]["r3"]["links"]["vm5"][addr_type],
"next_hop": topo["routers"]["r3"]["links"]["r2-link0"][
addr_type
].split("/")[0],
},
]
}
}
logger.info("Configure static routes")
result = create_static_routes(tgen, input_dict_4)
assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result
)
sleep(10)
step(
"Ping from all the vms for both ipv4 and ipv6 address. "
"All the ping should pass."
)
step("ping from vm4 to vm1 vm2")
vm4tovm1 = topo["routers"]["vm1"]["links"]["r2"][addr_type].split("/")[0]
result = verify_kernel_ping(tgen, "vm4", vm4tovm1, count=1, addrtype=addr_type)
assert result is True, "Testcase {}:Failed \n Error: {}".format(tc_name, result)
vm4tovm2 = topo["routers"]["vm2"]["links"]["r2"][addr_type].split("/")[0]
result = verify_kernel_ping(tgen, "vm4", vm4tovm2, count=1, addrtype=addr_type)
assert result is True, "Testcase {}:Failed \n Error: {}".format(tc_name, result)
step("ping from vm5 to vm3 vm6")
vm5tovm3 = topo["routers"]["vm3"]["links"]["r2"][addr_type].split("/")[0]
result = verify_kernel_ping(tgen, "vm5", vm5tovm3, count=1, addrtype=addr_type)
assert result is True, "Testcase {}:Failed \n Error: {}".format(tc_name, result)
vm5tovm6 = topo["routers"]["vm6"]["links"]["r2"][addr_type].split("/")[0]
result = verify_kernel_ping(tgen, "vm5", vm5tovm6, count=1, addrtype=addr_type)
assert result is True, "Testcase {}:Failed \n Error: {}".format(tc_name, result)
write_test_footer(tc_name)
if __name__ == "__main__": if __name__ == "__main__":
args = ["-s"] + sys.argv[1:] args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args)) sys.exit(pytest.main(args))