Skip to content

Add LLDP configuration brick #179

Closed
nikatza wants to merge 4 commits intomainfrom
cable-checker
Closed

Add LLDP configuration brick #179
nikatza wants to merge 4 commits intomainfrom
cable-checker

Conversation

@nikatza
Copy link
Contributor

@nikatza nikatza commented Feb 5, 2026

This PR enables LLDP configuration for Cisco devices. Notice that OpenConfig and Cisco models deviate from each other, and thus the provider-agnostic resource is reduced to a minimum set of properties.

OpenConfig model
Cisco DME LLDP Instance
Cisco DME LLDP per-interface configuration

@hardikdr hardikdr added the area/metal-automation Automation processes within the Metal project. label Feb 6, 2026
@hardikdr hardikdr added this to Roadmap Feb 6, 2026
@nikatza nikatza force-pushed the cable-checker branch 4 times, most recently from fdf5acc to c31e40e Compare February 11, 2026 15:37
@nikatza nikatza marked this pull request as ready for review February 11, 2026 15:46
@nikatza nikatza requested a review from a team as a code owner February 11, 2026 15:46
Comment on lines +321 to +330
// only cisco/nx for the moment
if gvk == nxv1alpha1.GroupVersion.WithKind("LLDPConfig") {
lc := new(nxv1alpha1.LLDPConfig)
if err := s.ProviderConfig.Into(lc); err != nil {
return reconcile.TerminalError(fmt.Errorf("failed to parse provider config into LLDPConfig: %w", err))
}
if err := r.validateProviderConfigNXOS(ctx, lc, s); err != nil {
return reconcile.TerminalError(fmt.Errorf("configuration error in provider config ref %w", err))
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

With this we are leaking the Cisco NX-OS specific implementation into the core and thus break our provider pattern, where usually the core would not contain anything that is specific to one platform..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is now handled different, with package providerconfig (subject to name change)

@nikatza nikatza force-pushed the cable-checker branch 8 times, most recently from d807522 to 2ecded4 Compare March 2, 2026 12:59
@nikatza nikatza requested a review from felix-kaestner March 2, 2026 13:41
@nikatza nikatza force-pushed the cable-checker branch 6 times, most recently from 63cc96c to ca4084e Compare March 4, 2026 09:52
@nikatza nikatza marked this pull request as draft March 4, 2026 09:58
@nikatza nikatza force-pushed the cable-checker branch 3 times, most recently from 4455b1d to 5bacff0 Compare March 4, 2026 10:21
@nikatza nikatza force-pushed the cable-checker branch 5 times, most recently from 95fad0f to 3087af9 Compare March 4, 2026 10:51
@nikatza nikatza marked this pull request as ready for review March 4, 2026 10:52
nikatza added 4 commits March 4, 2026 12:00
* Introduces the LLDP type and controller to configure Link Layer
  Discovery Protocol on network devices.
* Add type `LLDPConfig` for NXOS. Allows per-interface control of LLDP
  PDU tx/rx and global timing parameters (holdTime, initDelay).
* This package introduces a registry pattern for functions scoped to
  provider-specific objects. For example, controllers can use these
functions to validate provider-specific configs without them requiring
details of the implementation.
* We introduce this package as a stand-alone package to avoid adding a
  dependency to the k8s client in the provider implementation(s).
* Enables/disables LLDP feature and configures global and per-interface
  settings on Cisco NX-OS switches.
@github-actions
Copy link

github-actions bot commented Mar 4, 2026

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

Impacted Packages Coverage Δ 🤖
github.com/ironcore-dev/network-operator/api/cisco/nx/v1alpha1 0.00% (ø)
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 62.94% (+0.69%) 👍
github.com/ironcore-dev/network-operator/internal/provider 51.85% (+3.85%) 👍
github.com/ironcore-dev/network-operator/internal/provider/cisco/nxos 10.69% (-0.18%) 👎
github.com/ironcore-dev/network-operator/internal/providerconfig 100.00% (+100.00%) 🌟
github.com/ironcore-dev/network-operator/internal/providerconfig/cisco/nx 80.00% (+80.00%) 🌟

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/ironcore-dev/network-operator/api/cisco/nx/v1alpha1/lldpconfig_types.go 0.00% (ø) 0 0 0
github.com/ironcore-dev/network-operator/api/cisco/nx/v1alpha1/zz_generated.deepcopy.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/lldp_types.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/lldp_controller.go 73.71% (+73.71%) 175 (+175) 129 (+129) 46 (+46) 🌟
github.com/ironcore-dev/network-operator/internal/provider/cisco/nxos/lldp.go 66.67% (+66.67%) 3 (+3) 2 (+2) 1 (+1) 🌟
github.com/ironcore-dev/network-operator/internal/provider/cisco/nxos/provider.go 0.07% (-0.00%) 1538 (+52) 1 1537 (+52) 👎
github.com/ironcore-dev/network-operator/internal/provider/provider.go 51.85% (+3.85%) 27 (+2) 14 (+2) 13 👍
github.com/ironcore-dev/network-operator/internal/providerconfig/cisco/nx/lldpconfig.go 80.00% (+80.00%) 30 (+30) 24 (+24) 6 (+6) 🌟
github.com/ironcore-dev/network-operator/internal/providerconfig/validation_registry.go 100.00% (+100.00%) 10 (+10) 10 (+10) 0 🌟

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/lldp_controller_test.go
  • github.com/ironcore-dev/network-operator/internal/controller/core/suite_test.go
  • github.com/ironcore-dev/network-operator/internal/provider/cisco/nxos/lldp_test.go
  • github.com/ironcore-dev/network-operator/internal/providerconfig/cisco/nx/lldpconfig_test.go
  • github.com/ironcore-dev/network-operator/internal/providerconfig/validation_registry_test.go

@nikatza
Copy link
Contributor Author

nikatza commented Mar 4, 2026

It has been decided to drop support for more complex per-interface config. I will open a different PR for it.

@nikatza nikatza closed this Mar 4, 2026
@github-project-automation github-project-automation bot moved this to Done in Roadmap Mar 4, 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.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants