tests: use new def for redistribution in ospf

Signed-off-by: ckishimo <carles.kishimoto@gmail.com>
This commit is contained in:
ckishimo 2021-01-08 10:34:50 +01:00
parent 881fa68f05
commit c6b59ef48c
5 changed files with 17 additions and 63 deletions

View File

@ -277,7 +277,7 @@ def test_ospf_ecmp_tc16_p0(request):
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
dut = "r0" dut = "r0"
red_static(dut) redistribute(dut, "static")
step("Verify that route in R2 in stalled with 8 next hops.") step("Verify that route in R2 in stalled with 8 next hops.")
nh = [] nh = []
@ -358,7 +358,7 @@ def test_ospf_ecmp_tc16_p0(request):
step(" Un configure static route on R0") step(" Un configure static route on R0")
dut = "r0" dut = "r0"
red_static(dut, config=False) redistribute(dut, "static", delete=True)
# Wait for R0 to flush external LSAs. # Wait for R0 to flush external LSAs.
sleep(10) sleep(10)
@ -389,7 +389,7 @@ def test_ospf_ecmp_tc16_p0(request):
step("Re configure the static route in R0.") step("Re configure the static route in R0.")
dut = "r0" dut = "r0"
red_static(dut) redistribute(dut, "static")
dut = "r1" dut = "r1"
result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh) result = verify_ospf_rib(tgen, dut, input_dict, next_hop=nh)
@ -444,7 +444,7 @@ def test_ospf_ecmp_tc17_p0(request):
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
dut = "r0" dut = "r0"
red_static(dut) redistribute(dut, "static")
step("Verify that route in R2 in stalled with 2 next hops.") step("Verify that route in R2 in stalled with 2 next hops.")
@ -463,7 +463,7 @@ def test_ospf_ecmp_tc17_p0(request):
step(" Un configure static route on R0") step(" Un configure static route on R0")
dut = "r0" dut = "r0"
red_static(dut, config=False) redistribute(dut, "static", delete=True)
# sleep till the route gets withdrawn # sleep till the route gets withdrawn
sleep(10) sleep(10)
@ -493,7 +493,7 @@ def test_ospf_ecmp_tc17_p0(request):
step("Reconfigure the static route in R0.Change ECMP value to 2.") step("Reconfigure the static route in R0.Change ECMP value to 2.")
dut = "r0" dut = "r0"
red_static(dut) redistribute(dut, "static")
step("Configure cost on R0 as 100") step("Configure cost on R0 as 100")
r0_ospf_cost = {"r0": {"links": {"r1": {"ospf": {"cost": 100}}}}} r0_ospf_cost = {"r0": {"links": {"r1": {"ospf": {"cost": 100}}}}}

View File

@ -288,7 +288,7 @@ def test_ospf_lan_ecmp_tc18_p0(request):
) )
dut = rtr dut = rtr
red_static(dut) redistribute(dut, "static")
step( step(
"Verify that route in R0 in stalled with 8 hops. " "Verify that route in R0 in stalled with 8 hops. "

View File

@ -281,7 +281,7 @@ def test_ospf_learning_tc15_p0(request):
step("Redistribute static route in R2 ospf.") step("Redistribute static route in R2 ospf.")
dut = "r2" dut = "r2"
red_static(dut) redistribute(dut, "static")
step("Verify that Type 5 LSA is originated by R2.") step("Verify that Type 5 LSA is originated by R2.")
dut = "r0" dut = "r0"

View File

@ -239,9 +239,7 @@ def test_ospf_routemaps_functionality_tc19_p0(request):
result = create_static_routes(tgen, input_dict) result = create_static_routes(tgen, input_dict)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
ospf_red_r1 = {"r0": {"ospf": {"redistribute": [{"redist_type": "static"}]}}} redistribute("r0", "static")
result = create_router_ospf(tgen, topo, ospf_red_r1)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
dut = "r1" dut = "r1"
lsid = NETWORK["ipv4"][0].split("/")[0] lsid = NETWORK["ipv4"][0].split("/")[0]
@ -253,13 +251,7 @@ def test_ospf_routemaps_functionality_tc19_p0(request):
result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol) result = verify_rib(tgen, "ipv4", dut, input_dict, protocol=protocol)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
ospf_red_r1 = { redistribute("r0", "static", delete=True)
"r0": {
"ospf": {"redistribute": [{"redist_type": "static", "del_action": True}]}
}
}
result = create_router_ospf(tgen, topo, ospf_red_r1)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
step( step(
"Create prefix-list in R0 to permit 10.0.20.1/32 prefix &" " deny 10.0.20.2/32" "Create prefix-list in R0 to permit 10.0.20.1/32 prefix &" " deny 10.0.20.2/32"
@ -306,15 +298,7 @@ def test_ospf_routemaps_functionality_tc19_p0(request):
" ospf using route map rmap1" " ospf using route map rmap1"
) )
ospf_red_r1 = { redistribute("r0", "static", route_map="rmap_ipv4")
"r0": {
"ospf": {
"redistribute": [{"redist_type": "static", "route_map": "rmap_ipv4"}]
}
}
}
result = create_router_ospf(tgen, topo, ospf_red_r1)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
step("Change prefix rules to permit 10.0.20.2 and deny 10.0.20.1") step("Change prefix rules to permit 10.0.20.2 and deny 10.0.20.1")
# Create ip prefix list # Create ip prefix list
@ -508,15 +492,7 @@ def test_ospf_routemaps_functionality_tc20_p0(request):
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("Redistribute to ospf using route map ( non existent route map)") step("Redistribute to ospf using route map ( non existent route map)")
ospf_red_r1 = { redistribute("r0", "static", route_map="rmap_ipv4")
"r0": {
"ospf": {
"redistribute": [{"redist_type": "static", "route_map": "rmap_ipv4"}]
}
}
}
result = create_router_ospf(tgen, topo, ospf_red_r1)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
step( step(
"Verify that routes are not allowed in OSPF even tough no " "Verify that routes are not allowed in OSPF even tough no "
@ -646,15 +622,7 @@ def test_ospf_routemaps_functionality_tc21_p0(request):
result = create_static_routes(tgen, input_dict) result = create_static_routes(tgen, input_dict)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
ospf_red_r0 = { redistribute("r0", "static", route_map="rmap_ipv4")
"r0": {
"ospf": {
"redistribute": [{"redist_type": "static", "route_map": "rmap_ipv4"}]
}
}
}
result = create_router_ospf(tgen, topo, ospf_red_r0)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
# Create route map # Create route map
routemaps = { routemaps = {
@ -890,15 +858,7 @@ def test_ospf_routemaps_functionality_tc24_p0(request):
result = create_static_routes(tgen, input_dict) result = create_static_routes(tgen, input_dict)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result) assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
ospf_red_r0 = { redistribute("r0", "static", route_map="rmap_ipv4")
"r0": {
"ospf": {
"redistribute": [{"redist_type": "static", "route_map": "rmap_ipv4"}]
}
}
}
result = create_router_ospf(tgen, topo, ospf_red_r0)
assert result is True, "Testcase {} : Failed \n Error: {}".format(tc_name, result)
# Create ip prefix list # Create ip prefix list
pfx_list = { pfx_list = {

View File

@ -499,8 +499,8 @@ def test_ospf_redistribution_tc8_p1(request):
"advertised/exchaged via ospf" "advertised/exchaged via ospf"
) )
for rtr in topo["routers"]: for rtr in topo["routers"]:
red_static(rtr) redistribute(rtr, "static")
red_connected(rtr) redistribute(rtr, "connected")
for node in topo["routers"]: for node in topo["routers"]:
input_dict = { input_dict = {
"r0": { "r0": {
@ -557,13 +557,7 @@ def test_ospf_redistribution_tc8_p1(request):
) )
for rtr in topo["routers"]: for rtr in topo["routers"]:
ospf_red = { redistribute(rtr, "static", delete=True)
rtr: {"ospf": {"redistribute": [{"redist_type": "static", "delete": True}]}}
}
result = create_router_ospf(tgen, topo, ospf_red)
assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result
)
input_dict = { input_dict = {
"r0": { "r0": {