gNMI and gRPC dial-out alarms
Stream ReadyLinks switch alarms to a gNMI collector with an ON_CHANGE subscription, either directly or through the switch's gRPC dial-out tunnel. Covers paths, payload, TLS and mTLS, CLI, and a gnmic example.
The switch runs a gNMI server. A collector that subscribes ON_CHANGE to /readylinks-rlos:notification-status receives every alarm that is also sent as a NETCONF notification. There are two ways to reach the server:
| Mode | Who connects | Use when |
|---|---|---|
| Dial-in | The collector connects to the switch on TCP 10000 | The collector can reach the switch |
| Dial-out | The switch connects out to your tunnel server on TCP 10001, and the collector's gNMI session runs inside that tunnel | The switch is behind NAT or a firewall that blocks inbound connections |
Dial-out uses the OpenConfig grpctunnel protocol. Up to two dial-out servers can be set.
#Subscription
| Field | Value |
|---|---|
| RPC | gNMI.Subscribe |
SubscriptionList.mode | STREAM |
Subscription.mode | ON_CHANGE |
Subscription.path | /readylinks-rlos:notification-status. The first element must carry the module prefix |
prefix | Not used. Put the full path in each subscription |
| Encoding | The switch always replies with json_val |
- One subscription per request. The switch serves only the first
ON_CHANGEsubscription in aSubscribeRequest. Use one request for alarms, and separate requests for anything else. - No initial sync. No
sync_responseis sent. The stream stays quiet until the first alarm. - No authentication. The gNMI server does not check a username or password. Access is controlled by TLS or mTLS (see Security).
#Payload
Each alarm arrives as one SubscribeResponse.update:
| Field | Value |
|---|---|
timestamp | Time the switch sent the update, in nanoseconds since the Unix epoch |
prefix | Unset |
update[0].path | The path from your subscription |
update[0].val.json_val | A JSON object with one key, the leaf name, set to the message text |
The leaf names and message formats are listed in Leaves and message formats.
update {
timestamp: 1792591391520000000
update {
path { elem { name: "readylinks-rlos:notification-status" } }
val { json_val: "{\"switch-port-downspeed\":\" Ethernet0/5's speed is 1000M, it support max speed is 2500M!\"}" }
}
}{"ghn-port-status": "ifIndex.3 linkDown mac: 00-13-ba-0c-68-57 name: modem-example"}#Prerequisites
- NETCONF is enabled (
netconf enable). The gRPC service depends on it. - The global trap switch is on (
snmp-server traps). Alarms follow the same switches as SNMP traps (see Gating). You don't need any trap receivers. - gRPC is enabled (
grpc enable).
#Configure the switch
The grpc settings can be changed only while gRPC is stopped. Run grpc disable first, make the changes, then grpc enable.
#Dial-in
configure terminal
grpc disable
grpc grpchost 10000
grpc authentication enable
grpc enable
end| Command | Does | Default |
|---|---|---|
grpc enable / grpc disable | Start or stop the gRPC service. NETCONF must be running to enable it | Disabled |
grpc grpchost <port> | gNMI server port, 1-65535. Takes a port only | 10000 |
grpc httphost <port> | HTTP port of the gRPC service, 1-65535. Takes a port only and must differ from the gNMI port | 8080 |
grpc authentication enable | Use TLS on the gNMI server (disable uses plaintext) | Enable |
grpc mtls enable | Also require a client certificate (disable uses TLS only). Needs authentication enabled | Disable |
#Dial-out
configure terminal
grpc disable
grpc dialouthost 192.0.2.60 10001
grpc dialoutauthentication enable
grpc dialoutmtls enable
grpc certificate-upload filetype ca-file filename tunnel-ca.pem tftp 192.0.2.5
grpc certificate-upload filetype cert-file filename switch-client.crt tftp 192.0.2.5
grpc certificate-upload filetype key-file filename switch-client.key tftp 192.0.2.5
certificate-effect
grpc dialtargetId | hostname vendor model version
grpc dialout enable
grpc enable
end| Server 1 | Server 2 | Does | Default |
|---|---|---|---|
grpc dialout {enable|disable} | grpc dialout2 {enable|disable} | Turn the dial-out connection on or off | Disable |
grpc dialouthost <ip> <port> | grpc dialout2host <ip> <port> | Tunnel server address (IPv4 or IPv6) and port, 1-65535 | — |
grpc dialoutauthentication {enable|disable} | grpc dialout2authentication {enable|disable} | TLS on the tunnel connection (disable uses plaintext) | Enable |
grpc dialoutmtls {enable|disable} | grpc dialout2mtls {enable|disable} | enable: mTLS with a client certificate. disable: TLS only. Needs dial-out authentication enabled | Enable |
grpc certificate-upload filetype {ca-file|cert-file|key-file} filename <file> tftp <ip> | grpc certificate-upload2 ... | Load the tunnel CA, client certificate, or client key from a TFTP server | — |
grpc dialtarget <name> | grpc dialtarget2 <name> | Set the custom value used in the target ID, up to 32 characters | — |
grpc dialtargetId <delimiter> <p1> [<p2> ... <p5>] | grpc dialtarget2Id ... | Build the target ID | hostname|ReadyLinks|model|version |
certificate-effect. Run this in global config mode to apply uploaded certificates straight away.dialtargetIddelimiter. One of|,:or;.dialtargetIdparameters. One to five ofhostname,vendor(the literalReadyLinks),model,version(firmware version), andcustom(thedialtargetvalue). Each can be used only once.
#Check
show grpc shows the service state, TLS and mTLS settings, the gNMI and HTTP ports, and for each dial-out server its state, host, port, target, target ID, and tunnel status.
#How dial-out works
- The switch opens a gRPC connection to the tunnel server, using TLS or mTLS as configured, and registers its target. The target type is
GNMI_GNOI, and the target ID is set bydialtargetId. - The collector asks the tunnel server for a session to that target.
- The switch accepts the session and connects it to its local gNMI server. The collector then runs
Subscribethrough the tunnel, exactly as for dial-in. - If the connection to the tunnel server fails, the switch retries. The wait starts at 3 s and grows to at most 30 s between attempts.
The switch accepts a tunnel session only if the requested target ID starts with its own target ID and the type is GNMI_GNOI.
#Security
| Leg | Server certificate | Client certificate | Trust |
|---|---|---|---|
| Switch → tunnel server | Your tunnel server's | The switch's uploaded cert-file / key-file, with mTLS | The switch checks the tunnel server against the uploaded ca-file |
| Collector → switch gNMI, dial-in or inside the tunnel | The switch's HTTPS certificate | Required only with grpc mtls enable | With mTLS, the switch checks client certificates against the HTTPS CA |
- Shared certificate. The gNMI server uses the same certificate, key and CA as the switch's HTTPS web server. Replacing the HTTPS certificate replaces the gNMI one too.
- TLS version. With
grpc authentication enable, the gNMI server accepts TLS 1.3 only.
#Collector example (gnmic)
gnmic can act as the tunnel server and the gNMI client in one process. This is an example configuration. See the gnmic documentation for every option.
# gnmic.yaml
tunnel-server:
address: ":10001"
tls:
ca-file: /etc/gnmic/switch-ca.pem # CA that signed the switches' client certificates
cert-file: /etc/gnmic/tunnel-server.crt
key-file: /etc/gnmic/tunnel-server.key
client-auth: require-verify # mTLS
targets:
- id: ".*"
type: GNMI_GNOI
config:
skip-verify: true # or tls-ca: the CA of the switch HTTPS certificate
encoding: json
subscriptions:
rlos-alarms:
paths:
- /readylinks-rlos:notification-status
mode: stream
stream-mode: on-change
encoding: json
outputs:
stdout:
type: file
file-type: stdout
format: eventgnmic --config gnmic.yaml --use-tunnel-server subscribeFor dial-in, point gnmic at the switch directly:
gnmic -a 192.0.2.20:10000 --skip-verify -e json \
subscribe --path /readylinks-rlos:notification-status --mode stream --stream-mode on-changeTo test, unplug and reconnect a cable on a port with traps enabled. Two switch-port-status updates arrive, one for ifIndex.<N> linkDown and one for ifIndex.<N> linkUp.
Last updated October 21, 2026