Skip to content

Commit

Permalink
Route flap fix on upstream LC for AZNG route changes (#14804)
Browse files Browse the repository at this point in the history
With recent changes for AZNG routes on upstream LC, 'test_route_flap' test case fails for upstream T2 line card.
This PR fixes the above issue for T2 upstream line card.
  • Loading branch information
sanjair-git authored Oct 3, 2024
1 parent de89b30 commit 3349965
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
20 changes: 20 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1781,6 +1781,26 @@ def enum_rand_one_frontend_asic_index(request):
return request.param


@pytest.fixture(scope='module')
def enum_upstream_dut_hostname(duthosts, tbinfo):
if tbinfo["topo"]["type"] == "t0":
upstream_nbr_type = "T1"
elif tbinfo["topo"]["type"] == "t1":
upstream_nbr_type = "T2"
else:
upstream_nbr_type = "T3"

for a_dut in duthosts.frontend_nodes:
minigraph_facts = a_dut.get_extended_minigraph_facts(tbinfo)
minigraph_neighbors = minigraph_facts['minigraph_neighbors']
for key, value in minigraph_neighbors.items():
if upstream_nbr_type in value['name']:
return a_dut.hostname

pytest.fail("Did not find a dut in duthosts that for topo type {} that has upstream nbr type {}".
format(tbinfo["topo"]["type"], upstream_nbr_type))


@pytest.fixture(scope="module")
def duthost_console(duthosts, enum_supervisor_dut_hostname, localhost, conn_graph_facts, creds): # noqa F811
duthost = duthosts[enum_supervisor_dut_hostname]
Expand Down
12 changes: 10 additions & 2 deletions tests/route/test_route_flap.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ def check_route(duthost, route, dev_port, operation):
cmd = ' -c "show ip route {} json"'.format(route)
for asichost in duthost.frontend_asics:
out = json.loads(asichost.run_vtysh(cmd)['stdout'])
if len(out) == 0:
logger.info("Route table empty on asic {}, check other asic".format(asichost.asic_index))
continue
nexthops = out[route][0]['nexthops']
routes_per_asic = [hop['interfaceName'] for hop in nexthops if 'interfaceName' in hop.keys()]
result.extend(routes_per_asic)
Expand Down Expand Up @@ -376,7 +379,8 @@ def get_dev_port_and_route(duthost, asichost, dst_prefix_set):

def test_route_flap(duthosts, tbinfo, ptfhost, ptfadapter,
get_function_completeness_level, announce_default_routes,
enum_rand_one_per_hwsku_frontend_hostname, enum_rand_one_frontend_asic_index,
enum_rand_one_per_hwsku_frontend_hostname,
enum_upstream_dut_hostname, enum_rand_one_frontend_asic_index,
setup_standby_ports_on_non_enum_rand_one_per_hwsku_frontend_host_m, # noqa F811
toggle_all_simulator_ports_to_enum_rand_one_per_hwsku_frontend_host_m, loganalyzer): # noqa F811
ptf_ip = tbinfo['ptf_ip']
Expand All @@ -385,6 +389,7 @@ def test_route_flap(duthosts, tbinfo, ptfhost, ptfadapter,
nexthop = common_config.get('nhipv4', NHIPV4)
duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname]
asichost = duthost.asic_instance(enum_rand_one_frontend_asic_index)
duthost_upstream = duthosts[enum_upstream_dut_hostname]
if loganalyzer:
ignoreRegex = [
".*ERR.*\"missed_FRR_routes\".*"
Expand Down Expand Up @@ -441,7 +446,10 @@ def test_route_flap(duthosts, tbinfo, ptfhost, ptfadapter,
neighbor_type = get_neighbor_info(duthost, dev_port, tbinfo)
recv_neigh_list = get_all_recv_neigh(duthosts, neighbor_type)
logger.info("Receiving ports neighbor list : {}".format(recv_neigh_list))
ptf_recv_ports = get_all_ptf_recv_ports(duthosts, tbinfo, recv_neigh_list)
if 't2' in tbinfo["topo"]["type"] and duthost == duthost_upstream:
ptf_recv_ports = get_ptf_recv_ports(duthost, tbinfo)
else:
ptf_recv_ports = get_all_ptf_recv_ports(duthosts, tbinfo, recv_neigh_list)
logger.info("Receiving ptf ports list : {}".format(ptf_recv_ports))

exabgp_port = get_exabgp_port(duthost, tbinfo, dev_port)
Expand Down

0 comments on commit 3349965

Please sign in to comment.