Skip to main content
CommunityCloudEnterprise

gNMI Discovery

The gNMI discovery backend is an event-driven network discovery service that maintains long-lived gNMI subscriptions and ingests device, interface, and hardware-inventory changes into NetBox via Diode within seconds of them occurring.

Unlike SNMP/NAPALM-based polling, gnmi_discovery reacts to ON_CHANGE notifications from the device itself (with SAMPLE and GET fallback for devices that don't support streaming), so NetBox stays up to date continuously rather than on a polling interval.

Diode Entities

The gNMI discovery backend uses the Diode Go SDK to ingest the following entities:

  • Device (with DeviceType, Platform, and serial/manufacturer enrichment)
  • Interface
  • Module / ModuleBay (hardware inventory)
  • IP Address
  • VRF

Configuration

The gnmi_discovery backend requires no special configuration; host and port may be overridden. It uses the diode settings from the common subsection to forward discovery results.

orb:
backends:
common:
diode:
target: grpc://192.168.0.100:8080/diode
client_id: ${DIODE_CLIENT_ID}
client_secret: ${DIODE_CLIENT_SECRET}
agent_name: agent01
gnmi_discovery:
host: 192.168.5.11 # default localhost
port: 8076 # default 8075
log_level: ERROR # default INFO
log_format: JSON # default TEXT
profiles_dir: /opt/orb/gnmi-profiles # optional: directory of gNMI profile overrides
otel_export_period: 30 # optional: seconds between OpenTelemetry metric exports (default 10)
ParameterTypeRequiredDescription
hoststrnoREST API host (default localhost)
portintnoREST API port (default 8075)
log_levelstrnoLog level: DEBUG/INFO/WARN/ERROR (default INFO)
log_formatstrnoLog format: TEXT or JSON (default TEXT)
profiles_dirstrnoDirectory of gNMI profile overrides (empty = embedded profiles only)
otel_export_periodintnoSeconds between OpenTelemetry metric exports (default 10)

Policy

gNMI discovery policies are broken into two subsections: config and scope.

Config

config defines behavior for the whole policy and is optional overall.

ParameterTypeRequiredDescription
modestrnoDelivery mode: auto (default), on_change, sample, or get. auto negotiates the best mode per target (ON_CHANGE → SAMPLE → GET).
debounce_msintnoFlush delay in ms after the last notification before a snapshot is ingested (default 2000).
sample_interval_msintnoSAMPLE subscription interval in ms (default 300000 = 5m).
get_interval_msintnoGET poll interval in ms (default 900000 = 15m).
optionsmapnoPer-policy toggles. capture_config (bool) captures the CONFIG datastore into Device.config.running (default off).
defaultsmapnoNetBox defaults applied to discovered entities (see below).

Defaults

KeyTypeDescription
sitestrNetBox site (default undefined)
rolestrNetBox device role (default undefined)
locationstrNetBox location (optional)
tagslistNetBox tags applied to all entities
devicemapDevice overrides: manufacturer, model, platform, comments, tags
interfacemapInterface defaults: if_type (fallback type, default other), description, tags
ip_addressmapIP address defaults: role, tenant, description, comments, tags
vrfmapVRF defaults: tenant, description, comments, tags (name/RD come from discovery)
interface_patternslistName-regex → NetBox type, highest precedence (first match wins).
interface_exclude_patternslistName-regex; matching interfaces are skipped entirely.

Scope

scope defines the list of gNMI targets to discover.

ParameterTypeRequiredDescription
targetslistyesThe gNMI endpoints to subscribe to (see target fields below).

Target

KeyTypeRequiredDescription
hoststryeshost:port of the gNMI endpoint (e.g. 10.0.0.11:6030). When the port is omitted, the IANA gNMI port 9339 is used.
usernamestrnogNMI username. ${ENV_VAR} syntax is supported.
passwordstrnogNMI password. ${ENV_VAR} syntax is supported.
tlsmapnoTLS settings: skip_verify (keep TLS, don't verify the cert), insecure (opt-in PLAINTEXT, off by default), ca/cert/key (optional mTLS). TLS with system root CAs is the default.
modestrnoPer-target delivery mode override (auto/on_change/sample/get).
profilestrnoPin a gNMI profile (auto-detected when omitted).
originstrnogNMI path origin (default openconfig); set "" for origin-less paths.
netbox_idintnoPin discovery to an existing NetBox device ID.
override_defaultsmapnoPer-target overrides of the policy defaults.

Interface type discovery

Each interface's NetBox type is resolved per interface, in precedence order:

  1. interface_exclude_patterns — a name matching any regex is skipped (no interface emitted).
  2. interface_patterns — the first matching regex assigns its type (wins over the rest).
  3. OpenConfig state/type — the discovered identityref maps to a NetBox type for structural families (LAG → lag; loopback/VLAN/tunnel/prop-virtual → virtual).

Sample

A sample policy exercising the common gNMI discovery parameters.

orb:
...
policies:
gnmi_discovery:
gnmi_fabric:
config:
mode: auto
debounce_ms: 2000
defaults:
site: New York NY
role: Router
tags: [gnmi-discovery, orb-agent]
interface_patterns:
- match: "^Ethernet"
type: 10gbase-x-sfpp
interface_exclude_patterns:
- "^Management"
scope:
targets:
- host: 10.0.0.11:6030 # Arista EOS default gNMI port
username: ${GNMI_USER}
password: ${GNMI_PASS}
tls:
skip_verify: true
profile: arista_eos
- host: 10.0.0.21:57400 # Nokia SR-OS default gNMI port
username: admin
password: ${GNMI_PASS}