Skip to content

gnoi_shutdown_daemon: Replace docker exec gnoi_client with native gRPC calls #360

Description

@sigabrtv1-ui

Summary

The gnoi_shutdown_daemon currently makes gNOI System RPCs (Reboot HALT and RebootStatus) by shelling out to docker exec gnmi gnoi_client .... This creates an unnecessary dependency on the gnmi container being healthy, adds subprocess overhead, and relies on fragile stdout parsing.

Proposal

Replace the subprocess-based gnoi_client invocations with direct Python gRPC calls using generated protobuf stubs for the OpenConfig gNOI System service.

Key changes:

  1. Vendor gNOI System proto stubs (system_pb2.py, system_pb2_grpc.py)
  2. Add a lightweight GnoiClient wrapper for Reboot and RebootStatus RPCs
  3. Refactor GnoiRebootHandler to use native gRPC instead of docker exec
  4. Remove execute_command() subprocess helper (no longer needed)
  5. Update tests to mock at the gRPC stub level

Benefits:

  • No dependency on gnmi container being running
  • Structured error handling via gRPC status codes
  • No subprocess overhead or stdout parsing
  • Smaller attack surface (no shell-out through Docker CLI)

Design Doc

See doc/gnoi-native-grpc-design.md in this repository for the full design.

Implementation Plan

Single PR covering all phases — proto stubs, client wrapper, daemon refactor, and test updates.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions