Reference: https://jira.onap.org/browse/CPS-1380
Prefix required for
- root node of a parent yang
- direct leaves of external/augment yang
- direct leaf lists of external/augment yang
- direct containers of of external/augment yang
- lists of external/augment yang
Prefix not required for
- any direct nodes (leafs, leaf lists, containers, lists) of parent yang
- container inside container in augmented yang models
- containers inside list
- lists of a same yang
Approach to store prefix of containers
- add new field prefix in yangresourcesentity
- create many-to-many relationship between fragment and yangresourcesentity
- Store Yangresourceentity in storeschemaset. Changes required in CPSModulePersistenceServiceImpl
Approach to store prefix for leaves:
- add the prefix only for augmented nodes.
- Augmented nodes can be identified by module.getAugmentations() method. Iterate over schemacontext and identify the corresponding prefix
- CPSDataServiceImpl - DatanodeBuilder - addYangLeaf method can be modified to find the prefix from schemacontext and frame DataNode leaves (costly operation - time consuming)
How to identify a field is on particular yang module?
- iterate the modules of schemacontext
- compare the node's schemespecficpart with each module's schemespecificpart
- Matching schemespecficpart helps to identify the node's module.
schemespecficpart is part of namespace in yang module.
Prefix Retrieval
Containers:
- find the prefix from yangresources table using xpath(fragment)
- skip the above step for MapEntryNode ( to avoid prefix for lists and containers)
- skip for inner containers. Find approach to find a container is nested.
Leaves of augmented/external modules:
- No changes are required