1. Set up a development environment as described in A&AI Developer Environment Setup - Updated for Beijing!

  2. This document will show editing schema files with Eclipse, but Eclipse is not required.

  3. In this example, we will add 2 new attributes to the cloud-region node type and a new node type called "new-widget" which will be a child node of "cloud-region"

  4. Adding a new attribute to "cloud-region"
  5. Open aai/aai-common, aai-schema/src/main/resources/oxm/aai_oxm_v11.xml


  6. Add the following attributes between "complexName" and "resourceVersion":

    <xml-element java-attribute="complexName" name="complex-name" type="java.lang.String">
    <xml-properties>
    <xml-property name="description" value="complex name for cloud-region instance. NOTE - THIS FIELD IS NOT CORRECTLY POPULATED." />
    </xml-properties>
    </xml-element>
    <xml-element java-attribute="newAttributeForDemo" name="new-attribute-for-demo" required="true" type="java.lang.String">
    <xml-properties>
    <xml-property name="description" value="Example new attribute for cloud-region instance. " />
    </xml-properties>
    </xml-element>
    <xml-element java-attribute="numberAttributeForDemo" name="number-attribute-for-demo" required="true" type="java.lang.Integer">
    <xml-properties>
    <xml-property name="description" value="Example number attribute for cloud-region instance. " />
    </xml-properties>
    </xml-element>
    <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String">
    <xml-properties>
    <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." />
    </xml-properties>
    </xml-element>

  7. Save the file, and rebuild the libraries and microservices:

    here's my example file: aai_oxm_v11.xml
    1. Rebuild aai-common first:
    2. $ cd ~/LF/AAI/aai-common
    3. $ mvn versions:set -DnewVersion=0.0.1-TEST-SNAPSHOT
    4. $ mvn clean install
      Should result in BUILD SUCCESS
    5. $ cd ~/LF/AAI/resources
    6. $ mvn clean install -Daai.core.version=0.0.1-TEST-SNAPSHOT -Daai.schema.version=0.0.1-TEST-SNAPSHOT
      Should result in BUILD SUCCESS
    7. $ cd ~/LF/AAI/traversal
      mvn clean install -Daai.core.version=0.0.1-TEST-SNAPSHOT -Daai.schema.version=0.0.1-TEST-SNAPSHOT
    8. Should result in BUILD SUCCESS

      From https://lists.onap.org/g/onap-discuss/message/11507:


      The html and yaml gets automatically generated when you run install but the xsd was never part of the autogenerate maven profile.
      For Beijing and earlier release, we never auto generated it. In order to run the generation of the xsd, here is the command:

      cd ~/LF/aai/aai-common/aai-core/
      mvn -PgenerateXsd install -DskipTests -Dgendoc.version=v14

      I have actually noticed that recently within the internal release and realized that it makes sense for xsd to be also auto generated.
      I am not sure why it was left out from the autogenerate profile but when developing the model driven feature, I ensured that the auto generate also does xsd generation.
      Once that feature gets delivered to Casablanca, there wouldn't be a need to run the profile manually.


  8. Run GenTester, using the target dir under aai-resources:

    $ cd ~/LF/AAI/graphadmin;

    java -DAJSC_HOME=. -DBUNDLECONFIG_DIR=src/main/resources/ -Dloader.main=org.onap.aai.schema.GenTester -Dloader.path=./src/main/resources -Dschema.ingest.file=src/main/resources/application.properties -jar target/aai-graphadmin-*.jar

    You should see the following output:

        ---- NOTE --- about to open graph (takes a little while)--------;

    -- loading schema into JanusGraph

    -- loading schema into JanusGraph

    -- Loading new schema elements into JanusGraph --

    -- graph commit

    -- graph shutdown


    You can check the logs to see if the graph elements were created successfully and grep for your property
    cd logs/createDBSchema/;
    grep 'complex-name' metrics.log

    2018-12-06T04:43:18.061+0000|2018-12-06T04:43:42.960+0000|449b8583-54c1-42bf-8ada-5b75c52d7a13||main      ||AAI|AAI-TOOLS|AAI|main|COMPLETE|0|||INFO||127.0.1.1|24899|localhost||org.onap.a
    ai.dbgen.SchemaGenerator||||||||co=DBGenTester:Creating PropertyKey: [complex-name], [String], [SINGLE]
    2018-12-06T04:43:18.061+0000|2018-12-06T04:43:42.960+0000|449b8583-54c1-42bf-8ada-5b75c52d7a13||main      ||AAI|AAI-TOOLS|AAI|main|COMPLETE|0|||INFO||127.0.1.1|24899|localhost||org.onap.a
    ai.dbgen.SchemaGenerator||||||||co=DBGenTester:Add index for PropertyKey: [complex-name]

  9. Start the "resources" microservice
    1. Resources runs on port 8447.  Go to the resources directory
      $ cd ~/LF/AAI/resources
    2. Set the debug port to 9447
      $ export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9447,server=y,suspend=n"
    3. Start the microservice
      $ mvn -pl aai-resources -P runAjsc -Daai.core.version=0.0.1-TEST-SNAPSHOT -Daai.schema.version=0.0.1-TEST-SNAPSHOT

  10. Start the "traversal" microservice
    1. Traversal runs on port 8446.  Go to the traversal directory
      $ cd ~/LF/AAI/traversal
    2. Set the debug port to 9446
      $ export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9446,server=y,suspend=n"
    3. Start the microservice
      $ mvn -pl aai-traversal -PrunAjsc -Daai.core.version=0.0.1-TEST-SNAPSHOT -Daai.schema.version=0.0.1-TEST-SNAPSHOT
      Should see something like this: Traversal Microservice Started

  11. Get an example cloud-region object, postman: Cloud-Region Example.postman_collection.json

    You should see the new attributes on the example object, as highlighted in the red rectangle above

  12. Copy and paste the example object and PUT it to persist the new attributes.  Use this postman collection thru step 15

  13. Check the object by doing a GET: GET Cloud-Region (no depth param) in postman collection
  14. Add the depth parameter: GET Cloud-Region (depth = all) in postman collection



    1. This indicates that the schema has been updated with the new attributes and they are making it to the database

  15. Clear the cloud region and then delete it by using "Clear Cloud-Region" and "Delete Cloud-Region"
    1. note: you will need to perform a GET each time and update the resource version of the cloud-region in the XML payload for the clear, and do the GET again and update the resource-version QueryParam to perform
      the delete

  16. Run PUT Cloud-Region - missing attr.  This will try to PUT the object without the required attribute we defined in the schema, and the response will look like this:

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <Fault>
    <requestError>
    <serviceException>
    <messageId>SVC3000</messageId>
    <text>Invalid input performing %1 on %2 (msg=%3) (ec=%4)</text>
    <variables>
    <variable>PUT</variable>
    <variable>v11/cloud-infrastructure/cloud-regions/cloud-region/example-cloud-owner-val-44086/example-cloud-region-id-val-67393</variable>
    <variable>Invalid input performing %1 on %2:Missing required property: new-attribute-for-demo</variable>
    <variable>ERR.5.2.3000</variable>
    </variables>
    </serviceException>
    </requestError>
    </Fault>

  17. Adding a new node type.  First, add the container under the top-level inventory category.  Adding "newWidgets" to "Network" so the URI will be "aai/v11/network/new-widgets/new-widget/{new-widget-name}"

    <java-type name="Network">
    <xml-properties>
    <xml-property name="description" value="Namespace for network inventory resources." />
    </xml-properties>
    <xml-root-element name="network" />
    <java-attributes>
    <xml-element java-attribute="logicalLinks" name="logical-links" type="inventory.aai.onap.org.v11.LogicalLinks" />
    <xml-element java-attribute="sitePairSets" name="site-pair-sets" type="inventory.aai.onap.org.v11.SitePairSets" />
    <xml-element java-attribute="vpnBindings" name="vpn-bindings" type="inventory.aai.onap.org.v11.VpnBindings" />
    <xml-element java-attribute="vplsPes" name="vpls-pes" type="inventory.aai.onap.org.v11.VplsPes" />
    <xml-element java-attribute="multicastConfigurations" name="multicast-configurations" type="inventory.aai.onap.org.v11.MulticastConfigurations" />
    <xml-element java-attribute="vces" name="vces" type="inventory.aai.onap.org.v11.Vces" />
    <xml-element java-attribute="vpes" name="vpes" type="inventory.aai.onap.org.v11.Vpes" />
    <xml-element java-attribute="vnfcs" name="vnfcs" type="inventory.aai.onap.org.v11.Vnfcs" />
    <xml-element java-attribute="l3Networks" name="l3-networks" type="inventory.aai.onap.org.v11.L3Networks" />
    <xml-element java-attribute="networkPolicies" name="network-policies" type="inventory.aai.onap.org.v11.NetworkPolicies" />
    <xml-element java-attribute="genericVnfs" name="generic-vnfs" type="inventory.aai.onap.org.v11.GenericVnfs" />
    <xml-element java-attribute="lagLinks" name="lag-links" type="inventory.aai.onap.org.v11.LagLinks" />
    <xml-element java-attribute="newvces" name="newvces" type="inventory.aai.onap.org.v11.Newvces" />
    <xml-element java-attribute="pnfs" name="pnfs" type="inventory.aai.onap.org.v11.Pnfs" />
    <xml-element java-attribute="physicalLinks" name="physical-links" type="inventory.aai.onap.org.v11.PhysicalLinks" />
    <xml-element java-attribute="newWidgets" name="new-widgets" type="inventory.aai.onap.org.v11.NewWidgets" />
    <xml-element java-attribute="ipsecConfigurations" name="ipsec-configurations" type="inventory.aai.onap.org.v11.IpsecConfigurations" />
    <xml-element java-attribute="routeTableReferences" name="route-table-references" type="inventory.aai.onap.org.v11.RouteTableReferences" />
    <xml-element java-attribute="instanceGroups" name="instance-groups" type="inventory.aai.onap.org.v11.InstanceGroups" />
    <xml-element java-attribute="zones" name="zones" type="inventory.aai.onap.org.v11.Zones" />
    </java-attributes>
    </java-type>



  18. Set up the "NewWidgets" java type:

    <java-type name="NewWidgets">
    <xml-properties>
    <xml-property name="description" value="Collection of new Widgets" />
    </xml-properties>
    <xml-root-element name="new-widgets" />
    <java-attributes>
    <xml-element container-type="java.util.ArrayList" java-attribute="newWidget" name="new-widget" type="inventory.aai.onap.org.v11.NewWidget" />
    </java-attributes>
    </java-type>

  19. Set up the NewWidget java type:

    <java-type name="NewWidget">
    <xml-root-element name="new-widget" />
    <java-attributes>
    <xml-element java-attribute="newWidgetName" name="new-widget-name" required="true" type="java.lang.String" xml-key="true">
    <xml-properties>
    <xml-property name="description" value="e.g.,awesome-new-widget, terrific-new-widget" />
    </xml-properties>
    </xml-element>
    <xml-element java-attribute="newWidgetType" name="new-widget-type" required="true" type="java.lang.String">
    <xml-properties>
    <xml-property name="description" value="Type of new Widget, e.g., fantastic, amazing" />
    </xml-properties>
    </xml-element>
    <xml-element java-attribute="resourceVersion" name="resource-version" type="java.lang.String">
    <xml-properties>
    <xml-property name="description" value="Used for optimistic concurrency. Must be empty on create, valid on update and delete." />
    </xml-properties>
    </xml-element>
    <xml-element java-attribute="modelInvariantId" name="model-invariant-id" type="java.lang.String">
    <xml-properties>
    <xml-property name="description" value="the ASDC model id for this resource or service model." />
    <xml-property name="visibility" value="deployment" />
    <xml-property name="requires" value="model-version-id" />
    <xml-property name="dbAlias" value="model-invariant-id-local" />
    </xml-properties>
    </xml-element>
    <xml-element java-attribute="modelVersionId" name="model-version-id" type="java.lang.String">
    <xml-properties>
    <xml-property name="description" value="the ASDC model version for this resource or service model." />
    <xml-property name="visibility" value="deployment" />
    <xml-property name="requires" value="model-invariant-id" />
    <xml-property name="dbAlias" value="model-version-id-local" />
    </xml-properties>
    </xml-element>
    <xml-element java-attribute="newWidgetId" name="new-widget-id" type="java.lang.String">
    <xml-properties>
    <xml-property name="description" value="ID of the newWidget" />
    </xml-properties>
    </xml-element>
    <xml-element java-attribute="relationshipList" name="relationship-list" type="inventory.aai.onap.org.v11.RelationshipList" />
    </java-attributes>
    <xml-properties>
    <xml-property name="description" value="New widgets are the best widgets. Our new widgets are really, really great."/>
    <xml-property name="indexedProps" value="new-widget-id,new-widget-name,model-invariant-id,model-version-id" />
    <xml-property name="uniqueProps" value="new-widget-id" />
    <xml-property name="container" value="new-widgets" />
    <xml-property name="namespace" value="network" />
    <xml-property name="searchable" value="new-widget-name,new-widget-id" />
    </xml-properties>
    </java-type>

  20. Save the file, and rebuild the libraries and microservices:

    here's my example file: aai_oxm_v11.xml
    1. Rebuild aai-common first:
    2. $ cd ~/LF/AAI/aai-common
    3. $ mvn versions:set -DnewVersion=0.0.1-TEST-SNAPSHOT
    4. $ mvn clean install
      Should result in BUILD SUCCESS
    5. $ cd ~/LF/AAI/resources
    6. $ mvn clean install -Daai.core.version=0.0.1-TEST-SNAPSHOT -Daai.schema.version=0.0.1-TEST-SNAPSHOT
      Should result in BUILD SUCCESS
    7. $ cd ~/LF/AAI/traversal
      mvn clean install -Daai.core.version=0.0.1-TEST-SNAPSHOT -Daai.schema.version=0.0.1-TEST-SNAPSHOT
    8. Should result in BUILD SUCCESS

  21. Run GenTester, using the target dir under aai-resources:

    $ cd ~/LF/AAI/graphadmin;

    java -DAJSC_HOME=. -DBUNDLECONFIG_DIR=src/main/resources/ -Dloader.main=org.onap.aai.schema.GenTester -Dloader.path=./src/main/resources -Dschema.ingest.file=src/main/resources/application.properties -jar target/aai-graphadmin-*.jar

    You should see the following output:

        ---- NOTE --- about to open graph (takes a little while)--------;

    -- loading schema into JanusGraph

    -- loading schema into JanusGraph

    -- Loading new schema elements into JanusGraph --

    -- graph commit

    -- graph shutdown

    You can check the logs to see if the graph elements were created successfully and grep for your propertycd logs/createDBSchema/;
    grep 'new-widget-name' metrics.log

    Creating PropertyKey: [new-widget-name], [String], [SINGLE]
    [DEV: 2017-Jul-28 08:44:12,287][INFO ][main ]Creating PropertyKey: [new-widget-name], [String], [SINGLE]
    Add index for PropertyKey: [new-widget-name]
    [DEV: 2017-Jul-28 08:44:12,289][INFO ][main ]Add index for PropertyKey: [new-widget-name]
    Creating PropertyKey: [new-widget-type], [String], [SINGLE]
    [DEV: 2017-Jul-28 08:44:12,291][INFO ][main ]Creating PropertyKey: [new-widget-type], [String], [SINGLE]
    No index added for PropertyKey: [new-widget-type]
    [DEV: 2017-Jul-28 08:44:12,501][INFO ][main ]No index added for PropertyKey: [new-widget-type]
    PropertyKey [resource-version] already existed in the DB.
    PropertyKey [model-invariant-id] already existed in the DB.
    PropertyKey [model-version-id] already existed in the DB.
    Creating PropertyKey: [new-widget-id], [String], [SINGLE]
    [DEV: 2017-Jul-28 08:44:12,501][INFO ][main ]Creating PropertyKey: [new-widget-id], [String], [SINGLE]

  22. Start the "resources" microservice
    1. Resources runs on port 8447.  Go to the resources directory
      $ cd ~/LF/AAI/resources
    2. Set the debug port to 9447
      $ export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9447,server=y,suspend=n"
    3. Start the microservice
      $ mvn -pl aai-resources -P runAjsc -Daai.core.version=0.0.1-TEST-SNAPSHOT -Daai.schema.version=0.0.1-TEST-SNAPSHOT
      Should see something like this: Resources Microservice Started

  23. Start the "traversal" microservice
    1. Traversal runs on port 8446.  Go to the traversal directory
      $ cd ~/LF/AAI/traversal
    2. Set the debug port to 9446
      $ export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9447,server=y,suspend=n"
    3. Start the microservice
      $ mvn -pl aai-traversal -P runAjsc -Daai.core.version=0.0.1-TEST-SNAPSHOT -Daai.schema.version=0.0.1-TEST-SNAPSHOT
      Should see something like this: Traversal Microservice Started
  24. Get an example newWidget using "New Widget Example" (find these examples in this postman collection: New-Widget Example.postman_collection.json)
  25. Copy the new widget and PUT it: (PUT New Widget)

  26. Success!  We have updated an existing object type and added a new object type.  Next, we will set up an edge between the CloudRegion and the NewWidget

  27. Open DbEdgeRules_v11.json
    File is aai-common/aai-core/src/main/resources/dbedgerules/DbEdgeRules_v11.json
  28. Add a new EdgeRule, allowing an edge between the CloudRegion and NewWidget:

            {

                "from": "cloud-region",

                "to": "tenant",

                "label": "has",

                "direction": "OUT",

                "multiplicity": "One2Many",

                "contains-other-v": "${direction}",

                "delete-other-v": "NONE",

                "SVC-INFRA": "!${direction}",

                "prevent-delete": "${direction}"

            },

            {

                "from": "cloud-region",

                "to": "new-widget",

                "label": "has",

                "direction": "OUT",

                "multiplicity": "One2Many",

                "contains-other-v": "NONE",

                "delete-other-v": "NONE",

                "SVC-INFRA": "NONE",

                "prevent-delete": "NONE"

            },


    This means cloud-region connects to new-widget, edge label is "has", it's an OUT edge, one cloud region can have multiple edges to new-widgets,

    cloud-region does not contain new-widget, new-widget will not be deleted when the cloud-region connected to it is deleted, it is not SVC_INFRA type, and having an edge to a new-widget will not prevent deletion of the cloud-region.



  29. Save the file, and rebuild aai-common, resources, and traversal.  Start resources and traversal microservices.

  30. Create a cloud region with a relationship to the new-widget that was created earlier: (PUT Cloud-Region related to New-Widget)

  31. GET the new-widget object: (GET New Widget)



  32. Notice that when GETting the new-widget object it shows the relationship to the cloud-region.

    We have successfully modified the schema and edge rules to update an existing type, create a new type, and define an edge relationship which allows for a new-widget type to be connected to a cloud-region.  


Attachments

  File Modified
PNG File image2017-7-26_16-58-5.png Jul 27, 2017 by James Forsyth
File Execute Named Query.postman_collection.json Jul 27, 2017 by James Forsyth
File Add Instances for Named Query.postman_collection.json Jul 27, 2017 by James Forsyth
File NamedQuery.postman_collection.json Jul 27, 2017 by James Forsyth
File Add Widget Models.postman_collection.json Jul 27, 2017 by James Forsyth
PNG File image2017-7-26_16-23-12.png Jul 27, 2017 by James Forsyth
PNG File image2017-7-26_16-17-19.png Jul 27, 2017 by James Forsyth
File models.csv Jul 27, 2017 by James Forsyth
PNG File image2017-7-26_11-6-11.png Jul 27, 2017 by James Forsyth
File aai.pem Jul 27, 2017 by James Forsyth
File haproxy.cfg Jul 27, 2017 by James Forsyth
PNG File image2017-7-27_12-31-54.png Jul 27, 2017 by James Forsyth
File Cloud-Region Example.postman_collection.json Jul 27, 2017 by James Forsyth
PNG File image2017-7-27_13-57-5.png Jul 27, 2017 by James Forsyth
PNG File image2017-7-27_14-6-25.png Jul 27, 2017 by James Forsyth
PNG File image2017-7-27_14-6-53.png Jul 27, 2017 by James Forsyth
PNG File image2017-7-27_14-7-35.png Jul 27, 2017 by James Forsyth
PNG File image2017-7-27_14-7-48.png Jul 27, 2017 by James Forsyth
PNG File image2017-7-27_14-11-36.png Jul 27, 2017 by James Forsyth
PNG File image2017-7-27_14-15-23.png Jul 27, 2017 by James Forsyth
PNG File image2017-7-27_14-19-20.png Jul 27, 2017 by James Forsyth
File Put-Get Cloud-Region.postman_collection.json Jul 27, 2017 by James Forsyth
PNG File image2017-7-27_15-4-5.png Jul 27, 2017 by James Forsyth
PNG File image2017-7-27_15-5-19.png Jul 27, 2017 by James Forsyth
PNG File image2017-7-27_15-8-17.png Jul 27, 2017 by James Forsyth
PNG File image2017-7-27_15-14-13.png Jul 27, 2017 by James Forsyth
PNG File image2017-7-28_8-26-35.png Jul 28, 2017 by James Forsyth
PNG File image2017-7-28_8-27-41.png Jul 28, 2017 by James Forsyth
XML File aai_oxm_v11.xml Jul 28, 2017 by James Forsyth
PNG File image2017-7-28_9-18-56.png Jul 28, 2017 by James Forsyth
PNG File image2017-7-28_9-20-43.png Jul 28, 2017 by James Forsyth
PNG File edgeruleScreenshot.png Aug 21, 2017 by Jane Threefoot
File New-Widget Example.postman_collection.json Aug 31, 2017 by James Forsyth
PNG File image2017-9-4_11-4-45.png Sep 04, 2017 by Thamlur Raju
PNG File 1.PNG Dec 07, 2018 by Alex Hooper
PNG File 2.PNG Dec 07, 2018 by Alex Hooper
PNG File cr1.PNG Dec 07, 2018 by Alex Hooper
File l3vpn-service-model.yang Dec 07, 2018 by Alex Hooper
PNG File l3vpnview.PNG Dec 07, 2018 by Alex Hooper


28 Comments

  1. Hi,

    Can any one explain me the Step-12 and step-15 briefly.

    1. It's demonstrating PUTting a cloud region object, showing what happens when you GET the object without the depth query parameter, then shows what you get when you set depth=all, then clearing the cloud region from the graph.  You have to copy the resource-version from the GET payload in order to successfully delete the cloud-region.

      1. Hello James Forsyth it looks like in step 15 postman link is missing for "Clear Cloud-Region" and "Delete Cloud-Region".

        1. I reuploaded them.

  2. Hi,

    Please any one tell me the URL for Step-30.

  3. Hi,

    Can anyone help me out from following error, while running GenTester i am getting this error.


    1. Make sure your ASJC_HOME is set correctly, looks like it can't find your titan realtime/cached properties files

  4. Hi @Jimmy Forsyth,

    When we are trying to add a child node to service-instance, it is creating but i am unable to make relationship with the other tree-node (sibling-tree).

    For existing nodes, i am following the same procedure, it is making the relationship. But for our new node is not able make relationship.

    So while creating a new node, what kind of rules/procedure we need to follow for making relationship, as like existing node.



  5. Hi Jimmy, Can you please let us know if a simplified UML model is available for  A&AI schema. The xsd file is quite big, the navigation is bit difficult. 

    1. Manoj Nair - sorry for the late reply; We are working on tools to make it easier to view the schema, look for details in the upcoming casablanca release.

  6. Wondering how adding of an attribute to an existing type works if there are existing nodes of this type in the DB. Considering there is a graph db underneath, I'd assume they will still be fine, just without this new attribute, correct?

    1. Evguenia (Jane) Freider Correct.  Breaking changes (like re-naming an attribute) require migrations, but we haven't had to deal with those thus far in ONAP (ECOMP is another story (smile))

  7. Hi!

    Is there an equivalent procedure for changing the OXM for AAI when you're using Beijing deployed by OOM? I assume I'd need to rebuild the Docker images OOM is using, but I can't find that process documented anywhere.

    Thanks!

    1. Hi Michael

      I just went through making schema changes in A&AI using OOM however I am currently using OOM with Amsterdam, not Beijing. However, I do not believe the process would have changed much. You are correct in that once you have made you schema changes in AAI (OXM) you just need to build the AAI resources docker image and update your AAI resource deployment to use the new image. To create the image what I do is the following:

      • Make your A&AI changes in AAI common project
      • Do a "maven clean install" to build the aai-common project
      • Next go to AAI resources project and do a "maven clean install"
      • After both projects have successfully built, you will want to locate the 'Dockerfile which will alow you build your new aai docker image
      • In my case the dockerfile was located: 

        <aai-project-root>/resources/aai-resources/target/swm/package/nix/dist_files/Dockerfile

      • you can cd into the above "dist_files" directory (the one with the docker file) and a run a 'Docker build .' command. This will pull all the changes you made to the schema from the AAI Common project and create the new docker image for AAI resources
      • If you succeeded in building the docker image you should have a brand new aai resources docker image in your docker repo (check "Docker images") and you should see a new image that was built recently.
      • You can now retag your docker image with whatever name and tag you wish (checkout the "docker tag" command). 
      • Push your image to whatever nexus repo your environment uses for docker images.
      • You can now change your AAI OOM values yaml for AAI resources to use your new image. 

      There also may be an alternative way to swap out jar files (containing your new schema changes) into your container which would save you from having to create a new Docker image... however I don't have the detailed steps for that at this moment.

      Hope that helps!  


  8. Hello i couldnt find the GenTester.java under inv-resources  1.3.0

  9. James Forsyth this is another page that needs a separate page for Beijing and an update for Casablanca, Dublin, etc. It is linked from the AAI Developer Environment Setup - Casablanca

    Venkata Harish Kajur the GenTester appears to have been moved from aai-resources to graphadmin. What are the new parameters needed to run the command in step 8?

  10. Venkata Harish Kajur this page is linked from both the Beijing and Casablanca version of the Developer setup pages. Doesn't this page need to be forked into two separate pages, one maintained for Beijing version and the other for Casablanca updates? and same again for Dublin changes?


  11. I'm having trouble getting edge rules to work properly.  I created a new network node type with some children nodes and added an edge rule between them.  I can get an example from the REST endpoint just fine, but when I PUT that same example, I get an error saying "Required Edge-property not found in input data'.  I compared it to how some of the other relationships are implemented (i.e. tenants to cloud-region) and mine is identical.  Am I missing a step to get the edge rules to be applied properly to the database?  Working off of the Beijing release.

    1. Hi Alex Hooper,

      Is it failing on step 32 (PUT new cloud-region with relation to new-widget)?

      So, steps 30 (add EdgeRule to json) and step 31 (rebuild microservices) passed without errors?

      I suspect you may have hit some Casablanca-related updates in this page, which will throw your Beijing-based system off.

      Could you check whether the earlier v19 revision of this page works out better?

      1. I actually just loosely followed this tutorial.  I'm working on porting an existing datastore to A&AI.  Everything builds and runs just fine.  The problem is when I PUT the entity.

        I put my schema changes here.. https://pastebin.com/cv5nBgCy

        Would you be able to take a look and tell me if I missed anything?  The only thing I can think of is that the edge rules aren't being applied correctly to the database, but I'm not sure how I could verify that.

        1. Hi Alex,

          According to your pastebin, there are a couple of inconsistencies in the OXM file (maybe 2 sets of partial edits?)

          • OXM line 84 (inside <java-type name="L3VpnViewServicePoint">):
            • <xml-property name="dependentOn" value="l3-vpn-service-request" />
            • "l3-vpn-service-request" isn't defined, but maybe it's meant to be "l3-vpn-view"?
            • this suggests that "l3-vpn-view-service-point" is intended as a sub-object of "l3-vpn-view", which will have impact on the EdgeRules later
          • OXM lines 90/91:
            • <xml-element java-attribute="l3VpnServiceRequests" name="l3-vpn-service-requests"type="inventory.aai.onap.org.v13.L3VpnServiceRequests" />

            • <xml-element java-attribute="l3VpnViews" name="l3-vpn-views" type="inventory.aai.onap.org.v13.L3VpnViews" />

            • again, "l3-vpn-service-requests" appears to be undefined, so either it is omitted from the pastebin or should be removed and updated in-line with suggestion above
          • EdgeRule lines 101/102 confirm the sub-object modelling however
            • "contains-other-v": "OUT",

            • "delete-other-v": "IN",

            • these are only configured as "${direction}" and "!${direction}" rather than "IN" and "OUT"
            • in this case, you probably want both to say "${direction}" which means that "l3-vpn-view" contains the other object as sub-component and will cascade delete the sub-component as well.

          BTW, is the "l3-vpn-view" just an experiment or a potential contribution? I was wondering whether it's needed given the existing "l3-network" and "vpn-binding" concepts?


    2. If your edge rule is similar to the tenants to cloud-region one, then it will represent a containment relation (contains-other-v != NONE).

      For containment relationships, the order in which you PUT objects matter, i.e. you must put the parent before you can PUT the child, alternatively you can PUT the parent and contained children in the same request payload by nesting the children under the parent.

      It might be useful to also share your PUT payloads and the order which you are PUTting them.

      1. I'm able to PUT a full cloud-region example with all of it's children and it's created just fine.  However, with my own nodes, I can't create a parent with or without the children in the payload.  Here are some screenshots of what I've tried..

        1. In the first image it seems to be complaining about the lack of a nested l3-vpn-view-service-point child object in the payload (not sure why this is mandatory)

          In the second image, where you included a child l3-vpn-view-service-point, the error message has changed, and is now complaining that you haven't defined an edge rule between l3-vpn-view-service-point and simple-interface. I notice that in your payload you have nested an "interface" object under the l3-vpn-view-service-point object, but this is neither defined in your OXM snippet or your edgeRule.

          Have you tried the payload from your second image with the "interface" object removed?

          1. My mistake.  I've been testing with a bunch of changes to my schema so my screenshots did not match up to the XML that I shared.   Nonetheless, with the interface removed I still get an error about a missing edge rule:

             

  12. How do I add an index to a property in an existing AAI (beijing) instance? We tried adding the property as searchable in the OXM file and re-deployed aai-resources, but our gremlin query is still not indexed.

    Also is there a chat channel available to discuss this in detail if required?

    1. Ajith Thampi you could try joining the AAI Weekly Status Meeting (Cancelled) and AAI Developers Meeting

      or otherwise use the mailing list https://lists.onap.org/g/onap-discuss/messages

      In terms of making a searchable property in Beijing release, I think you'll need to run the createDbSchema.sh script in aai-resources in order to apply the OXM change to the database. I don't know if that property will have the effect you desire on the Gremlin query.

      Venkata Harish Kajur or Chandra Cinthala may be able to elaborate further on it.


      1. Yes you need to run the createDBSchema.sh after you changed the oxm to add the indexedProps.

        Once that is done, the effect can be seen when you run the gremlin query