...
Addresses:
Jira | ||||||
---|---|---|---|---|---|---|
|
YANG
...
schema mount mechanism overview
The YANG schema mount mechanism is described in RFC-8528.
...
- RFC-8528 YANG Schema Mount - Appendix A: Examples
- RFC-8530 YANG Model for Logical Network Elements - Appendix A: Examples
...
Schema mount support in a
...
context of CPS
The abilities of CPS regarding YANG model and associated data parsing is heavily dependent on
features provided by ODL YangTools library.
...
Code Block | ||||
---|---|---|---|---|
| ||||
import org.opendaylight.yangtools.rfc8528.parser.MountPointStatementSupport; // ... private static SchemaContext generateSchemaContext(final Map<String, String> yangResourceNameToContent) { final CrossSourceStatementReactor.BuildAction reactor = RFC7950Reactors.vanillaReactorBuilder() .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION, MountPointStatementSupport.getInstance()) .build().newBuild(); //... return reactor.buildEffective(); //... } |
Taken from MountPointTest @ git.opendaylight.org
...
Data Parser
There is no issue parsing the actual schema-mounts JSON. It just treats the JSON as data and converts it into NormalizedNode instance.
The problem is the schema-mount JSON is not a data, it's an instruction to server to modify the model it holds runtime. Unfortunately
taking into account the context (when treat the data as data and when as an instruction depending) in not fully implemented yet.
Currently the ODL Yangtools library supports schema-mount for XML parser only (not JSON one). The schema-mount instruction require to
be pre-processed into a MountPointContext object and passed to the parser as a context to be taken into account.
See XmlParserStream @ git.opendaylight.org
It means the MountPointContext is not a part of SchemaContext which holds a static information on YANG resources involved, but a
runtime context used on data parsing.