CPS-1301: Insert Module Prefixes
References
CPS-1301: No Prefix for containers in different modulesReopened
Sample Yang Module: https://github.com/YangModels/yang/blob/main/vendor/cisco/xr/534/ietf-inet-types.yan
PoC by @Toine Siebelink to insert prefixes based on schemaContext (ODL Model): https://gerrit.nordix.org/c/onap/cps/+/15553
CPS SChema for yang data: CPS Internal Relation DB Schema
Assumptions
# | Assumption | Notes |
---|---|---|
1 | Sample (wanted) output of: | See also decision #3 |
2 | Prefix can be inserted before each container but this is optional | See RFC... |
Issues & Decisions
Issue | Notes | Decision | ||
---|---|---|---|---|
1 | 1 | Performance issue with current solution | Current solution used inefficient query to populate (first) prefix property for ALL fragments although only used for top level | Will be handled by separate Jira already in progress, see CPS-1326: Creation of DataNodeBuilder with module name prefix is very slow Closed |
2 | 2 | Top level container is not always defined in first module | This might not be required as the first short-term solution is delivered first | Will be handled by separate JiraCPS-1344: Top level container (prefix) is not always the first moduleClosed |
3 | 3 | Add prefix for container in same module | This is allowed but not done normally. Team concerned about performance issues and impact on URLs when using this | @Ahila P Oct 21, 2022 : Prefix is not required for the child modules or nodes, if it carries the same prefix as parent |
4 | 4 | Add prefix to first container when this is not the top level for the module it is defined | retrieve B or C directly (without parent), in that case should the prefix stil be used ie. Module1:/B | Team Oct 21, 2022 Prefix required for top level nodes in output |
5 | 5 |
| See sample from https://github.com/YangModels/yang/blob/main/vendor/cisco/xr/534/ietf-inet-types.yang ietf-inet-types.yangmodule ietf-inet-types {
namespace "urn:ietf:params:xml:ns:yang:ietf-inet-types";
prefix "inet";
(Unfortunately in above example module name and last token of namespace are the same, not sure if this just convention or mandatory CPS Team (made-up) example bookstore.yangmodule stores {
yang-version 1.1;
namespace "org:onap:ccsdk:sample";
prefix book-store; | @Ahila P Oct 21, 2022 It refers to the 'prefix' in the yang model (highlighted in the sample yang model). module ietf-inet-types { namespace "urn:ietf:params:xml:ns:yang:ietf-inet-types"; prefix "inet"; |
6 | Prefix for (additional) leaves that are defined in a separate module then the container itself | Required, not sure how common this is. DB Solution for this might be quite difficult. Toine's POC should handle it (to be tested) | ||
7 | How to handle lists (instead of container) | Possibly ignore [@key=value] part. Small neglectable change of same model defined both under same parent... Toine's Poc can be modified to handle this with help from establish regular-expressions from other use cases | ||
8 | Performance Considerations | SchemaContext generation is expensive.
| Use Hazelcast to store 'simplified Model' as defined in Poc Toine | |
9 | 9 | Is 'prefix' attribute mandatory for any yang module | @Ahila P checked Documentation not clear btu in practice creating a yang module without prefix gives a 'compilation' liek error in PiYang | Oct 25, 2022 base in Ahila's feedback we assume it is mandatory. |
Meetings
Date | Participants | Topics |
---|---|---|
Oct 25, 2022 | @Toine Siebelink @arne.chrestin Lena Peuker (DT) @Ahila P @Priyank Maheshwari @Joe K |
|
Nov 28, 2022 | @Ahila P @arne.chrestin @Lena Peuker @Toine Siebelink @Andras Zoltan Kiss @Joe K @Levente Csanyi @Luke Gleeson (Unlicensed) @Seán Beirne @Tony Finnerty |
|
Road Map
Team agreed on 2 step approach (first step or short term solution was deemed unnecessary although some of the code develop as part of the PoC can be re-used in the 'proper' DB solution)
Short Term solution (no DB Changes)
No DB changes or DB interaction (after retrieving yang resources) Based on Toine's Poc https://gerrit.nordix.org/c/onap/cps/+/15553
Lazy loading of 'simplified model'
Cache simplified Module (for performance reasons) Can built on te solution for CPS-1326: Creation of DataNodeBuilder with module name prefix is very slow Closed here https://gerrit.onap.org/r/c/cps/+/131493
This solution should handle Leaf (defined in different module) as well
DB-Solution Part 1
Update CPS Internal Relation DB Schema and data insert to retain fragment - yang resource relation
DB-Solution Part 2
Modie schema to store attribute module informat when needed i.e. when not defined in same module as container that owns those leaves
Detailed analysis required
Cost estimates
Item | Details | Total | Notes |
---|---|---|---|
DB Solution, Part 1 (containers and list) |
| 14 Man weeks | Excludes ramping-up in CPS 7 people in parallel weeks, still seems optimistic |
DB Solution, Part 2 (leaves) |
Resourcing
Name | Involvement | Notes |
---|---|---|
@Toine Siebelink | PTL, Manage Jira's, Generaal support | |
@Ahila P | Analysis & Implementation | Analysis details are updated at CPS-1380: Node Prefix Issue AnalysisClosed |
@arne.chrestin | PO & Devolvement | Available after next internal product build |
@Lena Peuker | PO & Devolvement | Available after next internal product build |
DB-Insert Based Solution, part 1, Containers and Lists
Each Fragment needs a reference to the relevant module (on DB Level)
Use POC code to store prefix for each module name & revision
Possible a new table linking fragment with yang-resources
update yang resource to include prefix filed
Liquibase Upgrade Step(s) include rollback and migration/updating of existing data
Insert prefix as need upon retrieval (using SQL to combine relevant tables as needed)
Consider Performance (ie. need native queries if needed)
Out of scope: leaves with different modules (see part 2)
DB-Insert Based Solution, part 2, Leaves
TBD, decide to analyse this in more detail later once the changes for Part 1 are more clear