feat(openconfig): Implement ManagementAccess provider - #485
Open
rgildein wants to merge 2 commits into
Open
Conversation
Add EnsureManagementAccess and DeleteManagementAccess to the OpenConfig provider using openconfig-system YANG paths: - gRPC server: /system/grpc-servers/grpc-server[name=gnmi]/config - SSH server: /system/ssh-server/config Unsupported fields (spec.grpc.gnmi, spec.ssh.sessionLimit) are rejected with a terminal UnsupportedFieldError, following the DNS provider pattern. Co-authored-by: Claude <noreply@anthropic.com> Signed-off-by: Robert Gildein <rgildein@users.noreply.github.com>
| Timeout uint32 `json:"timeout,omitempty"` | ||
| } | ||
|
|
||
| func (s *SSHServer) XPath() string { |
Contributor
There was a problem hiding this comment.
Suggested change
| func (s *SSHServer) XPath() string { | |
| func (*SSHServer) XPath() string { |
in such cases, we can omit the receiver variable name
Signed-off-by: Robert Gildein <rgildein@users.noreply.github.com>
Merging this branch will not change overall coverage
Coverage by fileChanged files (no unit tests)
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. |
rgildein
marked this pull request as ready for review
August 7, 2026 07:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add EnsureManagementAccess and DeleteManagementAccess to the OpenConfig provider using openconfig-system YANG paths:
Unsupported fields (spec.grpc.gnmi, spec.ssh.sessionLimit) are rejected with a terminal UnsupportedFieldError, following the DNS provider pattern.
My prompt
Claude plan
Plan: Add ManagementAccess to OpenConfig Provider
Context
The
ManagementAccessCRD manages gRPC/gNMI and SSH server access on network devices. The NX-OS provider already implementsEnsureManagementAccessandDeleteManagementAccess, but the OpenConfig provider does not. The controller already checks if a provider implementsManagementAccessProvider(defined ininternal/provider/provider.go) and sets aNotImplementedReasonstatus when it doesn't. This task wires up the OpenConfig provider to configure devices using standard OpenConfig YANG paths fromopenconfig-system-grpcandopenconfig-system.OpenConfig YANG Paths
gRPC server (named list, key:
name):SSH server (singleton container):
Implementation
New file:
internal/provider/openconfig/managementaccess.goCompile-time assertion:
Two structs implementing
gnmiext.DataElement:GRPCServer— targets the grpc-server list item named"gnmi":openconfig-system:system/grpc-servers/grpc-server[name=gnmi]/configenable,port,certificate-id(omitempty),network-instance(omitempty)spec.grpc.*SSHServer— targets the SSH server config container:openconfig-system:system/ssh-server/configenable,timeout(seconds, uint32),session-limit(uint16)spec.ssh.*Duration conversion:
spec.grpc.gnmi.keepAliveTimeoutandspec.ssh.timeoutaremetav1.Duration. Convert to seconds with.Duration.Seconds()→uint32.EnsureManagementAccess:DeleteManagementAccess:Test data file
New file:
test/gnmi/testdata/openconfig/managementaccess.txtFormat mirrors
banner.txt— Kubernetes CR in the first block, expected JSON state in the second block:Critical files
internal/provider/openconfig/managementaccess.goEnsureManagementAccess,DeleteManagementAccess,GRPCServer,SSHServerstructstest/gnmi/testdata/openconfig/managementaccess.txtReference implementations to follow:
internal/provider/openconfig/banner.go— pattern forDataElementstructs andEnsureX/DeleteXmethodsinternal/provider/cisco/nxos/provider.go—EnsureManagementAccesslogic (field mapping)internal/provider/provider.go:388—ManagementAccessProviderinterface definitionVerification
/netop-setupthen/netop-testconfig/samples/v1alpha1_managementaccess.yamlagainst an OpenConfig devicetest/gnmi/testdata/openconfig/managementaccess.txtfixture is exercised by the existing test runner intest/gnmi/main.goManagementAccessCR reachesReady=TrueconditionClaude Test results
--- Test Report — ManagementAccess / OpenConfig Provider ┌──────────────────┬──────────────────┬───────────┬───────┬──────────────────────────────────────────────────────────────┬─────────────────┐ │ CR Name │ Kind │ Namespace │ Ready │ gNMI Path │ Result │ ├──────────────────┼──────────────────┼───────────┼───────┼──────────────────────────────────────────────────────────────┼─────────────────┤ │ managementaccess │ ManagementAccess │ default │ True │ openconfig-system:system/grpc-servers/grpc-server[name=gnmi] │ ✓ value matches │ │ │ │ │ │ /config │ │ ├──────────────────┼──────────────────┼───────────┼───────┼──────────────────────────────────────────────────────────────┼─────────────────┤ │ managementaccess │ ManagementAccess │ default │ True │ openconfig-system:system/ssh-server/config │ ✓ value matches │ └──────────────────┴──────────────────┴───────────┴───────┴──────────────────────────────────────────────────────────────┴─────────────────┘ --- Applied spec (kubectl get managementaccess managementaccess -n default -o yaml): spec: deviceRef: name: leaf1 grpc: certificateId: mytrustpoint enabled: true gnmi: keepAliveTimeout: 10m0s # default — ignored by OpenConfig provider maxConcurrentCall: 8 # default — ignored by OpenConfig provider port: 9339 vrfName: mgmt ssh: enabled: true sessionLimit: 32 # default — ignored by OpenConfig provider timeout: 120s --- gnmic get openconfig-system:system/grpc-servers/grpc-server[name=gnmi]/config ────────────────────────────────────────────────────────────────────── { "certificate-id": "mytrustpoint", "enable": true, "name": "gnmi", "network-instance": "mgmt", "port": 9339 } gnmic get openconfig-system:system/ssh-server/config ────────────────────────────────────────────────────────────────────── { "enable": true, "timeout": 120 } --- Operator logs — no errors on current CR. Previous session errors (now resolved): - leafref destination '.system.grpc-servers.grpc-server{.name=="gnmi"}.config.name' is not set — caused by wrong XPath format [gnmi] instead of [name=gnmi], fixed - schema '/system/ssh-server/config' has no local leaf 'session-limit' — field not in Nokia SRL model, dropped from SSHServer struct - leafref destination '.network-instance{.name=="default"}' does not exist — device only has mgmt network instance; sample updated to use vrfName: mgmt - UnsupportedField: spec.grpc.gnmi / spec.ssh.sessionLimit — validation correctly fires when user sets non-default values for unsupported fieldsManual test result