Skip to content

Implement NX-OS reprovisioning via NX-API#381

Open
felix-kaestner wants to merge 2 commits into
mainfrom
chore/nxos-reprovision
Open

Implement NX-OS reprovisioning via NX-API#381
felix-kaestner wants to merge 2 commits into
mainfrom
chore/nxos-reprovision

Conversation

@felix-kaestner

Copy link
Copy Markdown
Contributor

Replace the defunct GNMI-based reprovisioning with NXAPI JSON-RPC calls. The new implementation issues two requests:

  1. boot poap enable + copy running-config startup-config (batched with stop-on-error rollback)
  2. reload (separate request that tolerates transport errors because the device goes down before responding)

Add nxapi.IsTransportError to distinguish network-level errors (EOF, timeout, connection reset) from logical errors (RPCError, HTTPError), enabling callers of disruptive commands to tolerate expected connection drops.

Remove the now unused BootPOAP GNMI type.

@felix-kaestner felix-kaestner requested a review from a team as a code owner May 27, 2026 16:52
@felix-kaestner felix-kaestner force-pushed the chore/nxos-reprovision branch from 9ac1150 to 48f2d50 Compare May 28, 2026 08:30
@github-actions

Copy link
Copy Markdown

Merging this branch will increase overall coverage

Impacted Packages Coverage Δ 🤖
github.com/ironcore-dev/network-operator/internal/provider/cisco/nxos 10.39% (+0.44%) 👍
github.com/ironcore-dev/network-operator/internal/transport/nxapi 90.91% (+19.08%) 🎉

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/ironcore-dev/network-operator/internal/provider/cisco/nxos/provider.go 0.67% (+0.62%) 1781 (+2) 12 (+11) 1769 (-9) 👍
github.com/ironcore-dev/network-operator/internal/provider/cisco/nxos/system.go 3.33% (+0.11%) 30 (-1) 1 29 (-1) 👍
github.com/ironcore-dev/network-operator/internal/transport/nxapi/nxapi.go 90.91% (+19.08%) 77 (+6) 70 (+19) 7 (-13) 🎉

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/nxos/reprovision_test.go
  • github.com/ironcore-dev/network-operator/internal/transport/nxapi/nxapi_test.go

Replace the defunct GNMI-based reprovisioning with NXAPI
JSON-RPC calls. The new implementation issues two requests:

1. boot poap enable + copy running-config startup-config
   (batched with stop-on-error rollback)
2. reload (separate request that tolerates transport errors
   because the device goes down before responding)

Add nxapi.IsTransportError to distinguish network-level
errors (EOF, timeout, connection reset) from logical errors
(RPCError, HTTPError), enabling callers of disruptive
commands to tolerate expected connection drops.

Remove the now unused BootPOAP GNMI type.

Signed-off-by: Felix Kästner <felix.kaestner@sap.com>
Move the maintenance annotation deletion to after the switch
statement so it is only removed when the action succeeds. This
allows the reconciler to retry failed maintenance operations on
the next reconciliation instead of requiring the user to
re-apply the annotation.

Additionally, return a terminal error for unknown maintenance
actions since retrying will never succeed.

Signed-off-by: Felix Kästner <felix.kaestner@sap.com>
@felix-kaestner felix-kaestner force-pushed the chore/nxos-reprovision branch from 48f2d50 to 72080cf Compare June 19, 2026 12:14
@felix-kaestner felix-kaestner marked this pull request as ready for review June 19, 2026 12:15
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.

1 participant