Skip to content

Enhance the ztp plugin and add a new ONIE boot plugin - #470

Open
byteocean wants to merge 2 commits into
ironcore-dev:mainfrom
byteocean:enh/onie-plugin
Open

Enhance the ztp plugin and add a new ONIE boot plugin#470
byteocean wants to merge 2 commits into
ironcore-dev:mainfrom
byteocean:enh/onie-plugin

Conversation

@byteocean

@byteocean byteocean commented Aug 27, 2026

Copy link
Copy Markdown

This PR provides enhancement on the ztp plugin and the new ONIE plugin.

  1. the ztp plugin is enhanced in the sense that a general URL to access ztp script is provided. If any switch needs a special url for its ztp script, specifying such a url in the config file overwrites the general Url.
  2. the new onie plugin checks if a dhcp6 request contains OptionBootfileURL option and a special UserClass option for determining if it is an onie dhcp6 request. Thus, no conflict with other plugins.

Local tests are included. Also deployed and tested in fra3.

Summary by CodeRabbit

  • New Features

    • Added DHCPv6 ONIE support, providing ONIE image URLs for compatible discovery requests.
    • Added shared default provisioning script configuration for ZTP.
    • Per-switch provisioning script addresses can override the shared default.
  • Configuration

    • Added ONIE image server and ZTP provisioning script settings.
    • Improved switch configuration with support for named entries and script overrides.
  • Bug Fixes

    • ZTP requests now correctly use configured per-switch or global provisioning addresses.
    • Invalid or unsupported DHCPv6 requests are safely rejected.

@byteocean
byteocean requested a review from a team as a code owner August 27, 2026 12:27
@github-actions github-actions Bot added the enhancement New feature or request label Aug 27, 2026
Signed-off-by: Tao Li <tao.li06@sap.com>
Signed-off-by: Tao Li <tao.li06@sap.com>
@coderabbitai

coderabbitai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 23fb18e5-265a-4ac6-841c-79841707471d

📥 Commits

Reviewing files that changed from the base of the PR and between 0f1fd30 and 079703c.

📒 Files selected for processing (11)
  • example/onie_config.yaml
  • example/ztp_config.yaml
  • internal/api/onie_config.go
  • internal/api/ztp_config.go
  • main.go
  • plugins/onie/plugin.go
  • plugins/onie/plugin_test.go
  • plugins/onie/suite_test.go
  • plugins/ztp/plugin.go
  • plugins/ztp/plugin_test.go
  • plugins/ztp/suite_test.go

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Adds a DHCPv6 ONIE plugin with YAML configuration and tests. Extends ZTP configuration with a global provisioning script address, per-switch override resolution, URL validation, updated examples, and tests.

Changes

ONIE plugin

Layer / File(s) Summary
ONIE configuration and DHCPv6 handling
internal/api/onie_config.go, example/onie_config.yaml, plugins/onie/plugin.go, main.go
Defines ONIEConfig, loads and validates onieImagesAddress, registers the plugin, and returns BootFileURL for matching relayed ONIE requests.
ONIE plugin validation
plugins/onie/plugin_test.go, plugins/onie/suite_test.go
Adds tests for configuration setup, valid responses, request filtering, relay construction, and UserClass encoding.

ZTP provisioning defaults

Layer / File(s) Summary
ZTP configuration and address resolution
internal/api/ztp_config.go, plugins/ztp/plugin.go, example/ztp_config.yaml
Adds a global provisioning script address, validates HTTP(S) URLs, and resolves per-switch overrides against the global default.
ZTP fallback and override tests
plugins/ztp/suite_test.go, plugins/ztp/plugin_test.go
Configures switches with shared and override addresses and verifies the per-switch override path.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: 🟠 High · up to 07970

The PR adds a shared provisioning URL that can be used by multiple switches, while HTTP is allowed and script authenticity is not enforced by this change. A compromised or misconfigured endpoint could affect several devices, so merge should wait for an explicit security decision or stronger transport and content-integrity protections.

Sequence Diagram(s)

sequenceDiagram
  participant DHCPv6Client
  participant ONIEPlugin
  participant RelayMessage
  DHCPv6Client->>ONIEPlugin: Send relayed ONIE discovery request
  ONIEPlugin->>RelayMessage: Decapsulate relay message
  ONIEPlugin->>ONIEPlugin: Check BootFileURL and ONIE UserClass
  ONIEPlugin-->>DHCPv6Client: Return configured BootFileURL
Loading

Suggested reviewers: adracus

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 9 files. (2 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies both primary changes: ZTP plugin enhancements and the new ONIE boot plugin.
Description check ✅ Passed The description clearly explains the ZTP global URL and override behavior, the ONIE plugin behavior, and test coverage. It does not use the template headings or provide a linked issue, but the require…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description clearly explains the ZTP global URL and override behavior, the ONIE plugin behavior, and test coverage. It does not use the template headings or provide a linked issue, but the required change information is present.

Full details: Docstring Coverage

Explanation

Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 9 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hardikdr hardikdr added the area/metal-automation Automation processes within the Metal project. label Aug 28, 2026
@hardikdr hardikdr added this to Roadmap Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/metal-automation Automation processes within the Metal project. enhancement New feature or request ok-to-image

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants