References
- https://onap.readthedocs.io/en/latest/submodules/aai/aai-common.git/docs/platform/Getting%20Started/Edge_Rules.html
- https://tinkerpop.apache.org/javadocs/3.3.2/core/org/apache/tinkerpop/gremlin/structure/Direction.html
- https://docs.oracle.com/javase/7/docs/api/java/lang/Boolean.html#valueOf(java.lang.String)
- Source code: aai/aai-common/aai-schema-ingest/src/main/java/org/onap/aai/edges/enums
- Source code: aai/aai-common/aai-core/src/main/java/org/onap/aai/serialization/db
- https://lists.onap.org/g/onap-discuss/message/11643
Example from documentation
Example | Equivalent Example |
---|---|
General Applicability
- EdgeRules only apply to "relationship-list" relations in the schema, since the referenced object could be anything
- EdgeRules do not apply to sub-component relations in the schema, since this is implicit and hard-coded behaviour
Field | Values | Notes |
---|---|---|
from | (literal string as entered in EdgeRule file) | Expected to match the "name" value of "xml-root-element" in OXM file. Note that the "from|to" pair is normalised in the code according to alphabetical order, so that "cousin pairs" with the "to|from" ordering in the EdgeRule are also grouped together, e.g.
Also note that the hyphens "-" are removed from the names before comparison, so the following would be equivalent:
|
to | (literal string as entered in EdgeRule file) | Expected to match the "name" value of "xml-root-element" in OXM file. Note that the "from|to" pair is normalised in the code according to alphabetical order, so that "cousin pairs" with the "to|from" ordering in the EdgeRule are also grouped together, e.g.
Also note that the hyphens "-" are removed from the names before comparison, so the following would be equivalent:
|
label | (literal string as entered in EdgeRule file) | By convention, appears to be one of:
|
direction |
| Based on and extended from https://tinkerpop.apache.org/javadocs/3.3.2/core/org/apache/tinkerpop/gremlin/structure/Direction.html Comparison is case-sensitive |
multiplicity |
| Comparison ignores case |
contains-other-v |
| This is an "edge property" that applies for traversal to the other vertex. Comparison is case-sensitive Note that "opposite" means:
|
delete-other-v |
| This is an "edge property" that applies for traversal to the other vertex. Comparison is case-sensitive Note that "opposite" means:
|
SVC-INFRA |
| This is an "edge property" that applies for traversal to the other vertex. Comparison is case-sensitive Note that "opposite" means:
|
prevent-delete |
| This is an "edge property" that applies for traversal to the other vertex. Comparison is case-sensitive Note that "opposite" means:
|
default |
| Default EdgeRule will apply when no other more specific rule applies ? Based on https://docs.oracle.com/javase/7/docs/api/java/lang/Boolean.html#valueOf(java.lang.String) Comparison ignores case |
description | (literal string as entered in EdgeRule file) | Optional for backwards compatibility with v12 and earlier (default value is empty string) The EdgeRule JSON format does not permit comments (presence of comments appears to make the parser skip entries in the file). |
Questions
- Is there a way to find/remove the unused/redundant EdgeRules from the json file?
- Is there any plan to simplify EdgeRules into an unambiguous canonical form (might be easier to read and write correctly)?
- How does the "default" property actually work? In v13, there are 226 EdgeRules with 224 having default "true" and 2 having default "false".
9 Comments
Venkata Harish Kajur
Keong Lim, direction cannot be NONE.
Keong Lim
Label should be defined by TOSCA models and is intended to be generated from SDC, similarly for both OXM file and EdgeRule file.
Direction "IN" is deprecated. Current preference is to use Direction "OUT" for all EdgeRules. There was a bulk rewriting exercise which flipped all EdgeRules to the Direction.
SVC-INFRA is deprecated. Refers to a type of query no longer used.
default is used when there are multiple EdgeRules between same pair of classes, e.g. link having 2 interfaces (source and sink)
When "contains-other-v" is "NONE", then it means "cousin" relationship and the other vertex data appears in the "relationship-list" part of the schema.
When "contains-other-v" is "IN" or "OUT", then it means "contains" relationship and the other vertex data appears as an embedded element in the schema. This only affects the presentation of the data in the API; the storage in the graph database is unchanged.
Direction "BOTH" is not used. The vertexes can be traversed from either end of the edge anyway.
Keong Lim
Regarding the behaviour of "contains-other-v" and its effect on the schema definition, I found a reasonably small example for vpls-pe:
The EdgeRules for vpls-pe are:
The generated HTML documentation for vpls-pe includes:
So the overall explanation is:
Question:
Tian Lee
Tian Lee
I found the location of the TOSCA definition yamls in ONAP: https://gerrit.onap.org/r/gitweb?p=sdc.git;a=tree;f=common/onap-tosca-datatype/src/main/resources/globalTypes/openecomp-inventory;h=f6271b34b2d4081d0a8628544c64b449cf60d2f2;hb=refs/heads/master
However, they do not seem to be aligned with the current contents of the OXM / dbedgerules. E.g. the relationships yaml defines relationships using the "org.openecomp" namespace, whereas the dbedgerules have been updated to use the "org.onap" namespace. We need to be careful not to let the TOSCA and the AAI schema fall too far out of sync.
Maybe any AAI schema updates should be communicated to the SDC project PTL?
James Forsyth Christina Monteleone
Keong Lim
If the SDC does generate OXM and EdgeRule files for AAI schema definition:
Tian Lee
OXM and EdgeRules are AAI's internal representation of the TOSCA schema defined by SDC, therefore SDC should not responsible for the translation of TOSCA into OXM/EdgeRules.
I expect when the Tosca→OXM translation tool is open sourced, we would need to define a process by which the SDC TOSCA is consumed and translated to OXM/EdgeRules, which in turn is consumed by the aai-resources microservice.
As a start, this could be a manual design-time process. I.e., when we need to make a schema change, instead of updating the OXM+EdgeRules in AAI, we update the TOSCA schema in SDC, and use the tool to generate a new version of the OXM +EdgeRules, which we then checked into the aai-schema repo.
Eventually, the goal is to make this an dynamic process, where SDC can release a new version of the TOSCA schema at any time, and AAI will automatically consume this and update its schema at run-time.
Keong Lim
Will other components also have their XSD/HTML/YAML files generated from the TOSCA models, rather than from AAI OXM files?
Is there/will there be a reverse-engineering tool that converts AAI OXM/EdgeRules back into TOSCA models?
Is round-trip engineering of the AAI schema a goal of the project?
Given the current misalignment and on-going updates to AAI schema, there will need to be tools to help SDC TOSCA models catch up.
Tian Lee
There is no such tool in the pipeline at the moment because the TOSCA is intended to be the master. As things are, I think there will be some pain at some point when we switch to using the TOSCA, to align the TOSCA with the current AAI schema.
I don't know about how other projects will consume the TOSCA, but I do believe that there MUST be a master model referenced by the entire ONAP ecosystem, so that different components can integrate and speak the same language. Without this we will see a divergence in the modelling of various projects and components, which will lead to integration hell. Imagine trying to add a new service type that needs to be understood by multiple ONAP systems, without a common model this would be nigh on impossible.