cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
971
Views
10
Helpful
4
Replies

Imported modules in Yanger Swagger

Gastonper
Level 1
Level 1

Hi, I would like to make swagger documentation using yanger. However, I have difficulty figuring out how to do it when my module import other modules.

 

My yanger command look something like this:

yanger \
  --swagger-path-filter=/data/tailf-ncs-services:services/my_service:test \
  --format=swagger \
  -t expand \
  --output=/tmp/test.swagger \
  --swagger-host 127.0.0.1:8080 \
  test.yang

Since in test.yang I have imported module "test2.yang", I get the following error:

 

test.yang:13: error: module 'test2' not found
1 Accepted Solution

Accepted Solutions

Just tested. You can leave off the test2.yang and just specify the directory to the yang folder

 

so if /var/opt/ncs/packages/TEST/src/yang/test2.yang

it woudl be

-p /var/opt/ncs/packages/TEST/src/yang

View solution in original post

4 Replies 4

tsiemers1
Spotlight
Spotlight

Add the path for your yang module.

yanger \
  --swagger-path-filter=/data/tailf-ncs-services:services/my_service:test \
  --format=swagger \
  -t expand \
 -p /path/to/src/yang/test2.yang
  --output=/tmp/test.swagger \
  --swagger-host 127.0.0.1:8080 \
  test.yang

That should load the yang.

Should be an absolute o relative path?
Both yang are in the same package.
I tried :

-p test2.yang
and
-p test/src/yang/test2.yang

But didn't work

Just tested. You can leave off the test2.yang and just specify the directory to the yang folder

 

so if /var/opt/ncs/packages/TEST/src/yang/test2.yang

it woudl be

-p /var/opt/ncs/packages/TEST/src/yang

Thats works.

 

Thank you.