cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1446
Views
0
Helpful
5
Replies

How to hide yang files(module) from getting exposed via NETCONF ?

ajbharad
Cisco Employee
Cisco Employee

We are using some internal yang files which should not be exposed via Netconf ( shouldn`t be even showed as part of capability exchange.)

How to do this ? 

(tailf:hidden doesn`t works in module level)

5 Replies 5

perander
Cisco Employee
Cisco Employee

It's possible to compile the YANG file to not be exported to any agent with e.g.

ncsc --export none -c -o md.fxs md.yang

or explicitly list the agents that should export the model.

 

Another way to achieve the same thing is to annotate the YANG model with an annotation file e.g. md-ann.yang

module md-ann {
namespace "urn:dummy";
prefix dummy;

import tailf-common {
prefix tailf;
}

tailf:annotate-module 'md' {
tailf:export none;
}
}

This is then used when compiling

ncsc -a md-ann.yang -c -o md.fxs md.yang

 

Both mechanism shown above effectively removes the module from the NETCONF hello capability listing, netconf-state, and also the YANG library. It is however still listed in /ncs-state/loaded-data-models.

Thanks. That worked fine. 
How to hide tailf related yang files ?

Same mechanism apply for these as well.

We are bundling yang files using the below command to create ncs-device-type netconf.

    ncsc --ncs-compile-bundle ... --ncs-device-type netconf --ncs-device-dir ...

 

But, the "--export" option is not available for this command.

Even we specify "tailf:export none:" in the yang file,they are getting exported. 

 

Any known issues ?

 

I tried with a toy example

ncsc --ncs-compile-bundle . --ncs-device-dir . --ncs-device-type ...  ... --export none

And it worked.

I see that '--export' is not listed together with '--ncs-compile-bundle' in the usage output, but it seems to work.