Closed ramukima closed 8 years ago
Hi Amit, I actually don't think that is valid YANG schema? From the context of the module bar, it can use module foo's exported grouping, typedef, etc. it can also augment the foo module. But I don't think it can access data tree elements from module foo.
At least that's how I understood the spec. If there's public examples of how this should be possible, please share the reference.
Sorry, you're right! I didn't realize you should be allowed to go outside your current module for leafref! Ok will need to fix. :-)
The accessible tree depends on the context node:
o If the context node represents configuration data, the tree is the
data in the NETCONF datastore where the context node exists. The
XPath root node has all top-level configuration data nodes in all
modules as children.
o Otherwise, the tree is all state data on the device, and the
<running/> datastore. The XPath root node has all top-level data
nodes in all modules as children.
This should be addressed but I haven't verified.
Here's an example of how to test:
Yang = require 'yang-js'
store = new Yang.Store 'test'
store.import <schema or model>
store.import <schema or model>
console.log store.data.valueOf()
Basically, you can import
YANG schema text or Yang expression instance or a Model and it will link all the top-level properties at the store.data
property. This will make it possible for XPATH resolution for leafref/path
to traverse across module boundaries.
It'd be great if you can give it a try with the latest yang-js
published version (0.15.23).
@ramukima - were you able to confirm/verify the cross-module leafref functionality?
I tested it with petstore example and I could see it work. But I am yet to validate multiple scenarios. Closing for now, will reopen if I find it broken again later.
I have following models:
foo.yang
bar.yang
When I create an instance of foo (under yang-express using published URLs), and then try to create a bar instance supplying correct value of bar leafref, I always see error regarding unable to resolve the leafref.