Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions tests/dash/test_dash_privatelink_redirect.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,12 @@ def dpu_setup(duthost, dpuhosts, dpu_index, skip_config):
dpu_cmds.append(
f"config int ip add Ethernet0 {dpuhost.dpu_data_port_ip}/31"
)
pt_require(dpuhost.npu_data_port_ip, "DPU data port IP is not set")
dpu_cmds.append(
f"ip route replace default via {dpuhost.npu_data_port_ip}"
)
dpuhost.shell_cmds(cmds=dpu_cmds)
if dpuhost.npu_data_port_ip:
dpu_cmds.append(
f"ip route replace default via {dpuhost.npu_data_port_ip}"
)
if len(dpu_cmds) > 0:
dpuhost.shell_cmds(cmds=dpu_cmds)


@pytest.fixture(scope="class", autouse=True)
Expand Down
12 changes: 8 additions & 4 deletions tests/dash/test_dash_smartswitch_vnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ def dpu_setup_vnet(duthost, dpuhosts, dpu_index, skip_config):
dpu_cmds.append("config loopback add Loopback0")
dpu_cmds.append(f"config int ip add Loopback0 {APPLIANCE_VIP}/32")

dpu_cmds.append(f"ip route replace default via {dpuhost.npu_data_port_ip}")
dpuhost.shell_cmds(cmds=dpu_cmds)
if dpuhost.npu_data_port_ip:
dpu_cmds.append(f"ip route replace default via {dpuhost.npu_data_port_ip}")
if len(dpu_cmds) > 0:
dpuhost.shell_cmds(cmds=dpu_cmds)


@pytest.fixture(scope="module", autouse=True)
Expand All @@ -54,7 +56,8 @@ def add_npu_static_routes_vnet(duthost, dash_smartswitch_vnet_config, skip_confi
cmds = []
pe_nexthop_ip = get_interface_ip(duthost, dash_smartswitch_vnet_config[REMOTE_DUT_INTF]).ip + 1
cmds.append(f"ip route replace {dash_smartswitch_vnet_config[REMOTE_PA_IP]}/32 via {pe_nexthop_ip}")
cmds.append(f"ip route replace {APPLIANCE_VIP}/32 via {dpuhost.dpu_data_port_ip}")
if dpuhost.dpu_data_port_ip:
cmds.append(f"ip route replace {APPLIANCE_VIP}/32 via {dpuhost.dpu_data_port_ip}")
logger.info(f"Adding static routes: {cmds}")
duthost.shell_cmds(cmds=cmds)

Expand All @@ -63,7 +66,8 @@ def add_npu_static_routes_vnet(duthost, dash_smartswitch_vnet_config, skip_confi
if not skip_config and not skip_cleanup:
dpuhost = dpuhosts[dpu_index]
cmds = []
cmds.append(f"ip route del {dash_smartswitch_vnet_config[REMOTE_PA_IP]}/32 via {pe_nexthop_ip}")
if dpuhost.dpu_data_port_ip:
cmds.append(f"ip route del {dash_smartswitch_vnet_config[REMOTE_PA_IP]}/32 via {pe_nexthop_ip}")
cmds.append(f"ip route del {APPLIANCE_VIP}/32 via {dpuhost.dpu_data_port_ip}")
logger.info(f"Removing static routes: {cmds}")
duthost.shell_cmds(cmds=cmds)
Expand Down
Loading