...
ODL Yang Tools library provides an option to define a point within a model which will be used as root when data is validated
and parsed. It requires an appropriate DataSchemaNode
instance to be provided to JsonParserStream
instance as a custom root point.
It assumes the implementation/update of a following logic:
- Extracting the
DataSchemaNode
(fromSchemaContext
) matching the xpath requested - Update the
YangUtils.parseJsonData(..)
method to utilize additional input - Update the
DataNodeBuilder
logic to accept non-emptyxpath
when building data fromNormalizedNode
instance
Alternative solutions - pros and cons
Data Input / Output consistency
...
In order to make custom root pointer solution (described above) work properly, it should point to parent of data node being updated.
At the same time the JSON data require to be presented as a single entry explicitly defining a type of a current node.
From other hand when same data node is requested for output (GET) it addressed by direct xpath and value returned is a data
unwrapped (as is: multiple top level elements)
Below is example using a data fragment referencing ran-network2020-08-06.yang model
Getting data node
Code Block | ||
---|---|---|
| ||
{
"mcc": "310",
"mnc": "410",
"sNSSAIList": [{
"sNssai": "10000100",
"status": "INACTIVE",
"configData": [{
"configParameter": "maxNumberOfConns",
"configValue": 5000
}]
]}
} |