Table of contents
Addresses
Jira Legacy |
---|
server | System Jira |
---|
serverId | 4733707d-2057-3a0f-ae5e-4fd8aff50176 |
---|
key | CPS-43 |
---|
|
Using multiple YANG files cases
...
Code Block |
---|
| module base {
yang-version 1.1;
namespace "org:onap:cps:test:base";
revision "2020-01-01";
prefix "base";
container base-container {
leaf name {
type string;
}
leaf description {
type string;
}
}
} |
|
Code Block |
---|
| module augment {
yang-version 1.1;
namespace "org:onap:cps:test:augment";
revision "2020-01-02";
prefix "augment";
import base {
prefix "base";
}
grouping augment-group {
leaf augmented-leaf {
type string;
}
}
augment "base:base-container" {
uses augment-group;
}
} |
|
Code Block |
---|
| {
"base-container": {
"name": "test name",
"description": "test description",
"augmented-leaf": "more information"
}
} |
|
Empty module issue
When files are processed the effective schema context the target model is referenced by name, namespace and revision of a base module, which are not
changed and remain same.
...
At the same time the augment module became extra, because it contains no model so it won't be ever referenced (directly) for data validation.
Imports
The imports are mainly used to re-use definitions from existing modules.
Code Block |
---|
| module base {
yang-version 1.1;
namespace "org:onap:cps:test:importer";
revision "2020-02-01";
prefix "importer";
import exporter {
prefix "exporter";
}
container importer-container {
leaf name {
type string;
}
leaf description {
type string;
}
uses "exporter:export-group";
}
} |
|
Code Block |
---|
| module exporter {
yang-version 1.1;
namespace "org:onap:cps:test:exporter";
revision "2020-02-02";
prefix "exporter";
grouping export-group {
leaf exporter-leaf {
type string;
}
}
container exporter-container {
uses export-group;
}
} |
|
Code Block |
---|
title | importer.json (valid) |
---|
| {
"importer-container": {
"name": "test name",
"description": "test description",
"exporter-leaf": "test imported"
}
} |
Code Block |
---|
title | exporter.json (also valid) |
---|
| {
"exporter-container": {
"exporter-leaf": "test data"
}
} |
|
Multiple valid models issue
When the data is being decomposed using a schema context built from these two yang files, there will be no any error
if the incoming JSON matches any of models within . The appropriate module (for validation/parsing) could be chosen
dynamically. It also possible there could be collision if root container elements of both modules are having same name.
Current validation approach (no exception on data) seems being insufficient enough. Additional validation of root container
type will be necessary in order to ensure the correct model was chosen to process the data.
Assembly
...
Assembly case is mainly used to for organizational purposes when large module file is split to logical peaces (submodules)
for better maintainability. Submodules may have own revision but the namespace is shared with assembly module (the submodule belongs to).
Code Block |
---|
| module assembly {
yang-version 1.1;
namespace "org:onap:cps:test:assembly";
prefix "assembly";
revision "2020-03-01";
include "component";
container module-container {
leaf name {
type string;
}
leaf description {
type string;
}
}
} |
|
Code Block |
---|
| submodule component {
yang-version 1.1;
revision "2020-03-02";
belongs-to "assembly" {
prefix "assembly";
}
container submodule-container {
leaf name {
type string;
}
leaf description {
type string;
}
}
} |
|
Code Block |
---|
title | assembly.json (invalid) |
---|
| {
"module-container": {
"name": "module name",
"description": "module description"
},
"submodule-container": {
"name": "submodule name",
"description": "submodule description"
}
} |
|
Submodule issue
This issue is similar to the one of augmentation case: once the files are processed into an effective schema context the submodule has no use.
Model tree root
Issue description
This issue was determined on assembly case analysis.
...
Drawio |
---|
border | false |
---|
| |
---|
diagramName | CPS Module as tree model issue |
---|
simpleViewer | false |
---|
width | |
---|
links | auto |
---|
tbstyle | inline |
---|
lbox | false |
---|
diagramDisplayName | |
---|
diagramWidth | 891 |
---|
revision | 3 |
---|
|
Content persistence