diff --git a/tests/bgp/route_checker.py b/tests/bgp/route_checker.py index d04b6f05d..b4f73a5bb 100644 --- a/tests/bgp/route_checker.py +++ b/tests/bgp/route_checker.py @@ -64,6 +64,7 @@ def parse_routes_on_eos(dut_host, neigh_hosts, ip_ver, exp_community=[]): mg_facts = dut_host.minigraph_facts( host=dut_host.hostname)['ansible_facts'] asn = mg_facts['minigraph_bgp_asn'] + confed_asn = dut_host.get_bgp_confed_asn() all_routes = {} BGP_ENTRY_HEADING = r"BGP routing table entry for " BGP_COMMUNITY_HEADING = r"Community: " @@ -83,7 +84,15 @@ def parse_routes_process(node=None, results=None, my_community=exp_community): # get hostname('ARISTA11T0') by VM name('VM0122') hostname = host_name_map[node['host'].hostname] host = node['host'] - peer_ips = node['conf']['bgp']['peers'][asn] + peer_in_bgp_confed = node['conf']['bgp'].get('peer_in_bgp_confed', False) + try: + peer_ips = node['conf']['bgp']['peers'][asn] + except KeyError as e: + if peer_in_bgp_confed: + peer_ips = node['conf']['bgp']['peers'][int(confed_asn)] + else: + raise e + for ip in peer_ips: if ipaddress.IPNetwork(ip).version == 4: peer_ip_v4 = ip diff --git a/tests/bgp/test_traffic_shift.py b/tests/bgp/test_traffic_shift.py index 3cbc164fe..143d019e6 100644 --- a/tests/bgp/test_traffic_shift.py +++ b/tests/bgp/test_traffic_shift.py @@ -16,7 +16,7 @@ from tests.bgp.constants import TS_NORMAL, TS_MAINTENANCE, TS_NO_NEIGHBORS pytestmark = [ - pytest.mark.topology('t1') + pytest.mark.topology('t1', 'lt2', 'ft2') ] logger = logging.getLogger(__name__) @@ -291,6 +291,9 @@ def test_load_minigraph_with_traffic_shift_away(duthosts, enum_rand_one_per_hwsk Verify all routes are announced to bgp monitor, and only loopback routes are announced to neighs """ duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname] + if tbinfo['topo']['type'] in ['lt2', 'ft2'] and duthost.get_bgp_confed_asn(): + pytest.skip("Skip test on LT2/FT2 as BGP confederation configuration can only be loaded from golden config") + # Initially make sure both supervisor and line cards are in BGP operational normal state if tbinfo['topo']['type'] == 't2': initial_tsa_check_before_and_after_test(duthosts)