Skip to content

Commit

Permalink
Packets going to incorrect ToR fixed.
Browse files Browse the repository at this point in the history
The traffic from active-active mux ports is ECMPed twice:first time on the NiC to choose the ToR, second time on the ToR to choose the uplinks. The NiC ECMP is not within the test scope, and we also cannot guarantee that the traffic is evenly distributed among all the uplinks.

The proposed fix is to configure active-active ports to work in active-standby mode in case of the following tests :-

    1. dhcp_relay/test_dhcp_relay.py
    2. dhcp_relay/test_dhcpv6_relay.py
    3. drop_packets/test_configurable_drop_counters.py
    4. pfcwd/test_pfcwd_function.py
    5. route/test_route_flap.py
    6. snmp/test_snmp_fdb.py
    7. everflow/test_everflow_testbed.py
    8. everflow/test_everflow_ipv6.py
  • Loading branch information
vivekverma-arista committed Mar 7, 2024
1 parent 45cb9ed commit 3056620
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 31 deletions.
62 changes: 57 additions & 5 deletions tests/common/dualtor/dual_tor_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1586,9 +1586,7 @@ def check_active_active_port_status(duthost, ports, status):


@pytest.fixture
def config_active_active_dualtor_active_standby(
duthosts, active_active_ports, tbinfo, validate_active_active_dualtor_setup # noqa F811
):
def config_active_active_dualtor_active_standby(duthosts, active_active_ports, tbinfo): # noqa F811
"""Config the active-active dualtor that one ToR as active and the other as standby."""
if not ('dualtor' in tbinfo['topo']['name'] and active_active_ports):
yield
Expand All @@ -1605,7 +1603,7 @@ def check_active_active_port_status(duthost, ports, status):
return False
return True

def _config_the_active_active_dualtor(active_tor, standby_tor, ports):
def _config_the_active_active_dualtor(active_tor, standby_tor, ports, unconditionally=False):
active_side_commands = []
standby_side_commands = []
logging.info("Configuring {} as active".format(active_tor.hostname))
Expand All @@ -1616,7 +1614,7 @@ def _config_the_active_active_dualtor(active_tor, standby_tor, ports):
active_side_commands.append("config mux mode active {}".format(port))
standby_side_commands.append("config mux mode standby {}".format(port))

if not check_active_active_port_status(active_tor, ports, 'active'):
if not check_active_active_port_status(active_tor, ports, 'active') or unconditionally:
active_tor.shell_cmds(cmds=active_side_commands)
standby_tor.shell_cmds(cmds=standby_side_commands)

Expand Down Expand Up @@ -1740,3 +1738,57 @@ def setup_standby_ports_on_rand_selected_tor(active_active_ports, rand_selected_
if active_active_ports:
config_active_active_dualtor_active_standby(rand_unselected_dut, rand_selected_dut, active_active_ports)
return


@pytest.fixture
def setup_standby_ports_on_rand_unselected_tor(active_active_ports, rand_selected_dut, rand_unselected_dut, # noqa F811
config_active_active_dualtor_active_standby,
validate_active_active_dualtor_setup):
if active_active_ports:
config_active_active_dualtor_active_standby(rand_selected_dut, rand_unselected_dut, active_active_ports)
return


@pytest.fixture
def setup_standby_ports_on_non_enum_rand_one_per_hwsku_frontend_host_m(
active_active_ports, # noqa F811
enum_rand_one_per_hwsku_frontend_hostname,
config_active_active_dualtor_active_standby,
validate_active_active_dualtor_setup,
upper_tor_host,
lower_tor_host,
duthosts
):
if active_active_ports:
active_tor = duthosts[enum_rand_one_per_hwsku_frontend_hostname]
standby_tor = upper_tor_host if active_tor == lower_tor_host else lower_tor_host
config_active_active_dualtor_active_standby(active_tor, standby_tor, active_active_ports)
return


@pytest.fixture
def setup_standby_ports_on_rand_unselected_tor_unconditionally(
active_active_ports, # noqa F811
rand_selected_dut,
rand_unselected_dut,
config_active_active_dualtor_active_standby
):
if active_active_ports:
config_active_active_dualtor_active_standby(rand_selected_dut, rand_unselected_dut, active_active_ports, True)
return


@pytest.fixture
def setup_standby_ports_on_non_enum_rand_one_per_hwsku_frontend_host_m_unconditionally(
active_active_ports, # noqa F811
enum_rand_one_per_hwsku_frontend_hostname,
config_active_active_dualtor_active_standby,
upper_tor_host,
lower_tor_host,
duthosts
):
if active_active_ports:
active_tor = duthosts[enum_rand_one_per_hwsku_frontend_hostname]
standby_tor = upper_tor_host if active_tor == lower_tor_host else lower_tor_host
config_active_active_dualtor_active_standby(active_tor, standby_tor, active_active_ports, True)
return
7 changes: 6 additions & 1 deletion tests/dhcp_relay/test_dhcp_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
from tests.common import config_reload
from tests.common.platform.processes_utils import wait_critical_processes
from tests.common.plugins.loganalyzer.loganalyzer import LogAnalyzer, LogAnalyzerError

from tests.common.dualtor.dual_tor_utils import setup_standby_ports_on_rand_unselected_tor # noqa F401
from tests.common.dualtor.dual_tor_utils import config_active_active_dualtor_active_standby # noqa F401
from tests.common.dualtor.dual_tor_utils import validate_active_active_dualtor_setup # noqa F401
pytestmark = [
pytest.mark.topology('t0', 'm0'),
pytest.mark.device_type('vs')
Expand Down Expand Up @@ -306,6 +308,7 @@ def start_dhcp_monitor_debug_counter(duthost):


def test_dhcp_relay_default(ptfhost, dut_dhcp_relay_data, validate_dut_routes_exist, testing_config,
setup_standby_ports_on_rand_unselected_tor, # noqa F811
rand_unselected_dut, toggle_all_simulator_ports_to_rand_selected_tor_m): # noqa F811
"""Test DHCP relay functionality on T0 topology.
For each DHCP relay agent running on the DuT, verify DHCP packets are relayed properly
Expand Down Expand Up @@ -508,6 +511,7 @@ def test_dhcp_relay_start_with_uplinks_down(ptfhost, dut_dhcp_relay_data, valida


def test_dhcp_relay_unicast_mac(ptfhost, dut_dhcp_relay_data, validate_dut_routes_exist, testing_config,
setup_standby_ports_on_rand_unselected_tor, # noqa F811
toggle_all_simulator_ports_to_rand_selected_tor_m): # noqa F811
"""Test DHCP relay functionality on T0 topology with unicast mac
Instead of using broadcast MAC, use unicast MAC of DUT and verify that DHCP relay functionality is entact.
Expand Down Expand Up @@ -546,6 +550,7 @@ def test_dhcp_relay_unicast_mac(ptfhost, dut_dhcp_relay_data, validate_dut_route


def test_dhcp_relay_random_sport(ptfhost, dut_dhcp_relay_data, validate_dut_routes_exist, testing_config,
setup_standby_ports_on_rand_unselected_tor, # noqa F811
toggle_all_simulator_ports_to_rand_selected_tor_m): # noqa F811
"""Test DHCP relay functionality on T0 topology with random source port (sport)
If the client is SNAT'd, the source port could be changed to a non-standard port (i.e., not 68).
Expand Down
6 changes: 5 additions & 1 deletion tests/dhcp_relay/test_dhcpv6_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
from tests.common.utilities import wait_until
from tests.common.helpers.assertions import pytest_assert
from tests.common.dualtor.mux_simulator_control import toggle_all_simulator_ports_to_rand_selected_tor_m # noqa F401

from tests.common.dualtor.dual_tor_utils import setup_standby_ports_on_rand_unselected_tor # noqa F401
from tests.common.dualtor.dual_tor_utils import config_active_active_dualtor_active_standby # noqa F401
from tests.common.dualtor.dual_tor_utils import validate_active_active_dualtor_setup # noqa F401

pytestmark = [
pytest.mark.topology('t0', 'm0', 'mx'),
Expand Down Expand Up @@ -240,6 +242,7 @@ def test_interface_binding(duthosts, rand_one_dut_hostname, dut_dhcp_relay_data)


def test_dhcpv6_relay_counter(ptfhost, duthosts, rand_one_dut_hostname, dut_dhcp_relay_data,
setup_standby_ports_on_rand_unselected_tor, # noqa F811
toggle_all_simulator_ports_to_rand_selected_tor_m): # noqa F811
""" Test DHCPv6 Counter """
duthost = duthosts[rand_one_dut_hostname]
Expand Down Expand Up @@ -306,6 +309,7 @@ def test_dhcpv6_relay_counter(ptfhost, duthosts, rand_one_dut_hostname, dut_dhcp


def test_dhcp_relay_default(ptfhost, dut_dhcp_relay_data, validate_dut_routes_exist, testing_config,
setup_standby_ports_on_rand_unselected_tor, # noqa F811
toggle_all_simulator_ports_to_rand_selected_tor_m): # noqa F811
"""Test DHCP relay functionality on T0 topology.
For each DHCP relay agent running on the DuT, verify DHCP packets are relayed properly
Expand Down
6 changes: 4 additions & 2 deletions tests/drop_packets/test_configurable_drop_counters.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
from tests.common.utilities import is_ipv4_address
from tests.common import constants
from tests.common import config_reload


from tests.common.dualtor.dual_tor_utils import setup_standby_ports_on_rand_unselected_tor # noqa F401
from tests.common.dualtor.dual_tor_utils import config_active_active_dualtor_active_standby # noqa F401
from tests.common.dualtor.dual_tor_utils import validate_active_active_dualtor_setup # noqa F401
pytestmark = [
pytest.mark.topology('any')
]
Expand Down Expand Up @@ -147,6 +148,7 @@ def verifyFdbArp(duthost, dst_ip, dst_mac, dst_intf):

@pytest.mark.parametrize("drop_reason", ["L3_EGRESS_LINK_DOWN"])
def test_neighbor_link_down(testbed_params, setup_counters, duthosts, rand_one_dut_hostname,
setup_standby_ports_on_rand_unselected_tor, # noqa F811
toggle_all_simulator_ports_to_rand_selected_tor_m, mock_server, # noqa F811
send_dropped_traffic, drop_reason, generate_dropped_packet, tbinfo):
"""
Expand Down
Loading

0 comments on commit 3056620

Please sign in to comment.