Skip to content

Add dhcp relay to l3 interfaces#256

Merged
nikatza merged 6 commits intomainfrom
add-dhcp-relay-to-l3-interfaces
Apr 2, 2026
Merged

Add dhcp relay to l3 interfaces#256
nikatza merged 6 commits intomainfrom
add-dhcp-relay-to-l3-interfaces

Conversation

@nikatza
Copy link
Copy Markdown
Contributor

@nikatza nikatza commented Mar 24, 2026

No description provided.

@hardikdr hardikdr added the area/switch-automation Automation processes for network switch management and operations. label Mar 25, 2026
@hardikdr hardikdr added this to Roadmap Mar 25, 2026
@nikatza nikatza force-pushed the add-dhcp-relay-to-l3-interfaces branch 3 times, most recently from 02eab6f to f30d465 Compare March 25, 2026 11:10
@nikatza nikatza marked this pull request as ready for review March 25, 2026 11:11
@nikatza nikatza requested a review from a team as a code owner March 25, 2026 11:11
@nikatza nikatza force-pushed the add-dhcp-relay-to-l3-interfaces branch 5 times, most recently from 8187976 to 07e796b Compare March 25, 2026 12:59
@nikatza nikatza force-pushed the add-dhcp-relay-to-l3-interfaces branch from 07e796b to eb1d240 Compare March 25, 2026 16:19
@nikatza nikatza force-pushed the add-dhcp-relay-to-l3-interfaces branch 2 times, most recently from 790fdb4 to f837bd3 Compare March 26, 2026 11:14
@nikatza nikatza requested a review from felix-kaestner March 26, 2026 14:03
@nikatza nikatza force-pushed the add-dhcp-relay-to-l3-interfaces branch 3 times, most recently from c4fb79a to e6893ec Compare March 27, 2026 16:10
@nikatza nikatza force-pushed the add-dhcp-relay-to-l3-interfaces branch from e6893ec to ad2171f Compare March 30, 2026 12:55
@nikatza nikatza marked this pull request as draft March 30, 2026 12:58
@nikatza nikatza force-pushed the add-dhcp-relay-to-l3-interfaces branch from ad2171f to 785df40 Compare March 30, 2026 13:17
@nikatza nikatza marked this pull request as ready for review March 30, 2026 13:26
@nikatza nikatza force-pushed the add-dhcp-relay-to-l3-interfaces branch 2 times, most recently from 1fd869b to f0cb070 Compare April 1, 2026 09:15
@nikatza nikatza force-pushed the add-dhcp-relay-to-l3-interfaces branch 4 times, most recently from 9f2ca16 to 5da55c7 Compare April 1, 2026 12:40
@felix-kaestner
Copy link
Copy Markdown
Contributor

@nikatza would you be able to run a 'make fmt' once over the changes?

@nikatza nikatza force-pushed the add-dhcp-relay-to-l3-interfaces branch from 5da55c7 to f38e567 Compare April 2, 2026 12:52
nikatza added 6 commits April 2, 2026 14:53
Add core types to configure DHCP relay on L3 interfaces.

The DHCPRelay resource is device-scoped (one per device) and references
a list of Layer 3 interfaces where DHCP relay should be enabled, along
with the DHCP server addresses.

Supported interface types are Physical, Aggregate, and RoutedVLAN (Layer
3 SVIs). The controller will validate that all referenced interfaces
belong to the same device and are configured with IPv4 addressing.

The optional VrfRef field allows specifying which VRF context should be
used when forwarding DHCP messages to the servers.
The controller validates that the referenced Device exists and is not
paused, that all InterfaceRefs belong to the same device and are Layer 3
interfaces (Physical, Aggregate, or RoutedVLAN types) with IPv4
configuration, and that the optional VrfRef belongs to the same device.

It enforces that only one DHCPRelay resource exists per device.

The controller retrieves the list of interfaces that have DHCP relay
configured on the device and updates the ConfiguredInterfaceRefs status
field.

The controller watches for Device Paused field changes, Interface Ready
condition changes, VRF Ready condition changes, and ProviderConfig
updates to trigger re-reconciliation when dependencies change.

The controller considers only the Configuration condition of the
referenced resources as DHCPRelay is a configuration resource only.
Enable or disable the DHCP feature based on AdminState. When enabled,
configure DHCP relay on each referenced interface with the specified
server addresses.

The provider uses the VRF context from VrfRef (or the NXOS default
"!unspecified" if no VRF is specified) when configuring server
addresses.

The implementation uses the Update operation to ensure stale DHCP relay
entries are removed when the configuration changes. This also affects
entries referencing interfaces not managed by the operator.

The entire tree is removed on deletion, affecting non-managed interfaces.,
It leaves the DHCP feature in its current state.

GetDHCPRelayStatus queries the device for all interfaces with DHCP relay
configured and returns their names.
SA1019: LoadCertificate is deprecated but we still it on NXOS
@nikatza nikatza force-pushed the add-dhcp-relay-to-l3-interfaces branch from f38e567 to 2fdd75a Compare April 2, 2026 12:53
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 2, 2026

Merging this branch changes the coverage (1 decrease, 1 increase)

Impacted Packages Coverage Δ 🤖
github.com/ironcore-dev/network-operator/api/core/v1alpha1 0.00% (ø)
github.com/ironcore-dev/network-operator/cmd 0.00% (ø)
github.com/ironcore-dev/network-operator/internal/controller/core 63.27% (+0.12%) 👍
github.com/ironcore-dev/network-operator/internal/provider 52.00% (ø)
github.com/ironcore-dev/network-operator/internal/provider/cisco/nxos 10.36% (-0.16%) 👎

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/ironcore-dev/network-operator/api/core/v1alpha1/dhcprelay_types.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/api/core/v1alpha1/groupversion_info.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/api/core/v1alpha1/zz_generated.deepcopy.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/cmd/main.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/internal/controller/core/dhcprelay_controller.go 61.78% (+61.78%) 259 (+259) 160 (+160) 99 (+99) 🌟
github.com/ironcore-dev/network-operator/internal/controller/core/lldp_controller.go 67.84% (-0.14%) 199 (-4) 135 (-3) 64 (-1) 👎
github.com/ironcore-dev/network-operator/internal/provider/cisco/nxos/cert.go 3.33% (ø) 30 1 29
github.com/ironcore-dev/network-operator/internal/provider/cisco/nxos/dhcprelay.go 0.00% (ø) 3 (+3) 0 3 (+3)
github.com/ironcore-dev/network-operator/internal/provider/cisco/nxos/provider.go 0.06% (-0.00%) 1610 (+31) 1 1609 (+31) 👎
github.com/ironcore-dev/network-operator/internal/provider/provider.go 52.00% (ø) 25 13 12

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/ironcore-dev/network-operator/internal/controller/core/dhcprelay_controller_test.go
  • github.com/ironcore-dev/network-operator/internal/controller/core/lldp_controller_test.go
  • github.com/ironcore-dev/network-operator/internal/controller/core/suite_test.go

@nikatza nikatza merged commit 4d22cc1 into main Apr 2, 2026
10 checks passed
@nikatza nikatza deleted the add-dhcp-relay-to-l3-interfaces branch April 2, 2026 13:40
@github-project-automation github-project-automation bot moved this to Done in Roadmap Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/switch-automation Automation processes for network switch management and operations.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants