diff options
28 files changed, 4871 insertions, 380 deletions
diff --git a/Dockerfiles/aai-common/Dockerfile.alpine b/Dockerfiles/aai-common/Dockerfile.alpine new file mode 100644 index 00000000..915c511e --- /dev/null +++ b/Dockerfiles/aai-common/Dockerfile.alpine @@ -0,0 +1,39 @@ +FROM openjdk:8-jre-alpine3.9 + +# Set the version of the gosu command and if needs to be, it can be modified at runtime +ENV GOSU_VERSION 1.10 + +# For building the image in a proxy environment if necessary +ARG HTTP_PROXY +ARG HTTPS_PROXY +ARG no_proxy + +ENV HTTP_PROXY ${HTTP_PROXY} +ENV HTTPS_PROXY ${HTTPS_PROXY} +ENV http_proxy ${HTTP_PROXY} +ENV https_proxy ${HTTPS_PROXY} +ENV no_proxy 127.0.0.1,localhost,${no_proxy} + +RUN \ + # Put all the dependencies into this variable to easily install everything + DEPS="ca-certificates \ + curl \ + dpkg \ + fastjar \ + jq \ + loksh \ + bash \ + netcat-openbsd \ + openssl \ + shadow \ + util-linux \ + wget" \ + && apk add --no-cache ${DEPS} \ + # need fastjar for some projects to update app's jar on container restart + && ln -snf /usr/bin/fastjar $JAVA_HOME/bin/jar \ + # Get the dpkg to properly download and install that version compatible to install GOSU on the image + && dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')" \ + # Downloads the gosu command based on the dpkg version and gosu version supplied + && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \ + # Use GPG to install the gosu application locally + && chmod +x /usr/local/bin/gosu diff --git a/Dockerfiles/aai-common/Dockerfile b/Dockerfiles/aai-common/Dockerfile.ubuntu index fb7b6671..d81579d4 100644 --- a/Dockerfiles/aai-common/Dockerfile +++ b/Dockerfiles/aai-common/Dockerfile.ubuntu @@ -18,7 +18,7 @@ RUN \ # Creates the group and user with the name aaiadmin for aai #groupadd -r aaiadmin && useradd -r -g aaiadmin aaiadmin && \ # Put all the dependencies into this variable to easily install everything - DEPS="wget ca-certificates curl ksh git openjdk-8-jre-headless jq vim netcat uuid-runtime" && \ + DEPS="ca-certificates curl git fastjar jq ksh libcurl3 netcat openjdk-8-jre-headless vim uuid-runtime wget" && \ # Run the update before for the package manager to properly fetch install packages apt-get update && \ # Install the recommended dependencies diff --git a/Dockerfiles/aai-common/README.md b/Dockerfiles/aai-common/README.md index e61c63fb..82131247 100644 --- a/Dockerfiles/aai-common/README.md +++ b/Dockerfiles/aai-common/README.md @@ -2,12 +2,23 @@ ### Building the image -Run the following command if building the image in internal network +Run the following command to build AAI common images at internal network ```bash export NEW_VERSION=<NEW_VERSION> - docker build \ - -t aaionap/aai-common:${NEW_VERSION} . + export BASE_IMAGE=<alpine | ubuntu> + sudo docker build -t \ + nexus3.onap.org:10003/onap/aai-common-${BASE_IMAGE}:${NEW_VERSION} \ + -f Dockerfile.${BASE_IMAGE} . ``` -Replace the NEW\_VERSION with the new docker image version for aai-common +Replace the **NEW\_VERSION** with the new docker image version for aai-common. +Set **BASE\_IMAGE** to **alpine** or **ubuntu** to build aai-common-alpine or +aai-common-ubuntu image. + +NOTE: In order to push images into Nexus3, you have to be logged into Nexus3 +with appropriate credentials first. + +NOTE2: Both alpine and ubuntu based aai-common images are built automatically +by jenkins jobs and they are available at official ONAP docker registry +(currently nexus3). diff --git a/Dockerfiles/haproxy/Dockerfile b/Dockerfiles/haproxy/Dockerfile index f6d6c283..7bf9b20a 100644 --- a/Dockerfiles/haproxy/Dockerfile +++ b/Dockerfiles/haproxy/Dockerfile @@ -1,4 +1,4 @@ -FROM haproxy:1.7 +FROM haproxy:1.7-alpine # Set up your corporate proxy if there is ENV HTTP_PROXY "" @@ -6,17 +6,10 @@ ENV HTTPS_PROXY "" ENV http_proxy "" ENV https_proxy "" -ENV DEBIAN_FRONTEND=noninteractive - -RUN if [ ! -z ${HTTP_PROXY} ]; \ - then echo "Acquire::http::proxy \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf; \ - fi && \ - if [ ! -z ${HTTP_PROXY} ]; \ - then echo "Acquire::https::proxy \"${HTTP_PROXY}\";" >> /etc/apt/apt.conf; \ - fi && \ - apt-get update && \ - apt-get -y install ca-certificates openssl curl && \ - rm -rf /var/lib/apt/lists/* +RUN apk add --no-cache \ + ca-certificates \ + curl \ + openssl RUN mkdir -p /etc/ssl/certs/ && mkdir -p /etc/ssl/private diff --git a/aai-annotations/pom.xml b/aai-annotations/pom.xml index 3f5529e7..8838d532 100644 --- a/aai-annotations/pom.xml +++ b/aai-annotations/pom.xml @@ -27,12 +27,12 @@ <parent> <groupId>org.onap.aai.aai-common</groupId> <artifactId>aai-common</artifactId> - <version>1.4.3-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>aai-annotations</artifactId> <name>aai-annotations</name> <packaging>jar</packaging> - <version>1.4.3-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> <properties> <onap.nexus.url>https://nexus.onap.org</onap.nexus.url> </properties> @@ -55,10 +55,6 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> </plugin> - <plugin> - <groupId>org.sonatype.plugins</groupId> - <artifactId>nexus-staging-maven-plugin</artifactId> - </plugin> </plugins> </build> diff --git a/aai-auth/pom.xml b/aai-auth/pom.xml index 06d9410e..090a7bcd 100644 --- a/aai-auth/pom.xml +++ b/aai-auth/pom.xml @@ -26,11 +26,11 @@ <parent> <groupId>org.onap.aai.aai-common</groupId> <artifactId>aai-common</artifactId> - <version>1.4.3-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>aai-auth</artifactId> <name>aai-auth</name> - <version>1.4.3-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> <properties> <onap.nexus.url>https://nexus.onap.org</onap.nexus.url> @@ -70,10 +70,6 @@ <artifactId>maven-site-plugin</artifactId> <version>3.3</version> </plugin> - <plugin> - <groupId>org.sonatype.plugins</groupId> - <artifactId>nexus-staging-maven-plugin</artifactId> - </plugin> </plugins> </build> diff --git a/aai-core/pom.xml b/aai-core/pom.xml index dfc9ca52..75aea62b 100644 --- a/aai-core/pom.xml +++ b/aai-core/pom.xml @@ -27,13 +27,14 @@ <parent> <groupId>org.onap.aai.aai-common</groupId> <artifactId>aai-common</artifactId> - <version>1.4.3-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>aai-core</artifactId> <name>aai-core</name> - <version>1.4.3-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> + <springframework.version>4.3.24.RELEASE</springframework.version> <sonar.language>java</sonar.language> <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin> <sonar.surefire.reportsPath>${project.build.directory}/surefire-reports</sonar.surefire.reportsPath> @@ -74,6 +75,7 @@ <profile> <id>onap</id> <properties> + <springframework.version>4.3.24.RELEASE</springframework.version> <aai.release>onap</aai.release> <schema.configuration.location>N/A</schema.configuration.location> <schema.nodes.location>aai-schema/src/main/resources/${aai.release}/oxm</schema.nodes.location> @@ -174,10 +176,6 @@ <artifactId>maven-deploy-plugin</artifactId> </plugin> <plugin> - <groupId>org.sonatype.plugins</groupId> - <artifactId>nexus-staging-maven-plugin</artifactId> - </plugin> - <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> </plugin> @@ -265,7 +263,7 @@ <dependency> <groupId>org.janusgraph</groupId> <artifactId>janusgraph-core</artifactId> - <version>0.2.0</version> + <version>0.2.3</version> <exclusions> <exclusion> <groupId>org.slf4j</groupId> @@ -288,16 +286,6 @@ <version>1.1.1</version> </dependency> <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-web</artifactId> - <version>4.3.21.RELEASE</version> - </dependency> - <dependency> - <groupId>org.springframework</groupId> - <artifactId>spring-context</artifactId> - <version>4.3.21.RELEASE</version> - </dependency> - <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.2.11</version> @@ -443,16 +431,41 @@ <version>${groovy.version}</version> <classifier>indy</classifier> </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + <version>${springframework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-web</artifactId> + <version>${springframework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${springframework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-expression</artifactId> + <version>${springframework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-webmvc</artifactId> + <version>${springframework.version}</version> + </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> - <version>4.3.21.RELEASE</version> + <version>${springframework.version}</version> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-test</artifactId> - <version>1.5.20.RELEASE</version> + <version>1.5.21.RELEASE</version> <scope>test</scope> </dependency> <dependency> @@ -486,7 +499,7 @@ <dependency> <groupId>org.springframework</groupId> <artifactId>spring-jms</artifactId> - <version>4.3.21.RELEASE</version> + <version>${springframework.version}</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> diff --git a/aai-core/src/test/java/org/onap/aai/AAISetup.java b/aai-core/src/test/java/org/onap/aai/AAISetup.java index ade20f4a..4bc30b8c 100644 --- a/aai-core/src/test/java/org/onap/aai/AAISetup.java +++ b/aai-core/src/test/java/org/onap/aai/AAISetup.java @@ -22,7 +22,7 @@ package org.onap.aai; import java.util.Map; -import org.junit.BeforeClass; +import org.junit.Before; import org.junit.ClassRule; import org.junit.Rule; import org.onap.aai.config.ConfigConfiguration; @@ -88,8 +88,8 @@ public abstract class AAISetup { protected static final String SERVICE_NAME = "JUNIT"; - @BeforeClass - public static void setupBundleconfig() throws Exception { + @Before + public void setupBundleconfig() throws Exception { System.setProperty("AJSC_HOME", "."); System.setProperty("BUNDLECONFIG_DIR", "src/test/resources/bundleconfig-local"); System.setProperty("aai.service.name", SERVICE_NAME); diff --git a/aai-rest/pom.xml b/aai-rest/pom.xml index 3d57e69f..203a89e4 100644 --- a/aai-rest/pom.xml +++ b/aai-rest/pom.xml @@ -29,17 +29,17 @@ <parent> <groupId>org.onap.aai.aai-common</groupId> <artifactId>aai-common</artifactId> - <version>1.4.3-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>aai-rest</artifactId> <name>aai-rest</name> - <version>1.4.3-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> <properties> <onap.nexus.url>https://nexus.onap.org</onap.nexus.url> <eelf.core.version>1.0.1-oss</eelf.core.version> - <spring.boot.starter.web.version>1.5.20.RELEASE</spring.boot.starter.web.version> - <spring.boot.starter.parent.version>1.5.20.RELEASE</spring.boot.starter.parent.version> + <spring.boot.starter.web.version>1.5.21.RELEASE</spring.boot.starter.web.version> + <spring.boot.starter.parent.version>1.5.21.RELEASE</spring.boot.starter.parent.version> <spring.security.version>1.0.8.RELEASE</spring.security.version> </properties> @@ -121,7 +121,7 @@ <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-test</artifactId> - <version>1.5.20.RELEASE</version> + <version>1.5.21.RELEASE</version> <scope>test</scope> </dependency> </dependencies> diff --git a/aai-schema-ingest/pom.xml b/aai-schema-ingest/pom.xml index 73ac17f4..152994fb 100644 --- a/aai-schema-ingest/pom.xml +++ b/aai-schema-ingest/pom.xml @@ -25,16 +25,17 @@ <parent> <groupId>org.onap.aai.aai-common</groupId> <artifactId>aai-common</artifactId> - <version>1.4.3-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>aai-schema-ingest</artifactId> <name>aai-schema-ingest</name> - <version>1.4.3-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> <packaging>jar</packaging> <properties> <eelf.core.version>1.0.1-oss</eelf.core.version> <httpclient.version>4.5.5</httpclient.version> + <springframework.version>4.3.24.RELEASE</springframework.version> </properties> <build> <plugins> @@ -48,15 +49,12 @@ <artifactId>maven-deploy-plugin</artifactId> </plugin> <plugin> - <groupId>org.sonatype.plugins</groupId> - <artifactId>nexus-staging-maven-plugin</artifactId> - </plugin> - <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> </plugin> </plugins> </build> + <dependencies> <dependency> <groupId>org.eclipse.persistence</groupId> @@ -103,17 +101,32 @@ <dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> - <version>4.3.21.RELEASE</version> + <version>${springframework.version}</version> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> - <version>4.3.21.RELEASE</version> + <version>${springframework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + <version>${springframework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-expression</artifactId> + <version>${springframework.version}</version> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-webmvc</artifactId> + <version>${springframework.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> - <version>1.5.20.RELEASE</version> + <version>1.5.21.RELEASE</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> @@ -123,12 +136,12 @@ <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> - <version>4.3.21.RELEASE</version> + <version>${springframework.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-test</artifactId> - <version>1.5.20.RELEASE</version> + <version>1.5.21.RELEASE</version> <scope>test</scope> </dependency> <dependency> diff --git a/aai-utils/pom.xml b/aai-utils/pom.xml index 5a6cba4e..000c2d6f 100644 --- a/aai-utils/pom.xml +++ b/aai-utils/pom.xml @@ -29,11 +29,11 @@ <parent> <groupId>org.onap.aai.aai-common</groupId> <artifactId>aai-common</artifactId> - <version>1.4.3-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> </parent> <artifactId>aai-utils</artifactId> <name>aai-utils</name> - <version>1.4.3-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> <properties> <onap.nexus.url>https://nexus.onap.org</onap.nexus.url> @@ -120,10 +120,6 @@ <artifactId>maven-site-plugin</artifactId> <version>3.3</version> </plugin> - <plugin> - <groupId>org.sonatype.plugins</groupId> - <artifactId>nexus-staging-maven-plugin</artifactId> - </plugin> </plugins> </build> diff --git a/docs/AAI REST API Documentation/AAIRESTAPI.rst b/docs/AAI REST API Documentation/AAIRESTAPI.rst new file mode 100644 index 00000000..04cd6c08 --- /dev/null +++ b/docs/AAI REST API Documentation/AAIRESTAPI.rst @@ -0,0 +1,1777 @@ +.. contents:: + :depth: 3 +.. +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ + +============== + AAI REST API +============== + +Overview +======== + +The A&AI REST API provides access to the A&AI active inventory graph. +The API is largely configured off of models and configuration files. +Each vertex in the graph has an API that can be called separately or, +if part of a tree structure, as a nested element with one or more +generations (parent, grandparent, etc.). + +The edges of the graph are provisioned using a relationship list +construct. For PUT methods, a relationship contains the vertex type +or category (related-to) and a URI that provides the identity of the +resource within A&AI. The URI can be used with the server root to +call A&AI to get more details of the related resource but cannot be +cached for long periods. (e.g., the version of the URI may get +deprecated when the release changes). + +The REST API describes each API that A&AI provides, independent of the +caller of the API, therefore there is no information to be found here +regarding the expectations on the callers. That information is +conveyed in AID documents for each client. AIDs will describe the +information expected from specific clients, but may not contain the +full payloads that would be needed on an update. Please see the +concurrency notes referenced below in order to do the right kind of +PUTs (GET, replace just what you are changing, PUT) or use the PATCH +capability. + +Deprecation Warnings and History +================================ + +AAI will maintain backwards compatibility for three prior releases. +This means, with the introduction of v14 AAI will support **v11** +(Amsterdam), **v13** (Beijing), **v14** (Casablanca), and **v16** (Dublin) + +Dublin (v16) +------------ + +Clients can call the REST API with any valid path ending in /relationship-list to retrieve just the relationship-list for that object. + +For example: + - /network/generic-vnfs/generic-vnf/{vnf-id}/relationship-list + returns just the relationship-list of relationships for that generic-vnf + - /cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-name}/relationship-list + returns just the relationship-list of relationships for that vserver + +Custom Queries for replacing named queries are now available for clients to switch to. + +Casablanca (v14) +---------------- + +- A new API called recents API is now available mostly intended for DCAE use. + +- A new and improved bulk api interface is also available now. + +- More details on the above APIs can be found in wiki pages referenced + in sections below. + +Beijing (v13) +------------- + +- To handle security vulnerabilities that were raised as part of Nexus + IQ scans in ONAP, the APIs are being hosted on a spring-boot with + Jetty web container. + +- The deletion rules are now applied to all the nodes that will be + deleted by the delete request. + + For example, if the graph is: + + +------+----------+ + |nodeA | nodeD | + +------+----------+ + + If nodeA is parent of nodeB and nodeB is parent of nodeC + + +------+---------------------+ + |nodeA | CASCADE_TO_CHILDREN | + +------+---------------------+ + |nodeB | CASCADE_TO_CHILDREN | + +------+---------------------+ + |nodeC | ERROR_IF_IN_EDGES | + +------+---------------------+ + +- If request is to delete nodeA, it would fail because nodeC has an in + edge from a node not being deleted in this transaction. + +- A configurable server timeout was implemented to make sure the AAI + server did not continue processing the request long after a client + times out on their side. An error code ERR.5.4.7406 will be returned + when this limit is hit. A configuration for clients known to have + longer running queries currently overrides the default value. + +- To handle a risk identified by Fortify scans, a maxOccurs of 5000 + was added to the XSD. + +API changes +~~~~~~~~~~~ + +- DELETE request will generate a DMAAP event for each node deleted + (not just the for which the DELETE request was made) + +- Relationship list + + Starting with Casablanca, multiple edges can exist + in the graph between the same 2 nodes. The REST API has been + enhanced via changing the relationship-list so clients can specify + which edge they are creating and differentiate multiple edges + between the same 2 nodes. Backwards compatibility with older API + versions that do notspecify the edge will be maintained. + +- A new property “relationship-label” has been added that when + specified will be used to create any new edge. If not specified the + default edge label between the two nodes will be used. The + relationship-label will always be returned with the v12 version of + GETs whenever the relationship-list is returned. + +.. code-block:: json + + { + "relationship-list": { + "relationship": [ + { + "related-link": "/aai/v12/cloud-infrastructure/complexes/complex/6d8f945d-8bd2-4fa2-ad37-36b21fc8fb23-PS2418", + "related-to": "complex", + "relationship-data": [ + { + "relationship-key": "complex.physical-location-id", + "relationship-value": "6d8f945d-8bd2-4fa2-ad37-36b21fc8fb23-PS2418" + } + ], + "relationship-label": "locatedIn" + } + ] + } + } + +Amsterdam (v11) +--------------- + +API retirements: + +- The actions/update API will be retired. Clients must switch to PATCH. + There is one grandfathered usage for vpe update flows which will be + retired in v11. + +- The edge tag query will be retired. + +Notable attribute and/or valid value changes (generally also impacts +events): + +- The persona-model-id and persona-version will be replaced with + model-invariant-id (same value as persona-model-id) and + model-version-id (the UUID of the specific version of a model). + Persona-model-customization-id will be replaced by + model-customization-id. + +- The operational-state attribute will be replaced by + operational-status and the only valid values will be in-service-path + and out-of-service-path + +- The vpn-binding object will be split in two to reflect more than one + route-target per binding. The route-target will be a child of + vpn-binding and some attributes will move from vpn-binding to + route-target. + +- The following license related attributes will be removed from + generic-vnf: license-key, entitlement-assignment-group-uuid, + entitlement-resource-uuid, license-assignment-group-uuid, and + license-key-uuid due to the introduction of the entitlement and + license children. + +Event Specific: + +- Normal impacts due to renaming or adding attributes, splitting + objects, etc. Please see swagger documentation for objects of + interest. + +- In v11, clients that require lineage, children, or relationship + information need to subscribe to a different DMaaP topic than the + current one. + +Relationship List + +- The related-link will be a URI and thus not contain + https://{serverroot} (impacts events) + +- The related-link will be used on a PUT as the "first choice" to + identify the related resource. The relationship-data structure, which + contains the unordered set of keys, is still an acceptable way to + relate two objects but, *if both the relationship-data and the + related-link are passed, and they don't agree, the related-link will + be used without warning that the data is inconsistent*. + +- The relationship-data will be ignored on PUT. + +Future Warning +============== + +In the future, the hope is that individual node definitions will be +separately versioned from API behavior and from one another (e.g., +vserver hasn't changed in many releases and so doesn't need to have +its "definition" version updated). + +Because relationships are starting to become more complex, it may be +necessary for AAI to expose to clients the exact relationship between +two nodes. This will likely be done with a relationship-type +attribute of relationships in the relationship-list. + +To support the concept of events getting generated on specific changed +items, AAI will be migrating towards a model of asking clients to do +the most granular PUTs possible rather than leveraging the nested +elements of a tree structure. + +The vce, port-group, cvlan-tag, newvce, vpe, oam-network, and +dvs-switch objects will eventually be deprecated in favor of +generic-vnf, l3-network, ctag-assignment, segmentation-assignment, and +TBD. + +L3-network will eventually be replaced by virtual-network. + +How to Use this Document +======================== + +The only attributes in our objects that are declared required are +those which we know will be present at the creation of each object and +which are needed to support the construction of the AAI Graph. This +does not imply that one of AAI's clients doesn't need data. + +When you click on the API documentation, you will see the Summary of +APIs broken down by namespace (e.g., cloud-infrastructure, business, +network, service-design-and-creation). You can search for **Tag:** +(matching the explicit case) to move from namespace to namespace through +the Summary. + +Search for **Paths** to skip past the Summary section where there will +be more detail about each API. Query parameters are provided here, as +well as links to our error codes. + +Search for **Schema definitions** to see the definitions of the +payloads. In your browser URL, you can type /#/definitions/node-name at +the end of the html address to skip directly to a payload definition. + +Note that the schema definitions now contain information about the +delete scope of a node, edges, and some related node information. +Given this information can now be generated, it is no longer repeated +in this document. + +Once AAI has a model and configured it, the AAI development server can +be used to generate sample XML and JSON payloads, according to the +Accept header passed in the request. This is done by calling the +"plural" version of an API followed by the word example (e.g., +/vserver/vservers/example). This returns a GET result array with one +entry. That single entry can be sent in a PUT request with actual data +(the resource-id does not need to be in the PUT payload as it is on the +URL). + +Finally, custom queries that are not simple GETs of a resource must be +identified to AAI as separate user stories. This includes searching +for a resource with other attributes on the same resource, as well as +searching for resources based on their relationship with other +objects. + +AAI API Definition +================== + +Namespaces +---------- + +Cloud Infrastructure Domain +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The Cloud Infrastructure domain (cloud-infrastructure) represents the +assets managed within a cloud site. This includes the complex, the +physical servers, the availability zones, oam-networks, tenants, and +vserver-related resources (vservers, flavors, images, etc.). + +Tenants, oam-networks, availability-zones, volume-groups, images, +flavors, and dvs-switches will have cloud-region as its parent node. + +Network Domain +~~~~~~~~~~~~~~ + +The network namespace contains virtual and physical network resources +as well as connection resources such as physical links, logical links, +lag links, etc. + +The vce/port-group/cvlan-tag tree represents an immature model that +blended several resources together in ways that were expedient but +which need to be re-evaluated. A newvce object exists which was the +basis of the generic-vnf object. Future efforts will attempt to +migrate vce and vpe into generic-vnf. + +Business Domain +~~~~~~~~~~~~~~~ + +The business namespace captures customers, service-subscriptions, and +service-instances. This domain is immature and will be evolving as +service design and creation starts to gel. + +Customers and service-subscriptions in particular will be evolving +soon. Any service that is customer facing will see customer and +service-subscription data offboarding to BSSs. The +service-instance-id will be the "join point" within the BSS to +correlate the service-instance to the product and customer. Services +that are for infrastructure purposes will have a new entity, an +owning-entity, to replace the customer. The owning-entity will be +related to the SDC service models that use it. + +Service Design and Creation +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The service design and creation namespace captures data we invented +based on what we thought SDC would eventually provide. The structure +of that data is definitely not what the current plans are for SDC +however we need to at least capture the spirit of what's intended and +communicate that across ONAP sub components that need it. + +To date, there are only five containers: + +1. Service-capabilities capture the pairings of service to + resources. At the time of construction, the only data we had to + denote service was the service-type from SO. The vnf-type is the + resource. + +2. Service captures the service model instances and this will be + deprecated in the future as things mature + +3. Vnf-image captures information about the resource image needed for + a VNF. This was created due to there being no info available on + the vservers that run on uCPE + +4. Models captures model definitions (subgraph definitions using the + AAI widgets) + +5. named-queries capture subgraph definitions that allow different + data to be retrieved for a given type of asset + +Security +-------- + +All REST APIs must be called using https. + +HTTPS Basic Authentication will be used to authenticate clients. The +remote user from the HTTP Servlet Request is used against an AAI +policy to see if the authenticated user is authorized for the resource +and actions being request. + +Client should use credentials provided to their system via AAF. + +Headers +------- + +The following will be used for logging and interface diagnostic purposes. + + * X-FromAppId Unique Application ID assigned to the user of these APIs + * X-TransactionId Unique ID that identifies an API request + +The X-FromAppId will be assigned to each application by the AAI team. +The X-TransactionId must be unique to each transaction within the +context of an X-FromAppId. + +SO, SDN-C, and AAI have agreed to use the Java UUID class to generate +unique ids for X-TransactionId. + +The Accept and Content-type header should be set to either +application/json or application/xml except as documented for PATCH. + +Response Codes and Error Handling +--------------------------------- + +AAI will use the following HTTP codes + +HTTP Codes: +~~~~~~~~~~~ + +- 200 – Success +- 201 – Created +- 202 - Accepted +- 204 – Success, no payload returned +- 400 - Bad Request +- 401 - Unauthorized +- 403 - Forbidden +- 404 - Not Found +- 405 – Method Not Allowed +- 409 - The request could not be completed due to a conflict with the + current state of the target resource. This code is used in situations + where the user might be able to resolve the conflict and resubmit the + request. If the resource version doesn’t match AAI or a required + resource version isn't sent but should have been +- 410 - You are using a version of the API that has been retired +- 412 – Precondition failed (If the resource version doesn’t match AAI or arequired resource version isn't sent but should have been +- 415 – Unsupported Media Type +- 500 - Internal Server Error + +Successful PUT responses shall return the following codes: + * 200 (OK): used when an existing resource has been modified and + there is a response buffer + * 201 (Created): MUST be used when a new resource is created + * 202 (Accepted): used when AAI completed the action requested but + may have taken other actions as well, which are returned in the + response payload + * 204 (No Content): used when the existing resource has been modified + and there is no response buffer + +Successful DELETE responses shall return the following codes: + * 200 (OK): for a successful response if the response includes an + entity describing the status. + * 204 (No Content): if the action has been enacted but the response + does not include an entity. + +Successful GET responses shall return the following codes: + * 200 (OK): for a successful response for a resource that has been found + * 404 (Not Found) for a successful response retrieving a list of + items and there were no items found, i.e., the GET of the specific + plural resource was not found + * 404 (Not Found): when a specific resource was not found + +Failures: + * 400 Bad Request will be returned if headers are missing + * 404 Not Found will be returned if an unknown URL is used + +In addition, the standard response buffer will be structured as follows unless otherwise specified. +There are two types of requestErrors. + + * Service Exceptions – These exceptions occur when a service is + unable to process a request and retrying the request will result in + a consistent failure (e.g., an application provides invalid input). + * Policy Exceptions – These exceptions occur when a policy criteria + has not been met (e.g., the (N+1)th request arrives when an + application’s service level agreement only allows N transactions + per time interval). + +Italics are specific to the error returned, and generally described in the notes + +.. parsed-literal:: + + HTTP/1.1 405 *Method Not Allowed* + Content-Type: application/json + Content-Length: nnnnn + Date: *Thu, 04 Jun 2009 02:51:59 GMT* + { + “requestError”:{ + “policyException”:{ + “messageId”:"*POL8007*", + “text”:”*The resource was invoked with an unsupported operation: %1.*”, + “variables”: [”*PUT*”] + } + } + +Notes: + +a. On the first line, substitute the appropriate status response code. + +b. On the second line, substitute the appropriate content type. + +c. Express the requestError structure in the required content type (e.g., either JSON or XML). AAI will use JSON. + +d. ‘requestError’ contains either a ‘policyException’ or a ‘serviceException’ structure. + +e. url is optional + +In 1512, AAI is introducing a response payload that is possible during a successful PUT. This payload is used to inform the client that, while AAI completed the action requested, the result could be interpreted as a warning or request for additional action, as negotiated with the client. + +Sample response to a vserver PUT where the pserver and complex did not exist: + +.. code-block:: json + + {"responseMessages": {"responseMessage": [ + { + "messageId": "INF0003", + "text": "Success with additional info performing %1 on %2. Added %3 with key %4 (msg=%5) (rc=%6)", + "variables": {"variable": [ + "PUTvserver", + "ccwvm388", + "complex", + "physical-location-id=fakeccwcomplex", + "Added prerequisite object to db:complex", + "0.3.0004" + ]} + }, + { + "messageId": "INF0003", + "text": "Success with additional info performing %1 on %2. Added %3 with key %4 (msg=%5) (rc=%6)", + "variables": {"variable": [ + "PUTvserver", + "ccwvm388", + "pserver", + "hostname=fakeccwpserver", + "Added prerequisite object to db:pserver", + "0.3.0004" + ]} + } + ]}} + +Referential Integrity +--------------------- + +AAI is primarily a view to the relationships between instances of +services, physical and virtual components, etc. It stores just the +details it needs to be efficient to its tasks and knows how to get +more details if needed. + +As such, a transaction sent to AAI may be refused if would break +referential integrity. The referential integrity rules of AAI are +still evolving as we understand the services and customers that will +use us. + +AAI uses a graph database on a NoSQL data store. The following are +true for AAI: + +* Some vertices are exposed to the outside world through APIs, others + are internal to how we store the data (i.e., it may look like one + resource to our customers but it is expressed as more than one + vertex in our graph) + +* Vertices that are internal to AAI will be deleted when the parent + vertex is deleted, if deletion of the parent leaves the child vertex + orphaned + +* Vertices that are exposed need to be managed using specific rules + for each vertex. + +* Vertices may have more than just parent/child relationships. One + example is a vserver, which will be owned by a tenant and used by a + VNF. + + +URLs Sent To and Retrieved From A&AI +------------------------------------ + +A&AI receives URLs from clients that point back to that client in +order to get more details about the data sent to A&AI. A&AI expects +the URLs sent by clients (e.g., self links) to be URL encoded +(UTF-8) and A&AI will store them unchanged. + +URIs that A&AI constructs that point to A&AI resources will be +returned URLEncoded (UTF-8) to clients. This affects URIs in +relationship lists and search results. Note that A&AI used to send +URLs but, as reported in the 1707 impacts, these will now be URIs. + +A&AI expects space to be %20, and not plus(+). + +The Relationship-List +--------------------- + +The REST interface does not lend itself to creating more than +parent-child relationships and the backend structure of AAI is a +graph. A goal of AAI, and shared with ONAP, is to do as little coding +as possible to introduce a new service into the service design and +creation environment. + +To that end, we've introduced a relationship-list structure. AAI will +ask its clients to provide certain data in the relationship-list +structure. + +Each relationship has a related-to attribute and a list of key/value +pairs. The related-to attribute identifies the node type that the +resource being acted on is to be related to using the data in the +key/value pairs. AAI will encode a set of rules for each resource +type to verify that only valid edges are being made. AAI will keep +the directionality and cardinality, and the edge attributes within its +own logic. In the near future, the definition of relationships, their +validity, and cardinality will be captured in the ONAP TOSCA models. + +AAI also has a concept of a related-to category. To date, the only +category is vnf. The vnf category is used as the related-to value to +indicate that the relationship being establish is to a Virtual Network +Function of unknown type. The vnf-id happens to be unique for all +services across all nodes in the graph. By providing vnf.vnf-id with +a specific value, AAI can look at all VNFs in the graph and find the +appropriate vertex. Note that this only applies to PUTs. + +Category vnf is used for node types of vce, vpe, and generic-vnf. + +If an attempt is made to add a relationship to a node that doesn't +exist (e.g., from a vserver to a vnf, and the vnf doesn't exist), a +unique message Id (3003) will be returned with a specific error code +(ERR.5.4.6129). Arguments will tell the client which node type was +missing (e.g., vnf) and the key data for that node type (vnf.vnf-id). + +Single relationships can be PUT to the graph in the following way: + +.. code:: + + https://{serverRoot}/{namespace}/{resource}/relationship-list/relationship + +or + +.. code:: + + https://aai.onap:8443/aai/v16/cloud-infrastructure/pservers/pserver/pserver-123456789-01/p-interfaces/p-interface/p-interface-name-123456789-01/l-interfaces/l-interface/l-interface-name-123456789-01/relationship-list/relationship + +with a payload containing the relationship information. + +AAI will accept and give preference to the related-link URI + +XML + +.. code-block:: xml + + <relationship xmlns="http://org.onap.aai.inventory/vX"> + <related-link>*/aai/v16/network/logical-links/logical-link/logical-link-123456789-01*</related-link> + <related-to>logical-link</related-to> + <relationship-data> + <relationship-key>logical-link.link-name</relationship-key> + <relationship-value>logical-link-123456789-01</relationship-value> + </relationship-data> + </relationship> + +JSON + +.. code-block:: json + + { + "related-link": " /aai/v16/network/logical-links/logical-link/logical-link-123456789-01", + "related-to": "logical-link", + "relationship-data": [ + { + "relationship-key": "logical-link.link-name", + "relationship-value": " logical-link-123456789-01" + } + ] + } + +Health Check API +---------------- + +The util domain is where AAI locates utility functions. There is +currently one utility function, echo, which serves as a ping test that +authenticated authorized clients can call to ensure there is +connectivity with AAI. + +The URL for the echo utility is: + +.. code:: + + https://aai.onap:8443/aai/util/echo + +If the response is unsuccessful, an error will be returned following +the standard format. + +The successful payload returns the X-FromAppId and X-TransactionId +sent by the client. + +Successful XML Response Payload +------------------------------- + +.. code-block:: xml + + <Info> + <responseMessages> + <responseMessage> + <messageId>INF0001</messageId> + <text>Success X-FromAppId=%1 X-TransactionId=%2 (msg=%3) (rc=%4)</text> + <variables> + <variable>CCW</variable> + <variable>CCW33335</variable> + <variable>Successful health check:OK</variable> + <variable>0.0.0002</variable> + </variables> + </responseMessage> + </responseMessages> + </Info> + +Successful JSON Response Payload +-------------------------------- + +.. code-block:: json + + { + "responseMessages": { + "responseMessage": [ + { + "messageId": "INF0001", + "text": "Success X-FromAppId=%1 X-TransactionId=%2 (msg=%3) (rc=%4)", + "variables": { + "variable": [ + "CCW", + "CCW33335", + "Successful health check:OK", + "0.0.0002" + ] + } + } + ] + } + } + +AAI Resources CRUD APIs +======================= + +The API structure is composed of: + + * The HTTP command, which indicates the operation to perform + * The HTTP URI, which defines what object this operation is related to + * The HTTP version, which MUST be 1.1 + +Available HTTP commands are: + + * PUT: used to create or update an object + * DELETE: used to delete an object or a set of objects + * GET : used to query an object or set of objects + * PATCH : used to update specific fields owned by the client doing the update + +The HTTP URI is built according to this pattern: + +.. code:: + + https://{serverRoot}/{namespace}/{resource} + +* {serverRoot} refers to the server base url: hostname+port+base path+version. Port and base path are OPTIONAL but AAI will use port 8443 and base path aai. Note that the base path may change before production, so please make this configurable. Versions will change as releases are made. + +* {namespace} refers to the API namespace. Supported namespaces are cloud-infrastructure, business, service-design-and-creation, and network + +* {resource} refers to how the object is identified according to the namespace specifications. + +Example GET Request + +.. code:: + + GET https://aai.onap:8443/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id} + +Swagger and XSD: +---------------- + +`Offered APIs <../platform/offeredapis.html>`_ + +Data Assumptions +---------------- + +Given AAI is largely a correlation engine among disparate inventory +types, AAI will for the most part accept values as they are sent, +without validating the format or value of the input. **It is +incumbent upon the source of truth to provide valid information to +AAI.** + +Clients should either use the PATCH API to only change +the attribute values they mean to change, or do a GET prior to a PUT +and change only the data that they mean to affect. + +The PUT REST APIs expect the payload passed to replace the resource in +AAI. **A GET before PUT is vital in our concurrency scheme. The +client will be returned an opaque value per entity which needs to be +returned back in the PUT. AAI will reject the PUT or DELETE if the +opaque value doesn't match what AAI has stored for that entity.** + +If an attribute has been added to a model in vN+1, and a GET/PUT of a +vN resource is done, AAI should not affect the new attribute (i.e., it +should be left unchanged). + +Concurrency Control +------------------- + +Concurrency control for AAI is in place. + +* A client always gets a resource before updating through PUT or deleting it. + +* All resource updates and deletions are done via the AAI REST APIs + +* This solution will apply to PUT and DELETE operations. + +* The resource-version attribute is now in every container + +* The PATCH REST verb is not subject to concurrency control, because + it is only intended to be used by clients who are the definitive + source of truth for the attributes they are changing. An update + through the PATCH API will however reset the resource-version so + clients using PUT and DELETE will not risk updating with stale data. + If a client would like us to do concurrency control for PATCH, we + will need a feature request. PATCH is recommended for clients who + know they are the definitive source of data, as there is less risk + of destroying other data. + +If you use PUT, you MUST send back the entire resource, not just the +pieces you know about. This is best illustrated by example. Note: +Specific interfaces only show you the data you are responsible for but +that does not mean that's all the data that the resource you GET will +contain. You are responsible to overlay only your changes and leave +everything else untouched. + +Imagine this is the existing resource: + +.. code-block:: json + + { + "node-id": "valueOfNodeId", + "node-name": "valueOfNodeName", + "prov-status": "NVTPROV", + "relationship-list": { + "relationship": [ + { + "related-link": " /aai/v16/network/generic-vnfs/generic-vnf/generic-vnf-20160902a", + "related-to": "generic-vnf", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "generic-vnf-20160902a" + } + ] + }, + { + "related-link": " /aai/v16/network/generic-vnfs/generic-vnf/generic-vnf-20161010", + "related-to": "generic-vnf", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "generic-vnf-20161010" + } + ] + } + ] + }, + "resource-version": "1474912794" + } + +And you want to update the name and add a relationship to an l3-network. + +The payload you need to send back, if you choose PUT, is this. The +node-name and the third relationship block is the new data, and the +other data and relationships previously existed and must still be PUT. + +.. code-block:: json + + { + "node-id": "valueOfNodeId", + "node-name": "NEWvalueOfNodeName", + "prov-status": "NVTPROV", + "relationship-list": { + "relationship": [ + { + "related-link": " /aai/v16/network/generic-vnfs/generic-vnf/generic-vnf-20160902a", + "related-to": "generic-vnf", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "generic-vnf-20160902a" + } + ] + }, + { + "related-link": " /aai/v16/network/generic-vnfs/generic-vnf/generic-vnf-20161010", + "related-to": "generic-vnf", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "generic-vnf-20161010" + } + ] + }, + { + "related-link": " /aai/v16/network/l3-networks/l3-network/network-name-for-me", + "related-to": "l3-network", + "relationship-data": [ + { + "relationship-key": "l3-network.network-name", + "relationship-value": "network-name-for-me" + } + ] + } + ] + }, + "resource-version": "1474912794" + } + +A Warning About PUT and Lists +----------------------------- + +The PUT verb is used to both create and replace a resource. A given +resource may have child resources (e.g., customers have service +subscriptions, generic-vnfs have vf-modules, tenants have vservers and +vservers have volumes). + +The following convention will be followed: + + If a resource is replaced and there are no tags for children, the + children that exist will be left alone. + + If a resource is replaced and there are tags for children, the + children will be replaced by the list passed. If the list is empty, + then children will be deleted. + +Note that the relationship list is a type of child resource. The same +conventions are followed. It is especially critical to ensure that +you do not send an incomplete relationship list and therefore remove +edges in the graph. See `The Relationship-List`_ for more information on +relationship lists. See `Concurrency Control`_ for an example of GET followed by +PUT containing the entire resource (i.e., overlaying your changes on +what already exists so that you don't wipe out other data). + +PATCH +----- + +To move towards industry standards and to make our APIs easier to use +by clients who own specific attributes and do not require AAI to +enforce concurrency control around them, the PATCH verb has been +introduced. + +.. _RFC 7386: https://tools.ietf.org/html/rfc7386 + +- RFC Algorithm implemented JSON Merge PATCH: `RFC 7386`_ +- HTTP Verb = PATCH +- Clients can send a POST with "X-HTTP-Method-Override" = "PATCH" and + Content-Type = "application/merge-patch+json" to send a PATCH + request to AAI. +- PATCH does not support XML +- PATCH does not require a resource version to perform these modifications +- Clients should only send what they wish to modify and whose value they "own" +- PATCH returns a 200 with no response body for success + +Example: + +.. code:: + + PATCH https://aai.onap:8443/aai/v16/network/generic-vnfs/generic-vnf/cscf0001v + { + "vnf-id": "cscf0001v", <-- This key needs to be here but you cannot modify the key + "regional-resource-zone": null, + "ipv4-oam-address": "10.10.99.11" + } + +This payload would result in the generic-vnf with the vnf-id = +cscf0001v having ipv4-oam-address set to "10.10.99.11" and +regional-resource-zone having its value removed from the database. + +Note: PATCH is used only to update attributes on a single node that +already exists in AAI. That means it is not applicable to lists of +any type. + + * You do not manage relationships with PATCH. There is a + relationship API for that. + + * You cannot include child objects in a PATCH payload, i.e., you + cannot PATCH an l3-network's attributes as well as supply some + subnet children or their attributes within the same PATCH payload. + You can GET/overlay/PUT parent/child payloads or you can PUT or + PATCH each object individually with separate REST API calls. + +Optional Query Parameters +------------------------- + +A **depth** query parameter is available allowing a query to stop after it +has reached a certain point in the graph. This allows clients to +minimize the data that is returned to them and make the queries more +performant. A depth=0 will return information of the node referred to +by the URI only without any information on the children. + +Example + +.. code:: + + GET https://aai.onap:8443/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}?depth=0 + +A **nodes-only** parameter is available allowing a query to only +display the properties of the nodes being queried without any +relationship information. This allows clients to minimize data that is +returned to them and make the queries more performant. + +Example + +.. code:: + + GET https://aai.onap:8443/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}?nodes-only + +These parameters may be used in combination with each other. + +Example + +.. code:: + + GET https://aai.onap:8443/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}?depth=0&nodes-only + +Delete Scope and Edges +---------------------- + +An attempt to remove a node which would result in a delete scope being +violated will return error 5.4.6110. + +The swagger documentation has been updated to show information about +delete scope and edges. + +Here is a subset of the generic-vnf definition that will be used to +demonstrate how the delete scope and edges are documented. + +The following table summarizes actions AAI will take upon deletion of a resource, i.e., its default delete scope: + ++-----------------------------+--------------------------------------------------------------------+ +| ERROR_IF_ANY_EDGES | If the resource being deleted has any edges at all | +| | an error should be returned | ++-----------------------------+--------------------------------------------------------------------+ +| ERROR_IF_ANY_IN_EDGES | If the resource being deleted has any edges that point IN towards | +| | it, an error should be returned | ++-----------------------------+--------------------------------------------------------------------+ +| THIS_NODE_ONLY | Delete the vertex being requested by first deleting its edge to | +| | other vertices, but do not delete the other vertices. Note, the | +| | delete will be rejected if the deletion target has DEPENDENT | +| | children (e.g., tenants that have vservers) | ++-----------------------------+--------------------------------------------------------------------+ +| CASCADE_TO_CHILDREN | Cascade the delete through vertices who have a parentOf | +| | relationship to the vertex being deleted, as long as the vertex is | +| | orphaned by the delete of its parent | ++-----------------------------+--------------------------------------------------------------------+ +| ERROR_4_IN_EDGES_OR_CASCADE | Error if there are any in edges and, if not, cascade to | +| | children | ++-----------------------------+--------------------------------------------------------------------+ + +Edge Documentation + +* Node A is the object being defined - e.g., generic-vnf + +* Node B is the XXX of OUT TO XXX + +* Direction is always Node A OUT TO Node B. Node A has requirement + satisfied by Node B and the relationship is the edgelabel + +* Multiplicity is listed on the OUT TO edges + +* The former hasDelTarget is indicated by deletion statements that + make it clear what gets deleted as a side effect of deleting + something else. + +* The former isChild is indicated by full statements + + +.. parsed-literal:: + + *generic-vnf: object* + *General purpose VNF* + + *Default Delete Scope* + + CASCADE_TO_CHILDREN + + * *OUT TO vnfc (org.onap.relationships.inventory.Uses, One2Many, delete of generic-vnf will delete vnfc)* + * *IN FROM l-interface (l-interface child of generic-vnf)* + * *IN FROM service-instance* + +Server Timeout +-------------- + +A Server timeout is implemented for these APIs to make sure the server +did not continue processing the request long after a client times out +on their side. An error code ERR.5.4.7406 will be returned when this +limit is hit. The default value for Resources API is 60 secs. The +clients should set their timeouts accordingly. + +Bulk APIs +--------- + +The Bulk API allows clients to make multiple requests in a single +transaction. Please look for additional details on the following wiki +page: `Bulk API <bulkApi.html>`_ + +Nodes API +--------- + +In working with A&AI's standard REST API, you may have noticed that +certain API paths have a hierarchy to them and require a client to +know multiple object keys to preform GETs. For example: the vserver +object is under tenant, which is itself under cloud-region. If you +wanted to look up a vserver by name, you would still need to know the +tenant-id and cloud-region-id (and cloud-owner) in order to +successfully perform that GET. The nodes API allows for more freedom +in querying A&AI, allowing clients to circumvent the need to know +every key in the hierarchy. + +See `Nodes API <nodesApi.html>`_ for more information. + +AAI Traversal APIs +================== + +Not all queries of the graph are purely GETs of a specific resource +and its related vertexes. The following capabilities are available to +meet more advanced search needs. Please contact the AAI team if you +need another search. + +Nodes Query +----------- + +The Nodes Query mechanism was implemented in support of searching the +pservers which do not have the ipv4-oam-ipaddress set. It will allow +nodes to be searched based on certain properties of the nodes. It will +allow search based on properties being set, not set or set to specific +values. + +Please reference `Nodes Query <nodesQuery.html>`_ for details on the +API and test queries. + + +Generic Queries +--------------- + +The Generic Query mechanism allows to search for certain nodes of +“include” node types at a specified “depth” from the from a particular +start node of type “start-node-type” identified by specifying its +“key” values + + + +Model Based Query and Delete +---------------------------- + +AAI supports a search and delete capability that allows a client to +retrieve or delete an instance of a service based on the model +subgraph definition provided to AAI by ASDC. + +The instance filters must uniquely identify a service instance. + +The URL is as follows: + +.. code:: + + https://{serverRoot}/aai/search/model[?action=DELETE] + +.. code-block:: json + + { + "query-parameters": { + "model": { + "model-invariant-id": "$modelInvariantId", + "model-vers": { + "model-ver": [ + { + "model-version-id": "$modelVersionId" + } + ] + } + }, + "instance-filters": { + "instance-filter": [ + { + "customer": { + "global-customer-id": "$globalCustID" + }, + "service-instance": { + "resource-version": "$resourceversionID", + "service-instance-id": "$serviceInstanceID" + }, + "service-subscription": { + "service-type": "$serviceType" + } + } + ] + } + } + } + +Named Query +----------- + +These queries provide the ability to upload a json file describing the +inputs and designed output based on traversing the graph in a +particular way. Existing named queries are supported but will be +migrated to custom queries. **Named queries will be deprecated (no new +queries, just support for existing ones) in Dublin and clients will be +asked to migrate to use the custom queries instead.** + +Custom Query +------------ + +This API provides AAI clients an API for complex data retrieval. To +execute a custom query, a client will perform an HTTP PUT request on +the query API and include a payload indicating the starting node and +the query to be run. While the client is performing a PUT request, +this is actually a data query and no data is created or changed. + +Assumptions +~~~~~~~~~~~ + ++----------+-----------------------------+--------------------------+ +| No. | Assumption | Approach | ++==========+=============================+==========================+ +| 1 | Assume that client will | | +| | not request large amounts | | +| | of data from AAI w/out | | +| | using secondary filters | | ++----------+-----------------------------+--------------------------+ + +Depdendencies +~~~~~~~~~~~~~ + +Data has been PUT to AAI prior to the query. + +Custom Query URI +~~~~~~~~~~~~~~~~ + +.. code:: + + PUT /aai/v$/query?format={format} + +Query Formats +~~~~~~~~~~~~~ + +The format determines what information is returned from the +query. Acceptable formats are: count, id, pathed, resource, +resource_and_url, or simple. + +count +^^^^^ + +Provides an count of the objects returned in the query. + +.. code:: + + PUT /aai/v$/query?format=count + +Example reponse + +.. code-block:: json + + { + "results": [ + { + "pnf": 4, + "p-interface": 5, + "l-interface": 3, + "pserver": 1 + } + ] + } + +id +^^^ + +Provides an array of objects containing resource-type (AAI's node +type; i.e., pnf) and a URI using the vertex ID from AAI's graph. + +.. code:: + + PUT /aai/v$/query?format=id + +Example Response + +.. code-block:: json + + { + "results": [ + { + "resource-type": "complex", + "resource-link": "/aai/v1/resources/id/8159312" + }, + { + "resource-type": "complex", + "resource-link": "/aai/v1/resources/id/389256" + } + ] + } + +pathed +^^^^^^ + +Provides an array of objects containing resource-type (AAIs node type; +i.e., pnf) and a URI using the AAI REST API pathed URIs + +.. code:: + + PUT /aai/v$/query?format=pathed + +Example Response + +.. code-block:: json + + { + "results": [ + { + "resource-type": "complex", + "resource-link": "/aai/v1/cloud-infrastructure/complexes/complex/complex1" + }, + { + "resource-type": "complex", + "resource-link": "/aai/v1/cloud-infrastructure/complexes/complex/complex1" + } + ] + } + +resource +^^^^^^^^ + +Provides each object in the results array in the same format as AAI's +REST API with depth = 1 (first level children and cousin +relationships). + +.. code:: + + PUT /aai/v$/query?format=resource + + +Example Response + +.. code-block:: json + + { + "results": [ + { + "complex": { + "city": "Anywhere", + "complex-name": "complex-mccomplexface", + "country": "USA", + "data-center-code": "CHG", + "latitude": "30.123456", + "longitude": "-78.135344", + "physical-location-id": "complextest1", + "physical-location-type": "lab", + "postal-code": "90210", + "region": "West", + "relationship-list": { + "relationship": [ + { + "related-link": "/aai/v1/network/zones/zone/zone1", + "related-to": "zone", + "related-to-property": [ + { + "property-key": "zone.zone-name", + "property-value": "zone-name1" + } + ], + "relationship-data": [ + { + "relationship-key": "zone.zone-id", + "relationship-value": "zone1" + } + ], + "relationship-label": "org.onap.relationships.inventory.LocatedIn" + }, + { + "related-link": "/aai/v1/cloud-infrastructure/cloud-regions/cloud-region/Cloud-Region/Region1", + "related-to": "cloud-region", + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ], + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "Cloud-Region" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "Region1" + } + ], + "relationship-label": "org.onap.relationships.inventory.LocatedIn" + } + ] + }, + "resource-version": "1531233769164", + "state": "CA", + "street1": "100 Main St", + "street2": "C3-3W03" + } + } + ] + } + +resource_and_uri +^^^^^^^^^^^^^^^^ + +Provides each object in the results array in the same format as AAI’s +REST API with depth = 1 (first level children and cousin +relationships) plus the pathed url for the result object in AAI. + +.. code:: + + PUT /aai/v$/query?format=resource_and_url + +Example Response + +.. code-block:: json + + { + "results": [ + { + "complex": { + "city": "Anywhere", + "complex-name": "complex-mccomplexface", + "country": "USA", + "data-center-code": "CHG", + "latitude": "30.123456", + "longitude": "-78.135344", + "physical-location-id": "complextest1", + "physical-location-type": "lab", + "postal-code": "90210", + "region": "West", + "relationship-list": { + "relationship": [ + { + "related-link": "/aai/v16/network/zones/zone/zone1", + "related-to": "zone", + "related-to-property": [ + { + "property-key": "zone.zone-name", + "property-value": "zone-name1" + } + ], + "relationship-data": [ + { + "relationship-key": "zone.zone-id", + "relationship-value": "zone1" + } + ], + "relationship-label": "org.onap.relationships.inventory.LocatedIn" + }, + { + "related-link": "/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/Cloud-Region/Region1", + "related-to": "cloud-region", + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ], + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "Cloud-REgion" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "Region1" + } + ], + "relationship-label": "org.onap.relationships.inventory.LocatedIn" + } + ] + }, + "resource-version": "1531233769164", + "state": "CA", + "street1": "100 Main St", + "street2": "C3-3W03" + }, + "url": "/aai/v16/cloud-infrastructure/complexes/complex/complextest1" + } + ] + } + +simple +^^^^^^ + +Provides each result object in a simplified format. The node-type, +graph vertex id, pathed url, object properties, and directly related +objects in the graph are all returned. Both direct parent/child +objects and cousin objects are included in the related-to array. + +.. code:: + + PUT /aai/v$/query?format=simple + +Example Response + +.. code-block:: json + + { + "results": [ + { + "id": "81924184", + "node-type": "complex", + "properties": { + "city": "Anywhere", + "complex-name": "complex-mccomplexface", + "country": "USA", + "data-center-code": "CHG", + "latitude": "30.123456", + "longitude": "-78.135344", + "physical-location-id": "complextest1", + "physical-location-type": "lab", + "postal-code": "90210", + "region": "West", + "resource-version": "1531233769164", + "state": "CA", + "street1": "100 Main St", + "street2": "C3-3W03" + }, + "related-to": [ + { + "id": "40968400", + "node-type": "zone", + "relationship-label": "org.onap.relationships.inventory.LocatedIn", + "url": "/aai/v16/network/zones/zone/zone1" + }, + { + "id": "122884184", + "node-type": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.LocatedIn", + "url": "/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/Cloud-Region/Region1" + }, + { + "id": "122884296", + "node-type": "rack", + "relationship-label": "org.onap.relationships.inventory.LocatedIn", + "url": "/aai/v16/cloud-infrastructure/complexes/complex/complextest1/racks/rack/rackname1-1test" + } + ], + "url": "/aai/v16/cloud-infrastructure/complexes/complex/complextest1" + } + ] + } + +graphson +^^^^^^^^ + +Provides the results using the graphson standard. + +.. code:: + + PUT /aai/v$/query?format=graphson + +Example Response + +.. code-block:: json + + { + "results": [ + { + "id": 81924184, + "inE": { + "org.onap.relationships.inventory.LocatedIn": [ + { + "id": "oeioq-oe3f4-74l-1crx3s", + "outV": 40968400, + "properties": { + "aai-uuid": "9e75af3d-aa7f-4e8e-a7eb-32d8096f03cc", + "contains-other-v": "NONE", + "delete-other-v": "NONE", + "prevent-delete": "IN", + "private": false + } + }, + { + "id": "216a6j-215u1k-74l-1crx3s", + "outV": 122884184, + "properties": { + "aai-uuid": "4b3693be-b399-4355-8747-4ea2bb298dff", + "contains-other-v": "NONE", + "delete-other-v": "NONE", + "prevent-delete": "IN", + "private": false + } + }, + { + "id": "215xjt-215u4o-74l-1crx3s", + "outV": 122884296, + "properties": { + "aai-uuid": "958b8e10-6c42-4145-9cc1-76f50bb3e513", + "contains-other-v": "IN", + "delete-other-v": "IN", + "prevent-delete": "NONE", + "private": false + } + } + ] + }, + "label": "vertex", + "properties": { + "aai-created-ts": [ + { + "id": "1crvgr-1crx3s-6bk5", + "value": 1531231973518 + } + ], + "aai-last-mod-ts": [ + { + "id": "215vkb-1crx3s-6dxh", + "value": 1531233769164 + } + ], + "aai-node-type": [ + { + "id": "215urv-1crx3s-69z9", + "value": "complex" + } + ], + "aai-uri": [ + { + "id": "1crxfv-1crx3s-6gat", + "value": "/cloud-infrastructure/complexes/complex/complextest1" + } + ], + "aai-uuid": [ + { + "id": "1crvuz-1crx3s-1ybp", + "value": "3959ceca-3a89-4e92-a2ff-073b6f409303" + } + ], + "city": [ + { + "id": "1cs0zv-1crx3s-4irp", + "value": "Beverley Hills" + } + ], + "complex-name": [ + { + "id": "215wcr-1crx3s-4d8l", + "value": "chcil" + } + ], + "country": [ + { + "id": "1cs26j-1crx3s-4l51", + "value": "USA" + } + ], + "data-center-code": [ + { + "id": "215ssr-1crx3s-4bnp", + "value": "CHG" + } + ], + "last-mod-source-of-truth": [ + { + "id": "215vyj-1crx3s-696t", + "value": "aai-AppId" + } + ], + "latitude": [ + { + "id": "1cs2yz-1crx3s-4mpx", + "value": "30.123456" + } + ], + "longitude": [ + { + "id": "1cs3d7-1crx3s-4nid", + "value": "-174.135344" + } + ], + "physical-location-id": [ + { + "id": "1crzez-1crx3s-4a2t", + "value": "complextest1" + } + ], + "physical-location-type": [ + { + "id": "1crzt7-1crx3s-4ged", + "value": "lab" + } + ], + "postal-code": [ + { + "id": "1cs1sb-1crx3s-4kcl", + "value": "90210" + } + ], + "region": [ + { + "id": "1cs2kr-1crx3s-4lxh", + "value": "West" + } + ], + "resource-version": [ + { + "id": "215v63-1crx3s-glh", + "value": "1531233769164" + } + ], + "source-of-truth": [ + { + "id": "1crv2j-1crx3s-6epx", + "value": "foo" + } + ], + "state": [ + { + "id": "1cs1e3-1crx3s-4jk5", + "value": "CA" + } + ], + "street1": [ + { + "id": "1cs07f-1crx3s-4h6t", + "value": "100 Main St" + } + ], + "street2": [ + { + "id": "1cs0ln-1crx3s-4hz9", + "value": "Room 101" + } + ] + } + } + ] + } + + +Optional Query Parameters +~~~~~~~~~~~~~~~~~~~~~~~~~ + +depth +^^^^^ + +You can pass the depth query parameter to specify how many levels of +children/grandchildren to return. The default depth is 1. + +.. code:: + + PUT /aai/v$/query?format={format}&depth=0 + +nodesOnly +^^^^^^^^^ + +You can pass the nodesOnly query parameter to have the output only +contain the object properties with no relationships. + +.. code:: + + PUT /aai/v$/query?format={format}&nodesOnly=true + +subgraph +^^^^^^^^ + +You can pass a subgraph query parameter that determines the behavior +of the output. Using subgraph=prune returns all of the objects from +the query and only the edges between those objects. Using +subgraph=star returns all of the objects from the query plus all of +the objects they relate to. + +The default is subgraph=star + +.. code:: + + PUT /aai/v$/query?format={format}&subgraph={subgraph} + +HTTP Headers +~~~~~~~~~~~~ + ++--------------------------+--------------------------------------------------------------------------------------+ +| X-FromAppID={client ID}| Unique application identifier. | ++--------------------------+--------------------------------------------------------------------------------------+ +| X-TransactionID={UUDID} | must be a UUID and unique to each transaction within the context of an X-FromAppID. | ++--------------------------+--------------------------------------------------------------------------------------+ +| Content-Type={format} | format of the request. Should be application/json or application/xml. | ++--------------------------+--------------------------------------------------------------------------------------+ +| Accept={format} | format of the response. Should be application/json or application/xml. | ++--------------------------+--------------------------------------------------------------------------------------+ + +Request Payload +~~~~~~~~~~~~~~~ + +Typically the query payload will include both a "start" and a "query" +portion. The "start" can indicate one or more starting nodes in the +graph. If multiple nodes are specified, the result will contain the +query results for all of the start nodes. The "query" indicates the +name of the query to be run and also takes query parameters depending +on the query. Please reference the queries on the AAI wiki for +specific saved queries and how they should be usServer Timeout A +Server timeout is implemented for these APIs to make sure the server +did not continue processing the request long after a client times out +on their side. An error code ERR.5.4.7406 will be returned when this +limit is hit. The default value for Traversal API is 60 secs. The +clients should set their timeouts accordingly. + +List of Queries and Payloads +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +For a full list of available custom queries, please refer to our +`Custom Queries <customQueries.html>`_ document + +Recents API +----------- + +The Recents API allows a client to get the list of objects that has +been created or updated recently, up to a maximum of 1 week +back. + +`Recents API <recentsApi.html>`_ diff --git a/docs/AAI REST API Documentation/AAIRESTAPI_DUBLIN.rst b/docs/AAI REST API Documentation/AAIRESTAPI_DUBLIN.rst new file mode 100644 index 00000000..04cd6c08 --- /dev/null +++ b/docs/AAI REST API Documentation/AAIRESTAPI_DUBLIN.rst @@ -0,0 +1,1777 @@ +.. contents:: + :depth: 3 +.. +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_ + +============== + AAI REST API +============== + +Overview +======== + +The A&AI REST API provides access to the A&AI active inventory graph. +The API is largely configured off of models and configuration files. +Each vertex in the graph has an API that can be called separately or, +if part of a tree structure, as a nested element with one or more +generations (parent, grandparent, etc.). + +The edges of the graph are provisioned using a relationship list +construct. For PUT methods, a relationship contains the vertex type +or category (related-to) and a URI that provides the identity of the +resource within A&AI. The URI can be used with the server root to +call A&AI to get more details of the related resource but cannot be +cached for long periods. (e.g., the version of the URI may get +deprecated when the release changes). + +The REST API describes each API that A&AI provides, independent of the +caller of the API, therefore there is no information to be found here +regarding the expectations on the callers. That information is +conveyed in AID documents for each client. AIDs will describe the +information expected from specific clients, but may not contain the +full payloads that would be needed on an update. Please see the +concurrency notes referenced below in order to do the right kind of +PUTs (GET, replace just what you are changing, PUT) or use the PATCH +capability. + +Deprecation Warnings and History +================================ + +AAI will maintain backwards compatibility for three prior releases. +This means, with the introduction of v14 AAI will support **v11** +(Amsterdam), **v13** (Beijing), **v14** (Casablanca), and **v16** (Dublin) + +Dublin (v16) +------------ + +Clients can call the REST API with any valid path ending in /relationship-list to retrieve just the relationship-list for that object. + +For example: + - /network/generic-vnfs/generic-vnf/{vnf-id}/relationship-list + returns just the relationship-list of relationships for that generic-vnf + - /cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers/vserver/{vserver-name}/relationship-list + returns just the relationship-list of relationships for that vserver + +Custom Queries for replacing named queries are now available for clients to switch to. + +Casablanca (v14) +---------------- + +- A new API called recents API is now available mostly intended for DCAE use. + +- A new and improved bulk api interface is also available now. + +- More details on the above APIs can be found in wiki pages referenced + in sections below. + +Beijing (v13) +------------- + +- To handle security vulnerabilities that were raised as part of Nexus + IQ scans in ONAP, the APIs are being hosted on a spring-boot with + Jetty web container. + +- The deletion rules are now applied to all the nodes that will be + deleted by the delete request. + + For example, if the graph is: + + +------+----------+ + |nodeA | nodeD | + +------+----------+ + + If nodeA is parent of nodeB and nodeB is parent of nodeC + + +------+---------------------+ + |nodeA | CASCADE_TO_CHILDREN | + +------+---------------------+ + |nodeB | CASCADE_TO_CHILDREN | + +------+---------------------+ + |nodeC | ERROR_IF_IN_EDGES | + +------+---------------------+ + +- If request is to delete nodeA, it would fail because nodeC has an in + edge from a node not being deleted in this transaction. + +- A configurable server timeout was implemented to make sure the AAI + server did not continue processing the request long after a client + times out on their side. An error code ERR.5.4.7406 will be returned + when this limit is hit. A configuration for clients known to have + longer running queries currently overrides the default value. + +- To handle a risk identified by Fortify scans, a maxOccurs of 5000 + was added to the XSD. + +API changes +~~~~~~~~~~~ + +- DELETE request will generate a DMAAP event for each node deleted + (not just the for which the DELETE request was made) + +- Relationship list + + Starting with Casablanca, multiple edges can exist + in the graph between the same 2 nodes. The REST API has been + enhanced via changing the relationship-list so clients can specify + which edge they are creating and differentiate multiple edges + between the same 2 nodes. Backwards compatibility with older API + versions that do notspecify the edge will be maintained. + +- A new property “relationship-label” has been added that when + specified will be used to create any new edge. If not specified the + default edge label between the two nodes will be used. The + relationship-label will always be returned with the v12 version of + GETs whenever the relationship-list is returned. + +.. code-block:: json + + { + "relationship-list": { + "relationship": [ + { + "related-link": "/aai/v12/cloud-infrastructure/complexes/complex/6d8f945d-8bd2-4fa2-ad37-36b21fc8fb23-PS2418", + "related-to": "complex", + "relationship-data": [ + { + "relationship-key": "complex.physical-location-id", + "relationship-value": "6d8f945d-8bd2-4fa2-ad37-36b21fc8fb23-PS2418" + } + ], + "relationship-label": "locatedIn" + } + ] + } + } + +Amsterdam (v11) +--------------- + +API retirements: + +- The actions/update API will be retired. Clients must switch to PATCH. + There is one grandfathered usage for vpe update flows which will be + retired in v11. + +- The edge tag query will be retired. + +Notable attribute and/or valid value changes (generally also impacts +events): + +- The persona-model-id and persona-version will be replaced with + model-invariant-id (same value as persona-model-id) and + model-version-id (the UUID of the specific version of a model). + Persona-model-customization-id will be replaced by + model-customization-id. + +- The operational-state attribute will be replaced by + operational-status and the only valid values will be in-service-path + and out-of-service-path + +- The vpn-binding object will be split in two to reflect more than one + route-target per binding. The route-target will be a child of + vpn-binding and some attributes will move from vpn-binding to + route-target. + +- The following license related attributes will be removed from + generic-vnf: license-key, entitlement-assignment-group-uuid, + entitlement-resource-uuid, license-assignment-group-uuid, and + license-key-uuid due to the introduction of the entitlement and + license children. + +Event Specific: + +- Normal impacts due to renaming or adding attributes, splitting + objects, etc. Please see swagger documentation for objects of + interest. + +- In v11, clients that require lineage, children, or relationship + information need to subscribe to a different DMaaP topic than the + current one. + +Relationship List + +- The related-link will be a URI and thus not contain + https://{serverroot} (impacts events) + +- The related-link will be used on a PUT as the "first choice" to + identify the related resource. The relationship-data structure, which + contains the unordered set of keys, is still an acceptable way to + relate two objects but, *if both the relationship-data and the + related-link are passed, and they don't agree, the related-link will + be used without warning that the data is inconsistent*. + +- The relationship-data will be ignored on PUT. + +Future Warning +============== + +In the future, the hope is that individual node definitions will be +separately versioned from API behavior and from one another (e.g., +vserver hasn't changed in many releases and so doesn't need to have +its "definition" version updated). + +Because relationships are starting to become more complex, it may be +necessary for AAI to expose to clients the exact relationship between +two nodes. This will likely be done with a relationship-type +attribute of relationships in the relationship-list. + +To support the concept of events getting generated on specific changed +items, AAI will be migrating towards a model of asking clients to do +the most granular PUTs possible rather than leveraging the nested +elements of a tree structure. + +The vce, port-group, cvlan-tag, newvce, vpe, oam-network, and +dvs-switch objects will eventually be deprecated in favor of +generic-vnf, l3-network, ctag-assignment, segmentation-assignment, and +TBD. + +L3-network will eventually be replaced by virtual-network. + +How to Use this Document +======================== + +The only attributes in our objects that are declared required are +those which we know will be present at the creation of each object and +which are needed to support the construction of the AAI Graph. This +does not imply that one of AAI's clients doesn't need data. + +When you click on the API documentation, you will see the Summary of +APIs broken down by namespace (e.g., cloud-infrastructure, business, +network, service-design-and-creation). You can search for **Tag:** +(matching the explicit case) to move from namespace to namespace through +the Summary. + +Search for **Paths** to skip past the Summary section where there will +be more detail about each API. Query parameters are provided here, as +well as links to our error codes. + +Search for **Schema definitions** to see the definitions of the +payloads. In your browser URL, you can type /#/definitions/node-name at +the end of the html address to skip directly to a payload definition. + +Note that the schema definitions now contain information about the +delete scope of a node, edges, and some related node information. +Given this information can now be generated, it is no longer repeated +in this document. + +Once AAI has a model and configured it, the AAI development server can +be used to generate sample XML and JSON payloads, according to the +Accept header passed in the request. This is done by calling the +"plural" version of an API followed by the word example (e.g., +/vserver/vservers/example). This returns a GET result array with one +entry. That single entry can be sent in a PUT request with actual data +(the resource-id does not need to be in the PUT payload as it is on the +URL). + +Finally, custom queries that are not simple GETs of a resource must be +identified to AAI as separate user stories. This includes searching +for a resource with other attributes on the same resource, as well as +searching for resources based on their relationship with other +objects. + +AAI API Definition +================== + +Namespaces +---------- + +Cloud Infrastructure Domain +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The Cloud Infrastructure domain (cloud-infrastructure) represents the +assets managed within a cloud site. This includes the complex, the +physical servers, the availability zones, oam-networks, tenants, and +vserver-related resources (vservers, flavors, images, etc.). + +Tenants, oam-networks, availability-zones, volume-groups, images, +flavors, and dvs-switches will have cloud-region as its parent node. + +Network Domain +~~~~~~~~~~~~~~ + +The network namespace contains virtual and physical network resources +as well as connection resources such as physical links, logical links, +lag links, etc. + +The vce/port-group/cvlan-tag tree represents an immature model that +blended several resources together in ways that were expedient but +which need to be re-evaluated. A newvce object exists which was the +basis of the generic-vnf object. Future efforts will attempt to +migrate vce and vpe into generic-vnf. + +Business Domain +~~~~~~~~~~~~~~~ + +The business namespace captures customers, service-subscriptions, and +service-instances. This domain is immature and will be evolving as +service design and creation starts to gel. + +Customers and service-subscriptions in particular will be evolving +soon. Any service that is customer facing will see customer and +service-subscription data offboarding to BSSs. The +service-instance-id will be the "join point" within the BSS to +correlate the service-instance to the product and customer. Services +that are for infrastructure purposes will have a new entity, an +owning-entity, to replace the customer. The owning-entity will be +related to the SDC service models that use it. + +Service Design and Creation +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The service design and creation namespace captures data we invented +based on what we thought SDC would eventually provide. The structure +of that data is definitely not what the current plans are for SDC +however we need to at least capture the spirit of what's intended and +communicate that across ONAP sub components that need it. + +To date, there are only five containers: + +1. Service-capabilities capture the pairings of service to + resources. At the time of construction, the only data we had to + denote service was the service-type from SO. The vnf-type is the + resource. + +2. Service captures the service model instances and this will be + deprecated in the future as things mature + +3. Vnf-image captures information about the resource image needed for + a VNF. This was created due to there being no info available on + the vservers that run on uCPE + +4. Models captures model definitions (subgraph definitions using the + AAI widgets) + +5. named-queries capture subgraph definitions that allow different + data to be retrieved for a given type of asset + +Security +-------- + +All REST APIs must be called using https. + +HTTPS Basic Authentication will be used to authenticate clients. The +remote user from the HTTP Servlet Request is used against an AAI +policy to see if the authenticated user is authorized for the resource +and actions being request. + +Client should use credentials provided to their system via AAF. + +Headers +------- + +The following will be used for logging and interface diagnostic purposes. + + * X-FromAppId Unique Application ID assigned to the user of these APIs + * X-TransactionId Unique ID that identifies an API request + +The X-FromAppId will be assigned to each application by the AAI team. +The X-TransactionId must be unique to each transaction within the +context of an X-FromAppId. + +SO, SDN-C, and AAI have agreed to use the Java UUID class to generate +unique ids for X-TransactionId. + +The Accept and Content-type header should be set to either +application/json or application/xml except as documented for PATCH. + +Response Codes and Error Handling +--------------------------------- + +AAI will use the following HTTP codes + +HTTP Codes: +~~~~~~~~~~~ + +- 200 – Success +- 201 – Created +- 202 - Accepted +- 204 – Success, no payload returned +- 400 - Bad Request +- 401 - Unauthorized +- 403 - Forbidden +- 404 - Not Found +- 405 – Method Not Allowed +- 409 - The request could not be completed due to a conflict with the + current state of the target resource. This code is used in situations + where the user might be able to resolve the conflict and resubmit the + request. If the resource version doesn’t match AAI or a required + resource version isn't sent but should have been +- 410 - You are using a version of the API that has been retired +- 412 – Precondition failed (If the resource version doesn’t match AAI or arequired resource version isn't sent but should have been +- 415 – Unsupported Media Type +- 500 - Internal Server Error + +Successful PUT responses shall return the following codes: + * 200 (OK): used when an existing resource has been modified and + there is a response buffer + * 201 (Created): MUST be used when a new resource is created + * 202 (Accepted): used when AAI completed the action requested but + may have taken other actions as well, which are returned in the + response payload + * 204 (No Content): used when the existing resource has been modified + and there is no response buffer + +Successful DELETE responses shall return the following codes: + * 200 (OK): for a successful response if the response includes an + entity describing the status. + * 204 (No Content): if the action has been enacted but the response + does not include an entity. + +Successful GET responses shall return the following codes: + * 200 (OK): for a successful response for a resource that has been found + * 404 (Not Found) for a successful response retrieving a list of + items and there were no items found, i.e., the GET of the specific + plural resource was not found + * 404 (Not Found): when a specific resource was not found + +Failures: + * 400 Bad Request will be returned if headers are missing + * 404 Not Found will be returned if an unknown URL is used + +In addition, the standard response buffer will be structured as follows unless otherwise specified. +There are two types of requestErrors. + + * Service Exceptions – These exceptions occur when a service is + unable to process a request and retrying the request will result in + a consistent failure (e.g., an application provides invalid input). + * Policy Exceptions – These exceptions occur when a policy criteria + has not been met (e.g., the (N+1)th request arrives when an + application’s service level agreement only allows N transactions + per time interval). + +Italics are specific to the error returned, and generally described in the notes + +.. parsed-literal:: + + HTTP/1.1 405 *Method Not Allowed* + Content-Type: application/json + Content-Length: nnnnn + Date: *Thu, 04 Jun 2009 02:51:59 GMT* + { + “requestError”:{ + “policyException”:{ + “messageId”:"*POL8007*", + “text”:”*The resource was invoked with an unsupported operation: %1.*”, + “variables”: [”*PUT*”] + } + } + +Notes: + +a. On the first line, substitute the appropriate status response code. + +b. On the second line, substitute the appropriate content type. + +c. Express the requestError structure in the required content type (e.g., either JSON or XML). AAI will use JSON. + +d. ‘requestError’ contains either a ‘policyException’ or a ‘serviceException’ structure. + +e. url is optional + +In 1512, AAI is introducing a response payload that is possible during a successful PUT. This payload is used to inform the client that, while AAI completed the action requested, the result could be interpreted as a warning or request for additional action, as negotiated with the client. + +Sample response to a vserver PUT where the pserver and complex did not exist: + +.. code-block:: json + + {"responseMessages": {"responseMessage": [ + { + "messageId": "INF0003", + "text": "Success with additional info performing %1 on %2. Added %3 with key %4 (msg=%5) (rc=%6)", + "variables": {"variable": [ + "PUTvserver", + "ccwvm388", + "complex", + "physical-location-id=fakeccwcomplex", + "Added prerequisite object to db:complex", + "0.3.0004" + ]} + }, + { + "messageId": "INF0003", + "text": "Success with additional info performing %1 on %2. Added %3 with key %4 (msg=%5) (rc=%6)", + "variables": {"variable": [ + "PUTvserver", + "ccwvm388", + "pserver", + "hostname=fakeccwpserver", + "Added prerequisite object to db:pserver", + "0.3.0004" + ]} + } + ]}} + +Referential Integrity +--------------------- + +AAI is primarily a view to the relationships between instances of +services, physical and virtual components, etc. It stores just the +details it needs to be efficient to its tasks and knows how to get +more details if needed. + +As such, a transaction sent to AAI may be refused if would break +referential integrity. The referential integrity rules of AAI are +still evolving as we understand the services and customers that will +use us. + +AAI uses a graph database on a NoSQL data store. The following are +true for AAI: + +* Some vertices are exposed to the outside world through APIs, others + are internal to how we store the data (i.e., it may look like one + resource to our customers but it is expressed as more than one + vertex in our graph) + +* Vertices that are internal to AAI will be deleted when the parent + vertex is deleted, if deletion of the parent leaves the child vertex + orphaned + +* Vertices that are exposed need to be managed using specific rules + for each vertex. + +* Vertices may have more than just parent/child relationships. One + example is a vserver, which will be owned by a tenant and used by a + VNF. + + +URLs Sent To and Retrieved From A&AI +------------------------------------ + +A&AI receives URLs from clients that point back to that client in +order to get more details about the data sent to A&AI. A&AI expects +the URLs sent by clients (e.g., self links) to be URL encoded +(UTF-8) and A&AI will store them unchanged. + +URIs that A&AI constructs that point to A&AI resources will be +returned URLEncoded (UTF-8) to clients. This affects URIs in +relationship lists and search results. Note that A&AI used to send +URLs but, as reported in the 1707 impacts, these will now be URIs. + +A&AI expects space to be %20, and not plus(+). + +The Relationship-List +--------------------- + +The REST interface does not lend itself to creating more than +parent-child relationships and the backend structure of AAI is a +graph. A goal of AAI, and shared with ONAP, is to do as little coding +as possible to introduce a new service into the service design and +creation environment. + +To that end, we've introduced a relationship-list structure. AAI will +ask its clients to provide certain data in the relationship-list +structure. + +Each relationship has a related-to attribute and a list of key/value +pairs. The related-to attribute identifies the node type that the +resource being acted on is to be related to using the data in the +key/value pairs. AAI will encode a set of rules for each resource +type to verify that only valid edges are being made. AAI will keep +the directionality and cardinality, and the edge attributes within its +own logic. In the near future, the definition of relationships, their +validity, and cardinality will be captured in the ONAP TOSCA models. + +AAI also has a concept of a related-to category. To date, the only +category is vnf. The vnf category is used as the related-to value to +indicate that the relationship being establish is to a Virtual Network +Function of unknown type. The vnf-id happens to be unique for all +services across all nodes in the graph. By providing vnf.vnf-id with +a specific value, AAI can look at all VNFs in the graph and find the +appropriate vertex. Note that this only applies to PUTs. + +Category vnf is used for node types of vce, vpe, and generic-vnf. + +If an attempt is made to add a relationship to a node that doesn't +exist (e.g., from a vserver to a vnf, and the vnf doesn't exist), a +unique message Id (3003) will be returned with a specific error code +(ERR.5.4.6129). Arguments will tell the client which node type was +missing (e.g., vnf) and the key data for that node type (vnf.vnf-id). + +Single relationships can be PUT to the graph in the following way: + +.. code:: + + https://{serverRoot}/{namespace}/{resource}/relationship-list/relationship + +or + +.. code:: + + https://aai.onap:8443/aai/v16/cloud-infrastructure/pservers/pserver/pserver-123456789-01/p-interfaces/p-interface/p-interface-name-123456789-01/l-interfaces/l-interface/l-interface-name-123456789-01/relationship-list/relationship + +with a payload containing the relationship information. + +AAI will accept and give preference to the related-link URI + +XML + +.. code-block:: xml + + <relationship xmlns="http://org.onap.aai.inventory/vX"> + <related-link>*/aai/v16/network/logical-links/logical-link/logical-link-123456789-01*</related-link> + <related-to>logical-link</related-to> + <relationship-data> + <relationship-key>logical-link.link-name</relationship-key> + <relationship-value>logical-link-123456789-01</relationship-value> + </relationship-data> + </relationship> + +JSON + +.. code-block:: json + + { + "related-link": " /aai/v16/network/logical-links/logical-link/logical-link-123456789-01", + "related-to": "logical-link", + "relationship-data": [ + { + "relationship-key": "logical-link.link-name", + "relationship-value": " logical-link-123456789-01" + } + ] + } + +Health Check API +---------------- + +The util domain is where AAI locates utility functions. There is +currently one utility function, echo, which serves as a ping test that +authenticated authorized clients can call to ensure there is +connectivity with AAI. + +The URL for the echo utility is: + +.. code:: + + https://aai.onap:8443/aai/util/echo + +If the response is unsuccessful, an error will be returned following +the standard format. + +The successful payload returns the X-FromAppId and X-TransactionId +sent by the client. + +Successful XML Response Payload +------------------------------- + +.. code-block:: xml + + <Info> + <responseMessages> + <responseMessage> + <messageId>INF0001</messageId> + <text>Success X-FromAppId=%1 X-TransactionId=%2 (msg=%3) (rc=%4)</text> + <variables> + <variable>CCW</variable> + <variable>CCW33335</variable> + <variable>Successful health check:OK</variable> + <variable>0.0.0002</variable> + </variables> + </responseMessage> + </responseMessages> + </Info> + +Successful JSON Response Payload +-------------------------------- + +.. code-block:: json + + { + "responseMessages": { + "responseMessage": [ + { + "messageId": "INF0001", + "text": "Success X-FromAppId=%1 X-TransactionId=%2 (msg=%3) (rc=%4)", + "variables": { + "variable": [ + "CCW", + "CCW33335", + "Successful health check:OK", + "0.0.0002" + ] + } + } + ] + } + } + +AAI Resources CRUD APIs +======================= + +The API structure is composed of: + + * The HTTP command, which indicates the operation to perform + * The HTTP URI, which defines what object this operation is related to + * The HTTP version, which MUST be 1.1 + +Available HTTP commands are: + + * PUT: used to create or update an object + * DELETE: used to delete an object or a set of objects + * GET : used to query an object or set of objects + * PATCH : used to update specific fields owned by the client doing the update + +The HTTP URI is built according to this pattern: + +.. code:: + + https://{serverRoot}/{namespace}/{resource} + +* {serverRoot} refers to the server base url: hostname+port+base path+version. Port and base path are OPTIONAL but AAI will use port 8443 and base path aai. Note that the base path may change before production, so please make this configurable. Versions will change as releases are made. + +* {namespace} refers to the API namespace. Supported namespaces are cloud-infrastructure, business, service-design-and-creation, and network + +* {resource} refers to how the object is identified according to the namespace specifications. + +Example GET Request + +.. code:: + + GET https://aai.onap:8443/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id} + +Swagger and XSD: +---------------- + +`Offered APIs <../platform/offeredapis.html>`_ + +Data Assumptions +---------------- + +Given AAI is largely a correlation engine among disparate inventory +types, AAI will for the most part accept values as they are sent, +without validating the format or value of the input. **It is +incumbent upon the source of truth to provide valid information to +AAI.** + +Clients should either use the PATCH API to only change +the attribute values they mean to change, or do a GET prior to a PUT +and change only the data that they mean to affect. + +The PUT REST APIs expect the payload passed to replace the resource in +AAI. **A GET before PUT is vital in our concurrency scheme. The +client will be returned an opaque value per entity which needs to be +returned back in the PUT. AAI will reject the PUT or DELETE if the +opaque value doesn't match what AAI has stored for that entity.** + +If an attribute has been added to a model in vN+1, and a GET/PUT of a +vN resource is done, AAI should not affect the new attribute (i.e., it +should be left unchanged). + +Concurrency Control +------------------- + +Concurrency control for AAI is in place. + +* A client always gets a resource before updating through PUT or deleting it. + +* All resource updates and deletions are done via the AAI REST APIs + +* This solution will apply to PUT and DELETE operations. + +* The resource-version attribute is now in every container + +* The PATCH REST verb is not subject to concurrency control, because + it is only intended to be used by clients who are the definitive + source of truth for the attributes they are changing. An update + through the PATCH API will however reset the resource-version so + clients using PUT and DELETE will not risk updating with stale data. + If a client would like us to do concurrency control for PATCH, we + will need a feature request. PATCH is recommended for clients who + know they are the definitive source of data, as there is less risk + of destroying other data. + +If you use PUT, you MUST send back the entire resource, not just the +pieces you know about. This is best illustrated by example. Note: +Specific interfaces only show you the data you are responsible for but +that does not mean that's all the data that the resource you GET will +contain. You are responsible to overlay only your changes and leave +everything else untouched. + +Imagine this is the existing resource: + +.. code-block:: json + + { + "node-id": "valueOfNodeId", + "node-name": "valueOfNodeName", + "prov-status": "NVTPROV", + "relationship-list": { + "relationship": [ + { + "related-link": " /aai/v16/network/generic-vnfs/generic-vnf/generic-vnf-20160902a", + "related-to": "generic-vnf", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "generic-vnf-20160902a" + } + ] + }, + { + "related-link": " /aai/v16/network/generic-vnfs/generic-vnf/generic-vnf-20161010", + "related-to": "generic-vnf", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "generic-vnf-20161010" + } + ] + } + ] + }, + "resource-version": "1474912794" + } + +And you want to update the name and add a relationship to an l3-network. + +The payload you need to send back, if you choose PUT, is this. The +node-name and the third relationship block is the new data, and the +other data and relationships previously existed and must still be PUT. + +.. code-block:: json + + { + "node-id": "valueOfNodeId", + "node-name": "NEWvalueOfNodeName", + "prov-status": "NVTPROV", + "relationship-list": { + "relationship": [ + { + "related-link": " /aai/v16/network/generic-vnfs/generic-vnf/generic-vnf-20160902a", + "related-to": "generic-vnf", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "generic-vnf-20160902a" + } + ] + }, + { + "related-link": " /aai/v16/network/generic-vnfs/generic-vnf/generic-vnf-20161010", + "related-to": "generic-vnf", + "relationship-data": [ + { + "relationship-key": "generic-vnf.vnf-id", + "relationship-value": "generic-vnf-20161010" + } + ] + }, + { + "related-link": " /aai/v16/network/l3-networks/l3-network/network-name-for-me", + "related-to": "l3-network", + "relationship-data": [ + { + "relationship-key": "l3-network.network-name", + "relationship-value": "network-name-for-me" + } + ] + } + ] + }, + "resource-version": "1474912794" + } + +A Warning About PUT and Lists +----------------------------- + +The PUT verb is used to both create and replace a resource. A given +resource may have child resources (e.g., customers have service +subscriptions, generic-vnfs have vf-modules, tenants have vservers and +vservers have volumes). + +The following convention will be followed: + + If a resource is replaced and there are no tags for children, the + children that exist will be left alone. + + If a resource is replaced and there are tags for children, the + children will be replaced by the list passed. If the list is empty, + then children will be deleted. + +Note that the relationship list is a type of child resource. The same +conventions are followed. It is especially critical to ensure that +you do not send an incomplete relationship list and therefore remove +edges in the graph. See `The Relationship-List`_ for more information on +relationship lists. See `Concurrency Control`_ for an example of GET followed by +PUT containing the entire resource (i.e., overlaying your changes on +what already exists so that you don't wipe out other data). + +PATCH +----- + +To move towards industry standards and to make our APIs easier to use +by clients who own specific attributes and do not require AAI to +enforce concurrency control around them, the PATCH verb has been +introduced. + +.. _RFC 7386: https://tools.ietf.org/html/rfc7386 + +- RFC Algorithm implemented JSON Merge PATCH: `RFC 7386`_ +- HTTP Verb = PATCH +- Clients can send a POST with "X-HTTP-Method-Override" = "PATCH" and + Content-Type = "application/merge-patch+json" to send a PATCH + request to AAI. +- PATCH does not support XML +- PATCH does not require a resource version to perform these modifications +- Clients should only send what they wish to modify and whose value they "own" +- PATCH returns a 200 with no response body for success + +Example: + +.. code:: + + PATCH https://aai.onap:8443/aai/v16/network/generic-vnfs/generic-vnf/cscf0001v + { + "vnf-id": "cscf0001v", <-- This key needs to be here but you cannot modify the key + "regional-resource-zone": null, + "ipv4-oam-address": "10.10.99.11" + } + +This payload would result in the generic-vnf with the vnf-id = +cscf0001v having ipv4-oam-address set to "10.10.99.11" and +regional-resource-zone having its value removed from the database. + +Note: PATCH is used only to update attributes on a single node that +already exists in AAI. That means it is not applicable to lists of +any type. + + * You do not manage relationships with PATCH. There is a + relationship API for that. + + * You cannot include child objects in a PATCH payload, i.e., you + cannot PATCH an l3-network's attributes as well as supply some + subnet children or their attributes within the same PATCH payload. + You can GET/overlay/PUT parent/child payloads or you can PUT or + PATCH each object individually with separate REST API calls. + +Optional Query Parameters +------------------------- + +A **depth** query parameter is available allowing a query to stop after it +has reached a certain point in the graph. This allows clients to +minimize the data that is returned to them and make the queries more +performant. A depth=0 will return information of the node referred to +by the URI only without any information on the children. + +Example + +.. code:: + + GET https://aai.onap:8443/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}?depth=0 + +A **nodes-only** parameter is available allowing a query to only +display the properties of the nodes being queried without any +relationship information. This allows clients to minimize data that is +returned to them and make the queries more performant. + +Example + +.. code:: + + GET https://aai.onap:8443/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}?nodes-only + +These parameters may be used in combination with each other. + +Example + +.. code:: + + GET https://aai.onap:8443/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}?depth=0&nodes-only + +Delete Scope and Edges +---------------------- + +An attempt to remove a node which would result in a delete scope being +violated will return error 5.4.6110. + +The swagger documentation has been updated to show information about +delete scope and edges. + +Here is a subset of the generic-vnf definition that will be used to +demonstrate how the delete scope and edges are documented. + +The following table summarizes actions AAI will take upon deletion of a resource, i.e., its default delete scope: + ++-----------------------------+--------------------------------------------------------------------+ +| ERROR_IF_ANY_EDGES | If the resource being deleted has any edges at all | +| | an error should be returned | ++-----------------------------+--------------------------------------------------------------------+ +| ERROR_IF_ANY_IN_EDGES | If the resource being deleted has any edges that point IN towards | +| | it, an error should be returned | ++-----------------------------+--------------------------------------------------------------------+ +| THIS_NODE_ONLY | Delete the vertex being requested by first deleting its edge to | +| | other vertices, but do not delete the other vertices. Note, the | +| | delete will be rejected if the deletion target has DEPENDENT | +| | children (e.g., tenants that have vservers) | ++-----------------------------+--------------------------------------------------------------------+ +| CASCADE_TO_CHILDREN | Cascade the delete through vertices who have a parentOf | +| | relationship to the vertex being deleted, as long as the vertex is | +| | orphaned by the delete of its parent | ++-----------------------------+--------------------------------------------------------------------+ +| ERROR_4_IN_EDGES_OR_CASCADE | Error if there are any in edges and, if not, cascade to | +| | children | ++-----------------------------+--------------------------------------------------------------------+ + +Edge Documentation + +* Node A is the object being defined - e.g., generic-vnf + +* Node B is the XXX of OUT TO XXX + +* Direction is always Node A OUT TO Node B. Node A has requirement + satisfied by Node B and the relationship is the edgelabel + +* Multiplicity is listed on the OUT TO edges + +* The former hasDelTarget is indicated by deletion statements that + make it clear what gets deleted as a side effect of deleting + something else. + +* The former isChild is indicated by full statements + + +.. parsed-literal:: + + *generic-vnf: object* + *General purpose VNF* + + *Default Delete Scope* + + CASCADE_TO_CHILDREN + + * *OUT TO vnfc (org.onap.relationships.inventory.Uses, One2Many, delete of generic-vnf will delete vnfc)* + * *IN FROM l-interface (l-interface child of generic-vnf)* + * *IN FROM service-instance* + +Server Timeout +-------------- + +A Server timeout is implemented for these APIs to make sure the server +did not continue processing the request long after a client times out +on their side. An error code ERR.5.4.7406 will be returned when this +limit is hit. The default value for Resources API is 60 secs. The +clients should set their timeouts accordingly. + +Bulk APIs +--------- + +The Bulk API allows clients to make multiple requests in a single +transaction. Please look for additional details on the following wiki +page: `Bulk API <bulkApi.html>`_ + +Nodes API +--------- + +In working with A&AI's standard REST API, you may have noticed that +certain API paths have a hierarchy to them and require a client to +know multiple object keys to preform GETs. For example: the vserver +object is under tenant, which is itself under cloud-region. If you +wanted to look up a vserver by name, you would still need to know the +tenant-id and cloud-region-id (and cloud-owner) in order to +successfully perform that GET. The nodes API allows for more freedom +in querying A&AI, allowing clients to circumvent the need to know +every key in the hierarchy. + +See `Nodes API <nodesApi.html>`_ for more information. + +AAI Traversal APIs +================== + +Not all queries of the graph are purely GETs of a specific resource +and its related vertexes. The following capabilities are available to +meet more advanced search needs. Please contact the AAI team if you +need another search. + +Nodes Query +----------- + +The Nodes Query mechanism was implemented in support of searching the +pservers which do not have the ipv4-oam-ipaddress set. It will allow +nodes to be searched based on certain properties of the nodes. It will +allow search based on properties being set, not set or set to specific +values. + +Please reference `Nodes Query <nodesQuery.html>`_ for details on the +API and test queries. + + +Generic Queries +--------------- + +The Generic Query mechanism allows to search for certain nodes of +“include” node types at a specified “depth” from the from a particular +start node of type “start-node-type” identified by specifying its +“key” values + + + +Model Based Query and Delete +---------------------------- + +AAI supports a search and delete capability that allows a client to +retrieve or delete an instance of a service based on the model +subgraph definition provided to AAI by ASDC. + +The instance filters must uniquely identify a service instance. + +The URL is as follows: + +.. code:: + + https://{serverRoot}/aai/search/model[?action=DELETE] + +.. code-block:: json + + { + "query-parameters": { + "model": { + "model-invariant-id": "$modelInvariantId", + "model-vers": { + "model-ver": [ + { + "model-version-id": "$modelVersionId" + } + ] + } + }, + "instance-filters": { + "instance-filter": [ + { + "customer": { + "global-customer-id": "$globalCustID" + }, + "service-instance": { + "resource-version": "$resourceversionID", + "service-instance-id": "$serviceInstanceID" + }, + "service-subscription": { + "service-type": "$serviceType" + } + } + ] + } + } + } + +Named Query +----------- + +These queries provide the ability to upload a json file describing the +inputs and designed output based on traversing the graph in a +particular way. Existing named queries are supported but will be +migrated to custom queries. **Named queries will be deprecated (no new +queries, just support for existing ones) in Dublin and clients will be +asked to migrate to use the custom queries instead.** + +Custom Query +------------ + +This API provides AAI clients an API for complex data retrieval. To +execute a custom query, a client will perform an HTTP PUT request on +the query API and include a payload indicating the starting node and +the query to be run. While the client is performing a PUT request, +this is actually a data query and no data is created or changed. + +Assumptions +~~~~~~~~~~~ + ++----------+-----------------------------+--------------------------+ +| No. | Assumption | Approach | ++==========+=============================+==========================+ +| 1 | Assume that client will | | +| | not request large amounts | | +| | of data from AAI w/out | | +| | using secondary filters | | ++----------+-----------------------------+--------------------------+ + +Depdendencies +~~~~~~~~~~~~~ + +Data has been PUT to AAI prior to the query. + +Custom Query URI +~~~~~~~~~~~~~~~~ + +.. code:: + + PUT /aai/v$/query?format={format} + +Query Formats +~~~~~~~~~~~~~ + +The format determines what information is returned from the +query. Acceptable formats are: count, id, pathed, resource, +resource_and_url, or simple. + +count +^^^^^ + +Provides an count of the objects returned in the query. + +.. code:: + + PUT /aai/v$/query?format=count + +Example reponse + +.. code-block:: json + + { + "results": [ + { + "pnf": 4, + "p-interface": 5, + "l-interface": 3, + "pserver": 1 + } + ] + } + +id +^^^ + +Provides an array of objects containing resource-type (AAI's node +type; i.e., pnf) and a URI using the vertex ID from AAI's graph. + +.. code:: + + PUT /aai/v$/query?format=id + +Example Response + +.. code-block:: json + + { + "results": [ + { + "resource-type": "complex", + "resource-link": "/aai/v1/resources/id/8159312" + }, + { + "resource-type": "complex", + "resource-link": "/aai/v1/resources/id/389256" + } + ] + } + +pathed +^^^^^^ + +Provides an array of objects containing resource-type (AAIs node type; +i.e., pnf) and a URI using the AAI REST API pathed URIs + +.. code:: + + PUT /aai/v$/query?format=pathed + +Example Response + +.. code-block:: json + + { + "results": [ + { + "resource-type": "complex", + "resource-link": "/aai/v1/cloud-infrastructure/complexes/complex/complex1" + }, + { + "resource-type": "complex", + "resource-link": "/aai/v1/cloud-infrastructure/complexes/complex/complex1" + } + ] + } + +resource +^^^^^^^^ + +Provides each object in the results array in the same format as AAI's +REST API with depth = 1 (first level children and cousin +relationships). + +.. code:: + + PUT /aai/v$/query?format=resource + + +Example Response + +.. code-block:: json + + { + "results": [ + { + "complex": { + "city": "Anywhere", + "complex-name": "complex-mccomplexface", + "country": "USA", + "data-center-code": "CHG", + "latitude": "30.123456", + "longitude": "-78.135344", + "physical-location-id": "complextest1", + "physical-location-type": "lab", + "postal-code": "90210", + "region": "West", + "relationship-list": { + "relationship": [ + { + "related-link": "/aai/v1/network/zones/zone/zone1", + "related-to": "zone", + "related-to-property": [ + { + "property-key": "zone.zone-name", + "property-value": "zone-name1" + } + ], + "relationship-data": [ + { + "relationship-key": "zone.zone-id", + "relationship-value": "zone1" + } + ], + "relationship-label": "org.onap.relationships.inventory.LocatedIn" + }, + { + "related-link": "/aai/v1/cloud-infrastructure/cloud-regions/cloud-region/Cloud-Region/Region1", + "related-to": "cloud-region", + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ], + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "Cloud-Region" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "Region1" + } + ], + "relationship-label": "org.onap.relationships.inventory.LocatedIn" + } + ] + }, + "resource-version": "1531233769164", + "state": "CA", + "street1": "100 Main St", + "street2": "C3-3W03" + } + } + ] + } + +resource_and_uri +^^^^^^^^^^^^^^^^ + +Provides each object in the results array in the same format as AAI’s +REST API with depth = 1 (first level children and cousin +relationships) plus the pathed url for the result object in AAI. + +.. code:: + + PUT /aai/v$/query?format=resource_and_url + +Example Response + +.. code-block:: json + + { + "results": [ + { + "complex": { + "city": "Anywhere", + "complex-name": "complex-mccomplexface", + "country": "USA", + "data-center-code": "CHG", + "latitude": "30.123456", + "longitude": "-78.135344", + "physical-location-id": "complextest1", + "physical-location-type": "lab", + "postal-code": "90210", + "region": "West", + "relationship-list": { + "relationship": [ + { + "related-link": "/aai/v16/network/zones/zone/zone1", + "related-to": "zone", + "related-to-property": [ + { + "property-key": "zone.zone-name", + "property-value": "zone-name1" + } + ], + "relationship-data": [ + { + "relationship-key": "zone.zone-id", + "relationship-value": "zone1" + } + ], + "relationship-label": "org.onap.relationships.inventory.LocatedIn" + }, + { + "related-link": "/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/Cloud-Region/Region1", + "related-to": "cloud-region", + "related-to-property": [ + { + "property-key": "cloud-region.owner-defined-type" + } + ], + "relationship-data": [ + { + "relationship-key": "cloud-region.cloud-owner", + "relationship-value": "Cloud-REgion" + }, + { + "relationship-key": "cloud-region.cloud-region-id", + "relationship-value": "Region1" + } + ], + "relationship-label": "org.onap.relationships.inventory.LocatedIn" + } + ] + }, + "resource-version": "1531233769164", + "state": "CA", + "street1": "100 Main St", + "street2": "C3-3W03" + }, + "url": "/aai/v16/cloud-infrastructure/complexes/complex/complextest1" + } + ] + } + +simple +^^^^^^ + +Provides each result object in a simplified format. The node-type, +graph vertex id, pathed url, object properties, and directly related +objects in the graph are all returned. Both direct parent/child +objects and cousin objects are included in the related-to array. + +.. code:: + + PUT /aai/v$/query?format=simple + +Example Response + +.. code-block:: json + + { + "results": [ + { + "id": "81924184", + "node-type": "complex", + "properties": { + "city": "Anywhere", + "complex-name": "complex-mccomplexface", + "country": "USA", + "data-center-code": "CHG", + "latitude": "30.123456", + "longitude": "-78.135344", + "physical-location-id": "complextest1", + "physical-location-type": "lab", + "postal-code": "90210", + "region": "West", + "resource-version": "1531233769164", + "state": "CA", + "street1": "100 Main St", + "street2": "C3-3W03" + }, + "related-to": [ + { + "id": "40968400", + "node-type": "zone", + "relationship-label": "org.onap.relationships.inventory.LocatedIn", + "url": "/aai/v16/network/zones/zone/zone1" + }, + { + "id": "122884184", + "node-type": "cloud-region", + "relationship-label": "org.onap.relationships.inventory.LocatedIn", + "url": "/aai/v16/cloud-infrastructure/cloud-regions/cloud-region/Cloud-Region/Region1" + }, + { + "id": "122884296", + "node-type": "rack", + "relationship-label": "org.onap.relationships.inventory.LocatedIn", + "url": "/aai/v16/cloud-infrastructure/complexes/complex/complextest1/racks/rack/rackname1-1test" + } + ], + "url": "/aai/v16/cloud-infrastructure/complexes/complex/complextest1" + } + ] + } + +graphson +^^^^^^^^ + +Provides the results using the graphson standard. + +.. code:: + + PUT /aai/v$/query?format=graphson + +Example Response + +.. code-block:: json + + { + "results": [ + { + "id": 81924184, + "inE": { + "org.onap.relationships.inventory.LocatedIn": [ + { + "id": "oeioq-oe3f4-74l-1crx3s", + "outV": 40968400, + "properties": { + "aai-uuid": "9e75af3d-aa7f-4e8e-a7eb-32d8096f03cc", + "contains-other-v": "NONE", + "delete-other-v": "NONE", + "prevent-delete": "IN", + "private": false + } + }, + { + "id": "216a6j-215u1k-74l-1crx3s", + "outV": 122884184, + "properties": { + "aai-uuid": "4b3693be-b399-4355-8747-4ea2bb298dff", + "contains-other-v": "NONE", + "delete-other-v": "NONE", + "prevent-delete": "IN", + "private": false + } + }, + { + "id": "215xjt-215u4o-74l-1crx3s", + "outV": 122884296, + "properties": { + "aai-uuid": "958b8e10-6c42-4145-9cc1-76f50bb3e513", + "contains-other-v": "IN", + "delete-other-v": "IN", + "prevent-delete": "NONE", + "private": false + } + } + ] + }, + "label": "vertex", + "properties": { + "aai-created-ts": [ + { + "id": "1crvgr-1crx3s-6bk5", + "value": 1531231973518 + } + ], + "aai-last-mod-ts": [ + { + "id": "215vkb-1crx3s-6dxh", + "value": 1531233769164 + } + ], + "aai-node-type": [ + { + "id": "215urv-1crx3s-69z9", + "value": "complex" + } + ], + "aai-uri": [ + { + "id": "1crxfv-1crx3s-6gat", + "value": "/cloud-infrastructure/complexes/complex/complextest1" + } + ], + "aai-uuid": [ + { + "id": "1crvuz-1crx3s-1ybp", + "value": "3959ceca-3a89-4e92-a2ff-073b6f409303" + } + ], + "city": [ + { + "id": "1cs0zv-1crx3s-4irp", + "value": "Beverley Hills" + } + ], + "complex-name": [ + { + "id": "215wcr-1crx3s-4d8l", + "value": "chcil" + } + ], + "country": [ + { + "id": "1cs26j-1crx3s-4l51", + "value": "USA" + } + ], + "data-center-code": [ + { + "id": "215ssr-1crx3s-4bnp", + "value": "CHG" + } + ], + "last-mod-source-of-truth": [ + { + "id": "215vyj-1crx3s-696t", + "value": "aai-AppId" + } + ], + "latitude": [ + { + "id": "1cs2yz-1crx3s-4mpx", + "value": "30.123456" + } + ], + "longitude": [ + { + "id": "1cs3d7-1crx3s-4nid", + "value": "-174.135344" + } + ], + "physical-location-id": [ + { + "id": "1crzez-1crx3s-4a2t", + "value": "complextest1" + } + ], + "physical-location-type": [ + { + "id": "1crzt7-1crx3s-4ged", + "value": "lab" + } + ], + "postal-code": [ + { + "id": "1cs1sb-1crx3s-4kcl", + "value": "90210" + } + ], + "region": [ + { + "id": "1cs2kr-1crx3s-4lxh", + "value": "West" + } + ], + "resource-version": [ + { + "id": "215v63-1crx3s-glh", + "value": "1531233769164" + } + ], + "source-of-truth": [ + { + "id": "1crv2j-1crx3s-6epx", + "value": "foo" + } + ], + "state": [ + { + "id": "1cs1e3-1crx3s-4jk5", + "value": "CA" + } + ], + "street1": [ + { + "id": "1cs07f-1crx3s-4h6t", + "value": "100 Main St" + } + ], + "street2": [ + { + "id": "1cs0ln-1crx3s-4hz9", + "value": "Room 101" + } + ] + } + } + ] + } + + +Optional Query Parameters +~~~~~~~~~~~~~~~~~~~~~~~~~ + +depth +^^^^^ + +You can pass the depth query parameter to specify how many levels of +children/grandchildren to return. The default depth is 1. + +.. code:: + + PUT /aai/v$/query?format={format}&depth=0 + +nodesOnly +^^^^^^^^^ + +You can pass the nodesOnly query parameter to have the output only +contain the object properties with no relationships. + +.. code:: + + PUT /aai/v$/query?format={format}&nodesOnly=true + +subgraph +^^^^^^^^ + +You can pass a subgraph query parameter that determines the behavior +of the output. Using subgraph=prune returns all of the objects from +the query and only the edges between those objects. Using +subgraph=star returns all of the objects from the query plus all of +the objects they relate to. + +The default is subgraph=star + +.. code:: + + PUT /aai/v$/query?format={format}&subgraph={subgraph} + +HTTP Headers +~~~~~~~~~~~~ + ++--------------------------+--------------------------------------------------------------------------------------+ +| X-FromAppID={client ID}| Unique application identifier. | ++--------------------------+--------------------------------------------------------------------------------------+ +| X-TransactionID={UUDID} | must be a UUID and unique to each transaction within the context of an X-FromAppID. | ++--------------------------+--------------------------------------------------------------------------------------+ +| Content-Type={format} | format of the request. Should be application/json or application/xml. | ++--------------------------+--------------------------------------------------------------------------------------+ +| Accept={format} | format of the response. Should be application/json or application/xml. | ++--------------------------+--------------------------------------------------------------------------------------+ + +Request Payload +~~~~~~~~~~~~~~~ + +Typically the query payload will include both a "start" and a "query" +portion. The "start" can indicate one or more starting nodes in the +graph. If multiple nodes are specified, the result will contain the +query results for all of the start nodes. The "query" indicates the +name of the query to be run and also takes query parameters depending +on the query. Please reference the queries on the AAI wiki for +specific saved queries and how they should be usServer Timeout A +Server timeout is implemented for these APIs to make sure the server +did not continue processing the request long after a client times out +on their side. An error code ERR.5.4.7406 will be returned when this +limit is hit. The default value for Traversal API is 60 secs. The +clients should set their timeouts accordingly. + +List of Queries and Payloads +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +For a full list of available custom queries, please refer to our +`Custom Queries <customQueries.html>`_ document + +Recents API +----------- + +The Recents API allows a client to get the list of objects that has +been created or updated recently, up to a maximum of 1 week +back. + +`Recents API <recentsApi.html>`_ diff --git a/docs/AAI REST API Documentation/genericQueries.rst b/docs/AAI REST API Documentation/genericQueries.rst new file mode 100644 index 00000000..e2f7e200 --- /dev/null +++ b/docs/AAI REST API Documentation/genericQueries.rst @@ -0,0 +1,344 @@ +.. contents:: + :depth: 3 +.. +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +AAI Generic Query Implementation Notes + +Overview +======== + +The Generic Query mechanism allows to search for certain nodes of +“include” node types at a specified “depth” from the from a particular +start node of type “start-node-type” identified by specifying its +“key” values. + +The Generic Query is implemented using the GET method with the +following URL that takes 4 query params: + +.. code-block:: + + /aai/<version>/search/generic-query + + Ex. /aai/v16/search/generic-query + +Please look for other AAI documentation for what version to use in +which environment/release. + +**key** - multiple values that together specify the params to select a + unique start node. For example for selecting a customer we would + specify + +.. code-block:: + + key=customer.global-customer-id:ma9181-203-customerid&key=service-subscription.service-type:example-service-type + +**start-node-type** - node type of the start node. For example + start-node-type=service-instance + +**include** - multiple values of the node types that need to be + returned as part of the query-result. For example + +.. code-block:: + + include=vce&include=port-group + +**depth** – look for include node types within a certain depth from + the start-node-type + +The queries return a search-results object back which includes a list +of result-data which contains the node-type and a link for each +resource that was found. + +Requirements +============ + +* At depth=0, only the start node is returned, include is not needed + +* At any depth > 0 and <= 6, If start-node-type is in the include – + that should also be returned + +* The depth has a max value of 6 – an error will be returned if a + value higher than 6 is used + +* A special node type of “all” can be specified for include when all + nodes under the start node are to be searched for + +* If a start-node cannot be found based on the key a HTTP response + code of 404 Node not found error is returned + +* If no nodes can be found that meet the search criteria a HTTP + response code of 200 with an empty list is returned + +* The search results can be asked to be returned in json or xml based + on the ACCEPT header. For 1504, the queries are expected to be used + by MSO and therefore will use an ACCEPT header of application/xml. + +Supported Queries +================= + +Search customer and service-subscription by service instance id + +.. code-block:: + + URL: + + /aai/v16/search/generic-query?key=service-instance.service-instance-id:testserviceinstance&start-node-type=service-instance&include=customer&include=service-subscription&include=service-instance&depth=2 + +Search result: + +.. code-block:: xml + + <search-results xmlns="http://com.att.aai.inventory/v16"> + <result-data> + <resource-type>customer</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/</resource-link> + </result-data> + <result-data> + <resource-type>service-subscription</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/service-subscriptions/service-subscription/ptplgamma/</resource-link> + </result-data> + <result-data> + <resource-type>service-instance</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/service-subscriptions/service-subscription/ptplgamma/service-instances/service-instance/arnoldave/</resource-link> + </result-data> + </search-results> + +Search the VCE and its port groups and cvlan tags given the service instance id. + +.. code-block:: + + URL: /aai/v16/search/generic-query?key=service-instance.service-instance-id:arnoldave&start-node-type=service-instance&include=vce&include=port-group&include=cvlan-tag&depth=3 + +Search result: + +.. code-block:: xml + + <search-results xmlns="http://org.onap.aai.inventory/v16"> + <result-data> + <resource-type>cvlan-tag</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/cvlan-tags/cvlan-tag/333/</resource-link> + </result-data> + <result-data> + <resource-type>cvlan-tag</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/cvlan-tags/cvlan-tag/333/</resource-link> + </result-data> + <result-data> + <resource-type>cvlan-tag</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/cvlan-tags/cvlan-tag/111/</resource-link> + </result-data> + <result-data> + <resource-type>port-group</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/</resource-link> + </result-data> + <result-data> + <resource-type>vce</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/</resource-link> + </result-data> + <result-data> + <resource-type>cvlan-tag</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/cvlan-tags/cvlan-tag/222/</resource-link> + </result-data> + <result-data> + <resource-type>port-group</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/</resource-link> + </result-data> + </search-results> + +Customer GET based on tenant id + +.. code-block:: + + URL: + + /aai/v16/search/generic-query?key=tenant.tenant-id:examplepizzatenant&start-node-type=tenant&include=tenant&include=customer&include=service-subscription&depth=2 + +Search Result: + +.. code-block:: xml + + <search-results xmlns="http://org.onap.aai.inventory/v16"> + <result-data> + <resource-type>customer</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/</resource-link> + </result-data> + <result-data> + <resource-type>service-subscription</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/service-subscriptions/service-subscription/ptplgamma/</resource-link> + </result-data> + <result-data> + <resource-type>tenant</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/exampletenant/</resource-link> + </result-data> + </search-results> + +Search the tenant given a customer and service subscription. + +.. code-block:: + + URL: + + /aai/v16/search/generic-query?key=customer.global-customer-id:example-customer&key=service-subscription.service-type:example-service-type&start-node-type=service-subscription&include=tenant&include=service-subscription&depth=1 + +Search Result: + +.. code-block:: + + <search-results xmlns="http://org.onap.aai.inventory/v16"> + <result-data> + <resource-type>service-subscription</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/service-subscriptions/service-subscription/ptplgamma/</resource-link> + </result-data> + <result-data> + <resource-type>tenant</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/examplepizzatenant/</resource-link> + </result-data> + </search-results> + +For a service Instance - get its resource-link given the service-instance-id + +.. code-block:: + + URL: + + /aai/v16/search/generic-query?key=service-instance.service-instance-id:exampleservice&start-node-type=service-instance&depth=0 + +Search Result: + +.. code-block:: xml + + <search-results xmlns="http://org.onap.aai.inventory/v6"> + <result-data> + <resource-type>service-instance</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/service-subscriptions/service-subscription/ptplgamma/service-instances/service-instance/arnoldave/</resource-link> + </result-data> + </search-results> + +Get service-instance and service-subscription from vce + +.. code-block:: + + URL: + /aai/v16/search/generic-query?key=vce.vnf-id:examplevce&start-node-type=vce&include=service-instance&include=service-subscription&depth=2 + +Search Result: + +.. code-block:: xml + + <search-results xmlns="http://org.onap.aai.inventory/v16"> + <result-data> + <resource-type>service-instance</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/service-subscriptions/service-subscription/ptplgamma/service-instances/service-instance/arnoldave/</resource-link> + </result-data> + <result-data> + <resource-type>service-subscription</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/service-subscriptions/service-subscription/ptplgamma/</resource-link> + </result-data> + </search-results> + +Get all the nodes for a customer + +.. code-block:: + + URL: + + /aai/v16/search/generic-query?key=customer.global-customer-id:examplecustomer&start-node-type=customer&include=all&depth=6 + +Search Result: + +.. code-block:: xml + + <search-results xmlns="http://org.onap.aai.inventory/v16"> + <result-data> + <resource-type>service-capability</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/service-design-and-creation/service-capabilities/service-capability/ptplgamma/ptplbrocade-vce/</resource-link> + </result-data> + <result-data> + <resource-type>vserver</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/examplepizzatenant/vservers/vserver/ccwvm1/</resource-link> + </result-data> + <result-data> + <resource-type>cvlan-tag</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/cvlan-tags/cvlan-tag/333/</resource-link> + </result-data> + <result-data> + <resource-type>oam-network</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/oam-networks/oam-network/examplentwk/</resource-link> + </result-data> + <result-data> + <resource-type>cvlan-tag</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/cvlan-tags/cvlan-tag/333/</resource-link> + </result-data> + <result-data> + <resource-type>dvs-switch</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/dvs-switches/dvs-switch/dvsswitch-id1/</resource-link> + </result-data> + <result-data> + <resource-type>cvlan-tag</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/cvlan-tags/cvlan-tag/111/</resource-link> + </result-data> + <result-data> + <resource-type>customer</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/</resource-link> + </result-data> + <result-data> + <resource-type>service-subscription</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/service-subscriptions/service-subscription/ptplgamma/</resource-link> + </result-data> + <result-data> + <resource-type>port-group</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/</resource-link> + </result-data> + <result-data> + <resource-type>tenant</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/examplepizzatenant/</resource-link> + </result-data> + <result-data> + <resource-type>service-instance</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/service-subscriptions/service-subscription/ptplgamma/service-instances/service-instance/arnoldave/</resource-link> + </result-data> + <result-data> + <resource-type>pserver</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/pservers/pserver/ptpnj101snd/</resource-link> + </result-data> + <result-data> + <resource-type>availability-zone</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/availability-zones/availability-zone/ptplaz1/</resource-link> + </result-data> + <result-data> + <resource-type>vce</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/</resource-link> + </result-data> + <result-data> + <resource-type>image</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/images/image/valueOfImageId/</resource-link> + </result-data> + <result-data> + <resource-type>cvlan-tag</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/cvlan-tags/cvlan-tag/222/</resource-link> + </result-data> + <result-data> + <resource-type>port-group</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/</resource-link> + </result-data> + <result-data> + <resource-type>ipaddress</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/examplepizzatenant/vservers/vserver/ccwvm1/ipaddresses/ipaddress/10.10.10.5/guid of port or interface/</resource-link> + </result-data> + <result-data> + <resource-type>flavor</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/flavors/flavor/valueOfFlavorId/</resource-link> + </result-data> + <result-data> + <resource-type>ipaddress</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/examplepizzatenant/vservers/vserver/ccwvm1/ipaddresses/ipaddress/10.10.10.4/guid of port or interface/</resource-link> + </result-data> + <result-data> + <resource-type>complex</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/complexes/complex/PTPLNJ08742/</resource-link> + </result-data> + </search-results> + + + diff --git a/docs/AAI REST API Documentation/nodesApi.rst b/docs/AAI REST API Documentation/nodesApi.rst new file mode 100644 index 00000000..e54c0360 --- /dev/null +++ b/docs/AAI REST API Documentation/nodesApi.rst @@ -0,0 +1,105 @@ +.. contents:: + :depth: 3 +.. +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +Nodes Query +=========== + +In working with AAI's standard REST API, you may have noticed that +certain API paths have a hierarchy to them and require a client to +know multiple object keys to preform GETs. For example: the vserver +object is under tenant, which is itself under cloud-region. If you +wanted to look up a vserver by name, you would still need to know the +tenant-id and cloud-region-id (and cloud-owner) in order to +successfully perform that GET. The nodes API allows for more freedom +in querying AAI, allowing clients to circumvent the need to know +every key in the hierarchy. Using the previous example, the below is +how the API called would change for looking up a vserver by name: + +.. code:: + + GET /aai/v$/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers?vserver-name={vserver-name} + becomes + GET /aai/v$/nodes/vservers?vserver-name={vserver-name} + +A side effect of this is that if the same vserver name was reused between +multiple cloud-regions or tenants the client will receive multiple +vservers in the response. Vserver ID and vserver name are +intentionally non-unique outside of their cloud-region/tenant +hierarchy, as are many other keys for nested objects. + +API URI +~~~~~~~ + +nodes can be used to start a URI from any node type, whether singular or plural. + +.. code:: + GET /aai/v$/nodes/{plural} + OR + GET /aai/v$/nodes/{singular}/{key} + +From there, it can be expanded on similarly to our Resources API. For example: + +.. code:: + + GET /aai/v$/nodes/{plural}?{property}={value} + + GET /aai/v$/nodes/tenant/{tenant-id}/vservers + + GET /aai/v$/nodes/generic-vnf/{vnf-id}/related-to/platforms + +Optional Query Parameters +~~~~~~~~~~~~~~~~~~~~~~~~~ +The Nodes API can make use of all the optional query +parameters available on the standard REST API. + +Depth +~~~~~ + +You can pass a depth query parameter to indicate what level of child objects you want +returned. By default the output will be depth = 0 (no "children", only +"cousin" relationships). When using depth in conjunction with the +format query parameter, it will only apply to the on the resource or +resource_and_url formats. + +.. code:: + + GET /aai/v$/nodes/{plural}/{singular}/{key}?depth={integer} + +Nodes Only +~~~~~~~~~~ + +You can pass a nodes only query parameter to have the output only contain +the object properties with no relationships. + +.. code:: + + GET /aai/v$/nodes/{plural}/{singular}/{key}?nodes-only + OR + GET /aai/v$/nodes/{plural}/{singular}/{key}?format={format}&nodesOnly=true + +Format +~~~~~~ + +You can optionally request an output format different from the default +REST API output. You can reference the list of formats on the `Custom +Query <customQueries.html>`_ wiki page for the full list of available +formats and examples. + +.. code:: + + GET /aai/v$/nodes/{plural}/{singular}/{key}?format={format} + +Usage with Custom Query +~~~~~~~~~~~~~~~~~~~~~~~ + +The Nodes API can be called directly or as the start node for Custom +Queries. Please reference the Custom Queries wiki page for full +documentation on how to use that interface. + +.. code:: + + PUT /aai/v$/query?format={format} with payload like.. + { "start": ["nodes/{plural}/{singular}/{key}"], "query": "query/{query-name}" } diff --git a/docs/AAI REST API Documentation/nodesQuery.rst b/docs/AAI REST API Documentation/nodesQuery.rst index 6064020b..4b0a61f4 100644 --- a/docs/AAI REST API Documentation/nodesQuery.rst +++ b/docs/AAI REST API Documentation/nodesQuery.rst @@ -7,88 +7,118 @@ Nodes Query =========== -In working with AAI's standard REST API, you may have noticed that -certain API paths have a hierarchy to them and require a client to -know multiple object keys to preform GETs. For example: the vserver -object is under tenant, which is itself under cloud-region. If you -wanted to look up a vserver by name, you would still need to know the -tenant-id and cloud-region-id (and cloud-owner) in order to -successfully perform that GET. The nodes API allows for more freedom -in querying AAI, allowing clients to circumvent the need to know -every key in the hierarchy. Using the previous example, the below is -how the API called would change for looking up a vserver by name: +A&AI Nodes Query Implementation Notes: -.. code:: +Overview +-------- - GET /aai/v$/cloud-infrastructure/cloud-regions/cloud-region/{cloud-owner}/{cloud-region-id}/tenants/tenant/{tenant-id}/vservers?vserver-name={vserver-name} - becomes - GET /aai/v$/nodes/vservers?vserver-name={vserver-name} +AAI continues to support this API, but clients may find that `Custom +Queries <customQueries.html>`_ meet the needs more most queries. -A side effect of this is that if the same vserver name was reused between -multiple cloud-regions or tenants the client will receive multiple -vservers in the response. Vserver ID and vserver name are -intentionally non-unique outside of their cloud-region/tenant -hierarchy, as are many other keys for nested objects. +The Nodes Query mechanism is mostly being implemented in support of +searching the pservers which do not have the ipv4-oam-ipaddress +set. It will allow nodes to be searched based on certain properties of +the nodes. It will allow search based on properties being set, not set +or set to specific values. -API URI -~~~~~~~ +The Nodes Query API is implemented using the GET method with the following URL: .. code:: - GET /aai/v$/nodes/{plural}?{property}={value} - OR - GET /aai/v$/nodes/{plural}/{singular}/{key} + /aai/<version>/search/nodes-query + + ex. /aai/v16/search/nodes-query -Optional Query Parameters -~~~~~~~~~~~~~~~~~~~~~~~~~ -The Nodes API can make use of all the optional query -parameters available on the standard REST API. +New version numbers will be supported and older versions eventually +retired. Please look for other AAI documentation for what version to +use in which environment/release. -Depth -~~~~~ +The URL expects the following URL parameters: -You can pass a depth query parameter to indicate what level of child objects you want -returned. By default the output will be depth = 0 (no "children", only -"cousin" relationships). When using depth in conjunction with the -format query parameter, it will only apply to the on the resource or -resource_and_url formats. +**search-node-type** - node type of the node to be searched. + +**filter** – list of properties that specify the search +criterion. Format will be .. code:: - GET /aai/v$/nodes/{plural}/{singular}/{key}?depth={integer} + filter=<property-name>:<EQUALS|DOES-NOT-EQUAL|EXISTS|DOES-NOT-EXIST>:<property-value> + + such as -Nodes Only -~~~~~~~~~~ + filter=ipv4-oam-address:DOES-NOT-EXIST: -You can pass a nodes only query parameter to have the output only contain -the object properties with no relationships. +For EXISTS and DOES-NOT-EXIST the property value is not specified +(second colon is included). Multiple filter criteria may be specified. -.. code:: +The queries return a search-results object back which includes a list +of result-data which contains the node-type and a link for each +resource that was found. - GET /aai/v$/nodes/{plural}/{singular}/{key}?nodes-only - OR - GET /aai/v$/nodes/{plural}/{singular}/{key}?format={format}&nodesOnly=true -Format -~~~~~~ +Requirements +------------ -You can optionally request an output format different from the default -REST API output. You can reference the list of formats on the `Custom -Query <customQueries.html>`_ wiki page for the full list of available -formats and examples. +* If the search-node-type is not supported by the application, a HTTP + response code of 400 and Parameter passed error is returned -.. code:: +* If no nodes can be found that meet the search criteria a HTTP + response code of 200 with an empty list is returned + +* The search results can be asked to be returned in json or xml based + on the ACCEPT header. + +* If no filter params are specified, it would return all nodes of that node type. + +Design +------ - GET /aai/v$/nodes/{plural}/{singular}/{key}?format={format} +* REST GET api and dbmap classes added to process the search payload via a GET -Usage with Custom Query -~~~~~~~~~~~~~~~~~~~~~~~ +* New method searchForNodes() created in dbgen:DbSearch that does the + search based on the node type and the filter list and returns the + SearchResults object + + - The search does not require the properties used in the search to + be indexed + + - The filterParams will just be properties of the node itself. A + future version could have another parameter with some more + interesting search stuff – we’ll see what other queries are being + asked for and what makes sense to treat like this. + + - As other requests come in, this query mechanism may be re-used if + the requirements are able to fit this. + +Supported queries +----------------- + +* Search pserver nodes for which ipv4-oam-address DOES-NOT-EXIST + +.. code:: -The Nodes API can be called directly or as the start node for Custom -Queries. Please reference the Custom Queries wiki page for full -documentation on how to use that interface. + URL: + /aai/v16/search/nodes-query?search-node-type=pserver&filter=ipv4-oam-address:DOES-NOT-EXIST: + +Search result .. code:: - PUT /aai/v$/query?format={format} with payload like.. - { "start": ["nodes/{plural}/{singular}/{key}"], "query": "query/{query-name}" } + <search-results xmlns="http://org.onap.aai.inventory/v16"> + <result-data> + <resource-type>pserver</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/pservers/pserver/mygreatpserver</resource-link> + </result-data> + <result-data> + <resource-type>pserver</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/pservers/pserver/myothergreatpserver/</resource-link> + </result-data> + <result-data> + <resource-type>pserver</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/pservers/pserver/stillanothergreatpserver</resource-link> + </result-data> + <result-data> + <resource-type>pserver</resource-type> + <resource-link>https://aai.onap:8443/aai/v16/cloud-infrastructure/pservers/pserver/testbestestpserver</resource-link> + </result-data> + </search-results> diff --git a/docs/AAI REST API Documentation/recentsApi.rst b/docs/AAI REST API Documentation/recentsApi.rst new file mode 100644 index 00000000..74e423c8 --- /dev/null +++ b/docs/AAI REST API Documentation/recentsApi.rst @@ -0,0 +1,63 @@ +.. contents:: + :depth: 3 +.. +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +AAI Recents API +=============== + +Recents API Overview +-------------------- + +The Recents API will allow a client to get the list of objects that +has been created or updated recently, up to a maximum of 1 week back. +This API is accessed through the AAI Rest Interface, utilizing the +same certificates and headers. + +Request +------- + +The API can be accessed by using sending a GET request to the Recents +API and sending a single node-type and a parameter to specify either +timestamp to start the search or the number of hours to look back. + +Querying with number of hours + +.. code:: + + GET /aai/recents/v$/{node-type}?hours={hours} + +Querying with an epoch timestamp + +.. code:: + + GET /aai/recents/v$/{node-type}?date-time={timestamp} + + Example: + GET /aai/recents/v$/pnf?date-time=1531413113815 + +Response +-------- + +The Recents API sends a response in a new format, which includes the +object type, URI, and resource-version. + +Sample response: + +.. code-block:: json + + { + "results": [ + { + "resource-type": "pnf", + "resource-link": "/aai/v16/network/pnfs/pnf/lab20105v" + "resource-version": "1531413113815" + }, + { + "resource-type": "pnf", + "resource-link": "/aai/v16/network/pnfs/pnf/stack01" + "resource-version": "1531413113612" + },...] + + } diff --git a/docs/index.rst b/docs/index.rst index 18fccb05..aac322e2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -15,5 +15,4 @@ The key AAI repos for running the AAI REST APIs: platform/index.rst release-notes.rst - AAI REST API Documentation/AAIRESTAPI_CASABLANCA - + AAI REST API Documentation/AAIRESTAPI.rst diff --git a/docs/platform/Getting Started/AAI_Developer_Environment_Setup.rst b/docs/platform/Getting Started/AAI_Developer_Environment_Setup.rst index 6f7871cc..c8afd9c1 100644 --- a/docs/platform/Getting Started/AAI_Developer_Environment_Setup.rst +++ b/docs/platform/Getting Started/AAI_Developer_Environment_Setup.rst @@ -7,296 +7,338 @@ AAI Developer Environment Setup ================================ -This guide will illustrate setting up an A&AI development environment in -Ubuntu 16.04. +For this exercise, I set up a new instance of Ubuntu in Virtualbox and gave it 16G RAM, 200GB dynamically allocated storage, and 3 processors. -For this exercise, I set up a new instance of Ubuntu in Virtualbox and -gave it 16G RAM, 200GB dynamically allocated storage, and 3 processors. +1. Install openjdk 8 +-------------------- + .. code-block:: bash -Install openjdk 8 ------------------ + 1. $ sudo apt install openjdk-8-jdk - .. code:: bash +2. Install single node hadoop/janusgraph +---------------------------------------- + .. code-block:: bash - sudo apt install openjdk-8-jdk + 1. $ wget http://github.com/JanusGraph/janusgraph/releases/download/v0.2.0/janusgraph-0.2.0-hadoop2.zip + 2. $ unzip janusgraph-0.2.0-hadoop2.zip + 3. $ cd janusgraph-0.2.0-hadoop2/ + 4. $ ./bin/janusgraph.sh start -Install single node hadoop/titan --------------------------------- + Ensure you are not a root user as elasticsearch cannot be run as root. + Response looks like: - .. code-block:: bash + .. code-block:: bash - wget http://s3.thinkaurelius.com/downloads/titan/titan-1.0.0-hadoop1.zip + Forking Cassandra... + Running `nodetool statusthrift`... OK (returned exit status 0 and printed string "running"). + Forking Elasticsearch... + Connecting to Elasticsearch (127.0.0.1:9200)...... OK (connected to 127.0.0.1:9200). + Forking Gremlin-Server... + Connecting to Gremlin-Server (127.0.0.1:8182).... OK (connected to 127.0.0.1:8182). + Run gremlin.sh to connect. - unzip titan-1.0.0-hadoop1.zip + You can verify whether everything is running by executing - cd titan-1.0.0-hadoop1 - - sudo ./bin/titan.sh start + .. code-block:: bash -Install haproxy ---------------- - - .. code-block:: bash - - sudo apt-get -y install haproxy - - haproxy -v - HA-Proxy version 1.6.3 2015/12/25 - Copyright 2000-2015 Willy Tarreau - willy@haproxy.org http://haproxy.org/ + ./bin/janusgraph.sh status -- Install this haproxy.cfg file in /etc/haproxy + And the output looks like: - `haproxy.cfg <https://wiki.onap.org/download/attachments/10782088/haproxy.cfg?version=2&modificationDate=1501018863000&api=v2>`__ + .. code-block:: bash - .. code-block:: bash - - sudo cp aai.pem /etc/ssl/private/aai.pem + Gremlin-Server (org.apache.tinkerpop.gremlin.server.GremlinServer) is running with pid 9835 + Elasticsearch (org.elasticsearch.bootstrap.Elasticsearch) is running with pid 9567 + Cassandra (org.apache.cassandra.service.CassandraDaemon) is running with pid 9207 - sudo chmod 640 /etc/ssl/private/aai.pem +3. Install haproxy +------------------ - sudo chown root:ssl-cert /etc/ssl/private/aai.pem + .. code-block:: bash - `aai.pem <https://wiki.onap.org/download/attachments/10782088/aai.pem?version=1&modificationDate=1501019585000&api=v2>`__ - - .. code-block:: bash + 1. $ sudo apt-get -y install haproxy + 2. $ <path-to-haproxy>/haproxy -v - sudo mkdir /usr/local/etc/haproxy + Response should be: -- Add these hostnames to the loopback interface in /etc/hosts + .. code-block:: bash - .. code-block:: bash + HA-Proxy version 1.6.3 2015/12/25 + Copyright 2000-2015 Willy Tarreau <willy@haproxy.org> - 127.0.0.1 localhost aai-traversal.api.simpledemo.openecomp.org aai-resouces.api.simpledemo.openecomp.org - -- Restart haproxy - - .. code-block:: bash - - sudo service haproxy restart - -Set up repos ------------- - -- First, follow the initial setup instructions in - `Setting Up Your Development Environment <https://wiki.onap.org/display/DW/Setting+Up+Your+Development+Environment>`__ - - .. code-block:: bash + Install the attached :download:`haproxy.cfg <media/haproxy.cfg>` in /etc/haproxy - mkdir -p ~/LF/AAI + .. code-block:: bash - cd ~/LF/AAI + $ sudo cp haproxy.cfg /etc/haproxy + $ sudo mkdir /usr/local/etc/haproxy - git clone ssh://<username>@gerrit.onap.org:29418/aai/aai-common + Install the attached :download:`aai.pem <media/aai.pem>` file in /etc/ssl/private - git clone ssh://<username>@gerrit.onap.org:29418/aai/traversal + .. code-block:: bash - git clone ssh://<username>@gerrit.onap.org:29418/aai/resources + $ sudo cp aai.pem /etc/ssl/private/aai.pem + $ sudo chmod 640 /etc/ssl/private/aai.pem + $ sudo chown root:ssl-cert /etc/ssl/private/aai.pem - git clone ssh://<username>@gerrit.onap.org:29418/aai/logging-service + Add these hostnames to the loopback interface in /etc/hosts: -- If you did not originally create a settings.xml file when setting - up the dev environment, you may get an error on some of the repos - saying that oparent is unresolvable. Using the example - settings.xml file should solve this problem: - `Setting Up Your Development Environment#MavenExamplesettings.xml <https://wiki.onap.org/display/DW/Setting+Up+Your+Development+Environment#SettingUpYourDevelopmentEnvironment-MavenExamplesettings.xml>`__ + 127.0.0.1 localhost aai-traversal.api.simpledemo.openecomp.org aai-resources.api.simpledemo.openecomp.org aai-traversal.api.simpledemo.onap.org aai-resources.api.simpledemo.onap.org -Build aai-common, traversal, and resources ------------------------------------------- + .. code-block:: bash - .. code-block:: bash - - cd ~/LF/AAI/aai-common + $ sudo service haproxy restart - mvn clean install # Should result in BUILD SUCCESS +4. Follow the initial setup instructions in `Setting Up Your Development Environment <https://wiki.onap.org/display/DW/Setting+Up+Your+Development+Environment>`__ e.g. +----------------------------------------------------------------------------------------------------------------------------------------------------------------------- + .. code-block:: bash - cd ~/LF/AAI/resources + $ sudo apt-get install git + $ sudo apt-get install npm + $ sudo apt-get install maven + $ sudo apt-get install docker.io + $ wget https://git.onap.org/oparent/plain/settings.xml + $ mkdir ~/.m2 + $ cp settings.xml ~/.m2 - mvn clean install # Should result in BUILD SUCCESS + If you get an error on some of the repos saying that oparent is + unresolvable, using the example settings.xml file should solve this + problem: `Setting Up Your Development + Environment#MavenExamplesettings.xml + <https://wiki.onap.org/display/DW/Setting+Up+Your+Development+Environment#SettingUpYourDevelopmentEnvironment-MavenExamplesettings.xml>`__ - cd ~/LF/AAI/logging-service - - mvn clean install # Should result in BUILD SUCCESS - - cd ~/LF/AAI/traversal - -You might need to add the following to traversal/pom.xml to get traversal to build: - - .. code-block:: xml - - <repositories><repository><id>maven-restlet</id><name>Restlet repository</name><url>https://maven.restlet.com</url></repository></repositories> - - .. code-block:: bash - - mvn clean install # Should result in BUILD SUCCESS +5. Set Up Repos +--------------- -Titan setup ------------ + .. code-block:: bash - 1. Modify both titan-cached.properties and - titan-realtime.properties to the following (for all MS’s that - will connect to the local Cassandra backend) - - .. code-block:: bash + $ mkdir -p ~/src/aai + $ cd ~/src/aai ; for f in aai-common schema-service resources traversal graphadmin logging-service ; do git clone ssh://<username>@gerrit.onap.org:29418/aai/$f; done - storage.backend=\ *cassandra* - storage.hostname=\ *localhost* +6. Checkout the 'dublin' branch +------------------------------- - 2. update - ~/LF/AAI/resources/aai-resources/bundleconfig-local/etc/appprops/titan-cached.properties + .. code-block:: bash - 3. update - ~/LF/AAI/resources/aai-resources/bundleconfig-local/etc/appprops/titan-realtime.properties + $ cd ~/src/aai ; for f in aai-common schema-service resources traversal graphadmin logging-service ; do (cd $f ; git checkout dublin) done | tee checkoutlog.txt - 4. update - ~/LF/AAI/traversal/aai-traversal/bundleconfig-local/etc/appprops/titan-cached.properties +7. Janus Setup (part 1) +----------------------- - 5. update - ~/LF/AAI/traversal/aai-traversal/bundleconfig-local/etc/appprops/titan-realtime.properties + Modify both janus-cached.properties and janus-realtime.properties to the following (for all MS’s that will connect to the local Cassandra backend) - 6. The following property can be added to specify the keyspace - name, each time you do this step (g) should be done. If not - specified Titan will try to create/use a defaulted keyspace - named titan. + .. code:: + + storage.backend=cassandra + storage.hostname=localhost + storage.cassandra.keyspace=onap # or different keyspace name of your choosing + + Edit the following files: + + .. code:: + + ~/src/aai/resources/aai-resources/src/main/resources/etc/appprops/janusgraph-cached.properties + ~/src/aai/resources/aai-resources/src/main/resources/etc/appprops/janusgraph-realtime.properties + ~/src/aai/traversal/aai-traversal/src/main/resources/etc/appprops/janusgraph-cached.properties + ~/src/aai/traversal/aai-traversal/src/main/resources/etc/appprops/janusgraph-realtime.properties + ~/src/aai/graphadmin/src/main/resources/etc/appprops/janusgraph-cached.properties + ~/src/aai/graphadmin/src/main/resources/etc/appprops/janusgraph-realtime.properties + +8. Build all the modules +------------------------ + + .. code-block:: bash + + $ cd ~/src/aai ; for f in aai-common schema-service resources traversal graphadmin logging-service ; do (cd $f ; mvn versions:set -DnewVersion=0.0.1-TEST-SNAPSHOT && mvn -DskipTests clean install -Daai.schema.version=0.0.1-TEST-SNAPSHOT) done | tee log.txt 2>&1 + + $ grep -e "SUCCESS" -e "FAILURE" log.txt + + And you should see: + + .. code:: + + [INFO] aai-schema ......................................... SUCCESS [ 32.504 s] + [INFO] aai-queries ........................................ SUCCESS [ 6.461 s] + [INFO] aai-schema-service ................................. SUCCESS [02:17 min] + [INFO] BUILD SUCCESS + [INFO] aai-resources ...................................... SUCCESS [ 1.190 s] + [INFO] BUILD SUCCESS + [INFO] aai-resources ...................................... SUCCESS [ 3.210 s] + [INFO] aai-resources ...................................... SUCCESS [ 41.213 s] + [INFO] BUILD SUCCESS + [INFO] aai-traversal ...................................... SUCCESS [ 1.090 s] + [INFO] BUILD SUCCESS + [INFO] aai-traversal ...................................... SUCCESS [ 3.181 s] + [INFO] aai-traversal ...................................... SUCCESS [ 58.001 s] + [INFO] BUILD SUCCESS + [INFO] BUILD SUCCESS + [INFO] BUILD SUCCESS + [INFO] aai-logging-service ................................ SUCCESS [ 1.101 s] + [INFO] BUILD SUCCESS + [INFO] aai-logging-service ................................ SUCCESS [ 5.230 s] + [INFO] Common Logging API ................................. SUCCESS [ 1.995 s] + [INFO] EELF Logging Implementation ........................ SUCCESS [ 4.235 s] + [INFO] Common Logging Distribution ........................ SUCCESS [ 0.530 s] + [INFO] BUILD SUCCESS + +9. Janus setup (part 2) +----------------------- + + Run this on the local instance on your first time running AAI and whenever using new keyspace or after wiping the data. - .. code-block:: bash + Install the schema - storage.cassandra.keyspace=<keyspace name> + .. code-block:: bash - 7. From the resources MS run the create db schema standalone program. + $ (cd ~/src/aai/graphadmin/ && mvn -PrunAjsc -Dstart-class=org.onap.aai.schema.GenTester -Daai.schema.version=0.0.1-TEST-SNAPSHOT -Daai.schema.ingest.version=0.0.1-TEST-SNAPSHOT -DskipTests -Dcheckstyle.skip=true -DAJSC_HOME=$HOME/src/aai/graphadmin -DBUNDLECONFIG_DIR=src/main/resources) - 8. ***NOTE***: The first thing that would need to be done is adding - the schema to the local instance. (this will need to be done - whenever using a new keyspace or after wiping the data). + You should see: - Runnable class org.onap.aai.dbgen.GenTester with the following vm - args. + .. code:: - .. code-block:: bash + ---- NOTE --- about to open graph (takes a little while)--------; + -- Loading new schema elements into JanusGraph -- + -- graph commit + -- graph shutdown - -DAJSC_HOME=~/LF/AAI/resources -DBUNDLECONFIG\_DIR="bundleconfig-local" +10. Start the "resources" microservice +-------------------------------------- - 9. Here's the command I used, and it worked: + Resources runs on port 8447. Go to the resources directory - .. code-block:: bash + .. code-block:: bash - cd ~/LF/AAI; java -DAJSC_HOME=/home/jimmy/LF/AAI/resources/aai-resources - -DBUNDLECONFIG_DIR="bundleconfig-local" -cp - aai-common/aai-core/target/aai-core-1.1.0-SNAPSHOT.jar:resources/aai-resources/target/aai-resources.jar:resources/aai-resources/target/userjars/\* - org.onap.aai.dbgen.GenTester + $ cd ~/src/aai/resources -Start the "resources" microservice ----------------------------------- + Set the debug port to 9447 - 1. Resources runs on port 8446. Go to the resources directory - - .. code-block:: bash + .. code-block:: bash - $ cd ~/LF/AAI/resources + $ export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=9447,server=y,suspend=n" - 2. Set the debug port to 9446 + Start the microservice - adjust your build version accordingly - .. code-block:: bash + .. code-block:: bash - export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m - -Xdebug -Xnoagent -Djava.compiler=NONE - -Xrunjdwp:transport=dt_socket,address=9446,server=y,suspend=n" + $ mvn -pl aai-resources -PrunAjsc -Daai.schema.version=0.0.1-TEST-SNAPSHOT -Daai.schema.ingest.version=0.0.1-TEST-SNAPSHOT -DskipTests -Dcheckstyle.skip=true - 3. Start the microservice + Should see something like this: Resources Microservice Started - .. code-block::bash - $ mvn -P runAjsc +11. Verify the resources microservice +------------------------------------- -Verify the resources microservice (this example uses Postman utility for Google Chrome) -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + This example uses curl from commandline - 1. Use basic auth, user = AAI, pw = AAI + .. code-block:: bash - 2. Set the X-TransactionId header (in the example below, the value is - 9999) + $ sudo apt-get install jq # for pretty output - 3. Set the X-FromAppId header (in the example below, the value is - jimmy-postman) + Download :download:`script - test-complex <media/test-complex>` + Download :download:`data - data-complex.json <media/data-complex.json>` - 4. Perform a GET of https://127.0.0.1:8443/aai/v11/network/vces + .. code-block:: bash - 5. You should see an error as below, 404 Not Found, ERR.5.4.6114. - This indicates that the service is functioning normally: + $ sh ./test-complex 2>&1 | tee log.txt -+------------------------------------------+ -| |image1| | -+------------------------------------------+ + Confirm log.txt contains: -Start the "traversal" microservice ----------------------------------- + .. code-block:: bash - 1. Traversal runs on port 8447. Go to the traversal directory: + > GET /aai/v16/cloud-infrastructure/complexes HTTP/1.1 - .. code-block:: bash + .. code-block:: json - $ cd ~/LF/AAI/traversal - - 2. Set the debug port to 9447 + { + "requestError": { + "serviceException": { + "messageId": "SVC3001", + "text": "Resource not found for %1 using id %2 (msg=%3) (ec=%4)", + "variables": [ + "GET", + "cloud-infrastructure/complexes", + "Node Not Found:No Node of type complex found at: cloud-infrastructure/complexes", + "ERR.5.4.6114" + ] + } + } + } - $ export MAVEN_OPTS="-Xms1024m -Xmx5120m -XX:PermSize=2024m - -Xdebug -Xnoagent -Djava.compiler=NONE - -Xrunjdwp:transport=dt_socket,address=9447,server=y,suspend=n" + Then followed by: - 3. Start the microservice + .. code-block:: bash - .. code-block:: bash + > PUT /aai/v16/cloud-infrastructure/complexes/complex/clli2 HTTP/1.1 + > GET /aai/v16/cloud-infrastructure/complexes/complex/clli2 HTTP/1.1 - $ mvn -P runAjsc + With payload: - You should see something like this: + .. code-block:: json + + { + "physical-location-id": "clli2", + "data-center-code": "example-data-center-code-val-6667", + "complex-name": "clli2", + "identity-url": "example-identity-url-val-28399", + "resource-version": "1543408364646", + "physical-location-type": "example-physical-location-type-val-28399", + "street1": "example-street1-val-28399", + "street2": "example-street2-val-28399", + "city": "example-city-val-28399", + "state": "example-state-val-28399", + "postal-code": "example-postal-code-val-28399", + "country": "example-country-val-28399", + "region": "example-region-val-28399", + "latitude": "1111", + "longitude": "2222", + "elevation": "example-elevation-val-28399", + "lata": "example-lata-val-28399" + } + + And finishes with: - .. code-block:: bash + .. code-block:: bash - 2017-07-26 - 12:46:35.524:INFO:oejs.Server:com.att.ajsc.runner.Runner.main(): - Started @25827ms + > DELETE /aai/v16/cloud-infrastructure/complexes/complex/clli2?resource-version=1543408364646 HTTP/1.1 + > GET /aai/v16/cloud-infrastructure/complexes HTTP/1.1 -Verify the traversal microservice -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + With the following: + + .. code-block:: json - 1. Set up the widget models - This will set up the postman to add widget models: `Add Widget Models.postman_collection.json <https://wiki.onap.org/download/attachments/10782088/Add%20Widget%20Models.postman_collection.json?version=2&modificationDate=1501102559000&api=v2>`__ `NamedQuery.postman_collection.json <https://wiki.onap.org/download/attachments/10782088/NamedQuery.postman_collection.json?version=2&modificationDate=1501102582000&api=v2>`__ + { + "requestError": { + "serviceException": { + "messageId": "SVC3001", + "text": "Resource not found for %1 using id %2 (msg=%3) (ec=%4)", + "variables": [ + "GET", + "cloud-infrastructure/complexes", + "Node Not Found:No Node of type complex found at: cloud-infrastructure/complexes", + "ERR.5.4.6114" + ] + } + } + } - 2. Create a runner using this file: - `models.csv <https://wiki.onap.org/download/attachments/10782088/models.csv?version=1&modificationDate=1501100140000&api=v2>`__ +12. Start the "traversal" microservice +-------------------------------------- - 3. Run the test runner - |image2| + Traversal runs on port 8446. Go to the traversal directory - 4. Add a named query called "getComponentList" (this named query is used by VID): + .. code-block:: bash - `NamedQuery.postman_collection.json <ificationDate=1501102582000&api=v2>`__ - - |image3| + $ cd ~/src/aai/traversal - 5. Add objects: + 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" - `Add Instances for Named Query.postman_collection.json <https://wiki.onap.org/download/attachments/10782088/Add%20Instances%20for%20Named%20Query.postman_collection.json?version=1&modificationDate=1501102617000&api=v2>`__ + Start the microservice - adjust your build version accordingly - 6. Execute named-query: - `Execute Named Query.postman_collection.json <https://wiki.onap.org/download/attachments/10782088/Execute%20Named%20Query.postman_collection.json?version=1&modificationDate=1501102658000&api=v2>`__ - You should see something like the following: - |image4| + .. code-block:: bash -- Your A&AI instance is now running, both the resources and traversal microservices are working properly with a local titan graph. + $ mvn -pl aai-traversal -PrunAjsc -Daai.schema.version=0.0.1-TEST-SNAPSHOT -Daai.schema.ingest.version=0.0.1-TEST-SNAPSHOT -DskipTests -Dcheckstyle.skip=true -- Next: `Tutorial: Making and Testing a Schema Change in A&AI <https://wiki.onap.org/pages/viewpage.action?pageId=10783023>`__ + Should see something like this: Traversal Microservice Started -.. |image1| image:: media/image1.png - :width: 4.87500in - :height: 2.87500in -.. |image2| image:: media/image2.png - :width: 4.87500in - :height: 3.75000in -.. |image3| image:: media/image3.png - :width: 4.87500in - :height: 4.15000in -.. |image4| image:: media/image4.png - :width: 4.87500in - :height: 4.15000in diff --git a/docs/platform/Getting Started/media/aai.pem b/docs/platform/Getting Started/media/aai.pem new file mode 100644 index 00000000..e6dfd6a6 --- /dev/null +++ b/docs/platform/Getting Started/media/aai.pem @@ -0,0 +1,82 @@ +-----BEGIN CERTIFICATE----- +MIIFATCCA+mgAwIBAgIIWY+5kgf/UH8wDQYJKoZIhvcNAQELBQAwRzELMAkGA1UE +BhMCVVMxDTALBgNVBAoMBE9OQVAxDjAMBgNVBAsMBU9TQUFGMRkwFwYDVQQDDBBp +bnRlcm1lZGlhdGVDQV85MB4XDTE5MDMyNjAzMjc1MloXDTIwMDMyNjAzMjc1Mlow +azERMA8GA1UEAwwIYWFpLm9uYXAxDzANBgkqhkiG9w0BCQEWADEZMBcGA1UECwwQ +YWFpQGFhaS5vbmFwLm9yZzEOMAwGA1UECwwFT1NBQUYxDTALBgNVBAoMBE9OQVAx +CzAJBgNVBAYTAlVTMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuyZj +PvQrgB2bhyE3kpSH6OjXigs/+MfmV4eOrEwmMzQ1lWjItu2z5WY9xNGCky85G3Pr +qmCfT/qNPXd0W5kEujYlL0QnvrCa77WP3kSSu0kMKdUJV3S90Rp1SOhGFU/WroAQ +XvlzyBCunqQ9/F/L6mS8dLotUbkGIQlojAYOukWOT/+ogMMxzpxtb91QR+Wl4YeY +yzX//0rls/6nEKzCh2STHJuTkXqL0kod+KY08unpvMX2J/SEeHdWLS8Gsuus6oqM +r4bFyquua/U1ApxEMn0/agY58V75dF5CRPJRYrqqf9I6DBr0SntHv6pzMhokjewl +ukkrEsvIOkqEvIcE+QIDAQABo4IByzCCAccwCQYDVR0TBAIwADAOBgNVHQ8BAf8E +BAMCBeAwIAYDVR0lAQH/BBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMFQGA1UdIwRN +MEuAFIH3mVsQuciM3vNSXupOaaBDPqzdoTCkLjAsMQ4wDAYDVQQLDAVPU0FBRjEN +MAsGA1UECgwET05BUDELMAkGA1UEBhMCVVOCAQcwHQYDVR0OBBYEFFziBN1nFOnS +Sp7XkxOuzVNR1GFLMIIBEQYDVR0RBIIBCDCCAQSCCGFhaS5vbmFwghJhYWktc3Bh +cmt5LWJlLm9uYXCCG2FhaS5hcGkuc2ltcGxlZGVtby5vbmFwLm9yZ4IlYWFpLmVs +YXN0aWNzZWFyY2guc2ltcGxlZGVtby5vbmFwLm9yZ4IlYWFpLmdyZW1saW5zZXJ2 +ZXIuc2ltcGxlZGVtby5vbmFwLm9yZ4IdYWFpLmhiYXNlLnNpbXBsZWRlbW8ub25h +cC5vcmeCJWFhaS5zZWFyY2hzZXJ2aWNlLnNpbXBsZWRlbW8ub25hcC5vcmeCF2Fh +aS5zaW1wbGVkZW1vLm9uYXAub3JnghphYWkudWkuc2ltcGxlZGVtby5vbmFwLm9y +ZzANBgkqhkiG9w0BAQsFAAOCAQEAlqwzbZv/0uxVPmFJMB2t5B2nw3GNojLwxnHh +UVKzrLbDDpM36CkY8uX9kYAaf/Eg8eA5Jp0T9lGCheg0TNHM9OBqyyvDPjewZ5jO +N0xooRs7gh4bYtQaWIjCOg6bXg+mHkW4VVbpewMJYivGpJZQ76LauuHtg1OA688s +fy4SGrbC902OoPZ8zJlINOyljqSa+uNwvv6bg9Iqnuq/jUaFpKOYVUkMzw/ImVzy +3kXH/hY+nz4FNvMPlULgwxskOBRp90a5VWBC48cNzg4aNtanVz6lPAr/AVD1R6jt +ZDEd3Ww8nTlRKjUryxgoorqo8ThctZscWBpHMRW4B/LgGEYtRA== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIEdTCCAl2gAwIBAgIBBzANBgkqhkiG9w0BAQsFADAsMQ4wDAYDVQQLDAVPU0FB +RjENMAsGA1UECgwET05BUDELMAkGA1UEBhMCVVMwHhcNMTgwODE3MTg1MTM3WhcN +MjMwODE3MTg1MTM3WjBHMQswCQYDVQQGEwJVUzENMAsGA1UECgwET05BUDEOMAwG +A1UECwwFT1NBQUYxGTAXBgNVBAMMEGludGVybWVkaWF0ZUNBXzkwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCv0HHUkba3uNtNI3jPKimUcd6RNwmhSCJL +neMWpnjqp5/A+HCKyNsEaT4y177hNLmCm/aMm1u2JIfikc+8wEqLCSBBPz+P0h+d +o+sZ7U+4oeQizdYYpEdzHJ2SieHHa8vtu80rU3nO2NEIkuYC20HcKSEtl8fFKsk3 +nqlhY+tGfYJPTXcDOQAO40BTcgat3C3uIJHkWJJ4RivunE4LEuRv9QyKgAw7rkJV +v+f7guqpZlXy6dzAkuU7XULWcgo55MkZlssoiErMvEZJad5aWKvRY3g7qUjaQ6wO +15wOAUoRBW96eeZZbytgn8kybcBy++Ue49gPtgm1MF/KlAsp0MD5AgMBAAGjgYYw +gYMwHQYDVR0OBBYEFIH3mVsQuciM3vNSXupOaaBDPqzdMB8GA1UdIwQYMBaAFFNV +M/JL69BRscF4msEoMXvv6u1JMBIGA1UdEwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/ +BAQDAgGGMB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjANBgkqhkiG9w0B +AQsFAAOCAgEADxNymiCNr2e37iLReoaxKmZvwox0cTiNAaj7iafRzmwIoY3VXO8Q +ix5IYcp4FaQ7fV1jyp/AmaSnyHf6Osl0sx8PxsQkO7ALttxKUrjfbvNSVUA2C/vl +u5m7UVJLIUtFDZBWanzUSmkTsYLHpiANFQKd2c/cU1qXcyzgJVFEFVyyHNkF7Is+ ++pjG9M1hwQHOoTnEuU013P7X1mHek+RXEfhJWwe7UsZnBKZaZKbQZu7hEtqKWYp/ +QsHgnjoLYXsh0WD5rz/mBxdTdDLGpFqWDzDqb8rsYnqBzoowvsasV8X8OSkov0Ht +8Yka0ckFH9yf8j1Cwmbl6ttuonOhky3N/gwLEozuhy7TPcZGVyzevF70kXy7g1CX +kpFGJyEHXoprlNi8FR4I+NFzbDe6a2cFow1JN19AJ9Z5Rk5m7M0mQPaQ4RcikjB3 +aoLsASCJTm1OpOFHfxEKiBW4Lsp3Uc5/Rb9ZNbfLrwqWZRM7buW1e3ekLqntgbky +uKKISHqVJuw/vXHl1jNibEo9+JuQ88VNuAcm7WpGUogeCa2iAlPTckPZei+MwZ8w +tpvxTyYlZEC8DWzY1VC29+W2N5cvh01e2E3Ql08W1zL63dqrgdEZ3VWjzooYi4ep +BmMXTvouW+Flyvcw/0oTcfN0biDIt0mCkZ5CQVjfGL9DTOYteR5hw+k= +-----END CERTIFICATE----- +-----BEGIN RSA PRIVATE KEY----- +MIIEogIBAAKCAQEAuyZjPvQrgB2bhyE3kpSH6OjXigs/+MfmV4eOrEwmMzQ1lWjI +tu2z5WY9xNGCky85G3PrqmCfT/qNPXd0W5kEujYlL0QnvrCa77WP3kSSu0kMKdUJ +V3S90Rp1SOhGFU/WroAQXvlzyBCunqQ9/F/L6mS8dLotUbkGIQlojAYOukWOT/+o +gMMxzpxtb91QR+Wl4YeYyzX//0rls/6nEKzCh2STHJuTkXqL0kod+KY08unpvMX2 +J/SEeHdWLS8Gsuus6oqMr4bFyquua/U1ApxEMn0/agY58V75dF5CRPJRYrqqf9I6 +DBr0SntHv6pzMhokjewlukkrEsvIOkqEvIcE+QIDAQABAoIBAEe1OrvJZM2PCqOp +N5jjbnvwk32iN93EAl8xYppkBxMBgzJ/VsC4rYBNP4elWym4I2KAdSDwKrrDXtDZ +b20VYXlT+8VzkOMA2izU3Y4lqi82mwGATjcDVSPExoGr9gZ+c9yi1yL8478ZnT7N +4a5Mql5iQM9c8rZodY+9AiD8xTHbgXbaGmBsDhTxT/HPDsoacR/SHMh3XowbhAcs +eXAe+NdDtLcG6WOEqi/EhkagkWvsecIBoy888Ffbxa5h/DLEaCCoC3Dw1tWFX8KM +86sC9sQKDVRVKpKs2/9MGl9LoPi9jNDrOP6/Zx3T4k479ozGp/0G70LzmUcih72j +MUbr4f0CgYEA/AV0yOLZh0i2K53jpv3e8RDJkOBFuLb0ZZVdGkVYHncw9/WY070E +TJi0B51RAJtdSksAWa6o+1+VaJKQHtMZpABwMWDMRQUqdC+o+knONRpdCHwxXnSl +gvujFyYJhURKDr42z0xjbQrHaEZRuVJ6tzJQhFtE66G01ngREhDPbUsCgYEAvhrB +A/IOQpPaHcfU2ik80VE0KU9N4Ez50ZlheEbBDVTrMWzuFy8p9niNSfDKC7s5aqlP +DgDvTD80D8Zw6+yT/aDU5iEf5vMdKc1pnlr8jJoCNSvuyJZ40kDSehsBOKC+YN3g +b6xaYWIcH3mwwoLZO9XFsN5KAg/dSMJED8AGAEsCgYAduMMCIgbHdqLNWAyOGCif +w3wSEvEGDMWb6VaWj5EJ3sKuq48/gW4tXmD0+O+ho7EH3vqGmRuisa4cLBTFHd5L +QiX5HNJaXXaZRzmlcujXyGkqZAMqgZU3clfUlg7PYbNeM76hCgA7zuaffJOMyJZi +XpOyWFUzeNmr5XMV71eXKwKBgEtgzFvGJMVdXsUkMU/3vfe5XRdsLJLdssjbKnzI +gU/J9h/480caGmdyUYOaCGMyb4fNbl09HaV8AianJqtFeUC9/uzpAX9PsqaanmB9 +71nIz0tKCjpa/7lOnqZwAsHzasl58L4W9xdaEZChbecSfxRspSCGY44BwFpTPS2J +lFeVAoGAFOetqKStyEy+qruEOMk+lWwaKLGZ4hLk7qmFochxwrXgx7hcZ4Zrqkv9 +7qyQtbAalFiCHGmLBdSb+GLfD/1pPUA3wJoLo/I3f4g9c7cw7m7r8MdWPDXSL2Vk +vM97Syv92KQUBl8te7S3+bDBNklgb+KwRqSk3QRAl8ARWEjg8Kk= +-----END RSA PRIVATE KEY----- diff --git a/docs/platform/Getting Started/media/data-complex.json b/docs/platform/Getting Started/media/data-complex.json new file mode 100644 index 00000000..296dd89f --- /dev/null +++ b/docs/platform/Getting Started/media/data-complex.json @@ -0,0 +1,19 @@ +{ + "physical-location-id": "clli2", + "data-center-code": "example-data-center-code-val-6667", + "complex-name": "clli2", + "identity-url": "example-identity-url-val-28399", + "physical-location-type": "example-physical-location-type-val-28399", + "street1": "example-street1-val-28399", + "street2": "example-street2-val-28399", + "city": "example-city-val-28399", + "state": "example-state-val-28399", + "postal-code": "example-postal-code-val-28399", + "country": "example-country-val-28399", + "region": "example-region-val-28399", + "latitude": "1111", + "longitude": "2222", + "elevation": "example-elevation-val-28399", + "lata": "example-lata-val-28399" +} + diff --git a/docs/platform/Getting Started/media/dev.html b/docs/platform/Getting Started/media/dev.html new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/docs/platform/Getting Started/media/dev.html diff --git a/docs/platform/Getting Started/media/haproxy.cfg b/docs/platform/Getting Started/media/haproxy.cfg new file mode 100644 index 00000000..9ee24e62 --- /dev/null +++ b/docs/platform/Getting Started/media/haproxy.cfg @@ -0,0 +1,120 @@ +global + log /dev/log local0 + stats socket /usr/local/etc/haproxy/haproxy.socket mode 660 level admin + stats timeout 30s + user root + group root + daemon + ################################# + # Default SSL material locations# + ################################# + ca-base /etc/ssl/certs + crt-base /etc/ssl/private + + # Default ciphers to use on SSL-enabled listening sockets. + # For more information, see ciphers(1SSL). This list is from: + # https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/ + # An alternative list with additional directives can be obtained from + # https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=haproxy + tune.ssl.default-dh-param 2048 + +defaults + log global + mode http + option httplog +# option dontlognull +# errorfile 400 /etc/haproxy/errors/400.http +# errorfile 403 /etc/haproxy/errors/403.http +# errorfile 408 /etc/haproxy/errors/408.http +# errorfile 500 /etc/haproxy/errors/500.http +# errorfile 502 /etc/haproxy/errors/502.http +# errorfile 503 /etc/haproxy/errors/503.http +# errorfile 504 /etc/haproxy/errors/504.http + + option http-server-close + option forwardfor except 127.0.0.1 + retries 6 + option redispatch + maxconn 50000 + timeout connect 50000 + timeout client 480000 + timeout server 480000 + timeout http-keep-alive 30000 + + +frontend IST_8443 + mode http + bind 0.0.0.0:8443 name https ssl crt /etc/ssl/private/aai.pem +# log-format %ci:%cp\ [%t]\ %ft\ %b/%s\ %Tq/%Tw/%Tc/%Tr/%Tt\ %ST\ %B\ %CC\ %CS\ %tsc\ %ac/%fc/%bc/%sc/%rc\ %sq/%bq\ %hr\ %hs\ {%[ssl_c_verify],%{+Q}[ssl_c_s_dn],%{+Q}[ssl_c_i_dn]}\ %{+Q}r + log-format "%ci:%cp [%tr] %ft %b/%s %TR/%Tw/%Tc/%Tr/%Ta %ST %B %CC \ %CS %tsc %ac/%fc/%bc/%sc/%rc %sq/%bq %hr %hs %{+Q}r" + option httplog + log global + option logasap + option forwardfor + capture request header Host len 100 + capture response header Host len 100 + option log-separate-errors + option forwardfor + http-request set-header X-Forwarded-Proto https if { ssl_fc } + http-request set-header X-AAI-Client-SSL TRUE if { ssl_c_used } + http-request set-header X-AAI-SSL %[ssl_fc] + http-request set-header X-AAI-SSL-Client-Verify %[ssl_c_verify] + http-request set-header X-AAI-SSL-Client-DN %{+Q}[ssl_c_s_dn] + http-request set-header X-AAI-SSL-Client-CN %{+Q}[ssl_c_s_dn(cn)] + http-request set-header X-AAI-SSL-Issuer %{+Q}[ssl_c_i_dn] + http-request set-header X-AAI-SSL-Client-NotBefore %{+Q}[ssl_c_notbefore] + http-request set-header X-AAI-SSL-Client-NotAfter %{+Q}[ssl_c_notafter] + http-request set-header X-AAI-SSL-ClientCert-Base64 %{+Q}[ssl_c_der,base64] + http-request set-header X-AAI-SSL-Client-OU %{+Q}[ssl_c_s_dn(OU)] + http-request set-header X-AAI-SSL-Client-L %{+Q}[ssl_c_s_dn(L)] + http-request set-header X-AAI-SSL-Client-ST %{+Q}[ssl_c_s_dn(ST)] + http-request set-header X-AAI-SSL-Client-C %{+Q}[ssl_c_s_dn(C)] + http-request set-header X-AAI-SSL-Client-O %{+Q}[ssl_c_s_dn(O)] + reqadd X-Forwarded-Proto:\ https + reqadd X-Forwarded-Port:\ 8443 + +####################### +#ACLS FOR PORT 8446#### +####################### + + acl is_Port_8446_generic path_reg -i ^/aai/v[0-9]+/search/generic-query$ + acl is_Port_8446_nodes path_reg -i ^/aai/v[0-9]+/search/nodes-query$ + acl is_Port_8446_version path_reg -i ^/aai/v[0-9]+/query$ + acl is_named-query path_beg -i /aai/search/named-query + acl is_search-model path_beg -i /aai/search/model + use_backend IST_AAI_8446 if is_Port_8446_generic or is_Port_8446_nodes or is_Port_8446_version or is_named-query or is_search-model + + default_backend IST_Default_8447 + + +####################### +#DEFAULT BACKEND 847### +####################### + +backend IST_Default_8447 + balance roundrobin + http-request set-header X-Forwarded-Port %[src_port] + http-response set-header Strict-Transport-Security max-age=16000000;\ includeSubDomains;\ preload; + server aai-resources.api.simpledemo.openecomp.org aai-resources.api.simpledemo.openecomp.org:8447 port 8447 ssl verify none + +####################### +# BACKEND 8446######### +####################### + +backend IST_AAI_8446 + balance roundrobin + http-request set-header X-Forwarded-Port %[src_port] + http-response set-header Strict-Transport-Security max-age=16000000;\ includeSubDomains;\ preload; + server aai-traversal.api.simpledemo.openecomp.org aai-traversal.api.simpledemo.openecomp.org:8446 port 8446 ssl verify none + +listen IST_AAI_STATS + mode http + bind *:8080 + stats uri /stats + stats enable + stats refresh 30s + stats hide-version + stats auth admin:admin + stats show-legends + stats show-desc IST AAI APPLICATION NODES + stats admin if TRUE diff --git a/docs/platform/Getting Started/media/test-complex b/docs/platform/Getting Started/media/test-complex new file mode 100644 index 00000000..2d4e53b7 --- /dev/null +++ b/docs/platform/Getting Started/media/test-complex @@ -0,0 +1,21 @@ +set -x + +PROTO=https:// +AAIINST1=127.0.0.1:8443/aai/v14 +CURLOPTS="--verbose --silent --insecure --user AAI:AAI" +CURLHDR='--header "Accept: application/json" --header "X-TransactionId: testaai" --header "Content-Type: application/json" --header "X-FromAppId: AAI"' + +date + +eval curl $CURLOPTS $CURLHDR $PROTO$AAIINST1/cloud-infrastructure/complexes | jq '.' +eval curl $CURLOPTS $CURLHDR --upload-file data-complex.json $PROTO$AAIINST1/cloud-infrastructure/complexes/complex/clli2 | jq '.' +eval curl $CURLOPTS $CURLHDR $PROTO$AAIINST1/cloud-infrastructure/complexes/complex/clli2 | jq '.' +eval curl $CURLOPTS $CURLHDR $PROTO$AAIINST1/cloud-infrastructure/complexes | jq '.' + + +RESVER1=`eval curl $CURLOPTS $CURLHDR $PROTO$AAIINST1/cloud-infrastructure/complexes | jq '.["complex"] | .[] | select(.["physical-location-id"] == "clli2") | .["resource-version"] '` +eval curl $CURLOPTS $CURLHDR --request DELETE $PROTO$AAIINST1/cloud-infrastructure/complexes/complex/clli2?resource-version=$RESVER1 | jq '.' +eval curl $CURLOPTS $CURLHDR $PROTO$AAIINST1/cloud-infrastructure/complexes | jq '.' + +echo end test-complex + diff --git a/docs/platform/offeredapis.rst b/docs/platform/offeredapis.rst index 1c6351b1..62a519f8 100644 --- a/docs/platform/offeredapis.rst +++ b/docs/platform/offeredapis.rst @@ -18,6 +18,6 @@ The list of APIs that AAI offers could be found in the following table: :widths: 60,60 "html doc", "yaml doc" - ":download:`link <https://wiki.onap.org/download/attachments/41421924/aai_swagger_v14.html?api=v2>`", ":download:`link <https://wiki.onap.org/download/attachments/41421924/aai_swagger_v14.yaml?api=v2>`" + ":download:`link <https://wiki.onap.org/download/attachments/58229560/aai_swagger_v16.html?api=v2>`", ":download:`link <https://wiki.onap.org/download/attachments/58229560/aai_swagger_v16.yaml?api=v2>`" diff --git a/docs/release-notes.rst b/docs/release-notes.rst index b91bbbab..efb8134c 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -6,6 +6,84 @@ AAI Release Notes ================== +Version: 1.4.0 + +:Release Data: 2019-06-08 + +**New Features** + +The R4 Dublin release of ONAP is a balanced release, focusing on +platform maturity and deployablity while also bringing in significant +new features and use cases . AAI continued to leverage oom and +kubernetes, and added new data types in support of multiple R4 use +cases. AAI added a new schema service which moves AAI closer to being +more model-driven and flexible. + +AAI is more model driven in Casablanca, which means it dynamically +operationalize new and updated models at run-time, with minimal +downtime and coding, so that the latest service and resource models +can be delivered quickly. To do this, AAI must update its internal +model, external API and behavior to respond to change to service and +resource models, including schema changes. The schema service provides +ONAP users the ability to quickly change the AAI data model without +re-building key microservices. + +AAI delivered 55%+ test coverage on all Java-based repos. + +See `AAI-1779 <https://jira.onap.org/browse/AAI-1779>`__ for details +on the schema updates in R4. + +Some AAI services can be configured to leverage the ONAP Pluggable +Security Sidecar proof of concept (disabled by default, see the charts +under aai/oom for more details). + +AAI now manages its own helm charts. See `aai/oom <https://gerrit.onap.org/r/admin/repos/aai/oom>`__ + +**Known Issues** + +The AAI UI is now integrated with Portal and AAF. However, the AAF +default boostrap does not include a role that is necessary the demo +user to access the AAI UI. + +Run the following as a workaround, adjust the URL and credentials +according to your environment. The user in CRED must be able to update +the org.onap.aai namespace. The following example has been tested from +inside the AAI resources pod. + + .. code-block:: bash + + URL='https://aaf-service.onap:8100' + CRED='aai@aai.onap.org:demo123456!' + + curl -v -k -u "$CRED" -H "Content-Type: application/RoleRequest+json" $URL/authz/role -d '{"name":"org.onap.aai.aaiui"}' + + curl -v -k -u "$CRED" -H "Content-Type: application/UserRoleRequest+json" $URL/authz/userRole -d '{ "user":"demo@people.osaaf.org", "role":"org.onap.aai.aaiui" }' + +Future releases will include the role and role assignment in the +default bootstrap data (being tracked under `AAI-2475 <https://jira.onap.org/browse/AAI-2475>`__) + + +**Security Notes** + +*Fixed Security Issues* + +- `OJSI-114 <https://jira.onap.org/browse/OJSI-114>`_ In default deployment AAI (aai) exposes HTTP port 30232 outside of cluster. + +*Known Security Issues* + +*Known Vulnerabilities in Used Modules* + +AAI code has been formally scanned during build time using NexusIQ and all Critical vulnerabilities have been addressed, items that remain open have been assessed for risk and determined to be false positive. The AAI open Critical security vulnerabilities and their risk assessment have been documented as part of the `R4 project wiki <https://wiki.onap.org/pages/viewpage.action?pageId=64003431>`_. + +Quick Links: + +- `AAI project page <https://wiki.onap.org/display/DW/Active+and+Available+Inventory+Project>`_ +- `Passing Badge information for AAI <https://bestpractices.coreinfrastructure.org/en/projects/1591>`_ +- `R4 Project Vulnerability Review Table for AAI <https://wiki.onap.org/pages/viewpage.action?pageId=64003431>`_ + + + + Version: 1.3.2 -------------- @@ -100,8 +178,8 @@ resource models, including schema changes. There are changes required to align on implementation across different ONAP components to provide a more strategic model-driven A&AI implementation. For this release decomposing AAI model/schema artifacts (OXM/XSD) into a more granular -approach better enables extensibility and support logical -subdivision of models. +approach better enables extensibility and support logical subdivision +of models. AAI added support fo the Cross Domain and Carrier Layer VPN use case by adding new object types, models, and edge rules. @@ -110,15 +188,14 @@ AAI delivered 50%+ test coverage on all Java-based repos. Added support Support for SR-IOV. -Authentication and Authorization is performed using AAF with the -CADI framework. We use basic authentication with RBAC (Role Based -Access Control) to secure the AAI REST APIs. +Authentication and Authorization is performed using AAF with the CADI +framework. We use basic authentication with RBAC (Role Based Access +Control) to secure the AAI REST APIs. AAI added automation support for orchestrating SR-IOV Provider -Networks that are compatible with the Network Cloud 1.0 -infrastructure solution based on standard SR-IOV. Allow for standard -SR-IOV Provider Networks to be defined with a set of one or more -VLAN associations. +Networks that are compatible with the Network Cloud 1.0 infrastructure +solution based on standard SR-IOV. Allow for standard SR-IOV Provider +Networks to be defined with a set of one or more VLAN associations. AAI added suport to allow clients to specify the format on GET operations in the resources micoservices to output like the custom @@ -138,7 +215,7 @@ Quick Links: - `AAI project page <https://wiki.onap.org/display/DW/Active+and+Available+Inventory+Project>`_ - `Passing Badge information for AAI <https://bestpractices.coreinfrastructure.org/en/projects/1591>`_ -- `Project Vulnerability Review Table for AAI <https://wiki.onap.org/pages/viewpage.action?pageId=45307817>`_ +- `R3 Project Vulnerability Review Table for AAI <https://wiki.onap.org/pages/viewpage.action?pageId=45307817>`_ Version: 1.2.0 @@ -177,7 +254,7 @@ ONAP AAI R2 includes the following components: - Applications - Sparky (AAI User Interface) -Source code of AAI is released under the following repositories at https://gerrit.onap.org +Source code of AAI is released under the following repositories at https://gerrit.onap.org - aai/aai-common - aai/event-client @@ -204,7 +281,7 @@ Source code of AAI is released under the following repositories at https://gerri - `AAI-17 <https://jira.onap.org/browse/AAI-17>`_ Seed code stabilization -- `AAI-21 <https://jira.onap.org/browse/AAI-21>`_ Gizmo +- `AAI-21 <https://jira.onap.org/browse/AAI-21>`_ Gizmo - `AAI-24 <https://jira.onap.org/browse/AAI-24>`_ Move to Active Open Source Graph Database @@ -454,7 +531,7 @@ Version: 1.1.1 - `AAI-566 <https://jira.onap.org/browse/AAI-566>`_ AAI Eclipse build failure - aai-traversal pom as hardcoded 1.8.0_101 jdk.tools version - `AAI-621 <https://jira.onap.org/browse/AAI-621>`_ Update the snapshot in test-config for v1.1.1-SNAPSHOT - + Version: 1.1.0 -------------- @@ -462,7 +539,7 @@ Version: 1.1.0 **New Features** -Initial release of Active and Available Inventory (AAI) for Open Network Automation Platform (ONAP). AAI provides ONAP with its logically centralized view of inventory data, taking in updates from orchestrators, controllers, and assurance systems. AAI provides core REST services. +Initial release of Active and Available Inventory (AAI) for Open Network Automation Platform (ONAP). AAI provides ONAP with its logically centralized view of inventory data, taking in updates from orchestrators, controllers, and assurance systems. AAI provides core REST services. ONAP AAI R1 includes the following components: @@ -614,7 +691,7 @@ Source code of AAI is released under the following repositories at https://gerri **Known Issues** - `AAI-61 <https://jira.onap.org/browse/AAI-61>`_ AAI cleaned up references to OpenECOMP but in order to keep the release stable for R1, the XML namespace still contains openecomp. - + Client systems should use http://org.openecomp.aai.inventory/v11 as the XML namespace for ONAP AAI R1. **Security Issues** @@ -25,12 +25,12 @@ <parent> <groupId>org.onap.oparent</groupId> <artifactId>oparent</artifactId> - <version>1.1.0</version> + <version>2.0.0</version> </parent> <groupId>org.onap.aai.aai-common</groupId> <artifactId>aai-common</artifactId> - <version>1.4.3-SNAPSHOT</version> + <version>1.6.0-SNAPSHOT</version> <packaging>pom</packaging> <name>aai-aai-common</name> <description>Contains all of the common code for resources and traversal repos</description> @@ -116,23 +116,6 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.2</version> - <executions> - <execution> - <id>default-deploy</id> - <phase>none</phase> - </execution> - </executions> - </plugin> - <plugin> - <groupId>org.sonatype.plugins</groupId> - <artifactId>nexus-staging-maven-plugin</artifactId> - <version>1.6.7</version> - <extensions>true</extensions> - <configuration> - <nexusUrl>${onap.nexus.url}</nexusUrl> - <stagingProfileId>176c31dfe190a</stagingProfileId> - <serverId>ecomp-staging</serverId> - </configuration> </plugin> <plugin> <groupId>com.mycila</groupId> @@ -257,11 +240,6 @@ <url>${onap.nexus.url}/content/repositories/releases/</url> </repository> <repository> - <id>ecomp-staging</id> - <name>ECOMP Staging Repository</name> - <url>${onap.nexus.url}/content/repositories/staging/</url> - </repository> - <repository> <id>ecomp-snapshots</id> <name>ECOMP Snapshot Repository</name> <url>${onap.nexus.url}/content/repositories/snapshots/</url> diff --git a/version.properties b/version.properties index fc6970be..704dc531 100644 --- a/version.properties +++ b/version.properties @@ -4,8 +4,8 @@ # because they are used in Jenkins, whose plug-in doesn't support major_version=1 -minor_version=4 -patch_version=3 +minor_version=6 +patch_version=0 base_version=${major_version}.${minor_version}.${patch_version} |