Merge pull request #8923 from kuldeepkash/bgp_convergence_test

tests: Fix generate support bundle issue for test_route_map_topo1
This commit is contained in:
Donald Sharp 2021-06-25 08:18:32 -04:00 committed by GitHub
commit b4835c13b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,6 +20,53 @@
# OF THIS SOFTWARE. # OF THIS SOFTWARE.
# #
import sys
import json
import time
import pytest
import inspect
import os
from time import sleep
# Save the Current Working Directory to find configuration files.
CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CWD, "../"))
# pylint: disable=C0413
# Import topogen and topotest helpers
from lib import topotest
from lib.topogen import Topogen, get_topogen
from mininet.topo import Topo
# Required to instantiate the topology builder class.
from lib.topojson import *
from lib.common_config import (
start_topology,
write_test_header,
write_test_footer,
verify_bgp_community,
verify_rib,
delete_route_maps,
create_bgp_community_lists,
interface_status,
create_route_maps,
create_static_routes,
create_prefix_lists,
verify_route_maps,
check_address_types,
shutdown_bringup_interface,
verify_prefix_lists,
reset_config_on_routers,
)
from lib.topolog import logger
from lib.bgp import (
verify_bgp_convergence,
create_router_bgp,
clear_bgp_and_verify,
verify_bgp_attributes,
)
from lib.topojson import build_topo_from_json, build_config_from_json
################################# #################################
# TOPOLOGY # TOPOLOGY
################################# #################################
@ -61,53 +108,6 @@ TC_38:
clauses and without any set statement.(Match only) clauses and without any set statement.(Match only)
""" """
import sys
import json
import time
import pytest
import inspect
import os
from time import sleep
# Save the Current Working Directory to find configuration files.
CWD = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(CWD, "../"))
# pylint: disable=C0413
# Import topogen and topotest helpers
from lib import topotest
from lib.topogen import Topogen, get_topogen
from mininet.topo import Topo
# Required to instantiate the topology builder class.
from lib.topojson import *
from lib.common_config import (
start_topology,
write_test_header,
write_test_footer,
verify_bgp_community,
verify_rib,
delete_route_maps,
create_bgp_community_lists,
interface_status,
create_route_maps,
create_prefix_lists,
verify_route_maps,
check_address_types,
shutdown_bringup_interface,
verify_prefix_lists,
reset_config_on_routers,
)
from lib.topolog import logger
from lib.bgp import (
verify_bgp_convergence,
create_router_bgp,
clear_bgp_and_verify,
verify_bgp_attributes,
)
from lib.topojson import build_topo_from_json, build_config_from_json
# Global variables # Global variables
bgp_convergence = False bgp_convergence = False
BGP_CONVERGENCE = False BGP_CONVERGENCE = False
@ -475,8 +475,8 @@ def test_route_map_inbound_outbound_same_neighbor_p0(request):
result = verify_rib( result = verify_rib(
tgen, adt, dut, input_dict_2, protocol=protocol, expected=False tgen, adt, dut, input_dict_2, protocol=protocol, expected=False
) )
assert result is not True, "Testcase {} : Failed \n" assert result is not True, ("Testcase {} : Failed \n"
"routes are not present in rib \n Error: {}".format(tc_name, result) "routes are not present in rib \n Error: {}".format(tc_name, result))
logger.info("Expected behaviour: {}".format(result)) logger.info("Expected behaviour: {}".format(result))
# Verifying RIB routes # Verifying RIB routes
@ -495,8 +495,8 @@ def test_route_map_inbound_outbound_same_neighbor_p0(request):
result = verify_rib( result = verify_rib(
tgen, adt, dut, input_dict, protocol=protocol, expected=False tgen, adt, dut, input_dict, protocol=protocol, expected=False
) )
assert result is not True, "Testcase {} : Failed \n " assert result is not True, ("Testcase {} : Failed \n "
"routes are not present in rib \n Error: {}".format(tc_name, result) "routes are not present in rib \n Error: {}".format(tc_name, result))
logger.info("Expected behaviour: {}".format(result)) logger.info("Expected behaviour: {}".format(result))
write_test_footer(tc_name) write_test_footer(tc_name)
@ -687,14 +687,17 @@ def test_route_map_with_action_values_combination_of_prefix_action_p0(
} }
# tgen.mininet_cli() # tgen.mininet_cli()
result = verify_rib(
tgen, adt, dut, input_dict_2, protocol=protocol, expected=False
)
if "deny" in [prefix_action, rmap_action]: if "deny" in [prefix_action, rmap_action]:
assert result is not True, "Testcase {} : Failed \n " result = verify_rib(
"Routes are still present \n Error: {}".format(tc_name, result) tgen, adt, dut, input_dict_2, protocol=protocol, expected=False
)
assert result is not True, ("Testcase {} : Failed \n "
"Routes are still present \n Error: {}".format(tc_name, result))
logger.info("Expected behaviour: {}".format(result)) logger.info("Expected behaviour: {}".format(result))
else: else:
result = verify_rib(
tgen, adt, dut, input_dict_2, protocol=protocol
)
assert result is True, "Testcase {} : Failed \n Error: {}".format( assert result is True, "Testcase {} : Failed \n Error: {}".format(
tc_name, result tc_name, result
) )