1313from tests .common .utilities import wait_until
1414from tests .common .helpers .assertions import pytest_assert
1515from tests .common .dualtor .mux_simulator_control import toggle_all_simulator_ports_to_rand_selected_tor_m # noqa F401
16-
16+ from tests .common .dualtor .dual_tor_utils import config_active_active_dualtor_active_standby # noqa F401
17+ from tests .common .dualtor .dual_tor_utils import validate_active_active_dualtor_setup # noqa F401
18+ from tests .common .dualtor .dual_tor_common import active_active_ports # noqa F401
1719
1820pytestmark = [
1921 pytest .mark .topology ('t0' , 'm0' , 'mx' ),
@@ -239,8 +241,27 @@ def test_interface_binding(duthosts, rand_one_dut_hostname, dut_dhcp_relay_data)
239241 ("*:*" in output , "dhcp6relay socket is not properly binded" )
240242
241243
244+ @pytest .fixture
245+ def setup_active_active_as_active_standby (
246+ active_active_ports , rand_selected_dut , rand_unselected_dut , tbinfo , # noqa F811
247+ config_active_active_dualtor_active_standby , validate_active_active_dualtor_setup ): # noqa F811
248+ if 'dualtor' not in tbinfo ['topo' ]['name' ]:
249+ logger .info ("Skipping toggle on non-dualtor testbed" )
250+
251+ if active_active_ports :
252+ # The traffic from active-active mux ports are ECMPed so the DHCP6 Request
253+ # May land to any TOR.
254+ # So let's configure the active-active mux ports, to let them work in active-standby mode.
255+ logger .info ("Configuring {} as active" .format (rand_selected_dut .hostname ))
256+ logger .info ("Configuring {} as standby" .format (rand_unselected_dut .hostname ))
257+ config_active_active_dualtor_active_standby (rand_selected_dut , rand_unselected_dut , active_active_ports )
258+
259+ return
260+
261+
242262def test_dhcpv6_relay_counter (ptfhost , duthosts , rand_one_dut_hostname , dut_dhcp_relay_data ,
243- toggle_all_simulator_ports_to_rand_selected_tor_m ): # noqa F811
263+ toggle_all_simulator_ports_to_rand_selected_tor_m , # noqa F811
264+ setup_active_active_as_active_standby ): # noqa F811
244265 """ Test DHCPv6 Counter """
245266 duthost = duthosts [rand_one_dut_hostname ]
246267 skip_release (duthost , ["201911" , "202106" ])
@@ -249,7 +270,6 @@ def test_dhcpv6_relay_counter(ptfhost, duthosts, rand_one_dut_hostname, dut_dhcp
249270 "Decline" , "Reconfigure" , "Information-Request" , "Relay-Forward" , "Relay-Reply" , "Malformed" ]
250271
251272 for dhcp_relay in dut_dhcp_relay_data :
252-
253273 init_counter (duthost , dhcp_relay ['client_iface' ]['name' ], message_types )
254274 init_counter (duthost , dhcp_relay ['downlink_vlan_iface' ]['name' ], message_types )
255275 if dhcp_relay ['is_dualtor' ]:
@@ -306,7 +326,8 @@ def test_dhcpv6_relay_counter(ptfhost, duthosts, rand_one_dut_hostname, dut_dhcp
306326
307327
308328def test_dhcp_relay_default (ptfhost , dut_dhcp_relay_data , validate_dut_routes_exist , testing_config ,
309- toggle_all_simulator_ports_to_rand_selected_tor_m ): # noqa F811
329+ toggle_all_simulator_ports_to_rand_selected_tor_m , # noqa F811
330+ setup_active_active_as_active_standby ): # noqa F811
310331 """Test DHCP relay functionality on T0 topology.
311332 For each DHCP relay agent running on the DuT, verify DHCP packets are relayed properly
312333 """
0 commit comments