Skip to content

Add Test Framework Support for IPv6-only Management Network#22407

Closed
opcoder0 wants to merge 12 commits intosonic-net:masterfrom
opcoder0:ipv6-only-mgmt-test-setup
Closed

Add Test Framework Support for IPv6-only Management Network#22407
opcoder0 wants to merge 12 commits intosonic-net:masterfrom
opcoder0:ipv6-only-mgmt-test-setup

Conversation

@opcoder0
Copy link
Copy Markdown
Contributor

Description of PR

This PR adds test framework support for running SONiC tests in IPv6-only management network environments. When enabled, the test framework uses IPv6 addresses for DUT management connectivity and skips IPv4-specific sanity checks.

This complements the existing --ipv6-only-mgmt support in testbed-cli.sh (#22310) by adding the necessary test infrastructure changes.

Summary:
Fixes # (issue)

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • New Test case
    • Skipped for non-supported platforms
  • Test case improvement

Back port request

  • 202205
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511

Approach

What is the motivation for this PR?

Pretest needs to work in an IPv6 only management environment. The PR contains changes to invoke tests in such an environment and pretest checks.

How did you do it?

Changes include

run_tests.sh: Add -6 flag for IPv6-only management mode; fix pretest/posttest by adding . path argument
conftest.py: Add --ipv6_only_mgmt pytest option and ipv6_only_mgmt_enabled session fixture
base.py: Use IPv6 address as mgmt_ip when IPv6-only mode enabled
checks.py: Skip IPv4 management ping check when mgmt_ip is IPv6
reboot.py: Use ping6 for IPv6 management addresses

To run tests in IPv6 only management setup pass -6 to run_tests.sh. Example Usage -

./run_tests.sh -6 -n vms-kvm-t0 -t t0 -c platform_tests/test_reboot.py -d vlab-01 -i ../ansible/veos -f ../ansible/vtestbed.yaml

How did you verify/test it?

Locally.

Any platform specific information?

None

Supported testbed topology if it's a new test case?

None

Documentation

Updated in ipv6-management-setup.md and README.testbed.VsSetup.md.

This change introduces the --ipv6-only-mgmt flag for testbed-cli.sh
to configure DUTs with IPv6-only management interfaces, eliminating
IPv4 from the management network.

Key changes:
- testbed-cli.sh: Add --ipv6-only-mgmt flag for gen-mg, deploy-mg,
  test-mg
- config_sonic_basedon_testbed.yml: Handle IPv6-only minigraph
  deployment
  with proper async handling for management IP transition
- minigraph_dpg.j2, minigraph_dpg_asic.j2: Conditionally include
  IPv4/IPv6
  management interfaces based on use_ipv6_mgmt flag
- group_vars/*/ipv6.yml: IPv6 service configurations (NTP, DNS, syslog)
- setup-ntp-server.sh: Docker-based Chrony NTP server for local time
  sync
- pr_test_template.yml: Add CI jobs for IPv6-only management testing
- Documentation updates for setup and troubleshooting

The local NTP server (fec0::ffff:afa:2) ensures reliable time
synchronization when external IPv6 NTP servers are unreachable.

Signed-off-by: opcoder0 <110003254+opcoder0@users.noreply.github.com>
Remove unused ipv6.yml file from vm_host

Signed-off-by: opcoder0 <110003254+opcoder0@users.noreply.github.com>
Signed-off-by: opcoder0 <110003254+opcoder0@users.noreply.github.com>
Signed-off-by: opcoder0 <110003254+opcoder0@users.noreply.github.com>
Signed-off-by: opcoder0 <110003254+opcoder0@users.noreply.github.com>
Signed-off-by: opcoder0 <110003254+opcoder0@users.noreply.github.com>
Changes required to get sanity check and pretests to pass in
an IPv6 only mgmt environment.

- Add -6 to run_tests.sh to run tests in IPv6 only mgmt setup
- Add --ipv6_only_mgmt option to conftest
- Modify base.py init method to detect IPv6 only mgmt setup and
  initialize mgmt_ip accordingly
- Modify checks.py and reboot.py to use IPv6 address for pings

Signed-off-by: opcoder0 <110003254+opcoder0@users.noreply.github.com>
…e instead

Signed-off-by: opcoder0 <110003254+opcoder0@users.noreply.github.com>
Signed-off-by: opcoder0 <110003254+opcoder0@users.noreply.github.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Signed-off-by: opcoder0 <110003254+opcoder0@users.noreply.github.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).


# Module-level flag for IPv6-only management mode.
# This is set by the ipv6_only_mgmt_enabled fixture in conftest.py
_ipv6_only_mgmt_enabled = False
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to avoid using global variable?

logger.info("check if dut is pingable")
localhost.shell(f"ping -c 5 {duthost.mgmt_ip}", module_ignore_errors=True)
# Use ping6 for IPv6 addresses, ping for IPv4
ping_cmd = "ping6" if ":" in str(duthost.mgmt_ip) else "ping"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to use is_ipv6_address defined in tests.common.utilities to check if it is IPv6 address here.

@opcoder0
Copy link
Copy Markdown
Contributor Author

Re-opened new PR after some additional internal tests and bug fixing. #23292

@opcoder0 opcoder0 closed this Mar 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants