Skip to content

[dhcp_relay] Verify configured DHCP relay hop limits - #26321

Draft
Xichen96 wants to merge 1 commit into
sonic-net:masterfrom
Xichen96:dev/xichenlin/item10-max-hop-test
Draft

[dhcp_relay] Verify configured DHCP relay hop limits#26321
Xichen96 wants to merge 1 commit into
sonic-net:masterfrom
Xichen96:dev/xichenlin/item10-max-hop-test

Conversation

@Xichen96

@Xichen96 Xichen96 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Description of PR

Summary:
Repair the max-hop hardware/PTF coverage so configured thresholds are actually discriminated. PTF now accepts an explicit incoming hop count and an independent expected forward/drop result. The test configures a limit of 2 and proves incoming 1 forwards with hops 2 while incoming 2 drops; it also retains the limit-16 boundary.

This is a low-priority draft placeholder for a non-current deployment scenario. It depends on sonic-net/sonic-dhcp-relay#123 and may intentionally fail on current images until that product dependency merges. DRAFT — MUST NOT MERGE.

Fixes # N/A — draft test placeholder; no issue is linked.

Type of change

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

Back port request

  • 202311
  • 202405
  • 202411
  • 202505
  • 202511
  • 202512
  • 202605

Tracking issue/work item for backport/cherry-pick request (GitHub issue or Microsoft ADO): N/A; no backport requested.
Failure type: other — low-priority test coverage gap for a non-current deployment scenario.

Tested branch

  • master
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511
  • 202512
  • 202605
  • N/A

Test result

  • NOT RUN: no pytest, PTF, syntax-check, or hardware validation was executed.

  • Validation is intentionally deferred until the higher-priority DHCP relay PRs merge.

  • This draft must not merge before its dependency and validation TODOs are complete.

  • Dependency TODO: rebase/validate after [dhcp4relay] Apply configured maximum hop count sonic-dhcp-relay#123 merges.

  • Validation TODO: run the focused hardware/PTF cases for configured limits 2 and 16 after the higher-priority DHCP relay PRs merge.

Approach

What is the motivation for this PR?

The previous test derived packet input and expectation from the configured maximum, so it passed even when the daemon ignored a configured value of 2 and continued using 16.

How did you do it?

Pass explicit incoming hop counts and expected forwarding decisions to PTF, verify forwarded hops are incremented, and use a broad DHCP mask for negative cases so any upstream relay packet fails the drop assertion.

How did you verify/test it?

No validation was executed. Validation is deferred until the higher-priority DHCP relay PRs merge. This draft must not merge before the dependency and validation TODOs above are complete.

Any platform specific information?

Native sonic-relay-agent coverage; no ISC-specific behavior is asserted.

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

Existing t0 and m0 DHCP relay topologies.

Documentation

No documentation update. This draft only adds or corrects DHCP relay test coverage.

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@azure-pipelines

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

num_expected_packets = self.num_dhcp_servers
if self.agent_relay_mode == "discard" or self.dhcpv4_disable_flag or self.max_hop_count == self.MAX_HOP_COUNT:
# Expected result: No packet sent
if self.expected_forward is None:
Pass independent incoming hop counts and forwarding expectations into PTF coverage so a configured lower limit cannot pass while runtime remains at 16.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 2b881aa9-3a3a-4aaf-b2ca-b941705b2438
Signed-off-by: Xichen96 <lukelin0907@gmail.com>
@Xichen96
Xichen96 force-pushed the dev/xichenlin/item10-max-hop-test branch from 28e0084 to 3f127d6 Compare July 19, 2026 17:39
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

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