Skip to content

Add SetBuilder for batched gNMI Set operations - #445

Merged
felix-kaestner merged 3 commits into
mainfrom
refactor/gnmiext
Aug 11, 2026
Merged

Add SetBuilder for batched gNMI Set operations#445
felix-kaestner merged 3 commits into
mainfrom
refactor/gnmiext

Conversation

@felix-kaestner

Copy link
Copy Markdown
Contributor

Introduce a SetBuilder type that accumulates update, patch, and delete operations to be executed as a single gNMI Set RPC via the new Client.Do method. This allows atomic multi-operation commits without multiple round-trips to the device.

An optional Limit method controls the maximum number of operations per SetRequest, splitting into multiple RPCs when set.

Comment thread internal/transport/gnmiext/client.go
@felix-kaestner
felix-kaestner force-pushed the refactor/gnmiext branch 2 times, most recently from 9b6aad6 to b4aa0bc Compare July 16, 2026 08:41
@github-actions github-actions Bot added size/XXL and removed size/L labels Jul 16, 2026
@felix-kaestner
felix-kaestner force-pushed the refactor/gnmiext branch 2 times, most recently from 3d387c8 to e274257 Compare July 24, 2026 15:35
Comment thread internal/provider/cisco/nxos/provider.go Fixed
Comment thread internal/provider/cisco/nxos/provider.go Fixed
@felix-kaestner
felix-kaestner force-pushed the refactor/gnmiext branch 2 times, most recently from d29855e to 19fa61e Compare July 31, 2026 14:42
Comment thread internal/transport/gnmiext/client.go Outdated
@felix-kaestner
felix-kaestner force-pushed the refactor/gnmiext branch 2 times, most recently from e11e327 to 93fb9da Compare August 10, 2026 14:15

@IvoGoman IvoGoman left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Metric namespace would be nice to have. Comments about readability are up to you.

Comment thread internal/transport/gnmiext/client.go Outdated
Comment thread internal/transport/gnmiext/client.go
Comment thread internal/transport/gnmiext/metrics.go Outdated
Comment thread internal/transport/gnmiext/client.go Outdated
Comment thread internal/transport/gnmiext/client.go Outdated
Comment thread internal/transport/gnmiext/client.go
Introduce a SetBuilder type that accumulates update, patch, and
delete operations to be executed as a single gNMI Set RPC via the
new Client.Do method. This allows atomic multi-operation commits
without multiple round-trips to the device.

An optional Limit method controls the maximum number of operations
per SetRequest, splitting into multiple RPCs when set.

Signed-off-by: Felix Kästner <felix.kaestner@sap.com>
Register three metrics with controller-runtime's metrics registry:
- gnmi_operations_total: per-operation counter with target, rpc,
  operation, path, and status labels
- gnmi_rpc_duration_seconds: histogram of actual gNMI RPC latency
- gnmi_operations_skipped_total: counter for diff-skipped operations

Operation metrics are derived from the SetRequest after the RPC
completes, ensuring the status label reflects the actual outcome.

Add WithTarget option to associate a device address with metrics
for correlating slow-responding devices.

Signed-off-by: Felix Kästner <felix.kaestner@sap.com>
Add go:generate directive to produce a ClientMock using moq with
panic-on-unset and call-tracking resets. Register moq as a Go 1.24+
tool dependency in go.mod.

Replace the hand-rolled MockClient in the IOS-XR provider tests
with the generated gnmiext.ClientMock.

Signed-off-by: Felix Kästner <felix.kaestner@sap.com>
@github-actions

Copy link
Copy Markdown

Merging this branch will decrease overall coverage

Impacted Packages Coverage Δ 🤖
github.com/ironcore-dev/network-operator/internal/provider/cisco/iosxr 34.81% (ø)
github.com/ironcore-dev/network-operator/internal/transport/gnmiext 59.27% (-30.15%) 💀 💀 💀

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/ironcore-dev/network-operator/internal/transport/gnmiext/client.go 87.79% (+0.05%) 213 (+58) 187 (+51) 26 (+7) 👍
github.com/ironcore-dev/network-operator/internal/transport/gnmiext/client_mock.go 0.00% (ø) 126 (+126) 0 126 (+126)
github.com/ironcore-dev/network-operator/internal/transport/gnmiext/metrics.go 70.00% (+70.00%) 10 (+10) 7 (+7) 3 (+3) 🌟

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/provider/cisco/iosxr/provider_test.go
  • github.com/ironcore-dev/network-operator/internal/transport/gnmiext/client_test.go

@felix-kaestner
felix-kaestner merged commit b49369d into main Aug 11, 2026
24 checks passed
@felix-kaestner
felix-kaestner deleted the refactor/gnmiext branch August 11, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants