diff --git a/tests/qos/qos_sai_base.py b/tests/qos/qos_sai_base.py index 2ed74e995ac..3cc492c3a49 100644 --- a/tests/qos/qos_sai_base.py +++ b/tests/qos/qos_sai_base.py @@ -563,8 +563,8 @@ def __assignTestPortIps(self, mgFacts, topo): return dutPortIps - @pytest.fixture(scope='class') - def swapSyncd_on_selected_duts(self, request, duthosts, get_src_dst_asic_and_duts, creds, tbinfo, lower_tor_host): # noqa F811 + @pytest.fixture(scope='module') + def swapSyncd_on_selected_duts(self, request, duthosts, creds, tbinfo, lower_tor_host): # noqa F811 """ Swap syncd on DUT host @@ -575,6 +575,10 @@ def swapSyncd_on_selected_duts(self, request, duthosts, get_src_dst_asic_and_dut Returns: None """ + if 'dualtor' in tbinfo['topo']['name']: + dut_list = [lower_tor_host] + else: + dut_list = duthosts.frontend_nodes swapSyncd = request.config.getoption("--qos_swap_syncd") public_docker_reg = request.config.getoption("--public_docker_registry") try: @@ -586,12 +590,12 @@ def swapSyncd_on_selected_duts(self, request, duthosts, get_src_dst_asic_and_dut new_creds['docker_registry_password'] = '' else: new_creds = creds - for duthost in get_src_dst_asic_and_duts["all_duts"]: + for duthost in dut_list: docker.swap_syncd(duthost, new_creds) yield finally: if swapSyncd: - for duthost in get_src_dst_asic_and_duts["all_duts"]: + for duthost in dut_list: docker.restore_default_syncd(duthost, new_creds) @pytest.fixture(scope='class', name="select_src_dst_dut_and_asic", @@ -1872,11 +1876,15 @@ def populateArpEntries( yield return - @pytest.fixture(scope='class', autouse=True) - def dut_disable_ipv6(self, duthosts, get_src_dst_asic_and_duts, tbinfo, lower_tor_host, # noqa F811 - swapSyncd_on_selected_duts): + @pytest.fixture(scope='module', autouse=True) + def dut_disable_ipv6(self, duthosts, tbinfo, lower_tor_host, swapSyncd_on_selected_duts): # noqa F811 + if 'dualtor' in tbinfo['topo']['name']: + dut_list = [lower_tor_host] + else: + dut_list = duthosts.frontend_nodes + all_docker0_ipv6_addrs = {} - for duthost in get_src_dst_asic_and_duts['all_duts']: + for duthost in dut_list: try: all_docker0_ipv6_addrs[duthost.hostname] = \ duthost.shell("sudo ip -6 addr show dev docker0 | grep global" + " | awk '{print $2}'")[ @@ -1891,14 +1899,14 @@ def dut_disable_ipv6(self, duthosts, get_src_dst_asic_and_duts, tbinfo, lower_to yield - for duthost in get_src_dst_asic_and_duts['all_duts']: + for duthost in dut_list: duthost.shell("sysctl -w net.ipv6.conf.all.disable_ipv6=0") if all_docker0_ipv6_addrs[duthost.hostname] is not None: logger.info("Adding docker0's IPv6 address since it was removed when disabing IPv6") duthost.shell("ip -6 addr add {} dev docker0".format(all_docker0_ipv6_addrs[duthost.hostname])) # TODO: parallelize this step.. Do we really need this ? - for duthost in get_src_dst_asic_and_duts['all_duts']: + for duthost in dut_list: config_reload(duthost, config_source='config_db', safe_reload=True, check_intf_up_ports=True) @pytest.fixture(scope='class', autouse=True)