diff --git a/tests/common/devices/multi_asic.py b/tests/common/devices/multi_asic.py index 9d0a3e3720..94ee2b4146 100644 --- a/tests/common/devices/multi_asic.py +++ b/tests/common/devices/multi_asic.py @@ -655,6 +655,29 @@ def get_internal_bgp_peers(self): ) return bgp_internal_neighbors + def get_voq_inband_interfaces(self): + """ + This Function is only applicable on VOQ Chassis. + Get VOQ Internal Inband Interfaces. API iterates through frontend ASIC + index to get the VOQ Inband Interfaces from running configuration. + Not using BGP_VOQ_CHASSIS_NEIGHBOUR peer ips since they are not referenced in + next hops of route. + Returns: + List of [voq_inband_interfaces] + """ + if not self.sonichost.is_multi_asic: + return {} + voq_inband_interfaces = {} + for asic in self.frontend_asics: + config_facts = self.config_facts( + host=self.hostname, source="running", + namespace=asic.namespace + )['ansible_facts'] + voq_inband_interfaces.update( + config_facts.get("VOQ_INBAND_INTERFACE", {}) + ) + return voq_inband_interfaces.keys() + def docker_cmds_on_all_asics(self, cmd, container_name): """This function iterate for ALL asics and execute cmds""" duthost = self.sonichost diff --git a/tests/route/test_route_flap.py b/tests/route/test_route_flap.py index 4b467f8869..0bacae7065 100644 --- a/tests/route/test_route_flap.py +++ b/tests/route/test_route_flap.py @@ -200,6 +200,8 @@ def is_dualtor(tbinfo): def get_dev_port_and_route(duthost, asichost, dst_prefix_set): # Get internal bgp ips for later filtering internal_bgp_ips = duthost.get_internal_bgp_peers().keys() + # Get voq inband interface for later filtering + voq_inband_interfaces = duthost.get_voq_inband_interfaces() dev_port = None route_to_ping = None for dst_prefix in dst_prefix_set: @@ -219,17 +221,23 @@ def get_dev_port_and_route(duthost, asichost, dst_prefix_set): continue if per_hop['ip'] in internal_bgp_ips: continue + if per_hop['interfaceName'] in voq_inband_interfaces: + continue if 'IB' in per_hop['interfaceName'] or 'BP' in per_hop['interfaceName']: continue dev_port = per_hop['interfaceName'] + break else: dev = json.loads(asichost.run_vtysh(cmd)['stdout']) for per_hop in dev[route_to_ping][0]['nexthops']: if 'interfaceName' not in per_hop.keys(): continue + if per_hop['interfaceName'] in voq_inband_interfaces: + continue if 'IB' in per_hop['interfaceName'] or 'BP' in per_hop['interfaceName']: continue dev_port = per_hop['interfaceName'] + break pytest_assert(dev_port, "dev_port not exist") return dev_port, route_to_ping