Skip to content

Commit 84b5be9

Browse files
Fixed test issues for dualtor topologies. (#11921)
What is the motivation for this PR? In some test cases the packets go to unselected ToR in case of active-active links or forwarded by the unselected ToR in case of active-standby links. Some tests verify queue counters, but this check fails for UC1 in presence of active active links as UC1 always has gRPC traffic flowing through it. How did you do it? First issue can be addressed by using the following fixtures in case of active-standby (wherever missing, commit 1) :- a) toggle_all_simulator_ports_to_rand_selected_tor b) toggle_all_simulator_ports_to_enum_rand_one_per_hwsku_frontend_host_m To handle this in case of active-active links new fixtures are introduced (commit 3 & 4) a) setup_standby_ports_on_rand_unselected_tor b) setup_standby_ports_on_non_enum_rand_one_per_hwsku_frontend_host_m c) setup_standby_ports_on_rand_unselected_tor_unconditionally d) setup_standby_ports_on_non_enum_rand_one_per_hwsku_frontend_host_m_unconditionally Second issue can be addressed by simply skipping the check for UC1 in presence of active-active links. (commit 2) How did you verify/test it? Verified on Arista 7260 device using dualtor/dualtor-aa topology.
1 parent 99675f5 commit 84b5be9

File tree

10 files changed

+97
-23
lines changed

10 files changed

+97
-23
lines changed

git

Whitespace-only changes.

tests/common/dualtor/dual_tor_utils.py

Lines changed: 76 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@
4343

4444

4545
__all__ = ['tor_mux_intf', 'tor_mux_intfs', 'ptf_server_intf', 't1_upper_tor_intfs', 't1_lower_tor_intfs',
46-
'upper_tor_host', 'lower_tor_host', 'force_active_tor', 'force_standby_tor']
46+
'upper_tor_host', 'lower_tor_host', 'force_active_tor', 'force_standby_tor',
47+
'config_active_active_dualtor_active_standby', 'validate_active_active_dualtor_setup',
48+
'setup_standby_ports_on_rand_selected_tor',
49+
'setup_standby_ports_on_rand_unselected_tor',
50+
'setup_standby_ports_on_non_enum_rand_one_per_hwsku_frontend_host_m',
51+
'setup_standby_ports_on_rand_unselected_tor_unconditionally',
52+
'setup_standby_ports_on_non_enum_rand_one_per_hwsku_frontend_host_m_unconditionally',
53+
]
4754

4855
logger = logging.getLogger(__name__)
4956

@@ -1588,9 +1595,7 @@ def check_active_active_port_status(duthost, ports, status):
15881595

15891596

15901597
@pytest.fixture
1591-
def config_active_active_dualtor_active_standby(
1592-
duthosts, active_active_ports, tbinfo, validate_active_active_dualtor_setup # noqa F811
1593-
):
1598+
def config_active_active_dualtor_active_standby(duthosts, active_active_ports, tbinfo): # noqa F811
15941599
"""Config the active-active dualtor that one ToR as active and the other as standby."""
15951600
if not ('dualtor' in tbinfo['topo']['name'] and active_active_ports):
15961601
yield
@@ -1607,16 +1612,18 @@ def check_active_active_port_status(duthost, ports, status):
16071612
return False
16081613
return True
16091614

1610-
def _config_the_active_active_dualtor(active_tor, standby_tor, ports):
1615+
def _config_the_active_active_dualtor(active_tor, standby_tor, ports, unconditionally=False):
16111616
active_side_commands = []
16121617
standby_side_commands = []
1618+
logging.info("Configuring {} as active".format(active_tor.hostname))
1619+
logging.info("Configuring {} as standby".format(standby_tor.hostname))
16131620
for port in ports:
16141621
if port not in active_active_ports:
16151622
raise ValueError("Port {} is not in the active-active ports".format(port))
16161623
active_side_commands.append("config mux mode active {}".format(port))
16171624
standby_side_commands.append("config mux mode standby {}".format(port))
16181625

1619-
if not check_active_active_port_status(active_tor, ports, 'active'):
1626+
if not check_active_active_port_status(active_tor, ports, 'active') or unconditionally:
16201627
active_tor.shell_cmds(cmds=active_side_commands)
16211628
standby_tor.shell_cmds(cmds=standby_side_commands)
16221629

@@ -1749,3 +1756,66 @@ def log_flap_counter(flap_counters):
17491756
if unexpected_flap_mux_ports:
17501757
logging.error(error_str)
17511758
raise ValueError(error_str)
1759+
1760+
1761+
@pytest.fixture
1762+
def setup_standby_ports_on_rand_selected_tor(active_active_ports, rand_selected_dut, rand_unselected_dut, # noqa F811
1763+
config_active_active_dualtor_active_standby, # noqa F811
1764+
validate_active_active_dualtor_setup): # noqa F811
1765+
if active_active_ports:
1766+
config_active_active_dualtor_active_standby(rand_unselected_dut, rand_selected_dut, active_active_ports)
1767+
return
1768+
1769+
1770+
@pytest.fixture
1771+
def setup_standby_ports_on_rand_unselected_tor(active_active_ports, rand_selected_dut, rand_unselected_dut, # noqa F811
1772+
config_active_active_dualtor_active_standby,
1773+
validate_active_active_dualtor_setup):
1774+
if active_active_ports:
1775+
config_active_active_dualtor_active_standby(rand_selected_dut, rand_unselected_dut, active_active_ports)
1776+
return
1777+
1778+
1779+
@pytest.fixture
1780+
def setup_standby_ports_on_non_enum_rand_one_per_hwsku_frontend_host_m(
1781+
active_active_ports, # noqa F811
1782+
enum_rand_one_per_hwsku_frontend_hostname,
1783+
config_active_active_dualtor_active_standby,
1784+
validate_active_active_dualtor_setup,
1785+
upper_tor_host,
1786+
lower_tor_host,
1787+
duthosts
1788+
):
1789+
if active_active_ports:
1790+
active_tor = duthosts[enum_rand_one_per_hwsku_frontend_hostname]
1791+
standby_tor = upper_tor_host if active_tor == lower_tor_host else lower_tor_host
1792+
config_active_active_dualtor_active_standby(active_tor, standby_tor, active_active_ports)
1793+
return
1794+
1795+
1796+
@pytest.fixture
1797+
def setup_standby_ports_on_rand_unselected_tor_unconditionally(
1798+
active_active_ports, # noqa F811
1799+
rand_selected_dut,
1800+
rand_unselected_dut,
1801+
config_active_active_dualtor_active_standby
1802+
):
1803+
if active_active_ports:
1804+
config_active_active_dualtor_active_standby(rand_selected_dut, rand_unselected_dut, active_active_ports, True)
1805+
return
1806+
1807+
1808+
@pytest.fixture
1809+
def setup_standby_ports_on_non_enum_rand_one_per_hwsku_frontend_host_m_unconditionally(
1810+
active_active_ports, # noqa F811
1811+
enum_rand_one_per_hwsku_frontend_hostname,
1812+
config_active_active_dualtor_active_standby,
1813+
upper_tor_host,
1814+
lower_tor_host,
1815+
duthosts
1816+
):
1817+
if active_active_ports:
1818+
active_tor = duthosts[enum_rand_one_per_hwsku_frontend_hostname]
1819+
standby_tor = upper_tor_host if active_tor == lower_tor_host else lower_tor_host
1820+
config_active_active_dualtor_active_standby(active_tor, standby_tor, active_active_ports, True)
1821+
return

tests/dhcp_relay/test_dhcp_relay.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ def start_dhcp_monitor_debug_counter(duthost):
306306

307307

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

509510

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

547549

548550
def test_dhcp_relay_random_sport(ptfhost, dut_dhcp_relay_data, validate_dut_routes_exist, testing_config,
551+
setup_standby_ports_on_rand_unselected_tor, # noqa F811
549552
toggle_all_simulator_ports_to_rand_selected_tor_m): # noqa F811
550553
"""Test DHCP relay functionality on T0 topology with random source port (sport)
551554
If the client is SNAT'd, the source port could be changed to a non-standard port (i.e., not 68).

tests/drop_packets/test_configurable_drop_counters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def verifyFdbArp(duthost, dst_ip, dst_mac, dst_intf):
149149

150150
@pytest.mark.parametrize("drop_reason", ["L3_EGRESS_LINK_DOWN"])
151151
def test_neighbor_link_down(testbed_params, setup_counters, duthosts, rand_one_dut_hostname,
152+
setup_standby_ports_on_rand_unselected_tor, # noqa F811
152153
toggle_all_simulator_ports_to_rand_selected_tor_m, mock_server, # noqa F811
153154
send_dropped_traffic, drop_reason, generate_dropped_packet, tbinfo):
154155
"""

tests/dualtor/test_ipinip.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ def setup_active_active_ports(active_active_ports, rand_selected_dut, rand_unsel
278278
def test_encap_with_mirror_session(rand_selected_dut, rand_selected_interface, # noqa F811
279279
ptfadapter, tbinfo, setup_mirror_session,
280280
toggle_all_simulator_ports_to_rand_unselected_tor, # noqa F811
281-
setup_active_active_ports, # noqa F811
282-
tunnel_traffic_monitor): # noqa F811
281+
tunnel_traffic_monitor, # noqa F811
282+
setup_standby_ports_on_rand_selected_tor): # noqa F811
283283
"""
284284
A test case to verify the bounced back packet from Standby ToR to T1 doesn't have an unexpected vlan id (4095)
285285
The issue can happen if the bounced back packets egressed from the monitor port of mirror session

tests/dualtor/test_tor_ecn.py

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -335,18 +335,6 @@ def runcmd():
335335
pytest.skip('file {} not found'.format(file))
336336

337337

338-
@pytest.fixture
339-
def setup_active_active_ports(active_active_ports, rand_selected_dut, rand_unselected_dut, # noqa F811
340-
config_active_active_dualtor_active_standby, # noqa F811
341-
validate_active_active_dualtor_setup): # noqa F811
342-
if active_active_ports:
343-
logging.info("Configuring {} as active".format(rand_unselected_dut.hostname))
344-
logging.info("Configuring {} as standby".format(rand_selected_dut.hostname))
345-
config_active_active_dualtor_active_standby(rand_unselected_dut, rand_selected_dut, active_active_ports)
346-
347-
return
348-
349-
350338
@pytest.mark.parametrize("dscp", [3, 4, 2, 6]) # lossless queue is 3 or 4 or 2 or 6.
351339
def test_dscp_to_queue_during_encap_on_standby(
352340
dscp,
@@ -358,7 +346,7 @@ def test_dscp_to_queue_during_encap_on_standby(
358346
duthosts,
359347
rand_one_dut_hostname,
360348
write_standby,
361-
setup_active_active_ports
349+
setup_standby_ports_on_rand_selected_tor # noqa F811
362350
):
363351
"""
364352
Test if DSCP to Q mapping for outer header is matching with inner header during encap on standby
@@ -423,7 +411,7 @@ def test_ecn_during_encap_on_standby(
423411
rand_selected_interface, ptfadapter, # noqa F811
424412
tbinfo, rand_selected_dut, tunnel_traffic_monitor, # noqa F811
425413
write_standby,
426-
setup_active_active_ports
414+
setup_standby_ports_on_rand_selected_tor # noqa F811
427415
):
428416
"""
429417
Test if the ECN stamping on outer header is matching with inner during encap on standby

tests/pfcwd/test_pfcwd_function.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,7 @@ def set_traffic_action(self, duthost, action):
794794

795795
def test_pfcwd_actions(self, request, fake_storm, setup_pfc_test, setup_dut_test_params, enum_fanout_graph_facts, # noqa F811
796796
ptfhost, duthosts, enum_rand_one_per_hwsku_frontend_hostname, fanouthosts,
797+
setup_standby_ports_on_non_enum_rand_one_per_hwsku_frontend_host_m_unconditionally, # noqa F811
797798
pause_icmp_responder, toggle_all_simulator_ports_to_enum_rand_one_per_hwsku_frontend_host_m): # noqa F811
798799
"""
799800
PFCwd functional test
@@ -867,6 +868,7 @@ def test_pfcwd_actions(self, request, fake_storm, setup_pfc_test, setup_dut_test
867868

868869
def test_pfcwd_multi_port(self, request, fake_storm, setup_pfc_test, setup_dut_test_params, enum_fanout_graph_facts, # noqa F811
869870
ptfhost, duthosts, enum_rand_one_per_hwsku_frontend_hostname, fanouthosts,
871+
setup_standby_ports_on_non_enum_rand_one_per_hwsku_frontend_host_m_unconditionally, # noqa F811
870872
pause_icmp_responder, toggle_all_simulator_ports_to_enum_rand_one_per_hwsku_frontend_host_m): # noqa F811
871873
"""
872874
Tests pfcwd behavior when 2 ports are under pfc storm one after the other
@@ -944,6 +946,7 @@ def test_pfcwd_multi_port(self, request, fake_storm, setup_pfc_test, setup_dut_t
944946

945947
def test_pfcwd_mmu_change(self, request, fake_storm, setup_pfc_test, setup_dut_test_params, enum_fanout_graph_facts, # noqa F811
946948
ptfhost, duthosts, enum_rand_one_per_hwsku_frontend_hostname, fanouthosts, dualtor_ports, # noqa F811
949+
setup_standby_ports_on_non_enum_rand_one_per_hwsku_frontend_host_m_unconditionally, # noqa F811
947950
pause_icmp_responder, toggle_all_simulator_ports_to_enum_rand_one_per_hwsku_frontend_host_m): # noqa F811
948951
"""
949952
Tests if mmu changes impact Pfcwd functionality
@@ -1034,6 +1037,7 @@ def test_pfcwd_mmu_change(self, request, fake_storm, setup_pfc_test, setup_dut_t
10341037

10351038
def test_pfcwd_port_toggle(self, request, fake_storm, setup_pfc_test, setup_dut_test_params, enum_fanout_graph_facts, # noqa F811
10361039
tbinfo, ptfhost, duthosts, enum_rand_one_per_hwsku_frontend_hostname, fanouthosts,
1040+
setup_standby_ports_on_non_enum_rand_one_per_hwsku_frontend_host_m_unconditionally, # noqa F811
10371041
pause_icmp_responder, toggle_all_simulator_ports_to_enum_rand_one_per_hwsku_frontend_host_m): # noqa F811
10381042
"""
10391043
Test PfCWD functionality after toggling port

tests/qos/test_tunnel_qos_remap.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ def test_tunnel_decap_dscp_to_queue_mapping(ptfhost, rand_selected_dut, rand_uns
251251

252252

253253
def test_separated_qos_map_on_tor(ptfhost, rand_selected_dut, rand_unselected_dut,
254+
setup_standby_ports_on_rand_unselected_tor,
254255
toggle_all_simulator_ports_to_rand_selected_tor, tbinfo, ptfadapter, dut_qos_maps_module): # noqa F811
255256
"""
256257
The test case is to verify separated DSCP_TO_TC_MAP/TC_TO_QUEUE_MAP on uplink and downlink ports of dualtor
@@ -359,6 +360,7 @@ def pfc_pause_test(storm_handler, peer_info, prio, ptfadapter, dut, port, queue,
359360

360361

361362
def test_pfc_pause_extra_lossless_standby(ptfhost, fanouthosts, rand_selected_dut, rand_unselected_dut,
363+
setup_standby_ports_on_rand_selected_tor,
362364
toggle_all_simulator_ports_to_rand_unselected_tor, tbinfo, ptfadapter, conn_graph_facts, fanout_graph_facts, dut_config): # noqa F811
363365
"""
364366
The test case is to verify PFC pause frame can pause extra lossless queues in dualtor deployment.
@@ -436,6 +438,7 @@ def test_pfc_pause_extra_lossless_standby(ptfhost, fanouthosts, rand_selected_du
436438

437439

438440
def test_pfc_pause_extra_lossless_active(ptfhost, fanouthosts, rand_selected_dut, rand_unselected_dut,
441+
setup_standby_ports_on_rand_unselected_tor,
439442
toggle_all_simulator_ports_to_rand_selected_tor, tbinfo, ptfadapter, conn_graph_facts, fanout_graph_facts, dut_config): # noqa F811
440443
"""
441444
The test case is to verify PFC pause frame can pause extra lossless queues in dualtor deployment.

tests/route/test_route_flap.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import pytest
88
import ptf.testutils as testutils
99
import ptf.packet as scapy
10+
from tests.common.dualtor.mux_simulator_control import \
11+
toggle_all_simulator_ports_to_enum_rand_one_per_hwsku_frontend_host_m # noqa F401
1012

1113
from ptf.mask import Mask
1214
from natsort import natsorted
@@ -374,7 +376,9 @@ def get_dev_port_and_route(duthost, asichost, dst_prefix_set):
374376

375377
def test_route_flap(duthosts, tbinfo, ptfhost, ptfadapter,
376378
get_function_conpleteness_level, announce_default_routes,
377-
enum_rand_one_per_hwsku_frontend_hostname, enum_rand_one_frontend_asic_index, loganalyzer):
379+
enum_rand_one_per_hwsku_frontend_hostname, enum_rand_one_frontend_asic_index,
380+
setup_standby_ports_on_non_enum_rand_one_per_hwsku_frontend_host_m, # noqa F811
381+
toggle_all_simulator_ports_to_enum_rand_one_per_hwsku_frontend_host_m, loganalyzer): # noqa F811
378382
ptf_ip = tbinfo['ptf_ip']
379383
common_config = tbinfo['topo']['properties']['configuration_properties'].get(
380384
'common', {})

tests/snmp/test_snmp_fdb.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def build_icmp_packet(vlan_id, src_mac="00:22:00:00:00:02", dst_mac="ff:ff:ff:ff
7575
@pytest.mark.po2vlan
7676
def test_snmp_fdb_send_tagged(ptfadapter, duthosts, rand_one_dut_hostname, # noqa F811
7777
toggle_all_simulator_ports_to_rand_selected_tor_m, # noqa F811
78+
setup_standby_ports_on_rand_unselected_tor, # noqa F811
7879
rand_selected_dut, tbinfo, ports_list, localhost, creds_all_duts): # noqa F811
7980
"""
8081
Send tagged packets from each port.

0 commit comments

Comments
 (0)