Skip to content

Commit

Permalink
fix test_static_route.py
Browse files Browse the repository at this point in the history
Signed-off-by: Zhaohui Sun <[email protected]>
  • Loading branch information
ZhaohuiS committed Mar 3, 2025
1 parent a18e928 commit 12737f3
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions tests/route/test_static_route.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import ptf.packet as packet
from tests.common import constants
from tests.common.flow_counter.flow_counter_utils import RouteFlowCounterTestContext, is_route_flow_counter_supported # noqa F811
from tests.common.helpers.dut_ports import get_vlan_interface_list, get_vlan_interface_info


pytestmark = [
Expand Down Expand Up @@ -319,7 +320,13 @@ def get_nexthops(duthost, tbinfo, ipv6=False, count=1):
if expected_vlan_ifaces:
mg_facts['minigraph_vlan_interfaces'] = expected_vlan_ifaces

vlan_intf = mg_facts['minigraph_vlan_interfaces'][1 if ipv6 else 0]
vlan_interfaces = get_vlan_interface_list(duthost)
# pick up the first vlan to test
vlan_if_name = vlan_interfaces[0]
if ipv6:
vlan_intf = get_vlan_interface_info(duthost, tbinfo, vlan_if_name, "ipv6")
else:
vlan_intf = get_vlan_interface_info(duthost, tbinfo, vlan_if_name, "ipv4")
prefix_len = vlan_intf['prefixlen']

is_backend_topology = mg_facts.get(constants.IS_BACKEND_TOPOLOGY_KEY, False)
Expand All @@ -332,7 +339,7 @@ def get_nexthops(duthost, tbinfo, ipv6=False, count=1):
nexthop_interfaces = nexthop_devs
else:
vlan_subnet = ipaddress.ip_network(vlan_intf['subnet'])
vlan = mg_facts['minigraph_vlans'][mg_facts['minigraph_vlan_interfaces'][1 if ipv6 else 0]['attachto']]
vlan = mg_facts['minigraph_vlans'][vlan_if_name]
vlan_ports = vlan['members']
vlan_id = vlan['vlanid']
vlan_ptf_ports = [mg_facts['minigraph_ptf_indices'][port] for port in vlan_ports if 'PortChannel' not in port]
Expand Down

0 comments on commit 12737f3

Please sign in to comment.