Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change swapsyncd to module level. #15501

Merged
merged 2 commits into from
Dec 7, 2024
Merged
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
28 changes: 18 additions & 10 deletions tests/qos/qos_sai_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,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

Expand All @@ -574,6 +574,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:
Expand All @@ -585,12 +589,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",
Expand Down Expand Up @@ -1868,11 +1872,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}'")[
Expand All @@ -1887,14 +1895,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)
Expand Down
Loading