cancel
Showing results for 
Search instead for 
Did you mean: 

RESTCONF Fabric Engine

RESTCONF Fabric Engine

lsaas
New Contributor

Hi Community,

I am trying REST communication with VSP 4450 on Fabric Engine 8.8. I have already open the web-server and RESTCONF interface. I am using basic auth (username:password) with the same credentials as the HTTP web server of the switch. My guess is I am not using the right authentication method to access the RESTCONF interface. I value every input on this matter, thank you for your feedback.

Screenshot 2023-03-01 at 09.59.08.png

4 REPLIES 4

lsaas
New Contributor

Hi Jave & Markus,

Thank you for your valuable input. I got it working using a mix of your input. My remarks hereby on how I got there:

- I can't authenticate via Basic Auth embedded in Postman but I pass the credentials via Body message in JSON. 

- Credentials used are not the one from the web page but the one to access the switch via CLI

- Using Postman environment variable is a great idea to pass the bearer token around. I found out that:

* pm.environment.set("vossBearer"data.message.token) -> data.message.token is not a correct value to parse the JSON message. Maybe has the path changed from earlier VOSS versions?

* pm.environment.set("vossBearer", data.token); -> data.token is retrieving the token and setting the "vossBearer" key adequately. 

* You have to be careful using multiple Postman environment as only one can be active at the same time.

Markus_Nikulski
Extreme Employee

Yes, indeed you have run first a login request and catch the access token to be entitled to run the RESTconf calls. For postman is a clever way to use environment variables and map the token to predefined variable used by other request later on. This save time testing the API.

2023-03-01_18-30-33.png2023-03-01_18-31-43.png2023-03-01_18-32-48.png

 

here the code I've used

var data = pm.response.json();
pm.environment.set("vossBearer"data.message.token);

Jave
Contributor

Hi Isaas,

Personally, I retrieve an auth token with username/password in the body of a POST request, like this:

Jave_1-1677679104187.png

Jave_2-1677679151861.png

In cURL:

curl --location 'http://X.X.X.X:8080/auth/token/' \
--header 'Content-Type: application/json' \
--data-raw '{"username":"<username>","password":"<password>"}'

With the token, you can then do a GET request with "X-Auth-Token" key into the header:

Jave_3-1677679386436.png

In cURL (example with LLDP neighbors):

curl --location 'http://X.X.X.X:8080/rest/restconf/data/openconfig-lldp:lldp/interfaces' \
--header 'X-Auth-Token:<token>'

 

Regards,

Jave

 

GTM-P2G8KFN