mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-06 18:04:03 +00:00
tests: improve bgp test determinism by resetting configs
Signed-off-by: Christian Hopps <chopps@labn.net>
This commit is contained in:
parent
d448e2c5f9
commit
b86955a635
@ -208,6 +208,9 @@ def test_modify_and_delete_router_id(request):
|
|||||||
tc_name = request.node.name
|
tc_name = request.node.name
|
||||||
write_test_header(tc_name)
|
write_test_header(tc_name)
|
||||||
|
|
||||||
|
# Creating configuration from JSON
|
||||||
|
reset_config_on_routers(tgen)
|
||||||
|
|
||||||
# Modify router id
|
# Modify router id
|
||||||
input_dict = {
|
input_dict = {
|
||||||
"r1": {"bgp": {"router_id": "12.12.12.12"}},
|
"r1": {"bgp": {"router_id": "12.12.12.12"}},
|
||||||
@ -252,6 +255,9 @@ def test_bgp_config_with_4byte_as_number(request):
|
|||||||
tc_name = request.node.name
|
tc_name = request.node.name
|
||||||
write_test_header(tc_name)
|
write_test_header(tc_name)
|
||||||
|
|
||||||
|
# Creating configuration from JSON
|
||||||
|
reset_config_on_routers(tgen)
|
||||||
|
|
||||||
input_dict = {
|
input_dict = {
|
||||||
"r1": {"bgp": {"local_as": 131079}},
|
"r1": {"bgp": {"local_as": 131079}},
|
||||||
"r2": {"bgp": {"local_as": 131079}},
|
"r2": {"bgp": {"local_as": 131079}},
|
||||||
@ -283,6 +289,9 @@ def test_BGP_config_with_invalid_ASN_p2(request):
|
|||||||
tc_name = request.node.name
|
tc_name = request.node.name
|
||||||
write_test_header(tc_name)
|
write_test_header(tc_name)
|
||||||
|
|
||||||
|
# Creating configuration from JSON
|
||||||
|
reset_config_on_routers(tgen)
|
||||||
|
|
||||||
# Api call to modify AS number
|
# Api call to modify AS number
|
||||||
input_dict = {
|
input_dict = {
|
||||||
"r1": {
|
"r1": {
|
||||||
@ -307,11 +316,18 @@ def test_BGP_config_with_invalid_ASN_p2(request):
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
result = modify_as_number(tgen, topo, input_dict)
|
result = modify_as_number(tgen, topo, input_dict)
|
||||||
try:
|
assert result is not True, (
|
||||||
assert result is True
|
"Expected BGP config is not created because of invalid ASNs: {}".format(
|
||||||
except AssertionError:
|
result
|
||||||
logger.info("Expected behaviour: {}".format(result))
|
)
|
||||||
logger.info("BGP config is not created because of invalid ASNs")
|
)
|
||||||
|
|
||||||
|
# Creating configuration from JSON
|
||||||
|
reset_config_on_routers(tgen)
|
||||||
|
|
||||||
|
result = verify_bgp_convergence(tgen, topo)
|
||||||
|
if result != True:
|
||||||
|
assert False, "Testcase " + tc_name + " :Failed \n Error: {}".format(result)
|
||||||
|
|
||||||
write_test_footer(tc_name)
|
write_test_footer(tc_name)
|
||||||
|
|
||||||
@ -331,6 +347,13 @@ def test_BGP_config_with_2byteAS_and_4byteAS_number_p1(request):
|
|||||||
tc_name = request.node.name
|
tc_name = request.node.name
|
||||||
write_test_header(tc_name)
|
write_test_header(tc_name)
|
||||||
|
|
||||||
|
# Creating configuration from JSON
|
||||||
|
reset_config_on_routers(tgen)
|
||||||
|
|
||||||
|
result = verify_bgp_convergence(tgen, topo)
|
||||||
|
if result != True:
|
||||||
|
assert False, "Testcase " + tc_name + " :Failed \n Error: {}".format(result)
|
||||||
|
|
||||||
# Api call to modify AS number
|
# Api call to modify AS number
|
||||||
input_dict = {
|
input_dict = {
|
||||||
"r1": {"bgp": {"local_as": 131079}},
|
"r1": {"bgp": {"local_as": 131079}},
|
||||||
@ -586,7 +609,8 @@ def test_BGP_attributes_with_vrf_default_keyword_p0(request):
|
|||||||
if tgen.routers_have_failure():
|
if tgen.routers_have_failure():
|
||||||
pytest.skip(tgen.errors)
|
pytest.skip(tgen.errors)
|
||||||
|
|
||||||
# reset_config_on_routers(tgen)
|
# Creating configuration from JSON
|
||||||
|
reset_config_on_routers(tgen)
|
||||||
|
|
||||||
step("Configure static routes and redistribute in BGP on R3")
|
step("Configure static routes and redistribute in BGP on R3")
|
||||||
for addr_type in ADDR_TYPES:
|
for addr_type in ADDR_TYPES:
|
||||||
|
Loading…
Reference in New Issue
Block a user