Table of Contents
- Postman and gRPC
- Requirement
- Clone the gnmi repo on your automation setup
- Install Postman Desktop Agent on your automation setup
- Create a new workspace or select an existing one
- Create and activate a new environment
- Create a new request (Capablities)
- Verify the new API
- Add another request (Subscribe) to the new collection (gNMI)
We can use Postman to interact with CVP using gRPC (gNMI, resource APIs).
The gRPC port is 443 and gPRC uses HTTP2.
Token based authentication is required. To enable token based authentication, refer to this directory
The gNMI proto file is https://github.com/openconfig/gnmi/blob/master/proto/gnmi/gnmi.proto
cd $HOME
mkdir -p github.com/openconfig
git clone https://github.com/openconfig/gnmi.git github.com/openconfig/gnmi
ls github.com/openconfig/gnmi
Importing a proto file and invoking gRPC services is a new Postman feature.
To connect with a gRPC server (CVP) requires using Postman Desktop Agent (this is not supported with Postman web).
In this example we are using Postman Desktop Agent Version 9.26.8.
From your workspace, you will need to create and activate a new environment
Click on Environment and create a new environment.
Provide a name to the new environment.
Define these two variables:
- grpcServerUrl: use the CloudVision IP address
- token: use the token generated previously
From your workspace, select New > gRPC Request
Use the variable grpcServerUrl
for the server URL
Select the authorization type Bearer token
and use the variable token
for the token
Click on Import a .proto file
in service definition
Select the .proto file from the repo you cloned, and define the import path to use if your .proto file import other .proto files.
The gNMI proto file is https://github.com/openconfig/gnmi/blob/master/proto/gnmi/gnmi.proto
It imports https://github.com/openconfig/gnmi/blob/master/proto/gnmi_ext/gnmi_ext.proto
Click on Next
and import your .proto file as an API to reuse it in other requests with Postman
Select the RPC Capabilities
from the gNMI
service
Click on Invoke.
You should get a response.
Save the new request (name it Capabilities
) to a new collection (name it gNMI
)
From your workspace, verify the new API.
Duplicate the previous request (Capabilities
).
Rename it to Subscribe to interfaces state
.
Select the RPC Subcribe
of the gNMI
service.
Copy this in the message (update the target
with the SN of your device):
{
"subscribe": {
"encoding": "JSON",
"mode": "STREAM",
"prefix": {
"target": "BAD032986065E8DC14CBB6472EC314A6"
},
"subscription": [
{
"path": {
"elem": [
{
"name": "interfaces"
},
{
"name": "interface"
},
{
"name": "state"
}
],
"origin": "openconfig"
}
}
]
}
}
Save this request.