Skip to content

[docker-dhcp-relay] Start dhcp6relay unconditionally; apply IPv6 relay config at runtime#28042

Open
AnantKishorSharma wants to merge 2 commits into
sonic-net:masterfrom
AnantKishorSharma:dhcp6relay-dynamic-config
Open

[docker-dhcp-relay] Start dhcp6relay unconditionally; apply IPv6 relay config at runtime#28042
AnantKishorSharma wants to merge 2 commits into
sonic-net:masterfrom
AnantKishorSharma:dhcp6relay-dynamic-config

Conversation

@AnantKishorSharma

@AnantKishorSharma AnantKishorSharma commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #28048

Why I did it

With the SONiC-native dhcp6relay applying DHCP_RELAY changes at runtime (sonic-net/sonic-dhcp-relay#116), the agent no longer needs to be gated on the presence of dhcpv6_servers at render time, and the dhcp_relay container no longer needs to be restarted for an IPv6 relay configuration change.

How I did it

  • dhcpv6-relay.agents.j2 / dhcp-relay.programs.j2: start dhcp6relay unconditionally. The dual ToR -u Loopback0 option is unchanged from upstream — it is still passed only when DEVICE_METADATA subtype is DualToR.
  • cli/config/plugins/dhcp_relay.py: skip the dhcp_relay container restart on the IPv6 path, since dhcp6relay reconciles DHCP_RELAY at runtime.
  • wait_for_intf.sh.j2: bound the per-interface readiness waits so a never-ready interface cannot block startup. The IPv4 waits (WAIT_IFACE_READY_TIMEOUT) are bounded (300s) only when has_sonic_dhcpv4_relay is set; legacy ISC dhcrelay keeps the wait-forever default. The IPv6 VLAN waits (WAIT_IFACE_READY_TIMEOUT_V6) are always bounded (300s) since dhcp6relay reconciles at runtime, independent of the v4 relay type.
  • Regenerated the docker-dhcp-relay supervisord / wait_for_intf goldens (incl. a new wait_for_intf_v4_relay.sh golden for the has_sonic_dhcpv4_relay=True branch) and made the cli-plugin tests version-aware. Added test_j2files cases asserting the has_sonic_dhcpv4_relay=True wait rendering and that -u Loopback0 renders only for subtype == DualToR.

How to verify it

  • src/sonic-config-engine: test_j2files.py::TestJ2Files::test_dhcp_relay passes (goldens + the has_sonic_dhcpv4_relay=True and Dual-ToR render assertions).
  • docker-dhcp-relay cli-plugin tests: 36 passed.

Dependency: pairs with sonic-net/sonic-dhcp-relay#116 — the unconditional start relies on the runtime-reconfig + warning-throttle behavior in that PR. The src/dhcprelay submodule should be bumped to that change before this merges.

Companion PRs: sonic-net/sonic-dhcp-relay#116 (core) · sonic-net/sonic-mgmt sonic-net/sonic-mgmt#25589 (tests) · sonic-net/SONiC sonic-net/SONiC#2402 (HLD)

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines

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

@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

/azp run Azure.sonic-buildimage

@azure-pipelines

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

@AnantKishorSharma
AnantKishorSharma force-pushed the dhcp6relay-dynamic-config branch from 84e89a6 to 6c6bf05 Compare June 30, 2026 10:37
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines

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

@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 1152852:

✅Stage Test:

  • Job impacted-area-kvmtest-t1-lag-vpp by Elastictest: retried.

@bingwang-ms

Copy link
Copy Markdown
Contributor

@Xichen96 Can you help review this change?

@bingwang-ms

Copy link
Copy Markdown
Contributor

@anders-nexthop Please help review as well

@AnantKishorSharma

Copy link
Copy Markdown
Contributor Author

The failing impacted-area-kvmtest-t1-lag-vpp check here is not caused by this PR.

pc/test_po_cleanup.py::test_po_cleanup_after_reload ERRORs at teardown on the vpp KVM VM because the global memory_utilization plugin trips on a transient config_reload/CPU-stress memory spike (the test body passes). Tracked and fixed:

Once the fix merges, this check should go green on re-run.

@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

Build not found. Please close and reopen the PR or rebase your branch to trigger a new build.

@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

Build not found. Please close and reopen the PR or rebase your branch to trigger a new build.

…y config at runtime

Start dhcp6relay unconditionally instead of gating it on dhcpv6_servers,
skip the dhcp_relay container restart on the IPv6 config path, and bound
the per-interface readiness wait when has_sonic_dhcpv4_relay is set.
Regenerate the affected goldens and make the cli-plugin tests version-aware.

Signed-off-by: Anant Kishor Sharma <anant.kishor-sharma@hpe.com>
@AnantKishorSharma
AnantKishorSharma force-pushed the dhcp6relay-dynamic-config branch from 6c6bf05 to 7db26c0 Compare July 13, 2026 20:42
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines

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

@AnantKishorSharma

Copy link
Copy Markdown
Contributor Author

@Xichen96 @anders-nexthop - could you please help review? Thanks!

@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 1163924:

✅Stage Test:

  • Job impacted-area-kvmtest-t2 by Elastictest: retried.

@anders-nexthop anders-nexthop left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this — the design reads well: dhcp6relay started unconditionally so runtime DHCP_RELAY changes apply without a container restart, the dual-ToR -u Loopback0 gating preserved (good to see the new test_j2files assertion for it), and the CLI dropping the v6-path restart. One sequencing note and one question.

NOTE: this depends on sonic-net/sonic-dhcp-relay#116, so it should land only once the src/dhcprelay pin has advanced to include it. Against an earlier dhcp6relay the changes here would regress — #116's summary notes the agent previously "read the DHCP_RELAY table once at startup and required a dhcp_relay container restart for any subsequent relay configuration change," so without it, skipping the v6-path restart (config/plugins/dhcp_relay.py) would leave an IPv6 config dhcp_relay add with no effect, and the unconditional start would run the agent before #116's runtime-reconcile and warning-throttle. Purely a merge-order thing; the question below is independent of it.

— anders-bot (AI-assisted, on behalf of @anders-nexthop)

Comment thread dockers/docker-dhcp-relay/wait_for_intf.sh.j2
…s_sonic_dhcpv4_relay via WAIT_IFACE_READY_TIMEOUT_V6 (+test)

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

Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines

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

@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 1168563:

✅Stage Test:

  • Job impacted-area-kvmtest-t1-lag-vpp 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.

[docker-dhcp-relay] dhcp_relay startup waits indefinitely for a never-ready interface, blocking relay on all interfaces

4 participants