Skip to content

Add dhcp relay to l3 interfaces#256

Open
nikatza wants to merge 6 commits intomainfrom
add-dhcp-relay-to-l3-interfaces
Open

Add dhcp relay to l3 interfaces#256
nikatza wants to merge 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 from f837bd3 to c687310 Compare March 26, 2026 14:53
@github-actions
Copy link
Copy Markdown

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.06% (+0.43%) 👍
github.com/ironcore-dev/network-operator/internal/provider 52.00% (ø)
github.com/ironcore-dev/network-operator/internal/provider/cisco/nxos 10.44% (-0.18%) 👎

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 62.22% (+62.22%) 270 (+270) 168 (+168) 102 (+102) 🌟
github.com/ironcore-dev/network-operator/internal/controller/core/lldp_controller.go 68.00% (-0.14%) 200 (-4) 136 (-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%) 1589 (+35) 1 1588 (+35) 👎
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/suite_test.go

@nikatza nikatza force-pushed the add-dhcp-relay-to-l3-interfaces branch from c687310 to c4fb79a Compare March 27, 2026 16:05
nikatza added 6 commits March 27, 2026 17:10
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 c4fb79a to e6893ec Compare March 27, 2026 16:10
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: No status

Development

Successfully merging this pull request may close these issues.

3 participants