Table of Contents
- Postman and gRPC
- Requirement
- Install Postman Desktop Agent on your automation setup
- Create a new workspace or select an existing one
- Create a new environment
- Activate the new environment
- Create a new request using server reflexion
- Create a new request using a .proto file
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
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
Server reflection is enabled on CVP so you do not have to use the .proto source file.
Select Using server reflection
in service definition.
Once the services are discovered, select as example arista.inventory.v1.DeviceService.GetAll
.
The GetAll
RPC from the DeviceService
service is defined in the file arista/inventory.v1/services.gen.proto
Click on Invoke.
You should get a response.
Save the new request (name it server-reflection
) to a new collection (name it rAPI
)
Rename it to DeviceService-GetAll
we will update the service definition using a .proto file
Resources are modeled with .proto
files in the repository https://github.com/aristanetworks/cloudvision-apis
One of .proto
file is https://github.com/aristanetworks/cloudvision-apis/blob/trunk/arista/inventory.v1/services.gen.proto
cd $HOME
pwd
git clone https://github.com/aristanetworks/cloudvision-apis.git
ls cloudvision-apis
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.
Click on Next
And click on Import as API
to be able to reuse it in other requests with Postman
Select the RPC GetAll
of the DeviceService
service.
Save this request.
From your workspace, verify the new API.
So you can now use this API in the service definition of other requests (instead of importing a .proto file or using server reflection).