Skip to content

[dhcp_relay] Add DHCPv6 relay VRF tests - #25785

Open
AnantKishorSharma wants to merge 2 commits into
sonic-net:masterfrom
AnantKishorSharma:dhcp6relay-vrf-support
Open

[dhcp_relay] Add DHCPv6 relay VRF tests#25785
AnantKishorSharma wants to merge 2 commits into
sonic-net:masterfrom
AnantKishorSharma:dhcp6relay-vrf-support

Conversation

@AnantKishorSharma

@AnantKishorSharma AnantKishorSharma commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Why I did it

Add hardware test coverage for the dhcp6relay VRF support (sonic-net/sonic-dhcp-relay#89 / sonic-net/sonic-dhcp-relay#117): the relay must reach DHCPv6 servers through a non-default VRF, applied at runtime without a container restart.

How I did it

New tests/dhcp_relay/test_dhcpv6_relay_vrf.py with 4 control-plane + 4 data-plane tests:

  • Control: VLAN-VRF bind (Option A), explicit server_vrf shared socket (Option B), runtime VRF change (rebind), and runtime VRF unbind (revert to global) — each asserts the relay re-binds at runtime with the dhcp6relay PID unchanged.
  • Data-plane: client+server in the same VRF (Option A), client and servers in different VRFs (Option B), client-default + server-VRF, and traffic continuity across a runtime VRF unbind — driving the standard dhcpv6_relay_test.DHCPTest PTF exchange both directions.

Syslog assertions match only genuine dhcp6relay log lines (ansible command echoes excluded) and are marker-scoped where a VRF name is reused, so the tests are deterministic in CI.

How to verify it

Run on a t0 testbed:
./run_tests.sh ... -c "dhcp_relay/test_dhcpv6_relay.py dhcp_relay/test_dhcpv6_relay_vrf.py"
Validated on a qfx5200 t0: the existing v6 relay suite passes (no regression) alongside the new VRF tests.

Tests for sonic-net/sonic-dhcp-relay#89

CI note - The impacted-area-kvmtest failures are expected on the current image

Chain for these to go green in CI: sonic-dhcp-relay#116 + #117 merge → the sonic-dhcp-relay submodule is advanced to include them → the vs image is rebuilt → this PR's tests pass unmodified.

The full suite (8 VRF + 4 runtime-config cases) passes on hardware (qfx5200 T0) with an image built from #116 + #117. This PR should merge after the image carries the relay changes.

@AnantKishorSharma

Copy link
Copy Markdown
Contributor Author

@Xichen96 @yaqiangz @jcaiMR @saiarcot895 @yxieca @kellyyeh - Please review when you have a chance.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@AnantKishorSharma

Copy link
Copy Markdown
Contributor Author

@wangxin @yejianquan @zypgithub - Please review when you have a chance.

Comment thread tests/dhcp_relay/test_dhcpv6_relay_vrf.py Fixed
@AnantKishorSharma
AnantKishorSharma marked this pull request as draft July 1, 2026 10:01
@AnantKishorSharma
AnantKishorSharma marked this pull request as ready for review July 1, 2026 10:07
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@AnantKishorSharma
AnantKishorSharma marked this pull request as draft July 1, 2026 10:16
@AnantKishorSharma
AnantKishorSharma marked this pull request as ready for review July 1, 2026 10:18
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

Comment thread tests/dhcp_relay/test_dhcpv6_relay_runtime_config.py Fixed
Add sonic-mgmt tests that dhcp6relay applies configuration at runtime
without restarting the dhcp_relay container:

- starts when no dhcpv6_servers are configured
- adds a relay instance when a VLAN gets an IPv6 address at runtime, and
  removes it when that address is removed
- applies dhcpv6_server changes in place (PID unchanged, no
  "need restart container" log)

Signed-off-by: Anant Kishor Sharma <anant.kishor-sharma@hpe.com>
Control- and data-plane tests for dhcp6relay VLAN-VRF and server_vrf upstream socket binding (Option A/B), runtime rebind/unbind, applied without container restart. Tests for sonic-net/sonic-dhcp-relay#89.

Signed-off-by: Anant Kishor Sharma <anant.kishor-sharma@hpe.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@AnantKishorSharma

Copy link
Copy Markdown
Contributor Author

/azpw run

@mssonicbld

Copy link
Copy Markdown
Collaborator

⚠️ Notice: /azpw run only runs failed jobs now. If you want to trigger a whole pipline run, please rebase your branch or close and reopen the PR.
💡 Tip: You can also use /azpw retry to retry failed jobs directly.

Retrying failed(or canceled) jobs...

@mssonicbld

Copy link
Copy Markdown
Collaborator

Retrying failed(or canceled) stages in build 1163915:

✅Stage Test:

  • Job impacted-area-kvmtest-t0-2vlans by Elastictest: retried.
  • Job impacted-area-kvmtest-t0 by Elastictest: retried.

@AnantKishorSharma

Copy link
Copy Markdown
Contributor Author

/azpw retry

@mssonicbld

Copy link
Copy Markdown
Collaborator

Retrying failed(or canceled) jobs...

@mssonicbld

Copy link
Copy Markdown
Collaborator

Retrying failed(or canceled) stages in build 1163915:

✅Stage Test:

  • Job impacted-area-kvmtest-t0 by Elastictest: retried.
  • Job impacted-area-kvmtest-t0-2vlans by Elastictest: retried.

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