Table of Contents
gRPC / gNMI is the latest Yang-based network automation method that is the topic of this module.
In this section, we introduce gRPC and gNMI and compare it to the RESTCONF and NETCONF protocols, the other two Yang-based network automation methods that we discussed in the previous modules.
gRPC and gNMI Introduction
what are gRPC and gNMI in network automation?
RPC is a protocol that allows one program to request a service from another program located in another computer.
Probably you remember that NETCONF protocol uses RPC commands to request to get or change a configuration in network devices.
gRPC or Google RPC is Google’s version of RPC which is more efficient and faster. It was developed by Google to enable microservices to communicate with each other in a more efficient way.
But the details of gRPC are not important to us. We should only know that it uses protocol buffers (protobufs) to encode data between remote systems.
You can compare protobufs to XML and JSON used in netconf and restconf to encode the data.
Protobufs is not human-readable like XML and JSON, but is more efficient and faster.
gNMI or google RPC network management interface is a specific version of gRPC for network management. It is based on YANG data structure like restconf and netconf and the main topic of this module.
gNMI versus NETCONF and RESTCONF
The protocols gNMI, restconf and netconf, all of them are based on YANG data structure.
Netconf transfer commands to the network devices over SSH. Restconf over HTTP and gNMI over HTTP/2.
In netconf we use rpc commands to get the configuration or edit the configuration of network devices.
The commands, “get” and “get-config” are used to get the configuration or statistics and the command “edit-config” is used to change the configuration.
In restconf we use http commands, mostly “get” and “put” to get or change the configuration.
In gNMI we use gRPC commands, “capabilities” to get supported YANG capabilities, “get” to get the configuration and “set” command to change the configuration.
Finally, a new command, compare to netconf and restconf, “subscribe” in which any application can subscribe itself to any data in supported YANG data structure.
Subscribing allows the data to be streamed to the requestor at regular intervals and also whenever changes.
For example, you can subscribe to the status of interfaces. When the state of the interface changes, this is streamed to your application.
The data sent or received over the netconf protocol is encoded using XML. Both XML and JSON are supported in restconf. Protobufs and also JSON are supported in new gNMI protocol.
gNMI demonstartion resource
To demonstrate gNMI, unfortunately, most Cisco devices do not support gNMI or support it partially. According to Cisco documentation, Cisco network devices running NX-OS 9.3.3 or later fully support gNMi commands.
Therefore, we will use Arista network devices to demonstrate gNMI protocol.
I used an Arista example gNMI demonstration video on YouTube and an Arista openconfig GitHub link in this module for gNMI demonstration.