How google/gnxi works
Project type and purpose
• This is a monorepo of command-line tools, servers (targets), and testing/orchestration infrastructure implementing and exercising the gNMI and gNOI gRPC-based network management protocols.
• It includes:
• Go-based gNMI clients (Capabilities, Get, Set, Subscribe)
• A Go-based gNMI Target server
• Go-based gNOI clients (Cert, OS, Reset) and a gNOI Target server
• A Python gNMI CLI
• A Python-based configuration validator (oc_config_validate)
• A test harness (“gnxi_tester”) with Go orchestrator, Docker integration, and Angular web UI
• Utility packages (credentials, mockOS, XPath, cert generation)
File structure
• Top-level folders each correspond to a self-contained binary or library:
• /gnmi – Go library for gNMI protocol (models, server, utilities)
• /gnmi_* – individual Go clients and the Go gNMI target server
• /gnoi – core Go library for gNOI sub-services (cert, os, reset)
• /gnoi_* – Go clients and Go gNOI target server
• /gnmi_cli_py – Python client implementation
• /oc_config_validate – Python package implementing config validation, testcases, and models
• /gnxi_tester – Go CLI, orchestrator (Docker), web server, config, plus /web_ui Angular application
• /utils – shared helper libraries (credentials, entity, mockos, xpath)
• /certs – certificate generation scripts
• Configuration files: Dockerfiles, docker-compose.yml, Go modules (go.mod/sum), Python requirements, Angular CLI files.
README for additional insights
• Confirms this is a reference/test implementation of gNMI/gNOI.
• Lists all clients and servers.
• Mentions code generation (proto → Go/Python stubs) and certificate generation.
a. Main components
• gNMI Library (Go): model.go, server.go, utility code
• gNOI Library (Go): cert, os, reset sub-packages
• CLI Clients:
• Go binaries: gnmi_capabilities, gnmi_get, gnmi_set, gnmi_subscribe, gnoi_cert, gnoi_os, gnoi_reset
• Python binary: gnmi_cli_py
• Target Servers:
• Go gNMI Target (gnmi_target)
• Go gNOI Target (gnoi_target)
• Mock servers: utils/mockos, gnoi_mockos
• Validation Tool: oc_config_validate (Python)
• Test Harness: gnxi_tester
• Orchestrator (Go) → spins up Docker containers running target servers
• Web Server (Go) → REST/WS endpoints for UI
• Angular Web UI (gnxi_tester/web_ui)
• Shared Utilities: utils/credentials, utils/entity, utils/xpath
• Certificate Generation: certs/generate.sh
b. Relationships and interactions
• CLI Clients ←[gRPC over TLS]→ Target Servers
• Python Validator ←[gRPC over TLS]→ Target Servers
• gnxi_tester Orchestrator ←[Docker API]→ Containers (running servers)
• Web UI ←[HTTP/REST or WebSocket]→ Go web server
• Go web server ←[exec or API]→ CLI binaries to perform tests
• All use shared codegen outputs (proto → Go/Python stubs in gnmi/, gnoi/)
• Certificate generator produces certs for TLS between clients and servers
c. Architectural patterns / design principles
• Microservice style: each client and server is a separate process/binary
• Shared libraries for protocol handling (proto stubs) and utilities
• Clear separation of concerns: protocol libs vs. CLIs vs. servers vs. test harness
• Test harness orchestrates and aggregates components using containers
d. Key technologies
• Go modules, gRPC, Protocol Buffers, glog
• Python 3, grpcio, pytest
• Docker, docker-compose
• Angular CLI, TypeScript, Karma/Protractor
• Shell scripts for certs and fixtures
Essential details to capture
• Proto code generation → shared stub libraries
• Certificate generation and usage for TLS
• How the test harness spins up real server instances in Docker and runs clients against them
• The Web UI’s relationship to the Go web server and underlying orchestrator