You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/gnoi-native-grpc-design.md
+70-19Lines changed: 70 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,23 +2,23 @@
2
2
3
3
## TL;DR
4
4
5
-
`gnoi_shutdown_daemon` issues gNOI RPCs by shelling out to `docker exec gnmi gnoi_client`. This is fragile, opaque, and already causing silent failures. Replace with direct Python gRPC calls using vendored proto stubs.
5
+
`gnoi_shutdown_daemon` issues gNOI RPCs by shelling out to `docker exec gnmi gnoi_client`. This introduces several layers of indirection that make failures hard to diagnose and completion detection unreliable. This document proposes replacing the subprocess path with direct Python gRPC calls using vendored proto stubs.
6
6
7
-
## 1. Why This Pattern Is Bad
7
+
## 1. Limitations of the Current Approach
8
8
9
-
|Problem|Impact|
10
-
|---------|--------|
11
-
| Requires `gnmi` container running and healthy | DPU shutdown silently fails if gnmi is restarting|
12
-
| Subprocess + Docker CLI overhead per RPC | Extra process creation, Docker round-trip, stdout capture |
13
-
| Output is unstructured text with a header line |Any format change in`gnoi_client` breaks parsing|
14
-
| gRPC status codes are lost | Caller only sees `rc != 0` — no code, no details |
15
-
| Errors are Go `panic()` stack traces on stderr |Production diagnosis requires SSH + manual docker exec |
16
-
|`suppress_stderr=True`discards those panics | Error output goes to `/dev/null`, logs say only "command failed" |
17
-
|String matching for completion detection|`"reboot complete" in out_s.lower()`doesn't match actual output (see §2) |
18
-
| Tight coupling to CLI flag interface |`-module System -rpc Reboot -jsonin '{...}'`is a serialization layer we don't need|
19
-
|Security surface | Shell-out through Docker CLI is wider than a direct gRPC socket |
9
+
|Observation|Consequence|
10
+
|-------------|-------------|
11
+
| Requires NPU `gnmi` container running and healthy | DPU shutdown depends on an unrelated NPU container's availability, even though the RPC target is the DPU's own gnmi server|
12
+
| Subprocess + Docker CLI overhead per RPC | Extra process creation, Docker round-trip, stdout capture on each call |
13
+
| Output is unstructured text with a header line |Parsing is coupled to`gnoi_client`'s print format, which has no stability guarantee|
14
+
| gRPC status codes are not propagated | Caller only sees `rc != 0` — no status code, no error details |
15
+
| Errors surface as Go `panic()` stack traces on stderr |Diagnosing RPC failures requires SSH + manual docker exec |
16
+
|`suppress_stderr=True`on the Reboot call | Panic output is discarded; logs show only "command failed" |
17
+
|Completion check uses string matching|`"reboot complete" in out_s.lower()`does not match actual output format (see §2) |
18
+
| Tight coupling to CLI flag interface |`-module System -rpc Reboot -jsonin '{...}'`adds a serialization layer between caller and protobuf|
19
+
|Broader privilege surface | Shell-out through Docker CLI vs. a direct gRPC socket |
**Correct completion check** — inspect `resp.active` and `resp.status.status` directly instead of string matching.
81
+
82
+
**Removes unnecessary NPU gnmi container dependency** — the current approach shells into the NPU's `gnmi` container to run `gnoi_client`, but there's no reason the NPU daemon needs the NPU gnmi container as an intermediary. The DPU's own gnmi server is the actual RPC endpoint; direct gRPC connects to it without involving the NPU container.
83
+
84
+
**Scales to future RPCs** — the same pattern extends to any gNOI or gNMI call without adding more subprocess wrappers:
85
+
```python
86
+
# Adding a new gNOI RPC is just another method on the client
87
+
classGnoiClient:
88
+
defreboot(self, ...): ...
89
+
defreboot_status(self, ...): ...
90
+
defcancel_reboot(self, ...): ...# future
91
+
defsystem_time(self, ...): ...# future
92
+
93
+
# Or a gNMI client alongside it
94
+
with GnmiClient(f"{dpu_ip}:{port}") as client:
95
+
client.get(path="/system/state/...")
96
+
```
97
+
Each new RPC is a typed method with protobuf request/response — no new shell commands, no new output formats to parse.
66
98
67
99
## 4. Scope
68
100
@@ -72,6 +104,25 @@ if not resp.active and resp.status.status == STATUS_SUCCESS:
72
104
- Refactor the two RPC call sites in `GnoiRebootHandler`
0 commit comments