cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2212
Views
5
Helpful
4
Replies

Swagger for NSO restconf API

Islam_Hassanin
Level 1
Level 1

Hi,

i have a running Swagger UI container configured with the BaseURL to be : /restconf and host: http://NSO-IP:8080

as shown below:

1.jpeg

 

i'm using NSO 5.2.1 and i used its yanger to generate the swagger.json file from the /opt/ncs/current/src/ncs/yang/tailf-ncs.yang yang file.

 

But i found that it failed to fetch because of the wrong URL sent with the API request :

2.jpeg

 

i have changed it manually from tailf-ncs-package to tailf-ncs in the json file after testing it with curl and it works:

3.jpeg

 

my question is, how to get the appropriate yang file to generate the correct json file with the correct paths ?

 

Thanks in advance !

1 Accepted Solution

Accepted Solutions

snovello
Cisco Employee
Cisco Employee

Hello Islam

It looks like you are hitting this (fixed) yanger issue https://github.com/mbj4668/yanger/pull/11

It was taking submodule names and using them as prefixes

Try with latest yanger release and please tell us if it worked for you.

 

Stefano

View solution in original post

4 Replies 4

perander
Cisco Employee
Cisco Employee

It seems you are compiling the tailf-ncs-packages YANG sub-module.
This is probably why it takes the wrong module-name for the path.

Can you compile the tailf-ncs YANG module and perhaps use path
filters to prune your Swagger file?

Hello @perander , Thank for reply

 

i have compiled the tailf-ncs.yang module path: /opt/ncs/current/src/ncs/yang/tailf-ncs.yang which includes all other sub-modules like tailf-ncs-packages, tailf-ncs-devices and so on.

8.png

 

i also tried to use path filters but the output json file have no paths match.

 

Any other ideas!

 

 

snovello
Cisco Employee
Cisco Employee

Hello Islam

It looks like you are hitting this (fixed) yanger issue https://github.com/mbj4668/yanger/pull/11

It was taking submodule names and using them as prefixes

Try with latest yanger release and please tell us if it worked for you.

 

Stefano

Hi @snovello, Thanks for your response.

 

indeed i have done something similar using python to update the tailf-ncs-(anything): to tailf-ncs: it works properly. 

but i just got confused from the tailf-ncs.yang module for these strange paths and wanted to ensure that it's a bug to be in mind.

 

i will try to use the latest yanger and inform you back. 

 

Appreciate your time and response @snovello @perander. Thanks!