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

Adding ipv6_mgmt_only test case into PR testing and fix fixture errors #12393

Merged
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .azure-pipelines/pr_test_scripts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ t0:
- vlan/test_vlan.py
- vlan/test_vlan_ping.py
- vxlan/test_vnet_route_leak.py
- ip/test_mgmt_ipv6_only.py

t0-2vlans:
- dhcp_relay/test_dhcp_relay.py
Expand Down
10 changes: 5 additions & 5 deletions tests/ip/test_mgmt_ipv6_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from tests.bgp.test_bgp_fact import run_bgp_facts
from tests.test_features import run_show_features
from tests.tacacs.test_ro_user import ssh_remote_run
from tests.ntp.test_ntp import run_ntp, setup_ntp # noqa F401
from tests.ntp.test_ntp import run_ntp, setup_ntp_func # noqa F401
from tests.common.helpers.assertions import pytest_require
from tests.tacacs.conftest import tacacs_creds, check_tacacs_v6 # noqa F401
from tests.syslog.test_syslog import run_syslog, check_default_route # noqa F401
Expand Down Expand Up @@ -127,7 +127,7 @@ def test_snmp_ipv6_only(duthosts, enum_rand_one_per_hwsku_hostname, localhost, c


def test_ro_user_ipv6_only(localhost, duthosts, enum_rand_one_per_hwsku_hostname,
tacacs_creds, check_tacacs_v6, convert_and_restore_config_db_to_ipv6_only): # noqa F811
tacacs_creds, convert_and_restore_config_db_to_ipv6_only, check_tacacs_v6): # noqa F811
# Add a temporary debug log to see if DUTs are reachable via IPv6 mgmt-ip. Will remove later
log_eth0_interface_info(duthosts)
duthost = duthosts[enum_rand_one_per_hwsku_hostname]
Expand All @@ -139,7 +139,7 @@ def test_ro_user_ipv6_only(localhost, duthosts, enum_rand_one_per_hwsku_hostname


def test_rw_user_ipv6_only(localhost, duthosts, enum_rand_one_per_hwsku_hostname,
tacacs_creds, check_tacacs_v6, convert_and_restore_config_db_to_ipv6_only): # noqa F811
tacacs_creds, convert_and_restore_config_db_to_ipv6_only, check_tacacs_v6): # noqa F811
# Add a temporary debug log to see if DUTs are reachable via IPv6 mgmt-ip. Will remove later
log_eth0_interface_info(duthosts)
duthost = duthosts[enum_rand_one_per_hwsku_hostname]
Expand Down Expand Up @@ -172,7 +172,7 @@ def test_telemetry_output_ipv6_only(convert_and_restore_config_db_to_ipv6_only,


def test_ntp_ipv6_only(duthosts, rand_one_dut_hostname,
convert_and_restore_config_db_to_ipv6_only, setup_ntp): # noqa F811
convert_and_restore_config_db_to_ipv6_only, setup_ntp_func): # noqa F811
# Add a temporary debug log to see if DUTs are reachable via IPv6 mgmt-ip. Will remove later
log_eth0_interface_info(duthosts)
run_ntp(duthosts, rand_one_dut_hostname, setup_ntp)
run_ntp(duthosts, rand_one_dut_hostname, setup_ntp_func)
13 changes: 13 additions & 0 deletions tests/ntp/test_ntp.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
import time
import pytest
from contextlib import contextmanager

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -46,6 +47,18 @@ def config_long_jump(duthost, enable=False):

@pytest.fixture(scope="module")
def setup_ntp(ptfhost, duthosts, rand_one_dut_hostname, ptf_use_ipv6):
with _context_for_setup_ntp(ptfhost, duthosts, rand_one_dut_hostname, ptf_use_ipv6) as result:
yield result


@pytest.fixture(scope="function")
def setup_ntp_func(ptfhost, duthosts, rand_one_dut_hostname, ptf_use_ipv6):
with _context_for_setup_ntp(ptfhost, duthosts, rand_one_dut_hostname, ptf_use_ipv6) as result:
yield result


@contextmanager
def _context_for_setup_ntp(ptfhost, duthosts, rand_one_dut_hostname, ptf_use_ipv6):
"""setup ntp client and server"""
duthost = duthosts[rand_one_dut_hostname]

Expand Down
Loading