diff options
author | Jessica Wagantall <jwagantall@linuxfoundation.org> | 2020-12-01 11:52:01 -0800 |
---|---|---|
committer | Jessica Wagantall <jwagantall@linuxfoundation.org> | 2020-12-01 11:52:01 -0800 |
commit | ff3eecb980bfdc8d43d2ed3a4c786d634fa6f4e2 (patch) | |
tree | 680db1c4f69f5c181b8f1fb7d7d8f46942783b3e /northbound | |
parent | 02b6c140f031c19cfcb791fd0142f03167db69b1 (diff) |
Migrate sli-northbound repo
Migrate sli-northbound repo files into
new directory "northbound".
Signed-off-by: Jessica Wagantall <jwagantall@linuxfoundation.org>
Diffstat (limited to 'northbound')
251 files changed, 31054 insertions, 0 deletions
diff --git a/northbound/LICENSE.txt b/northbound/LICENSE.txt new file mode 100644 index 000000000..3ea5081a0 --- /dev/null +++ b/northbound/LICENSE.txt @@ -0,0 +1,22 @@ +/* + * ============LICENSE_START========================================== + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END============================================ + * + * ECOMP and OpenECOMP are trademarks + * and service marks of AT&T Intellectual Property. + * + */ diff --git a/northbound/README.md b/northbound/README.md new file mode 100644 index 000000000..64be1de02 --- /dev/null +++ b/northbound/README.md @@ -0,0 +1,8 @@ +This source repository contains the code for the SDN Controller northbound interface adaptors. +To compile this code: + +1. Make sure your local Maven settings file ($HOME/.m2/settings.xml) contains references to the OpenECOMP repositories and OpenDaylight repositories. See example-settings.xml for an example. + +2. To compile, run "mvn clean install". + + diff --git a/northbound/artifacts/pom.xml b/northbound/artifacts/pom.xml new file mode 100755 index 000000000..c4fca9fb6 --- /dev/null +++ b/northbound/artifacts/pom.xml @@ -0,0 +1,97 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>parent</artifactId> + <version>2.1.0</version> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>sli-northbound-artifacts</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>ccsdk-sli-northbound :: sli-northbound-artifacts</name> + <description>CCSDK northbound components Bill of Materials (BOM)</description> + <url>https://wiki.onap.org</url> + <organization> + <name>ONAP</name> + </organization> + + <properties> + <ccsdk.sli.northbound.version>${project.version}</ccsdk.sli.northbound.version> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>ccsdk-asdcApi</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>feature</classifier> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>ccsdk-dataChange</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>feature</classifier> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>ccsdk-lcm</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>feature</classifier> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>asdcApi-model</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>asdcApi-provider</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>asdcApi-installer</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>dataChange-model</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>dataChange-provider</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>dataChange-installer</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>lcm-model</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>lcm-provider</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>lcm-installer</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + </dependencyManagement> +</project> diff --git a/northbound/asdcApi/.gitignore b/northbound/asdcApi/.gitignore new file mode 100755 index 000000000..b73caf31e --- /dev/null +++ b/northbound/asdcApi/.gitignore @@ -0,0 +1,34 @@ +#####standard .git ignore entries##### + +## IDE Specific Files ## +org.eclipse.core.resources.prefs +.classpath +.project +.settings +.idea +.externalToolBuilders +maven-eclipse.xml +workspace + +## Compilation Files ## +*.class +**/target +target +target-ide +MANIFEST.MF + +## Misc Ignores (OS specific etc) ## +bin/ +dist +*~ +*.ipr +*.iml +*.iws +classes +out/ +.DS_STORE +.metadata + +## Folders which contain auto generated source code ## +yang-gen-config +yang-gen-sal diff --git a/northbound/asdcApi/installer/pom.xml b/northbound/asdcApi/installer/pom.xml new file mode 100755 index 000000000..bbdeb0cba --- /dev/null +++ b/northbound/asdcApi/installer/pom.xml @@ -0,0 +1,134 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>odlparent-lite</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>asdcApi-installer</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>ccsdk-sli-northbound :: asdcApi :: ${project.artifactId}</name> + + <properties> + <application.name>ccsdk-asdcApi</application.name> + <features.boot>${application.name}</features.boot> + <features.repositories>mvn:org.onap.ccsdk.sli.northbound/${features.boot}/${project.version}/xml/features</features.repositories> + <include.transitive.dependencies>false</include.transitive.dependencies> + </properties> + + <dependencies> + + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>asdcApi-model</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>asdcApi-provider</artifactId> + <version>${project.version}</version> + </dependency> + + + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>maven-repo-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>true</attach> + <finalName>stage/${application.name}-${project.version}</finalName> + <descriptors> + <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>true</appendAssemblyId> + </configuration> + </execution> + <execution> + <id>installer-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>true</attach> + <finalName>${application.name}-${project.version}-installer</finalName> + <descriptors> + <descriptor>src/assembly/assemble_installer_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>false</appendAssemblyId> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <phase>prepare-package</phase> + <configuration> + <transitive>false</transitive> + <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + <useRepositoryLayout>true</useRepositoryLayout> + <addParentPoms>false</addParentPoms> + <copyPom>false</copyPom> + <includeGroupIds>org.onap.ccsdk.sli.northbound</includeGroupIds> + <scope>provided</scope> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>copy-version</id> + <goals> + <goal>copy-resources</goal> + </goals><!-- here the phase you need --> + <phase>validate</phase> + <configuration> + <outputDirectory>${basedir}/target/stage</outputDirectory> + <resources> + <resource> + <directory>src/main/resources/scripts</directory> + <includes> + <include>install-feature.sh</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + + </executions> + </plugin> + + </plugins> + </build> +</project> diff --git a/northbound/asdcApi/installer/src/assembly/assemble_installer_zip.xml b/northbound/asdcApi/installer/src/assembly/assemble_installer_zip.xml new file mode 100644 index 000000000..3bed4b5ef --- /dev/null +++ b/northbound/asdcApi/installer/src/assembly/assemble_installer_zip.xml @@ -0,0 +1,59 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>installer_zip</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>755</fileMode> + <includes> + <include>*.sh</include> + </includes> + </fileSet> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>644</fileMode> + <excludes> + <exclude>*.sh</exclude> + </excludes> + </fileSet> + </fileSets> + + + +</assembly> diff --git a/northbound/asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml b/northbound/asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100644 index 000000000..479896182 --- /dev/null +++ b/northbound/asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,47 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>repo</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/assembly/</directory> + <outputDirectory>.</outputDirectory> + <excludes> + </excludes> + </fileSet> + </fileSets> + +</assembly> diff --git a/northbound/asdcApi/installer/src/main/resources/scripts/install-feature.sh b/northbound/asdcApi/installer/src/main/resources/scripts/install-feature.sh new file mode 100644 index 000000000..cee4a4952 --- /dev/null +++ b/northbound/asdcApi/installer/src/main/resources/scripts/install-feature.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} +ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} +INSTALLERDIR=$(dirname $0) + +REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip + +if [ -f ${REPOZIP} ] +then + unzip -d ${ODL_HOME} ${REPOZIP} +else + echo "ERROR : repo zip ($REPOZIP) not found" + exit 1 +fi + +${ODL_KARAF_CLIENT} feature:repo-add ${features.repositories} +${ODL_KARAF_CLIENT} feature:install ${features.boot} diff --git a/northbound/asdcApi/model/pom.xml b/northbound/asdcApi/model/pom.xml new file mode 100755 index 000000000..53fed3587 --- /dev/null +++ b/northbound/asdcApi/model/pom.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>binding-parent</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>asdcApi-model</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>bundle</packaging> + + <name>ccsdk-sli-northbound :: asdcApi :: ${project.artifactId}</name> + + <properties> + <ccsdk.sli.northbound.version>${project.version}</ccsdk.sli.northbound.version> + </properties> + + <dependencies> + + <dependency> + <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId> + <artifactId>rfc6991</artifactId> + </dependency> + + + </dependencies> +</project> diff --git a/northbound/asdcApi/model/src/main/resources/asdc-api.20170201.json b/northbound/asdcApi/model/src/main/resources/asdc-api.20170201.json new file mode 100644 index 000000000..7bf27da82 --- /dev/null +++ b/northbound/asdcApi/model/src/main/resources/asdc-api.20170201.json @@ -0,0 +1,3254 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0" + }, + "basePath": "/restconf", + "paths": { + "/config": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "**(config)artifacts", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API(config)artifacts-TOP" + } + }, + { + "in": "body", + "name": "**(config)vf-license-model-versions", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API(config)vf-license-model-versions-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)ASDC-API_modulePOST" + } + } + }, + "description": "SDC Interface", + "operationId": "POST-ASDC-API_module" + } + }, + "/config/ASDC-API:artifacts": { + "delete": { + "produces": [ + "application/json", + "application/xml" + ], + "responses": { + "200": { + "description": "No response was specified" + } + }, + "operationId": "DELETE-artifacts" + }, + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)artifacts" + } + } + }, + "operationId": "GET-artifacts" + }, + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "**(config)artifact", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/artifacts(config)artifact-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)artifactsPOST" + } + } + }, + "operationId": "POST-artifacts" + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "(config)artifacts", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API(config)artifacts-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/ASDC-API(config)artifacts-TOP" + } + } + }, + "operationId": "PUT-artifacts" + } + }, + "/config/ASDC-API:artifacts/artifact/{artifact-name}/{artifact-version}": { + "delete": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Name of artifact", + "in": "path", + "name": "artifact-name", + "required": true, + "type": "string" + }, + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified" + } + }, + "operationId": "DELETE-artifact" + }, + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Name of artifact", + "in": "path", + "name": "artifact-name", + "required": true, + "type": "string" + }, + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)artifact" + } + } + }, + "operationId": "GET-artifact" + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Name of artifact", + "in": "path", + "name": "artifact-name", + "required": true, + "type": "string" + }, + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "(config)artifact", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/artifacts(config)artifact-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/ASDC-API/artifacts(config)artifact-TOP" + } + } + }, + "operationId": "PUT-artifact" + } + }, + "/config/ASDC-API:vf-license-model-versions": { + "delete": { + "produces": [ + "application/json", + "application/xml" + ], + "responses": { + "200": { + "description": "No response was specified" + } + }, + "operationId": "DELETE-vf-license-model-versions" + }, + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)vf-license-model-versions" + } + } + }, + "operationId": "GET-vf-license-model-versions" + }, + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "**(config)vf-license-model-version", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions(config)vf-license-model-version-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)vf-license-model-versionsPOST" + } + } + }, + "operationId": "POST-vf-license-model-versions" + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "(config)vf-license-model-versions", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API(config)vf-license-model-versions-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/ASDC-API(config)vf-license-model-versions-TOP" + } + } + }, + "operationId": "PUT-vf-license-model-versions" + } + }, + "/config/ASDC-API:vf-license-model-versions/vf-license-model-version/{artifact-version}": { + "delete": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified" + } + }, + "operationId": "DELETE-vf-license-model-version" + }, + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)vf-license-model-version" + } + } + }, + "operationId": "GET-vf-license-model-version" + }, + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "**(config)vf-license-model", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version(config)vf-license-model-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)vf-license-model-versionPOST" + } + } + }, + "operationId": "POST-vf-license-model-version" + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "(config)vf-license-model-version", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions(config)vf-license-model-version-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions(config)vf-license-model-version-TOP" + } + } + }, + "operationId": "PUT-vf-license-model-version" + } + }, + "/config/ASDC-API:vf-license-model-versions/vf-license-model-version/{artifact-version}/vf-license-model": { + "delete": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified" + } + }, + "description": "xxxx", + "operationId": "DELETE-vf-license-model" + }, + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)vf-license-model" + } + } + }, + "description": "xxxx", + "operationId": "GET-vf-license-model" + }, + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "**(config)feature-group-list", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model(config)feature-group-list-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)vf-license-modelPOST" + } + } + }, + "description": "xxxx", + "operationId": "POST-vf-license-model" + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "(config)vf-license-model", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version(config)vf-license-model-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version(config)vf-license-model-TOP" + } + } + }, + "description": "xxxx", + "operationId": "PUT-vf-license-model" + } + }, + "/config/ASDC-API:vf-license-model-versions/vf-license-model-version/{artifact-version}/vf-license-model/feature-group-list": { + "delete": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified" + } + }, + "description": "xxxx", + "operationId": "DELETE-feature-group-list" + }, + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)feature-group-list" + } + } + }, + "description": "xxxx", + "operationId": "GET-feature-group-list" + }, + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "**(config)feature-group", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list(config)feature-group-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)feature-group-listPOST" + } + } + }, + "description": "xxxx", + "operationId": "POST-feature-group-list" + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "(config)feature-group-list", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model(config)feature-group-list-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model(config)feature-group-list-TOP" + } + } + }, + "description": "xxxx", + "operationId": "PUT-feature-group-list" + } + }, + "/config/ASDC-API:vf-license-model-versions/vf-license-model-version/{artifact-version}/vf-license-model/feature-group-list/feature-group": { + "delete": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified" + } + }, + "description": "xxxx", + "operationId": "DELETE-feature-group" + }, + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)feature-group" + } + } + }, + "description": "xxxx", + "operationId": "GET-feature-group" + }, + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "**(config)license-key-group-list", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group(config)license-key-group-list-TOP" + } + }, + { + "in": "body", + "name": "**(config)entitlement-pool-list", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group(config)entitlement-pool-list-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)feature-groupPOST" + } + } + }, + "description": "xxxx", + "operationId": "POST-feature-group" + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "(config)feature-group", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list(config)feature-group-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list(config)feature-group-TOP" + } + } + }, + "description": "xxxx", + "operationId": "PUT-feature-group" + } + }, + "/config/ASDC-API:vf-license-model-versions/vf-license-model-version/{artifact-version}/vf-license-model/feature-group-list/feature-group/entitlement-pool-list": { + "delete": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified" + } + }, + "description": "xxxx", + "operationId": "DELETE-entitlement-pool-list" + }, + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)entitlement-pool-list" + } + } + }, + "description": "xxxx", + "operationId": "GET-entitlement-pool-list" + }, + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "**(config)entitlement-pool", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list(config)entitlement-pool-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)entitlement-pool-listPOST" + } + } + }, + "description": "xxxx", + "operationId": "POST-entitlement-pool-list" + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "(config)entitlement-pool-list", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group(config)entitlement-pool-list-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group(config)entitlement-pool-list-TOP" + } + } + }, + "description": "xxxx", + "operationId": "PUT-entitlement-pool-list" + } + }, + "/config/ASDC-API:vf-license-model-versions/vf-license-model-version/{artifact-version}/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool": { + "delete": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified" + } + }, + "description": "xxxx", + "operationId": "DELETE-entitlement-pool" + }, + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)entitlement-pool" + } + } + }, + "description": "xxxx", + "operationId": "GET-entitlement-pool" + }, + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "**(config)threshold-value", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)threshold-value-TOP" + } + }, + { + "in": "body", + "name": "**(config)time", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)time-TOP" + } + }, + { + "in": "body", + "name": "**(config)operational-scope", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)operational-scope-TOP" + } + }, + { + "in": "body", + "name": "**(config)entitlement-metric", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)entitlement-metric-TOP" + } + }, + { + "in": "body", + "name": "**(config)aggregation-function", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)aggregation-function-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)entitlement-poolPOST" + } + } + }, + "description": "xxxx", + "operationId": "POST-entitlement-pool" + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "(config)entitlement-pool", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list(config)entitlement-pool-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list(config)entitlement-pool-TOP" + } + } + }, + "description": "xxxx", + "operationId": "PUT-entitlement-pool" + } + }, + "/config/ASDC-API:vf-license-model-versions/vf-license-model-version/{artifact-version}/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool/aggregation-function": { + "delete": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified" + } + }, + "description": "xxxx", + "operationId": "DELETE-aggregation-function" + }, + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)aggregation-function" + } + } + }, + "description": "xxxx", + "operationId": "GET-aggregation-function" + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "(config)aggregation-function", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)aggregation-function-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)aggregation-function-TOP" + } + } + }, + "description": "xxxx", + "operationId": "PUT-aggregation-function" + } + }, + "/config/ASDC-API:vf-license-model-versions/vf-license-model-version/{artifact-version}/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool/entitlement-metric": { + "delete": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified" + } + }, + "description": "xxxx", + "operationId": "DELETE-entitlement-metric" + }, + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)entitlement-metric" + } + } + }, + "description": "xxxx", + "operationId": "GET-entitlement-metric" + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "(config)entitlement-metric", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)entitlement-metric-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)entitlement-metric-TOP" + } + } + }, + "description": "xxxx", + "operationId": "PUT-entitlement-metric" + } + }, + "/config/ASDC-API:vf-license-model-versions/vf-license-model-version/{artifact-version}/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool/operational-scope": { + "delete": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified" + } + }, + "description": "xxxx", + "operationId": "DELETE-operational-scope" + }, + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)operational-scope" + } + } + }, + "description": "xxxx", + "operationId": "GET-operational-scope" + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "(config)operational-scope", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)operational-scope-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)operational-scope-TOP" + } + } + }, + "description": "xxxx", + "operationId": "PUT-operational-scope" + } + }, + "/config/ASDC-API:vf-license-model-versions/vf-license-model-version/{artifact-version}/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool/threshold-value": { + "delete": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified" + } + }, + "description": "xxxx", + "operationId": "DELETE-threshold-value" + }, + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)threshold-value" + } + } + }, + "description": "xxxx", + "operationId": "GET-threshold-value" + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "(config)threshold-value", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)threshold-value-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)threshold-value-TOP" + } + } + }, + "description": "xxxx", + "operationId": "PUT-threshold-value" + } + }, + "/config/ASDC-API:vf-license-model-versions/vf-license-model-version/{artifact-version}/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool/time": { + "delete": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified" + } + }, + "description": "xxxx", + "operationId": "DELETE-time" + }, + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)time" + } + } + }, + "description": "xxxx", + "operationId": "GET-time" + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "(config)time", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)time-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)time-TOP" + } + } + }, + "description": "xxxx", + "operationId": "PUT-time" + } + }, + "/config/ASDC-API:vf-license-model-versions/vf-license-model-version/{artifact-version}/vf-license-model/feature-group-list/feature-group/license-key-group-list": { + "delete": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified" + } + }, + "description": "xxxx", + "operationId": "DELETE-license-key-group-list" + }, + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)license-key-group-list" + } + } + }, + "description": "xxxx", + "operationId": "GET-license-key-group-list" + }, + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "**(config)license-key-group", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/license-key-group-list(config)license-key-group-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)license-key-group-listPOST" + } + } + }, + "description": "xxxx", + "operationId": "POST-license-key-group-list" + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "(config)license-key-group-list", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group(config)license-key-group-list-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group(config)license-key-group-list-TOP" + } + } + }, + "description": "xxxx", + "operationId": "PUT-license-key-group-list" + } + }, + "/config/ASDC-API:vf-license-model-versions/vf-license-model-version/{artifact-version}/vf-license-model/feature-group-list/feature-group/license-key-group-list/license-key-group": { + "delete": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified" + } + }, + "description": "xxxx", + "operationId": "DELETE-license-key-group" + }, + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)license-key-group" + } + } + }, + "description": "xxxx", + "operationId": "GET-license-key-group" + }, + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "**(config)operational-scope", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/license-key-group-list/license-key-group(config)operational-scope-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)license-key-groupPOST" + } + } + }, + "description": "xxxx", + "operationId": "POST-license-key-group" + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "(config)license-key-group", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/license-key-group-list(config)license-key-group-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/license-key-group-list(config)license-key-group-TOP" + } + } + }, + "description": "xxxx", + "operationId": "PUT-license-key-group" + } + }, + "/config/ASDC-API:vf-license-model-versions/vf-license-model-version/{artifact-version}/vf-license-model/feature-group-list/feature-group/license-key-group-list/license-key-group/operational-scope": { + "delete": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified" + } + }, + "description": "xxxx", + "operationId": "DELETE-operational-scope" + }, + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config)operational-scope" + } + } + }, + "description": "xxxx", + "operationId": "GET-operational-scope" + }, + "put": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "description": "Version of artifact", + "in": "path", + "name": "artifact-version", + "required": true, + "type": "string" + }, + { + "in": "body", + "name": "(config)operational-scope", + "required": false, + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/license-key-group-list/license-key-group(config)operational-scope-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/license-key-group-list/license-key-group(config)operational-scope-TOP" + } + } + }, + "description": "xxxx", + "operationId": "PUT-operational-scope" + } + }, + "/operational/ASDC-API:artifacts": { + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(operational)artifacts" + } + } + }, + "operationId": "GET-artifacts" + } + }, + "/operational/ASDC-API:vf-license-model-versions": { + "get": { + "produces": [ + "application/json", + "application/xml" + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(operational)vf-license-model-versions" + } + } + }, + "operationId": "GET-vf-license-model-versions" + } + }, + "/operations/ASDC-API:vf-license-model-update": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(vf-license-model-update)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(vf-license-model-update)output-TOP" + } + } + }, + "operationId": "vf-license-model-update" + } + } + }, + "definitions": { + "(config)ASDC-API_modulePOST": { + "properties": { + "artifacts": { + "items": { + "$ref": "#/definitions/ASDC-API(config)artifacts" + }, + "type": "object" + }, + "vf-license-model-versions": { + "items": { + "$ref": "#/definitions/ASDC-API(config)vf-license-model-versions" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config)aggregation-functionPOST": { + "properties": { + "other": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "value": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "(config)artifactPOST": { + "properties": { + "artifact-name": { + "$ref": "#/definitions/Optional.empty", + "description": "Name of artifact" + }, + "artifact-version": { + "$ref": "#/definitions/Optional.empty", + "description": "Version of artifact" + } + }, + "type": "object" + }, + "(config)artifactsPOST": { + "properties": { + "artifact": { + "items": { + "$ref": "#/definitions/ASDC-API/artifacts(config)artifact" + }, + "type": "array" + } + }, + "type": "object" + }, + "(config)entitlement-metricPOST": { + "properties": { + "other": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "value": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "(config)entitlement-pool-listPOST": { + "properties": { + "entitlement-pool": { + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list(config)entitlement-pool" + }, + "type": "array" + } + }, + "type": "object" + }, + "(config)entitlement-poolPOST": { + "properties": { + "aggregation-function": { + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)aggregation-function" + }, + "type": "object" + }, + "description": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "entitlement-metric": { + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)entitlement-metric" + }, + "type": "object" + }, + "entitlement-pool-uuid": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "increments": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "manufacturer-reference-number": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "name": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "operational-scope": { + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)operational-scope" + }, + "type": "object" + }, + "threshold-value": { + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)threshold-value" + }, + "type": "object" + }, + "time": { + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)time" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config)feature-group-listPOST": { + "properties": { + "feature-group": { + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list(config)feature-group" + }, + "type": "array" + } + }, + "type": "object" + }, + "(config)feature-groupPOST": { + "properties": { + "att-part-number": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "description": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "entitlement-pool-list": { + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group(config)entitlement-pool-list" + }, + "type": "object" + }, + "feature-group-uuid": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "license-key-group-list": { + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group(config)license-key-group-list" + }, + "type": "object" + }, + "name": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "(config)license-key-group-listPOST": { + "properties": { + "license-key-group": { + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/license-key-group-list(config)license-key-group" + }, + "type": "array" + }, + "name": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "(config)license-key-groupPOST": { + "properties": { + "description": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "license-key-group-uuid": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "name": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "operational-scope": { + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/license-key-group-list/license-key-group(config)operational-scope" + }, + "type": "object" + }, + "type": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "(config)operational-scopePOST": { + "properties": { + "other": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "value": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "(config)threshold-valuePOST": { + "properties": { + "unit": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "value": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "(config)timePOST": { + "properties": { + "other": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "value": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "(config)vf-license-model-versionPOST": { + "properties": { + "artifact-name": { + "$ref": "#/definitions/Optional.empty", + "description": "Name of artifact" + }, + "artifact-version": { + "$ref": "#/definitions/Optional.empty", + "description": "Version of artifact" + }, + "vf-license-model": { + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version(config)vf-license-model" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config)vf-license-model-versionsPOST": { + "properties": { + "vf-license-model-version": { + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions(config)vf-license-model-version" + }, + "type": "array" + } + }, + "type": "object" + }, + "(config)vf-license-modelPOST": { + "properties": { + "feature-group-list": { + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model(config)feature-group-list" + }, + "type": "object" + }, + "vendor-name": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "vf-id": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "(vf-license-model-update)input": { + "properties": { + "ASDC-API:artifact-name": { + "$ref": "#/definitions/Optional.empty", + "description": "Name of artifact" + }, + "ASDC-API:artifact-version": { + "$ref": "#/definitions/Optional.empty", + "description": "Version of artifact" + }, + "ASDC-API:vf-license-model": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API(config)vf-license-model" + }, + "type": "object" + } + }, + "type": "object" + }, + "(vf-license-model-update)input-TOP": { + "properties": { + "ASDC-API:input": { + "items": { + "$ref": "#/definitions/(vf-license-model-update)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(vf-license-model-update)output": { + "properties": { + "ASDC-API:asdc-api-response-code": { + "$ref": "#/definitions/Optional.empty", + "description": "Code indicating success/failure" + }, + "ASDC-API:asdc-api-response-text": { + "$ref": "#/definitions/Optional.empty", + "description": "Text indicating reason for failure" + } + }, + "type": "object" + }, + "(vf-license-model-update)output-TOP": { + "properties": { + "ASDC-API:output": { + "items": { + "$ref": "#/definitions/(vf-license-model-update)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API(config)artifacts": { + "properties": { + "ASDC-API:artifact": { + "items": { + "$ref": "#/definitions/ASDC-API/artifacts(config)artifact" + }, + "type": "array" + } + }, + "type": "object" + }, + "ASDC-API(config)artifacts-TOP": { + "properties": { + "ASDC-API:artifacts": { + "items": { + "$ref": "#/definitions/ASDC-API(config)artifacts" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API(config)vf-license-model": { + "properties": { + "ASDC-API:feature-group-list": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model(config)feature-group-list" + }, + "type": "object" + }, + "ASDC-API:vendor-name": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:vf-id": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API(config)vf-license-model-TOP": { + "properties": { + "ASDC-API:vf-license-model": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API(config)vf-license-model" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API(config)vf-license-model-versions": { + "properties": { + "ASDC-API:vf-license-model-version": { + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions(config)vf-license-model-version" + }, + "type": "array" + } + }, + "type": "object" + }, + "ASDC-API(config)vf-license-model-versions-TOP": { + "properties": { + "ASDC-API:vf-license-model-versions": { + "items": { + "$ref": "#/definitions/ASDC-API(config)vf-license-model-versions" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API(operational)artifacts": { + "type": "object" + }, + "ASDC-API(operational)artifacts-TOP": { + "properties": { + "ASDC-API:artifacts": { + "items": { + "$ref": "#/definitions/ASDC-API(operational)artifacts" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API(operational)vf-license-model-versions": { + "type": "object" + }, + "ASDC-API(operational)vf-license-model-versions-TOP": { + "properties": { + "ASDC-API:vf-license-model-versions": { + "items": { + "$ref": "#/definitions/ASDC-API(operational)vf-license-model-versions" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/artifacts(config)artifact": { + "properties": { + "ASDC-API:artifact-name": { + "$ref": "#/definitions/Optional.empty", + "description": "Name of artifact" + }, + "ASDC-API:artifact-version": { + "$ref": "#/definitions/Optional.empty", + "description": "Version of artifact" + } + }, + "type": "object" + }, + "ASDC-API/artifacts(config)artifact-TOP": { + "properties": { + "ASDC-API:artifact": { + "items": { + "$ref": "#/definitions/ASDC-API/artifacts(config)artifact" + }, + "type": "array" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model(config)feature-group-list": { + "properties": { + "ASDC-API:feature-group": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list(config)feature-group" + }, + "type": "array" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model(config)feature-group-list-TOP": { + "properties": { + "ASDC-API:feature-group-list": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model(config)feature-group-list" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions(config)vf-license-model-version": { + "properties": { + "ASDC-API:artifact-name": { + "$ref": "#/definitions/Optional.empty", + "description": "Name of artifact" + }, + "ASDC-API:artifact-version": { + "$ref": "#/definitions/Optional.empty", + "description": "Version of artifact" + }, + "ASDC-API:vf-license-model": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version(config)vf-license-model" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions(config)vf-license-model-version-TOP": { + "properties": { + "ASDC-API:vf-license-model-version": { + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions(config)vf-license-model-version" + }, + "type": "array" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version(config)vf-license-model": { + "properties": { + "ASDC-API:feature-group-list": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model(config)feature-group-list" + }, + "type": "object" + }, + "ASDC-API:vendor-name": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:vf-id": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version(config)vf-license-model-TOP": { + "properties": { + "ASDC-API:vf-license-model": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version(config)vf-license-model" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model(config)feature-group-list": { + "properties": { + "ASDC-API:feature-group": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list(config)feature-group" + }, + "type": "array" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model(config)feature-group-list-TOP": { + "properties": { + "ASDC-API:feature-group-list": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model(config)feature-group-list" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list(config)feature-group": { + "properties": { + "ASDC-API:att-part-number": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:description": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:entitlement-pool-list": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group(config)entitlement-pool-list" + }, + "type": "object" + }, + "ASDC-API:feature-group-uuid": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:license-key-group-list": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group(config)license-key-group-list" + }, + "type": "object" + }, + "ASDC-API:name": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list(config)feature-group-TOP": { + "properties": { + "ASDC-API:feature-group": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list(config)feature-group" + }, + "type": "array" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group(config)entitlement-pool-list": { + "properties": { + "ASDC-API:entitlement-pool": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list(config)entitlement-pool" + }, + "type": "array" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group(config)entitlement-pool-list-TOP": { + "properties": { + "ASDC-API:entitlement-pool-list": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group(config)entitlement-pool-list" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group(config)license-key-group-list": { + "properties": { + "ASDC-API:license-key-group": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/license-key-group-list(config)license-key-group" + }, + "type": "array" + }, + "ASDC-API:name": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group(config)license-key-group-list-TOP": { + "properties": { + "ASDC-API:license-key-group-list": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group(config)license-key-group-list" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list(config)entitlement-pool": { + "properties": { + "ASDC-API:aggregation-function": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)aggregation-function" + }, + "type": "object" + }, + "ASDC-API:description": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:entitlement-metric": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)entitlement-metric" + }, + "type": "object" + }, + "ASDC-API:entitlement-pool-uuid": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:increments": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:manufacturer-reference-number": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:name": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:operational-scope": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)operational-scope" + }, + "type": "object" + }, + "ASDC-API:threshold-value": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)threshold-value" + }, + "type": "object" + }, + "ASDC-API:time": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)time" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list(config)entitlement-pool-TOP": { + "properties": { + "ASDC-API:entitlement-pool": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list(config)entitlement-pool" + }, + "type": "array" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)aggregation-function": { + "properties": { + "ASDC-API:other": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:value": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)aggregation-function-TOP": { + "properties": { + "ASDC-API:aggregation-function": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)aggregation-function" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)entitlement-metric": { + "properties": { + "ASDC-API:other": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:value": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)entitlement-metric-TOP": { + "properties": { + "ASDC-API:entitlement-metric": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)entitlement-metric" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)operational-scope": { + "properties": { + "ASDC-API:other": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:value": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)operational-scope-TOP": { + "properties": { + "ASDC-API:operational-scope": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)operational-scope" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)threshold-value": { + "properties": { + "ASDC-API:unit": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:value": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)threshold-value-TOP": { + "properties": { + "ASDC-API:threshold-value": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)threshold-value" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)time": { + "properties": { + "ASDC-API:other": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:value": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)time-TOP": { + "properties": { + "ASDC-API:time": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)time" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/license-key-group-list(config)license-key-group": { + "properties": { + "ASDC-API:description": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:license-key-group-uuid": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:name": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:operational-scope": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/license-key-group-list/license-key-group(config)operational-scope" + }, + "type": "object" + }, + "ASDC-API:type": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/license-key-group-list(config)license-key-group-TOP": { + "properties": { + "ASDC-API:license-key-group": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/license-key-group-list(config)license-key-group" + }, + "type": "array" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/license-key-group-list/license-key-group(config)operational-scope": { + "properties": { + "ASDC-API:other": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:value": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/license-key-group-list/license-key-group(config)operational-scope-TOP": { + "properties": { + "ASDC-API:operational-scope": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model-versions/vf-license-model-version/vf-license-model/feature-group-list/feature-group/license-key-group-list/license-key-group(config)operational-scope" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list(config)feature-group": { + "properties": { + "ASDC-API:att-part-number": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:description": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:entitlement-pool-list": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group(config)entitlement-pool-list" + }, + "type": "object" + }, + "ASDC-API:feature-group-uuid": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:license-key-group-list": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group(config)license-key-group-list" + }, + "type": "object" + }, + "ASDC-API:name": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list(config)feature-group-TOP": { + "properties": { + "ASDC-API:feature-group": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list(config)feature-group" + }, + "type": "array" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group(config)entitlement-pool-list": { + "properties": { + "ASDC-API:entitlement-pool": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list(config)entitlement-pool" + }, + "type": "array" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group(config)entitlement-pool-list-TOP": { + "properties": { + "ASDC-API:entitlement-pool-list": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group(config)entitlement-pool-list" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group(config)license-key-group-list": { + "properties": { + "ASDC-API:license-key-group": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/license-key-group-list(config)license-key-group" + }, + "type": "array" + }, + "ASDC-API:name": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group(config)license-key-group-list-TOP": { + "properties": { + "ASDC-API:license-key-group-list": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group(config)license-key-group-list" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list(config)entitlement-pool": { + "properties": { + "ASDC-API:aggregation-function": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)aggregation-function" + }, + "type": "object" + }, + "ASDC-API:description": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:entitlement-metric": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)entitlement-metric" + }, + "type": "object" + }, + "ASDC-API:entitlement-pool-uuid": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:increments": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:manufacturer-reference-number": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:name": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:operational-scope": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)operational-scope" + }, + "type": "object" + }, + "ASDC-API:threshold-value": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)threshold-value" + }, + "type": "object" + }, + "ASDC-API:time": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)time" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list(config)entitlement-pool-TOP": { + "properties": { + "ASDC-API:entitlement-pool": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list(config)entitlement-pool" + }, + "type": "array" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)aggregation-function": { + "properties": { + "ASDC-API:other": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:value": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)aggregation-function-TOP": { + "properties": { + "ASDC-API:aggregation-function": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)aggregation-function" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)entitlement-metric": { + "properties": { + "ASDC-API:other": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:value": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)entitlement-metric-TOP": { + "properties": { + "ASDC-API:entitlement-metric": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)entitlement-metric" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)operational-scope": { + "properties": { + "ASDC-API:other": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:value": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)operational-scope-TOP": { + "properties": { + "ASDC-API:operational-scope": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)operational-scope" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)threshold-value": { + "properties": { + "ASDC-API:unit": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:value": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)threshold-value-TOP": { + "properties": { + "ASDC-API:threshold-value": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)threshold-value" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)time": { + "properties": { + "ASDC-API:other": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:value": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)time-TOP": { + "properties": { + "ASDC-API:time": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool(config)time" + }, + "type": "object" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group/license-key-group-list(config)license-key-group": { + "properties": { + "ASDC-API:description": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:license-key-group-uuid": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:name": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:operational-scope": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/license-key-group-list/license-key-group(config)operational-scope" + }, + "type": "object" + }, + "ASDC-API:type": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group/license-key-group-list(config)license-key-group-TOP": { + "properties": { + "ASDC-API:license-key-group": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/license-key-group-list(config)license-key-group" + }, + "type": "array" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group/license-key-group-list/license-key-group(config)operational-scope": { + "properties": { + "ASDC-API:other": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + }, + "ASDC-API:value": { + "$ref": "#/definitions/Optional.empty", + "description": "xxxx" + } + }, + "type": "object" + }, + "ASDC-API/vf-license-model/feature-group-list/feature-group/license-key-group-list/license-key-group(config)operational-scope-TOP": { + "properties": { + "ASDC-API:operational-scope": { + "description": "xxxx", + "items": { + "$ref": "#/definitions/ASDC-API/vf-license-model/feature-group-list/feature-group/license-key-group-list/license-key-group(config)operational-scope" + }, + "type": "object" + } + }, + "type": "object" + }, + "unique_empty_identifier": {} + } +} diff --git a/northbound/asdcApi/model/src/main/yang/ASDC-API.yang b/northbound/asdcApi/model/src/main/yang/ASDC-API.yang new file mode 100755 index 000000000..12cfb9a56 --- /dev/null +++ b/northbound/asdcApi/model/src/main/yang/ASDC-API.yang @@ -0,0 +1,63 @@ + +module ASDC-API { + yang-version "1"; + + namespace "org:onap:ccsdk"; + + prefix asdc-api; + + import asdc-api-common { prefix asdc-api-common; } + + + import asdc-license-model { prefix asdc-license-model; } + + import ietf-inet-types { + prefix inet; + revision-date "2013-07-15"; + } + + organization + "ONAP"; + + contact + "Dan Timoney"; + + description + "SDC Interface"; + + revision 2017-02-01 { + description "database definitions"; + } + + // Containers + container artifacts { + list artifact { + key "artifact-name artifact-version"; + + uses asdc-api-common:artifact-fields; + } + } + + + + container vf-license-model-versions { + list vf-license-model-version { + key artifact-version; + uses asdc-api-common:artifact-fields; + uses asdc-license-model:vf-license-model-grouping; + } + } + + + // RPCs + + rpc vf-license-model-update { + input { + uses asdc-api-common:artifact-fields; + uses asdc-license-model:vf-license-model-grouping; + } + output { + uses asdc-api-common:asdc-api-response; + } + } +} diff --git a/northbound/asdcApi/model/src/main/yang/asdc-api-common.yang b/northbound/asdcApi/model/src/main/yang/asdc-api-common.yang new file mode 100755 index 000000000..1531b7b30 --- /dev/null +++ b/northbound/asdcApi/model/src/main/yang/asdc-api-common.yang @@ -0,0 +1,53 @@ + +module asdc-api-common { + yang-version "1"; + + // Use same namespace defined for file upload in 15.12 + namespace "org:onap:ccsdk:sli:northbound:asdcapi:common"; + + prefix asdcapi; + + organization + "ONAP"; + + contact + "Dan Timoney"; + + description + "ASDC/SDN-C API common data"; + + revision 2017-02-01 { + description "Initial release"; + } + + + + // Groupings + + grouping artifact-fields { + leaf artifact-name { + type string; + description "Name of artifact"; + } + + leaf artifact-version { + type string; + description "Version of artifact"; + } + } + + grouping asdc-api-response { + leaf asdc-api-response-code { + type string; + description "Code indicating success/failure"; + } + + leaf asdc-api-response-text { + type string; + description "Text indicating reason for failure"; + } + } + + + +} diff --git a/northbound/asdcApi/model/src/main/yang/asdc-license-model.yang b/northbound/asdcApi/model/src/main/yang/asdc-license-model.yang new file mode 100755 index 000000000..33f383569 --- /dev/null +++ b/northbound/asdcApi/model/src/main/yang/asdc-license-model.yang @@ -0,0 +1,369 @@ +module asdc-license-model { + + namespace "http://xmlns.onap.org/asdc/license-model/1.0"; + prefix le; + organization "onap"; + contact "asdc"; + description "schema for both vendor license and VF license models"; + revision 2016-04-27 { + description "xxxx"; + reference "xxxx"; + } + + container vendor-license-model { + description "xxxx"; + leaf vendor-name { + type string{ + length "1..200"; + } + description "xxxx"; + } + uses entitlement-pools; + uses license-key-groups; + } + + grouping entitlement-pools { + description "xxxx"; + container entitlement-pool-list { + description "xxxx"; + uses entitlement-pool; + } + } + + grouping entitlement-pool { + description "xxxx"; + list entitlement-pool { + description "xxxx"; + leaf entitlement-pool-uuid { + type string; + description "xxxx"; + } + leaf name { + type string{ + length "1..120"; + } + description "xxxx"; + } + leaf description { + type string{ + length "1..1000"; + } + description "xxxx"; + } + leaf manufacturer-reference-number { + type string{ + length "1..100"; + } + description "xxxx"; + } + uses operational-scope; + uses threshold-value; + uses entitlement-metric; + leaf increments { + type string{ + length "1..120"; + } + description "xxxx"; + } + uses aggregation-function; + uses time; + } + } + + grouping operational-scope { + description "xxxx"; + container operational-scope { + description "xxxx"; + leaf value { + type enumeration { + enum "Network_Wide"{ + description "xxxx"; + } + enum "Availability_Zone"{ + description "xxxx"; + } + enum "Data_Center"{ + description "xxxx"; + } + enum "Tenant"{ + description "xxxx"; + } + enum "VM"{ + description "xxxx"; + } + enum "CPU"{ + description "xxxx"; + } + enum "Core"{ + description "xxxx"; + } + enum "Other"{ + description "xxxx"; + } + } + description "xxxx"; + } + leaf other { + type string{ + length "1..200"; + } + description "xxxx"; + } + } + } + + grouping threshold-value { + description "xxxx"; + container threshold-value { + description "xxxx"; + leaf value { + type uint32{ + range "0..9999999"; + } //TBD Change to type number + description "xxxx"; + } + leaf unit { + type enumeration { + enum "Absolute"{ + description "xxxx"; + } + enum "Percentage"{ + description "xxxx"; + } + } + description "xxxx"; + } + } + } + + grouping entitlement-metric { + description "xxxx"; + container entitlement-metric { + description "xxxx"; + leaf value { + type enumeration { + enum "Software_Instances_Count"{ + description "xxxx"; + } + enum "CPU"{ + description "xxxx"; + } + enum "Core"{ + description "xxxx"; + } + enum "Trunks"{ + description "xxxx"; + } + enum "User"{ + description "xxxx"; + } + enum "Subscribers"{ + description "xxxx"; + } + enum "Tenants"{ + description "xxxx"; + } + enum "Tokens"{ + description "xxxx"; + } + enum "Seats"{ + description "xxxx"; + } + enum "Units_TB"{ + description "xxxx"; + } + enum "Units_GB"{ + description "xxxx"; + } + enum "Units_MB"{ + description "xxxx"; + } + enum "Other"{ + description "xxxx"; + } + } + description "xxxx"; + } + leaf other { + type string{ + length "1..200"; + } + description "xxxx"; + } + } + } + + grouping aggregation-function { + description "xxxx"; + container aggregation-function { + description "xxxx"; + leaf value { + type enumeration { + enum "Peak"{ + description "xxxx"; + } + enum "Average"{ + description "xxxx"; + } + enum "Other"{ + description "xxxx"; + } + } + description "xxxx"; + } + leaf other { + type string{ + length "1..200"; + } + description "xxxx"; + } + } + } + + grouping time { + description "xxxx"; + container time { + description "xxxx"; + leaf value { + type enumeration { + enum "Hour"{ + description "xxxx"; + } + enum "Day"{ + description "xxxx"; + } + enum "Month"{ + description "xxxx"; + } + enum "Quarter"{ + description "xxxx"; + } + enum "Year"{ + description "xxxx"; + } + enum "Other"{ + description "xxxx"; + } + } + description "xxxx"; + } + leaf other { + type string{ + length "1..200"; + } + description "xxxx"; + } + } + } + + + + grouping license-key-groups { + description "xxxx"; + container license-key-group-list { + description "xxxx"; + leaf name { + type string; + description "xxxx"; + } + uses license-key-group; + } + } + + grouping license-key-group { + description "xxxx"; + list license-key-group { + description "xxxx"; + leaf license-key-group-uuid { + type string; + description "xxxx"; + } + leaf name { + type string{ + length "1..120"; + } + description "xxxx"; + } + leaf description { + type string{ + length "1..1000"; + } + description "xxxx"; + } + uses operational-scope; + leaf type { + type enumeration { + enum "Universal"{ + description "xxxx"; + } + enum "Unique"{ + description "xxxx"; + } + enum "One_Time"{ + description "xxxx"; + } + } + description "xxxx"; + } + } + } + + grouping vf-license-model-grouping { + description "xxxx"; + container vf-license-model { + description "xxxx"; + leaf vf-id { + type string{ + length "1..200"; + } + description "xxxx"; + } + leaf vendor-name { + type string{ + length "1..200"; + } + description "xxxx"; + } + uses feature-groups; + } + } + + grouping feature-groups { + description "xxxx"; + container feature-group-list { + description "xxxx"; + uses feature-group-grouping; + } + } + + grouping feature-group-grouping { + description "xxxx"; + list feature-group { + description "xxxx"; + leaf name{ + type string{ + length "1..120"; + } + description "xxxx"; + } + leaf feature-group-uuid{ + type string; + description "xxxx"; + } + leaf description { + type string{ + length "1..1000"; + } + description "xxxx"; + } + leaf att-part-number { + type string{ + length "1..100"; + } + description "xxxx"; + } + uses entitlement-pools; + uses license-key-groups; + } + } +} diff --git a/northbound/asdcApi/pom.xml b/northbound/asdcApi/pom.xml new file mode 100755 index 000000000..b5cea9931 --- /dev/null +++ b/northbound/asdcApi/pom.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>odlparent-lite</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>asdcApi</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>ccsdk-sli-northbound :: asdcApi</name> + + <modules> + <module>model</module> + <module>provider</module> + <module>installer</module> + </modules> + + <properties> + <ccsdk.sli.northbound.version>${project.version}</ccsdk.sli.northbound.version> + </properties> +</project> diff --git a/northbound/asdcApi/provider/pom.xml b/northbound/asdcApi/provider/pom.xml new file mode 100755 index 000000000..97c4ba9aa --- /dev/null +++ b/northbound/asdcApi/provider/pom.xml @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>binding-parent</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>asdcApi-provider</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>bundle</packaging> + + <name>ccsdk-sli-northbound :: asdcApi :: ${project.artifactId}</name> + + <properties> + <ccsdk.sli.northbound.version>${project.version}</ccsdk.sli.northbound.version> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-core-artifacts</artifactId> + <version>${ccsdk.sli.core.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>asdcApi-model</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-api</artifactId> + </dependency> + + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-common-util</artifactId> + </dependency> + + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-common</artifactId> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-provider</artifactId> + </dependency> + + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-test-model</artifactId> + <scope>test</scope> + </dependency> + + + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-broker-impl</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-broker-impl</artifactId> + <type>test-jar</type> + <classifier>tests</classifier> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java b/northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java new file mode 100644 index 000000000..1a79f8c41 --- /dev/null +++ b/northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiProvider.java @@ -0,0 +1,379 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.asdcapi; + +import java.util.Properties; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; +import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; +import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; +import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; +import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; +import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.opendaylight.yang.gen.v1.http.xmlns.onap.org.asdc.license.model._1._0.rev160427.vf.license.model.grouping.VfLicenseModel; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.ASDCAPIService; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.Artifacts; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.ArtifactsBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.VfLicenseModelUpdateInput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.VfLicenseModelUpdateInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.VfLicenseModelUpdateOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.VfLicenseModelUpdateOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.VfLicenseModelVersions; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.VfLicenseModelVersionsBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.artifacts.Artifact; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.artifacts.ArtifactBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.artifacts.ArtifactKey; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.vf.license.model.versions.VfLicenseModelVersion; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.vf.license.model.versions.VfLicenseModelVersionBuilder; +import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.opendaylight.yangtools.yang.common.RpcResultBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.Optional; +import com.google.common.util.concurrent.CheckedFuture; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; + +/** + * Defines a base implementation for your provider. This class extends from a helper class + * which provides storage for the most commonly used components of the MD-SAL. Additionally the + * base class provides some basic logging and initialization / clean up methods. + * + * To use this, copy and paste (overwrite) the following method into the TestApplicationProviderModule + * class which is auto generated under src/main/java in this project + * (created only once during first compilation): + * + * <pre> + + @Override + public java.lang.AutoCloseable createInstance() { + + final asdcApiProvider provider = new asdcApiProvider(); + provider.setDataBroker( getDataBrokerDependency() ); + provider.setNotificationService( getNotificationServiceDependency() ); + provider.setRpcRegistry( getRpcRegistryDependency() ); + provider.initialize(); + return new AutoCloseable() { + + @Override + public void close() throws Exception { + //TODO: CLOSE ANY REGISTRATION OBJECTS CREATED USING ABOVE BROKER/NOTIFICATION + //SERVIE/RPC REGISTRY + provider.close(); + } + }; + } + + + </pre> + */ +public class AsdcApiProvider implements AutoCloseable, ASDCAPIService { + + private static final Logger LOG = LoggerFactory.getLogger(AsdcApiProvider.class); + + private static final String ACTIVE_VERSION = "active"; + + private static final String APPLICATION_NAME = "asdcApi"; + + private final ExecutorService executor; + protected DataBroker dataBroker; + protected NotificationPublishService notificationService; + protected RpcProviderRegistry rpcRegistry; + private final AsdcApiSliClient asdcApiSliClient; + + protected BindingAwareBroker.RpcRegistration<ASDCAPIService> rpcRegistration; + + public AsdcApiProvider(final DataBroker dataBroker, + final NotificationPublishService notificationPublishService, + final RpcProviderRegistry rpcProviderRegistry, + final AsdcApiSliClient asdcApiSliClient) { + + LOG.info("Creating provider for {}", APPLICATION_NAME); + executor = Executors.newFixedThreadPool(1); + this.dataBroker = dataBroker; + notificationService = notificationPublishService; + rpcRegistry = rpcProviderRegistry; + this.asdcApiSliClient= asdcApiSliClient; + initialize(); + } + + public void initialize(){ + LOG.info("Initializing {} for {}", this.getClass().getName(), APPLICATION_NAME); + + createContainers(); + + if (rpcRegistration == null) { + if (rpcRegistry != null) { + rpcRegistration = rpcRegistry.addRpcImplementation( + ASDCAPIService.class, this); + LOG.info("Initialization complete for {}", APPLICATION_NAME); + } else { + LOG.warn("Error initializing {} : rpcRegistry unset", APPLICATION_NAME); + } + } + } + + private void createContainers() { + + if (dataBroker != null) { + final WriteTransaction t = dataBroker.newReadWriteTransaction(); + + // Create the vf-model-license-versions and artifacts containers + t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(VfLicenseModelVersions.class), + new VfLicenseModelVersionsBuilder().build()); + + t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Artifacts.class), new ArtifactsBuilder().build()); + + + try { + CheckedFuture<Void, TransactionCommitFailedException> checkedFuture = t.submit(); + checkedFuture.get(); + LOG.info("Create Containers succeeded!: "); + + } catch (InterruptedException | ExecutionException e) { + LOG.error("Create Containers Failed: ", e); + } + } else { + LOG.warn("createContainers : cannot find dataBroker to create containers"); + } + } + protected void initializeChild() { + //Override if you have custom initialization intelligence + } + + @Override + public void close() throws Exception { + LOG.info( "Closing provider for " + APPLICATION_NAME); + executor.shutdown(); + rpcRegistration.close(); + LOG.info( "Successfully closed provider for " + APPLICATION_NAME); + } + + protected boolean artifactVersionExists(String aName, String aVersion) { + InstanceIdentifier artifactInstanceId = + InstanceIdentifier.<Artifacts>builder(Artifacts.class) + .child(Artifact.class, new ArtifactKey(aName, aVersion)).build(); + Optional<Artifact> data = null; + try(ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction()) { + data = (Optional<Artifact>) readTx.read(LogicalDatastoreType.CONFIGURATION, artifactInstanceId).get(); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught Exception reading MD-SAL for ["+aName+","+ aVersion+"] " ,e); + return false; + } + + return data.isPresent(); + } + + protected void addArtifactVersion(String aName, String aVersion) { + + + try { + ArtifactBuilder aBuilder = new ArtifactBuilder(); + + aBuilder.setArtifactName(aName); + aBuilder.setArtifactVersion(aVersion); + + Artifact artifact = aBuilder.build(); + + InstanceIdentifier.InstanceIdentifierBuilder<Artifact> aIdBuilder = InstanceIdentifier + .<Artifacts> builder(Artifacts.class) + .child(Artifact.class, artifact.key()); + + InstanceIdentifier<Artifact> path = aIdBuilder.build(); + + WriteTransaction tx = dataBroker.newWriteOnlyTransaction(); + + tx.merge(LogicalDatastoreType.CONFIGURATION, path, + artifact); + tx.submit().checkedGet(); + } catch (Exception e) { + LOG.error("Caught exception trying to add artifact entry", e); + } + + } + + + private void applyVfLicenseModelUpdate(VfLicenseModelUpdateInput input) { + + String aName = input.getArtifactName(); + String aVersion = input.getArtifactVersion(); + VfLicenseModel vfLicenseModel = input.getVfLicenseModel(); + + + // Add new version (version = artifact-version) + try { + + VfLicenseModelVersionBuilder vBuilder = new VfLicenseModelVersionBuilder(); + vBuilder.setArtifactName(aName); + vBuilder.setArtifactVersion(aVersion); + vBuilder.setVfLicenseModel(vfLicenseModel); + + VfLicenseModelVersion version = vBuilder.build(); + + InstanceIdentifier.InstanceIdentifierBuilder<VfLicenseModelVersion> versionIdBuilder = InstanceIdentifier + .<VfLicenseModelVersions> builder(VfLicenseModelVersions.class) + .child(VfLicenseModelVersion.class, version.key()); + + InstanceIdentifier<VfLicenseModelVersion> path = versionIdBuilder.build(); + + WriteTransaction tx = dataBroker.newWriteOnlyTransaction(); + tx.merge(LogicalDatastoreType.CONFIGURATION, path, + version); + tx.submit().checkedGet(); + } catch (Exception e) { + LOG.error( + "Caught exception trying to save entry to MD-SAL", + e); + } + + + // Add "active" version (version = "active") + try { + + VfLicenseModelVersionBuilder vBuilder = new VfLicenseModelVersionBuilder(); + vBuilder.setArtifactName(aName); + vBuilder.setArtifactVersion(ACTIVE_VERSION); + vBuilder.setVfLicenseModel(vfLicenseModel); + + VfLicenseModelVersion version = vBuilder.build(); + InstanceIdentifier.InstanceIdentifierBuilder<VfLicenseModelVersion> versionIdBuilder = InstanceIdentifier + .<VfLicenseModelVersions> builder(VfLicenseModelVersions.class) + .child(VfLicenseModelVersion.class, version.key()); + + InstanceIdentifier<VfLicenseModelVersion> path = versionIdBuilder.build(); + + WriteTransaction tx = dataBroker.newWriteOnlyTransaction(); + + tx.merge(LogicalDatastoreType.CONFIGURATION, path, + version); + tx.submit().checkedGet(); + } catch (Exception e) { + LOG.error( + "Caught exception trying to save entry to MD-SAL", + e); + } + +} + +@Override +public ListenableFuture<RpcResult<VfLicenseModelUpdateOutput>> vfLicenseModelUpdate(VfLicenseModelUpdateInput input) { + final String svcOperation = "vf-license-model-update"; + + Properties parms = new Properties(); + + LOG.info( svcOperation +" called." ); + + if(input == null ) { + LOG.debug("exiting " +svcOperation+ " because of invalid input"); + return null; + } + + VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder(input); + + VfLicenseModelUpdateInput inputVfLic = inputBuilder.build(); + + String errorMessage = "Success"; + String errorCode = "200"; + + // If this artifact already exists, reject this update + if (artifactVersionExists(inputVfLic.getArtifactName(), inputVfLic.getArtifactVersion())) { + errorCode = "409"; + errorMessage = "Artifact version already exists"; + } else { + // Translate input object into SLI-consumable properties + LOG.info("Adding INPUT data for "+svcOperation+" input: " + inputVfLic); + AsdcApiUtil.toProperties(parms, inputVfLic); + + + // Call directed graph + Properties respProps = null; + try + { + if (asdcApiSliClient.hasGraph("ASDC-API", svcOperation , null, "sync")) + { + + try + { + respProps = asdcApiSliClient.execute("ASDC-API", svcOperation, null, "sync", parms); + } + catch (Exception e) + { + LOG.error("Caught exception executing service logic for "+ svcOperation, e); + } + } else { + errorMessage = "No service logic active for ASDC-API: '" + svcOperation + "'"; + errorCode = "503"; + } + } + catch (Exception e) + { + errorCode = "500"; + errorMessage = e.getMessage(); + LOG.error("Caught exception looking for service logic", e); + } + + + if (respProps != null) + { + errorCode = respProps.getProperty("error-code"); + errorMessage = respProps.getProperty("error-message", ""); + } + } + + + if ("200".equals(errorCode)) { + LOG.info("ASDC update succeeded"); + + // Update config tree + applyVfLicenseModelUpdate(inputVfLic); + addArtifactVersion(inputVfLic.getArtifactName(), inputVfLic.getArtifactVersion()); + + } else { + LOG.info("ASDC update failed ("+errorCode+" : "+errorMessage); + } + + // Send response + VfLicenseModelUpdateOutputBuilder respBuilder = new VfLicenseModelUpdateOutputBuilder(); + respBuilder.setAsdcApiResponseCode(errorCode); + if (errorMessage != null && errorMessage.length() > 0) { + respBuilder.setAsdcApiResponseText(errorMessage); + } + + RpcResult<VfLicenseModelUpdateOutput> rpcResult; + + + rpcResult = RpcResultBuilder.<VfLicenseModelUpdateOutput> status(true).withResult(respBuilder.build()).build(); + + + + return Futures.immediateFuture(rpcResult); +} + + +} diff --git a/northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiSliClient.java b/northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiSliClient.java new file mode 100644 index 000000000..880a2fb76 --- /dev/null +++ b/northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiSliClient.java @@ -0,0 +1,97 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.asdcapi; + +import java.util.Properties; + +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class AsdcApiSliClient { + + private static final Logger LOG = LoggerFactory.getLogger(AsdcApiSliClient.class); + + private final SvcLogicService svcLogicService; + + private String ErrorCode = "error-code"; + + public AsdcApiSliClient(final SvcLogicService svcLogicService) { + this.svcLogicService = svcLogicService; + } + + public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException + { + return svcLogicService.hasGraph(module, rpc, version, mode); + } + + + public Properties execute(String module, String rpc, String version, String mode, Properties parms) + throws SvcLogicException { + + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters passed to SLI"); + + for (Object key : parms.keySet()) { + String parmName = (String) key; + String parmValue = parms.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + + Properties respProps = svcLogicService.execute(module, rpc, version, mode, parms); + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters returned by SLI"); + + for (Object key : respProps.keySet()) { + String parmName = (String) key; + String parmValue = respProps.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + + if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) { + + if (!respProps.containsKey(ErrorCode)) { + respProps.setProperty(ErrorCode, "500"); + } + } else { + if (!respProps.containsKey(ErrorCode)) { + respProps.setProperty(ErrorCode, "200"); + } + } + + + return respProps; + } + +} diff --git a/northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiUtil.java b/northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiUtil.java new file mode 100644 index 000000000..602b389cb --- /dev/null +++ b/northbound/asdcApi/provider/src/main/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiUtil.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.asdcapi; + +import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.ArtifactsBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.VfLicenseModelUpdateInput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.VfLicenseModelUpdateInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.VfLicenseModelVersionsBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.vf.license.model.versions.VfLicenseModelVersionBuilder; + +public class AsdcApiUtil extends MdsalHelper { + + static { + + // Input objects + + VfLicenseModelUpdateInput i13 = new VfLicenseModelUpdateInputBuilder().build(); + + + // Other builders + ArtifactsBuilder b1 = new ArtifactsBuilder(); + + VfLicenseModelVersionsBuilder b14a = new VfLicenseModelVersionsBuilder(); + VfLicenseModelVersionBuilder b26a = new VfLicenseModelVersionBuilder(); + + + } +} diff --git a/northbound/asdcApi/provider/src/main/resources/OSGI-INF/blueprint/asdc-blueprint.xml b/northbound/asdcApi/provider/src/main/resources/OSGI-INF/blueprint/asdc-blueprint.xml new file mode 100644 index 000000000..9ad08d3db --- /dev/null +++ b/northbound/asdcApi/provider/src/main/resources/OSGI-INF/blueprint/asdc-blueprint.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" + xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0" + odl:use-default-for-reference-types="true"> + + <reference id="svcLogicService" + interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService" /> + + <bean id="client" class="org.onap.ccsdk.sli.northbound.asdcapi.AsdcApiSliClient"> + <argument ref="svcLogicService" /> + </bean> + + <reference id="dataBroker" + interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" + odl:type="default" /> + + <reference id="notificationService" + interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService" + odl:type="default" /> + + <reference id="rpcRegistry" + interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry" + odl:type="default" /> + + <bean id="provider" class="org.onap.ccsdk.sli.northbound.asdcapi.AsdcApiProvider"> + <argument ref="dataBroker" /> + <argument ref="notificationService" /> + <argument ref="rpcRegistry" /> + <argument ref="client" /> + </bean> + +</blueprint>
\ No newline at end of file diff --git a/northbound/asdcApi/provider/src/main/resources/org/opendaylight/blueprint/asdc-blueprint.xml b/northbound/asdcApi/provider/src/main/resources/org/opendaylight/blueprint/asdc-blueprint.xml new file mode 100644 index 000000000..9ad08d3db --- /dev/null +++ b/northbound/asdcApi/provider/src/main/resources/org/opendaylight/blueprint/asdc-blueprint.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" + xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0" + odl:use-default-for-reference-types="true"> + + <reference id="svcLogicService" + interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService" /> + + <bean id="client" class="org.onap.ccsdk.sli.northbound.asdcapi.AsdcApiSliClient"> + <argument ref="svcLogicService" /> + </bean> + + <reference id="dataBroker" + interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" + odl:type="default" /> + + <reference id="notificationService" + interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService" + odl:type="default" /> + + <reference id="rpcRegistry" + interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry" + odl:type="default" /> + + <bean id="provider" class="org.onap.ccsdk.sli.northbound.asdcapi.AsdcApiProvider"> + <argument ref="dataBroker" /> + <argument ref="notificationService" /> + <argument ref="rpcRegistry" /> + <argument ref="client" /> + </bean> + +</blueprint>
\ No newline at end of file diff --git a/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiSliClientTest.java b/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiSliClientTest.java new file mode 100644 index 000000000..5e6a9daf7 --- /dev/null +++ b/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiSliClientTest.java @@ -0,0 +1,59 @@ +package org.onap.ccsdk.sli.northbound.asdcapi; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; + +import java.util.Properties; + +import org.junit.Before; +import org.junit.Test; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService; + +public class AsdcApiSliClientTest { + Properties mockProp; + Properties propReturn; + AsdcApiSliClient testAsdcApiSliClient; + + @Before + public void setup() { + SvcLogicService mockSvcLogic = mock(SvcLogicService.class); + mockProp = new Properties(); + mockProp.setProperty("test-value1", "value1"); + propReturn = new Properties(); + propReturn.setProperty("SvcLogic.status", "Success"); + propReturn.setProperty("Object1", "value1"); + try { + when(mockSvcLogic.hasGraph("TestModule", "TestRPC", "TestVersion", "TestMode")).thenReturn(true); + when(mockSvcLogic.hasGraph("NotExist", "TestRPC", "TestVersion", "TestMode")).thenReturn(false); + when(mockSvcLogic.execute("TestModule", "TestRPC", "TestVersion", "TestMode", mockProp)).thenReturn(propReturn); + } catch (Exception e) { + System.out.println(e); + } + + testAsdcApiSliClient = new AsdcApiSliClient(mockSvcLogic); + } + + @Test + public void testhasGraphGraphExsists() throws SvcLogicException { + assertTrue(testAsdcApiSliClient.hasGraph("TestModule", "TestRPC", "TestVersion", "TestMode")); + } + + @Test + public void testhasGraphnoGraph() throws SvcLogicException { + assertFalse(testAsdcApiSliClient.hasGraph("NotExist", "TestRPC", "TestVersion", "TestMode")); + } + + @Test + public void testExecutewithSvcLogicSuccess() throws SvcLogicException { + Properties result = testAsdcApiSliClient.execute("TestModule", "TestRPC", "TestVersion", "TestMode", mockProp); + assertEquals(result.getProperty("error-code"), "200"); + } + + @Test + public void testExecutewithSvcLogicFailure500() throws SvcLogicException { + propReturn.setProperty("SvcLogic.status", "failure"); + Properties result = testAsdcApiSliClient.execute("TestModule", "TestRPC", "TestVersion", "TestMode", mockProp); + assertEquals(result.getProperty("error-code"), "500"); + } +}
\ No newline at end of file diff --git a/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiUtilTest.java b/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiUtilTest.java new file mode 100644 index 000000000..463e5ea0b --- /dev/null +++ b/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/AsdcApiUtilTest.java @@ -0,0 +1,15 @@ +package org.onap.ccsdk.sli.northbound.asdcapi; + +import static org.junit.Assert.*; + +import org.junit.Test; + +public class AsdcApiUtilTest { + + @Test + public void testAsdcApiUtilConstructor() { + AsdcApiUtil asdcApiUtilTest = new AsdcApiUtil(); + assertNotNull(asdcApiUtilTest); + } + +}
\ No newline at end of file diff --git a/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java b/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java new file mode 100644 index 000000000..1f266365c --- /dev/null +++ b/northbound/asdcApi/provider/src/test/java/org/onap/ccsdk/sli/northbound/asdcapi/TestAsdcApiApi.java @@ -0,0 +1,136 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.asdcapi; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.fail; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.junit.Before; +import org.junit.Test; +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; +import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest; +import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.opendaylight.yang.gen.v1.http.xmlns.onap.org.asdc.license.model._1._0.rev160427.vf.license.model.grouping.VfLicenseModelBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.VfLicenseModelUpdateInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.rev170201.VfLicenseModelUpdateOutput; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Properties; + +public class TestAsdcApiApi extends AbstractConcurrentDataBrokerTest { + + private AsdcApiProvider asdcApiProvider; + private static final Logger LOG = LoggerFactory.getLogger(AsdcApiProvider.class); + + @Before + public void setUp() throws Exception { + if (null == asdcApiProvider) { + DataBroker dataBroker = getDataBroker(); + NotificationPublishService mockNotification = mock(NotificationPublishService.class); + RpcProviderRegistry mockRpcRegistry = mock(RpcProviderRegistry.class); + AsdcApiSliClient mockSliClient = mock(AsdcApiSliClient.class); + Properties respProps = new Properties(); + respProps.setProperty("error-code", "200"); + respProps.setProperty("error-message", "Success"); + + when(mockSliClient.hasGraph("ASDC-API", "vf-license-model-update" , null, "sync")).thenReturn(true); + when(mockSliClient.execute("ASDC-API", "vf-license-model-update", null, "sync", respProps)).thenReturn(respProps); + + asdcApiProvider = new AsdcApiProvider(dataBroker, mockNotification, mockRpcRegistry, mockSliClient); + } + } + + //Testcase should return error 503 when No service logic active for ASDC-API. + @Test + public void testVfLicenseModelUpdate() { + + VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder(); + + inputBuilder.setArtifactName("abc"); + inputBuilder.setArtifactVersion("1"); + + // TODO: currently initialize SvcLogicServiceClient is failing, need to fix + java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider + .vfLicenseModelUpdate(inputBuilder.build()); + RpcResult<VfLicenseModelUpdateOutput> rpcResult = null; + try { + rpcResult = future.get(); + } catch (Exception e) { + fail("Error : " + e); + } + LOG.info("result: {}", rpcResult); + assertEquals("200", rpcResult.getResult().getAsdcApiResponseCode()); + } + + //Input parameter validation + @Test + public void testVfLicenseModelUpdateInputValidation() { + + VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder(); + + inputBuilder.setArtifactName("abc"); + inputBuilder.setArtifactVersion("1"); + + java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider + .vfLicenseModelUpdate(null); + assertNull(future); + } + + @Test + public void testVfLicenseModelUpdateValidation1() { + + VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder(); + + inputBuilder.setArtifactName("license1"); + inputBuilder.setArtifactVersion("version1"); + + VfLicenseModelBuilder vfLicenseModelBuilder = new VfLicenseModelBuilder(); + vfLicenseModelBuilder.setVfId("123"); + vfLicenseModelBuilder.setVendorName("acme"); + inputBuilder.setVfLicenseModel(vfLicenseModelBuilder.build()); + + + java.util.concurrent.Future<RpcResult<VfLicenseModelUpdateOutput>> future = asdcApiProvider + .vfLicenseModelUpdate(inputBuilder.build()); + RpcResult<VfLicenseModelUpdateOutput> rpcResult = null; + try { + rpcResult = future.get(); + } catch (Exception e) { + fail("Error : " + e); + } + } + + + + + @Test + public void testAddArtifactVersion() { + asdcApiProvider.addArtifactVersion("artifact1", + "version1"); + } +} diff --git a/northbound/daexim-offsite-backup/.gitignore b/northbound/daexim-offsite-backup/.gitignore new file mode 100755 index 000000000..a01e90efe --- /dev/null +++ b/northbound/daexim-offsite-backup/.gitignore @@ -0,0 +1,38 @@ +tandard .git ignore entries##### + +## IDE Specific Files ## +org.eclipse.core.resources.prefs +.classpath +.project +.settings +.idea +.externalToolBuilders +maven-eclipse.xml +workspace + +## Compilation Files ## +*.class +**/target +target +target-ide +MANIFEST.MF + +## Misc Ignores (OS specific etc) ## +bin/ +dist +*~ +*.ipr +*.iml +*.iws +classes +out/ +.DS_STORE +.metadata + +## Folders which contain auto generated source code ## +yang-gen-config +yang-gen-sal + +#####Archetype specific .git ignore entries####### +generate +Archetype_Next_Steps.README diff --git a/northbound/daexim-offsite-backup/README.md b/northbound/daexim-offsite-backup/README.md new file mode 100755 index 000000000..e3f13aee9 --- /dev/null +++ b/northbound/daexim-offsite-backup/README.md @@ -0,0 +1,87 @@ +Introduction +====================== +You have generated an MD-SAL module. + +* You should be able to successfully run ```mvn clean install``` on this project. + +Next Steps +====================== +* run a ```mvn clean install``` if you haven't already. This will generate some code from the yang models. +* Modify the model yang file under the model project. +* Follow the comments in the generated provider class to wire your new provider into the generated +code. +* Modify the generated provider model to respond to and handle the yang model. Depending on what +you added to your model you may need to inherit additional interfaces or make other changes to +the provider model. + +Generated Bundles +====================== +* model + - Provides the yang model for your application. This is your primary northbound interface. +* provider + - Provides a template implementation for a provider to respond to your yang model. +* features + - Defines a karaf feature. If you add dependencies on third-party bundles then you will need to + modify the features.xml to list out the dependencies. +* installer + - Bundles all of the jars and third party dependencies (minus ODL dependencies) into a single + .zip file. + +Usage +====================== +## Purpose +The purpose of this ODL feature is to support local and geo-redundancy by providing a way to +back up and retrieve MD-SAL data exports to and from a Sonatype Nexus server. In order to function, +this module requires the controller to have an installation of the ```data-export-import``` module and a valid export of MD-SAL data. + +## Backup +MD-SAL Backup can be achieved using the ```daexim-offsite-backup:backup-data``` RPC either through the +RESTConf portal or through a tool such as cURL or Postman. While no input is required for this RPC, +the RPC does require the operational, models, and config .JSONs to be present in the daexim directory of the controller. +```sh +export USER=user +export PASSWORD=password +export ODL_HOST=https://yourhost.com:8181 +curl -X POST -u$USER:$PASSWORD ${ODL_HOST}/restconf/operations/daexim-offsite-backup:backup-data +``` +Through this process a timestamped archive is created in the form of ```POD_NAME-yyyyMMdd_HH-odl_backup.zip``` +where ```POD_NAME``` is the name of the ODL, specified through the properties file or through an environment variable. + +## Retrieval +MD-SAL Retrieval can be achieved by using the ```daexim-offsite-backup:retrieve-data``` RPC either through the +RESTConf portal or through a tool such as cURL or Postman. This RPC requires timestamp information and may +be supplied with an optional podName. + +```sh +export USER=user +export PASSWORD=password +export ODL_HOST=https://yourhost.com:8181 +export TARGET_ODL=targetOdlPodName +export TIMESTAMP=yyyyMMdd_HH +export DATA= ' + { + "input": { + "pod-name": "'"$TARGET_ODL"'", + "timestamp": "'"$TIMESTAMP"'" + } + }' +curl -X POST -u$USER:$PASSWORD --data $DATA ${ODL_HOST}/restconf/operations/daexim-offsite-backup:retrieve-data +``` + +Through this process an archive with the specified timestamp (and optional pod name) is downloaded from +the Nexus server and extracted into the controller's daexim directory. After this it is up to the user +to trigger an MD-SAL import. + +## Properties File +Before each RPC execution this module pulls information from a user supplied properties file. The module expects to find: +- daeximDirectory +- credentials +- nexusUrl +- podName +- file.operational +- file.models +- file.config + +> Refer to the example properties file + +If the module cannot find the properties file it will default to generic values and attempt to move forward. diff --git a/northbound/daexim-offsite-backup/installer/pom.xml b/northbound/daexim-offsite-backup/installer/pom.xml new file mode 100755 index 000000000..6fbabb426 --- /dev/null +++ b/northbound/daexim-offsite-backup/installer/pom.xml @@ -0,0 +1,129 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>odlparent-lite</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>daexim-offsite-backup-installer</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>ccsdk-sli-northbound :: daexim-offsite-backup :: ${project.artifactId}</name> + + <properties> + <application.name>ccsdk-daexim-offsite-backup</application.name> + <features.boot>${application.name}</features.boot> + <features.repositories>mvn:org.onap.ccsdk.sli.northbound/${features.boot}/${project.version}/xml/features</features.repositories> + <include.transitive.dependencies>false</include.transitive.dependencies> + </properties> + + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>daexim-offsite-backup-provider</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>daexim-offsite-backup-model</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>maven-repo-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>true</attach> + <finalName>stage/${application.name}-${project.version}</finalName> + <descriptors> + <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>true</appendAssemblyId> + </configuration> + </execution> + <execution> + <id>installer-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>true</attach> + <finalName>${application.name}-${project.version}-installer</finalName> + <descriptors> + <descriptor>src/assembly/assemble_installer_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>false</appendAssemblyId> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <phase>prepare-package</phase> + <configuration> + <transitive>false</transitive> + <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + <useRepositoryLayout>true</useRepositoryLayout> + <addParentPoms>false</addParentPoms> + <copyPom>false</copyPom> + <includeGroupIds>org.onap.ccsdk.sli.northbound</includeGroupIds> + <scope>provided</scope> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>copy-version</id> + <goals> + <goal>copy-resources</goal> + </goals> + <phase>validate</phase> + <configuration> + <outputDirectory>${basedir}/target/stage</outputDirectory> + <resources> + <resource> + <directory>src/main/resources/scripts</directory> + <includes> + <include>install-feature.sh</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/northbound/daexim-offsite-backup/installer/src/assembly/assemble_installer_zip.xml b/northbound/daexim-offsite-backup/installer/src/assembly/assemble_installer_zip.xml new file mode 100755 index 000000000..41d23e88a --- /dev/null +++ b/northbound/daexim-offsite-backup/installer/src/assembly/assemble_installer_zip.xml @@ -0,0 +1,56 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2018 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>installer_zip</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>755</fileMode> + <includes> + <include>*.sh</include> + </includes> + </fileSet> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>644</fileMode> + <excludes> + <exclude>*.sh</exclude> + </excludes> + </fileSet> + </fileSets> +</assembly> diff --git a/northbound/daexim-offsite-backup/installer/src/assembly/assemble_mvnrepo_zip.xml b/northbound/daexim-offsite-backup/installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100755 index 000000000..275060986 --- /dev/null +++ b/northbound/daexim-offsite-backup/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,47 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2018 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>repo</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/assembly/</directory> + <outputDirectory>.</outputDirectory> + <excludes> + </excludes> + </fileSet> + </fileSets> + +</assembly> diff --git a/northbound/daexim-offsite-backup/installer/src/main/resources/scripts/install-feature.sh b/northbound/daexim-offsite-backup/installer/src/main/resources/scripts/install-feature.sh new file mode 100644 index 000000000..1d7be149e --- /dev/null +++ b/northbound/daexim-offsite-backup/installer/src/main/resources/scripts/install-feature.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2018 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} +ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} +INSTALLERDIR=$(dirname $0) + +REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}-repo.zip + +if [ -f ${REPOZIP} ] +then + unzip -d ${ODL_HOME} ${REPOZIP} +else + echo "ERROR : repo zip ($REPOZIP) not found" + exit 1 +fi + +${ODL_KARAF_CLIENT} feature:repo-add ${features.repositories} +${ODL_KARAF_CLIENT} feature:install ${features.boot} diff --git a/northbound/daexim-offsite-backup/model/.gitignore b/northbound/daexim-offsite-backup/model/.gitignore new file mode 100755 index 000000000..eacf31a67 --- /dev/null +++ b/northbound/daexim-offsite-backup/model/.gitignore @@ -0,0 +1 @@ +/target-ide/ diff --git a/northbound/daexim-offsite-backup/model/pom.xml b/northbound/daexim-offsite-backup/model/pom.xml new file mode 100755 index 000000000..4f338c786 --- /dev/null +++ b/northbound/daexim-offsite-backup/model/pom.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>binding-parent</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>daexim-offsite-backup-model</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>bundle</packaging> + + <name>ccsdk-sli-northbound :: daexim-offsite-backup :: ${project.artifactId}</name> + + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId> + <artifactId>rfc6991</artifactId> + </dependency> + + + </dependencies> +</project> diff --git a/northbound/daexim-offsite-backup/model/scripts/python/yang2props.py b/northbound/daexim-offsite-backup/model/scripts/python/yang2props.py new file mode 100755 index 000000000..97ceaa760 --- /dev/null +++ b/northbound/daexim-offsite-backup/model/scripts/python/yang2props.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + +import re +import sys + + +# Convert word from foo-bar to FooBar +# words begining with a digit will be converted to _digit +def to_enum(s): + if s[0].isdigit(): + s = "_" + s + else: + s = s[0].upper() + s[1:] + return re.sub(r'(?!^)-([a-zA-Z])', lambda m: m.group(1).upper(), s) + +leaf = "" +val = "" +li = [] + +if len(sys.argv) < 3: + print('yang2props.py <input yang> <output properties>') + sys.exit(2) + +with open(sys.argv[1], "r") as ins: + for line in ins: + # if we see a leaf save the name for later + if "leaf " in line: + match = re.search(r'leaf (\S+)', line) + if match: + leaf = match.group(1) + + # if we see enum convert the value to enum format and see if it changed + # if the value is different write a property entry + if "enum " in line: + match = re.search(r'enum "(\S+)";', line) + if match: + val = match.group(1) + enum = to_enum(val) + + # see if converting to enum changed the string + if val != enum: + property = "yang."+leaf+"."+enum+"="+val + if property not in li: + li.append( property) + + +with open(sys.argv[2], "w") as fo: + fo.write("# yang conversion properties \n") + fo.write("# used to convert Enum back to the original yang value \n") + fo.write("\n".join(li)) + fo.write("\n") + diff --git a/northbound/daexim-offsite-backup/model/src/main/yang/daexim-offsite-backup.yang b/northbound/daexim-offsite-backup/model/src/main/yang/daexim-offsite-backup.yang new file mode 100755 index 000000000..363136caf --- /dev/null +++ b/northbound/daexim-offsite-backup/model/src/main/yang/daexim-offsite-backup.yang @@ -0,0 +1,46 @@ +module daexim-offsite-backup{
+ namespace "org:onap:ccsdk:sli:northbound:daeximoffsitebackup";
+ prefix daexim-offsite-backup;
+
+ import ietf-inet-types {
+ prefix inet;
+ }
+ import ietf-yang-types {
+ prefix yang;
+ }
+ description
+ "This ODL feature is designed for transferring MD-SAL data
+ to an offsite location in the ECOMP-C containerized environments.";
+ revision "2018-09-26" {
+ description
+ "Release 19.02 draft";
+ }
+
+ rpc backup-data {
+ output {
+ leaf status { type string; }
+ leaf message { type string; }
+ }
+ }
+
+ rpc retrieve-data {
+ input {
+ leaf pod-name {
+ type string;
+ description
+ "Name of the desired MD-SAL backup's pod. If not supplied will
+ default to the name of this pod.";
+ }
+ leaf timestamp {
+ type string;
+ description
+ "Timestamp of the desired backup. Format: yyyyMMdd_HH";
+ mandatory true;
+ }
+ }
+ output {
+ leaf status { type string; }
+ leaf message { type string; }
+ }
+ }
+}////closes the module
\ No newline at end of file diff --git a/northbound/daexim-offsite-backup/pom.xml b/northbound/daexim-offsite-backup/pom.xml new file mode 100755 index 000000000..aa98f5137 --- /dev/null +++ b/northbound/daexim-offsite-backup/pom.xml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>odlparent-lite</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>daexim-offsite-backup</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>ccsdk-sli-northbound :: daexim-offsite-backup</name> + <description>ODL feature used for transferring MD-SAL data to an offsite location.</description> + + <modules> + <module>model</module> + <module>provider</module> + <module>installer</module> + </modules> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>daexim-offsite-backup-features</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>features</classifier> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>daexim-offsite-backup-model</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>daexim-offsite-backup-provider</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> + </dependencyManagement> +</project> diff --git a/northbound/daexim-offsite-backup/provider/.gitignore b/northbound/daexim-offsite-backup/provider/.gitignore new file mode 100755 index 000000000..527bb69aa --- /dev/null +++ b/northbound/daexim-offsite-backup/provider/.gitignore @@ -0,0 +1,3 @@ +/target-ide/ +fileToZip1 +fileToZip2
\ No newline at end of file diff --git a/northbound/daexim-offsite-backup/provider/pom.xml b/northbound/daexim-offsite-backup/provider/pom.xml new file mode 100755 index 000000000..8d060bb94 --- /dev/null +++ b/northbound/daexim-offsite-backup/provider/pom.xml @@ -0,0 +1,95 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>binding-parent</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>daexim-offsite-backup-provider</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>bundle</packaging> + + <name>ccsdk-sli-northbound :: daexim-offsite-backup :: ${project.artifactId}</name> + + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>daexim-offsite-backup-model</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-api</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-common-util</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-test-model</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-broker-impl</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-broker-impl</artifactId> + <type>test-jar</type> + <classifier>tests</classifier> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-common</artifactId> + <version>${sdnctl.sli.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-provider</artifactId> + <version>${sdnctl.sli.version}</version> + </dependency> + <dependency> + <groupId>com.google.code.findbugs</groupId> + <artifactId>annotations</artifactId> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Export-Package>org.opendaylight.controller.config.yang.config.daexim-offsite-backup_provider</Export-Package> + <Import-Package>*</Import-Package> + </instructions> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java b/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java new file mode 100755 index 000000000..09c8f92f4 --- /dev/null +++ b/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProvider.java @@ -0,0 +1,429 @@ +/* + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= +*/ + +package org.onap.ccsdk.sli.northbound.daeximoffsitebackup; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.time.Instant; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; +import java.util.Arrays; +import java.util.Base64; +import java.util.Collection; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; +import javax.annotation.Nonnull; + +import com.google.common.util.concurrent.CheckedFuture; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; + +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener; +import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; +import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; +import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.BackupDataInput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.BackupDataOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.BackupDataOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.DaeximOffsiteBackupService; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataInput; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.opendaylight.yangtools.yang.common.RpcResultBuilder; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DaeximOffsiteBackupProvider implements AutoCloseable, DaeximOffsiteBackupService, DataTreeChangeListener { + private static final Logger LOG = LoggerFactory.getLogger(DaeximOffsiteBackupProvider.class); + + private static String DAEXIM_DIR; + private static String CREDENTIALS; + private static String NEXUS_URL; + private static String POD_NAME; + private static String OPERATIONAL_JSON; + private static String MODELS_JSON; + private static String CONFIG_JSON; + private static String PROPERTIES_FILE = System.getenv("SDNC_CONFIG_DIR") + "/daexim-offsite-backup.properties"; + + private static final String BACKUP_ARCHIVE = "odl_backup.zip"; + private static final String appName = "daexim-offsite-backup"; + + private final ExecutorService executor; + private Properties properties; + private DataBroker dataBroker; + private RpcProviderRegistry rpcRegistry; + private BindingAwareBroker.RpcRegistration<DaeximOffsiteBackupService> rpcRegistration; + + public DaeximOffsiteBackupProvider(DataBroker dataBroker, + RpcProviderRegistry rpcProviderRegistry) { + LOG.info("Creating provider for " + appName); + this.executor = Executors.newFixedThreadPool(1); + this.dataBroker = dataBroker; + this.rpcRegistry = rpcProviderRegistry; + initialize(); + } + + public void initialize() { + LOG.info("Initializing provider for " + appName); + // Create the top level containers + createContainers(); + try { + DaeximOffsiteBackupUtil.loadProperties(); + } catch (Exception e) { + LOG.error("Caught Exception while trying to load properties file", e); + } + rpcRegistration = rpcRegistry.addRpcImplementation(DaeximOffsiteBackupService.class, this); + LOG.info("Initialization complete for " + appName); + } + + private void loadProperties() { + LOG.info("Loading properties from " + PROPERTIES_FILE); + if(properties == null) + properties = new Properties(); + File propertiesFile = new File(PROPERTIES_FILE); + if(!propertiesFile.exists()) { + LOG.warn("Properties file (" + PROPERTIES_FILE + ") not found. Using default properties."); + properties.put("daeximDirectory", "/opt/opendaylight/current/daexim/"); + properties.put("credentials", "admin:enc:YWRtaW4xMjM="); + properties.put("nexusUrl", "http://localhost:8081/nexus/content/repositories/"); + properties.put("podName", "UNKNOWN_ODL"); + properties.put("file.operational", "odl_backup_operational.json"); + properties.put("file.models", "odl_backup_models.json"); + properties.put("file.config", "odl_backup_config.json"); + return; + } + FileInputStream fileInputStream; + try { + fileInputStream = new FileInputStream(propertiesFile); + properties.load(fileInputStream); + fileInputStream.close(); + LOG.info(properties.size() + " properties loaded."); + LOG.info("daeximDirectory: " + properties.getProperty("daeximDirectory")); + LOG.info("nexusUrl: " + properties.getProperty("nexusUrl")); + LOG.info("podName: " + properties.getProperty("podName")); + LOG.info("file.operational: " + properties.getProperty("file.operational")); + LOG.info("file.models: " + properties.getProperty("file.models")); + LOG.info("file.config: " + properties.getProperty("file.config")); + } catch(IOException e) { + LOG.error("Error loading properties.", e); + } + } + + private void applyProperties() { + LOG.info("Applying properties..."); + if(POD_NAME == null || POD_NAME.isEmpty()) { + LOG.warn("MY_POD_NAME environment variable not set. Using value from properties."); + POD_NAME = properties.getProperty("podName"); + } + DAEXIM_DIR = properties.getProperty("daeximDirectory"); + NEXUS_URL = properties.getProperty("nexusUrl"); + + OPERATIONAL_JSON = properties.getProperty("file.operational"); + MODELS_JSON = properties.getProperty("file.models"); + CONFIG_JSON = properties.getProperty("file.config"); + + if(!properties.getProperty("credentials").contains(":")) { //Entire thing is encoded + CREDENTIALS = new String(Base64.getDecoder().decode(properties.getProperty("credentials"))); + } + else { + String[] credentials = properties.getProperty("credentials").split(":", 2); + if(credentials[1].startsWith("enc:")) { // Password is encoded + credentials[1] = new String(Base64.getDecoder().decode(credentials[1].split(":")[1])); + } + CREDENTIALS = credentials[0] + ":" + credentials[1]; + } + LOG.info("Properties applied."); + } + + private void createContainers() { + final WriteTransaction t = dataBroker.newReadWriteTransaction(); + try { + CheckedFuture<Void, TransactionCommitFailedException> checkedFuture = t.submit(); + checkedFuture.get(); + LOG.info("Create Containers succeeded!: "); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Create Containers Failed: " + e); + LOG.error("context", e); + } + } + + protected void initializeChild() { + + } + + @Override + public void close() throws Exception { + LOG.info("Closing provider for " + appName); + executor.shutdown(); + rpcRegistration.close(); + LOG.info("Successfully closed provider for " + appName); + } + + @Override + public void onDataTreeChanged(@Nonnull Collection changes) { + + } + + @Override + public ListenableFuture<RpcResult<BackupDataOutput>> backupData(BackupDataInput input) { + final String SVC_OPERATION = "backup-data"; + LOG.info(appName + ":" + SVC_OPERATION + " called."); + + String statusCode; + String message = "Data sent to offsite location."; + + loadProperties(); + applyProperties(); + + LOG.info("Pod Name: " + POD_NAME); + Instant timestamp = Instant.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd_HH").withZone(ZoneId.of("GMT")); + String timestampedArchive = DAEXIM_DIR + POD_NAME + '-' + formatter.format(timestamp) + "-" + BACKUP_ARCHIVE; + try { + LOG.info("Creating archive..."); + List<String> daeximFiles = Arrays.asList(DAEXIM_DIR + OPERATIONAL_JSON,DAEXIM_DIR + MODELS_JSON, DAEXIM_DIR + CONFIG_JSON); + createArchive(daeximFiles, timestampedArchive); + LOG.info("Archive created."); + } catch(IOException e) { + LOG.error("Error creating archive " + timestampedArchive); + LOG.error(e.getMessage()); + statusCode = "500"; + message = "Archive creation failed."; + return buildBackupDataFuture(statusCode, message); + } + + try{ + LOG.info("Sending archive to Nexus server: " + NEXUS_URL); + statusCode = Integer.toString(putArchive(timestampedArchive)); + LOG.info("Archive sent to Nexus."); + } catch(IOException e) { + LOG.error("Nexus creation failed.", e); + statusCode = "500"; + message = "Nexus creation failed."; + } + + File archive = new File(timestampedArchive); + if(archive.exists()) { + archive.delete(); // Save some space on the ODL, keep them from piling up + } + + LOG.info("Sending Response statusCode=" + statusCode+ " message=" + message + " | " + SVC_OPERATION); + return buildBackupDataFuture(statusCode, message); + } + + @Override + public ListenableFuture<RpcResult<RetrieveDataOutput>> retrieveData(RetrieveDataInput input) { + final String SVC_OPERATION = "retrieve-data"; + LOG.info(appName + ":" + SVC_OPERATION + " called."); + + String statusCode = "200"; + String message = "Data retrieved from offsite location."; + + loadProperties(); + applyProperties(); + + LOG.info("Pod Name: " + POD_NAME); + String archiveIdentifier = POD_NAME + '-' + input.getTimestamp(); + String timestampedArchive = DAEXIM_DIR + archiveIdentifier + "-" + BACKUP_ARCHIVE; + LOG.info("Trying to retrieve " + timestampedArchive); + try { + statusCode = Integer.toString(getArchive(archiveIdentifier)); + } catch(IOException e) { + LOG.error("Could not retrieve archive.", e); + statusCode = "500"; + message = "Could not retrieve archive."; + return retrieveDataOutputRpcResult(statusCode, message); + } + LOG.info("Retrieved archive."); + + LOG.info("Extracting archive..."); + try { + extractArchive(DAEXIM_DIR + "-" + BACKUP_ARCHIVE); + } catch(IOException e) { + LOG.error("Could not extract archive.", e); + statusCode = "500"; + message = "Could not extract archive."; + return retrieveDataOutputRpcResult(statusCode, message); + } + LOG.info("Archive extracted."); + + return retrieveDataOutputRpcResult(statusCode, message); + } + + private boolean exportExists(List<String> daeximFiles) { + File file; + for(String f : daeximFiles) { + file = new File(f); + if(!file.exists()) { + return false; + } + } + return true; + } + + private void createArchive(List<String> daeximFiles, String timestampedArchive) throws IOException { + if(!exportExists(daeximFiles)) { + LOG.error("Daexim exports do not exist."); + throw new IOException(); + } + LOG.info("Creating " + timestampedArchive); + FileOutputStream fileOutputStream = new FileOutputStream(timestampedArchive); + ZipOutputStream zipOutputStream = new ZipOutputStream(fileOutputStream); + File targetZipFile; + FileInputStream fileInputStream; + ZipEntry zipEntry; + byte[] bytes; + int length; + for(String source : daeximFiles) { + LOG.info("Adding " + source + " to archive..."); + targetZipFile = new File(source); + fileInputStream = new FileInputStream(targetZipFile); + zipEntry = new ZipEntry(targetZipFile.getName()); + zipOutputStream.putNextEntry(zipEntry); + bytes = new byte[1024]; + + while((length = fileInputStream.read(bytes)) >= 0) { + zipOutputStream.write(bytes, 0, length); + } + fileInputStream.close(); + } + + zipOutputStream.close(); + fileOutputStream.close(); + } + + private void extractArchive(String timestampedArchive) throws IOException { + byte[] bytes = new byte[1024]; + ZipInputStream zis = new ZipInputStream(new FileInputStream(timestampedArchive)); + ZipEntry zipEntry = zis.getNextEntry(); + while(zipEntry != null){ + String fileName = zipEntry.getName(); + File newFile = new File(DAEXIM_DIR + fileName); + FileOutputStream fos = new FileOutputStream(newFile); + int len; + while ((len = zis.read(bytes)) > 0) { + fos.write(bytes, 0, len); + } + fos.close(); + LOG.info(zipEntry.getName() + " extracted."); + zipEntry = zis.getNextEntry(); + } + zis.closeEntry(); + zis.close(); + LOG.info(timestampedArchive + " extracted successfully."); + } + + private int putArchive(String timestampedArchive) throws IOException { + File archive = new File(timestampedArchive); + HttpURLConnection connection = getNexusConnection(archive.getName()); + connection.setRequestProperty("Content-Length", Long.toString(archive.length())); + connection.setRequestMethod("PUT"); + connection.setDoOutput(true); + + FileInputStream fileInputStream = new FileInputStream(archive); + OutputStream outputStream = connection.getOutputStream(); + + byte[] bytes = new byte[1024]; + int length; + while((length = fileInputStream.read(bytes)) >= 0) { + outputStream.write(bytes, 0, length); + } + + outputStream.flush(); + outputStream.close(); + fileInputStream.close(); + connection.disconnect(); + + LOG.info("Status: " + connection.getResponseCode()); + LOG.info("Message: " + connection.getResponseMessage()); + return connection.getResponseCode(); + } + + private HttpURLConnection getNexusConnection(String archive) throws IOException { + URL url = new URL(NEXUS_URL + archive); + String auth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(CREDENTIALS.getBytes()); + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); + connection.addRequestProperty("Authorization", auth); + connection.setRequestProperty("Connection", "keep-alive"); + connection.setRequestProperty("Proxy-Connection", "keep-alive"); + return connection; + } + + private int getArchive(String archiveIdentifier) throws IOException { + File archive = new File(DAEXIM_DIR + "backup.zip"); + if(archive.exists()) { + LOG.info("Recently retrieved archive found. Removing old archive..."); + archive.delete(); + LOG.info("Archive removed."); + } + HttpURLConnection connection = getNexusConnection( archiveIdentifier + "-" + BACKUP_ARCHIVE); + connection.setRequestMethod("GET"); + connection.setDoInput(true); + + InputStream connectionInputStream = connection.getInputStream(); + FileOutputStream fileOutputStream = new FileOutputStream(archive); + + byte[] bytes = new byte[1024]; + int length; + while((length = connectionInputStream.read(bytes)) >= 0) { // while connection has bytes + fileOutputStream.write(bytes, 0, length); // write to archive + } + connection.disconnect(); + + LOG.info("Status: " + connection.getResponseCode()); + LOG.info("Message: " + connection.getResponseMessage()); + LOG.info(archive.getName() + " successfully created."); + return connection.getResponseCode(); + } + + private ListenableFuture<RpcResult<BackupDataOutput>> buildBackupDataFuture(String statusCode, String message) { + BackupDataOutputBuilder outputBuilder = new BackupDataOutputBuilder(); + outputBuilder.setStatus(statusCode); + outputBuilder.setMessage(message); + RpcResult<BackupDataOutput> rpcResult = RpcResultBuilder.<BackupDataOutput> status(true).withResult(outputBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + private ListenableFuture<RpcResult<RetrieveDataOutput>> retrieveDataOutputRpcResult(String status, String message) { + RetrieveDataOutputBuilder outputBuilder = new RetrieveDataOutputBuilder(); + outputBuilder.setStatus(status); + outputBuilder.setMessage(message); + RpcResult<RetrieveDataOutput> rpcResult = RpcResultBuilder.<RetrieveDataOutput> status(true).withResult(outputBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } +} diff --git a/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupUtil.java b/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupUtil.java new file mode 100755 index 000000000..7adb2fa1b --- /dev/null +++ b/northbound/daexim-offsite-backup/provider/src/main/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupUtil.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.daeximoffsitebackup; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.BackupDataOutputBuilder; + +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataOutputBuilder; + +import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DaeximOffsiteBackupUtil extends MdsalHelper { + private static final Logger LOG = LoggerFactory.getLogger(DaeximOffsiteBackupUtil.class); + private static String PROPERTIES_FILE; + + public static void loadProperties() { + File file = new File(PROPERTIES_FILE); + Properties properties = new Properties(); + InputStream input = null; + if(file.isFile() && file.canRead()) { + try { + input = new FileInputStream(file); + properties.load(input); + LOG.info("Loaded properties from " + PROPERTIES_FILE); + setProperties(properties); + } catch (Exception e) { + LOG.error("Failed to load properties " + PROPERTIES_FILE + "\n", e); + } finally { + if(input != null) { + try { + input.close(); + } catch (IOException e) { + LOG.error("Failed to close properties file " + PROPERTIES_FILE + "\n", e); + } + } + } + } + } + + static { + // Trick class loader into loading builders. Some of + // these will be needed later by Reflection classes, but need + // to explicitly "new" them here to get class loader to load them. + + BackupDataOutputBuilder b1 = new BackupDataOutputBuilder(); + + RetrieveDataOutputBuilder b2 = new RetrieveDataOutputBuilder(); + RetrieveDataInputBuilder b3 = new RetrieveDataInputBuilder(); + } +} diff --git a/northbound/daexim-offsite-backup/provider/src/main/resources/OSGI-INF/blueprint/DaeximOffsiteBackup.xml b/northbound/daexim-offsite-backup/provider/src/main/resources/OSGI-INF/blueprint/DaeximOffsiteBackup.xml new file mode 100755 index 000000000..8e2101ad3 --- /dev/null +++ b/northbound/daexim-offsite-backup/provider/src/main/resources/OSGI-INF/blueprint/DaeximOffsiteBackup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" + xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0" + odl:use-default-for-reference-types="true"> + + <reference id="dataBroker" + interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" + odl:type="default" /> + + <reference id="rpcRegistry" + interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry" + odl:type="default" /> + + <bean id="provider" class="org.onap.ccsdk.sli.northbound.daeximoffsitebackup.DaeximOffsiteBackupProvider"> + <argument ref="dataBroker" /> + <argument ref="rpcRegistry" /> + </bean> + + <odl:rpc-implementation ref="provider"/> +</blueprint> diff --git a/northbound/daexim-offsite-backup/provider/src/main/resources/daexim-offsite-backup.properties b/northbound/daexim-offsite-backup/provider/src/main/resources/daexim-offsite-backup.properties new file mode 100755 index 000000000..51efc1f1e --- /dev/null +++ b/northbound/daexim-offsite-backup/provider/src/main/resources/daexim-offsite-backup.properties @@ -0,0 +1,28 @@ +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2019 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= + +# Example properties file + +daeximDirectory=/opt/opendaylight/current/daexim/ +credentials=admin:enc:YWRtaW4xMjM= +nexusUrl=http://localhost:8081/nexus/content/repositories/ +podName=UNKNOWN_ODL +file.operational=odl_backup_operational.json +file.models=odl_backup_models.json +file.config=odl_backup_config.json
\ No newline at end of file diff --git a/northbound/daexim-offsite-backup/provider/src/main/resources/org/opendaylight/blueprint/DaeximOffsiteBackup.xml b/northbound/daexim-offsite-backup/provider/src/main/resources/org/opendaylight/blueprint/DaeximOffsiteBackup.xml new file mode 100755 index 000000000..8e2101ad3 --- /dev/null +++ b/northbound/daexim-offsite-backup/provider/src/main/resources/org/opendaylight/blueprint/DaeximOffsiteBackup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" + xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0" + odl:use-default-for-reference-types="true"> + + <reference id="dataBroker" + interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" + odl:type="default" /> + + <reference id="rpcRegistry" + interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry" + odl:type="default" /> + + <bean id="provider" class="org.onap.ccsdk.sli.northbound.daeximoffsitebackup.DaeximOffsiteBackupProvider"> + <argument ref="dataBroker" /> + <argument ref="rpcRegistry" /> + </bean> + + <odl:rpc-implementation ref="provider"/> +</blueprint> diff --git a/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProviderTest.java b/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProviderTest.java new file mode 100644 index 000000000..d070c30e2 --- /dev/null +++ b/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupProviderTest.java @@ -0,0 +1,216 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.daeximoffsitebackup; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import com.google.common.util.concurrent.CheckedFuture; +import java.io.File; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.List; +import java.util.Properties; +import java.util.concurrent.ExecutionException; +import org.eclipse.jdt.annotation.Nullable; +import org.junit.Before; +import org.junit.Test; +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; +import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; +import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.DaeximOffsiteBackupService; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.daeximoffsitebackup.rev180926.RetrieveDataInput; +import org.opendaylight.yangtools.yang.binding.Augmentation; + +public class DaeximOffsiteBackupProviderTest { + public DataBroker dataBroker; + public ReadWriteTransaction writeTransaction; + public CheckedFuture<Void, TransactionCommitFailedException> checkedFuture; + public RpcProviderRegistry rpcRegistry; + public DaeximOffsiteBackupProvider provider; + public Properties resProps; + + @Before + public void setup() { + resProps = new Properties(); + resProps.put("error-code", "200"); + resProps.put("error-message", "Success"); + dataBroker = mock(DataBroker.class); + writeTransaction = mock(ReadWriteTransaction.class); + checkedFuture = mock(CheckedFuture.class); + rpcRegistry = mock(RpcProviderRegistry.class); + when(rpcRegistry.addRoutedRpcImplementation(any(), any(DaeximOffsiteBackupService.class))).thenReturn(null); + try { + when(checkedFuture.get()).thenReturn(null); + } + catch(InterruptedException | ExecutionException e) { + e.printStackTrace(); + } + when(writeTransaction.submit()).thenReturn(checkedFuture); + when(dataBroker.newReadWriteTransaction()).thenReturn(writeTransaction); + + provider = new DaeximOffsiteBackupProvider(dataBroker, rpcRegistry); + } + + @Test + public void initializeTest() { + provider.initialize(); + } + + @Test + public void closeTest() { + try { + provider.close(); + } + catch(Exception e) { + e.printStackTrace(); + } + } + + @Test + public void onDataTreeChangedTest() { + provider.onDataTreeChanged(null); + // onDataTreeChanged is an empty stub + } + + @Test + public void backupDataTest() { + try { + assertNotNull(provider.backupData(null)); + } + catch(Exception e) { + fail(); + } + try { + assertNotNull(provider.backupData(null)); + } + catch(Exception e) { + fail(); + } + try { + assertNotNull(provider.backupData(null)); + } + catch(Exception e) { + fail(); + } + try { + assertNotNull(provider.backupData(null)); + } + catch(Exception e) { + fail(); + } + try { + assertNotNull(provider.backupData(null)); + } + catch(Exception e) { + fail(); + } + } + + @Test + public void retrieveDataTest() { + RetrieveDataInput input = new RetrieveDataInput() { + @Override + public <E extends Augmentation<RetrieveDataInput>> @Nullable E augmentation(Class<E> augmentationType) { + return null; + } + + @Override + public String getPodName() { + return "Some Pod"; + } + + @Override + public String getTimestamp() { + return "Some Timestamp"; + } + + + }; + try { + assertNotNull(provider.retrieveData(input)); + } + catch(Exception e) { + fail(); + } + try { + assertNotNull(provider.retrieveData(input)); + } + catch(Exception e) { + fail(); + } + try { + assertNotNull(provider.retrieveData(input)); + } + catch(Exception e) { + fail(); + } + try { + assertNotNull(provider.retrieveData(input)); + } + catch(Exception e) { + fail(); + } + try { + assertNotNull(provider.retrieveData(input)); + } + catch(Exception e) { + fail(); + } + } + + @Test + public void archiveOperationsTest() { + List<String> files = Arrays.asList("src/test/resources/fileToZip1", "src/test/resources/fileToZip2"); + String archive = "src/test/resources/zippedArchive.zip"; + try { + Method method = provider.getClass().getDeclaredMethod("createArchive", List.class, String.class); + method.setAccessible(true); + method.invoke(provider, files, archive); + + } + catch(NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { + fail(); + } + + try { + Field field = provider.getClass().getDeclaredField("DAEXIM_DIR"); + field.setAccessible(true); + field.set(provider, ""); + Method method = provider.getClass().getDeclaredMethod("extractArchive", String.class); + method.setAccessible(true); + method.invoke(provider, archive); + } + catch(NoSuchMethodException | IllegalAccessException | InvocationTargetException | NoSuchFieldException e) { + fail(); + } + finally { + File zip = new File(archive); + zip.delete(); + } + } +} diff --git a/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupUtilTest.java b/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupUtilTest.java new file mode 100644 index 000000000..16ce68198 --- /dev/null +++ b/northbound/daexim-offsite-backup/provider/src/test/java/org/onap/ccsdk/sli/northbound/daeximoffsitebackup/DaeximOffsiteBackupUtilTest.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.daeximoffsitebackup; + +import org.junit.Test; + +import java.lang.reflect.Field; + +public class DaeximOffsiteBackupUtilTest { + @Test + public void loadProperties() { + try { + Field field = DaeximOffsiteBackupUtil.class.getDeclaredField("PROPERTIES_FILE"); + field.setAccessible(true); + field.set(new DaeximOffsiteBackupUtil(), "src/test/resources/daexim-offsite-backup.properties"); + DaeximOffsiteBackupUtil.loadProperties(); + } catch(Exception e) { + // Files don't exist on build server + } + } +} diff --git a/northbound/daexim-offsite-backup/provider/src/test/resources/daexim-offsite-backup.properties b/northbound/daexim-offsite-backup/provider/src/test/resources/daexim-offsite-backup.properties new file mode 100755 index 000000000..b69027906 --- /dev/null +++ b/northbound/daexim-offsite-backup/provider/src/test/resources/daexim-offsite-backup.properties @@ -0,0 +1,26 @@ +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2019 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= + +daeximDirectory=/opt/opendaylight/current/daexim/ +credentials=admin:admin123 +nexusUrl=http://localhost:8081/nexus/content/repositories/ +podName=UNKNOWN_ODL +file.operational=odl_backup_operational.json +file.models=odl_backup_models.json +file.config=odl_backup_config.json
\ No newline at end of file diff --git a/northbound/dataChange/.gitignore b/northbound/dataChange/.gitignore new file mode 100755 index 000000000..b73caf31e --- /dev/null +++ b/northbound/dataChange/.gitignore @@ -0,0 +1,34 @@ +#####standard .git ignore entries##### + +## IDE Specific Files ## +org.eclipse.core.resources.prefs +.classpath +.project +.settings +.idea +.externalToolBuilders +maven-eclipse.xml +workspace + +## Compilation Files ## +*.class +**/target +target +target-ide +MANIFEST.MF + +## Misc Ignores (OS specific etc) ## +bin/ +dist +*~ +*.ipr +*.iml +*.iws +classes +out/ +.DS_STORE +.metadata + +## Folders which contain auto generated source code ## +yang-gen-config +yang-gen-sal diff --git a/northbound/dataChange/.sonar/checkstyle.xml b/northbound/dataChange/.sonar/checkstyle.xml new file mode 100755 index 000000000..3fa231535 --- /dev/null +++ b/northbound/dataChange/.sonar/checkstyle.xml @@ -0,0 +1 @@ +<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"><!-- Generated by Sonar --><module name="Checker"><module name="SuppressionCommentFilter"/><module name="TreeWalker"><module name="FileContentsHolder"/> <module name="ClassFanOutComplexity"><property name="severity" value="warning"/></module><module name="NestedForDepth"><property name="severity" value="warning"/><property name="max" value="1"/></module><module name="ClassDataAbstractionCoupling"><property name="severity" value="warning"/></module></module></module>
\ No newline at end of file diff --git a/northbound/dataChange/.sonar/pmd.xml b/northbound/dataChange/.sonar/pmd.xml new file mode 100755 index 000000000..80343b3bd --- /dev/null +++ b/northbound/dataChange/.sonar/pmd.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<ruleset>
+ <rule ref="rulesets/java/naming.xml/BooleanGetMethodName">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/j2ee.xml/StaticEJBFieldShouldBeFinal">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/coupling.xml/CouplingBetweenObjects">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/codesize.xml/TooManyMethods">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/naming.xml/AvoidFieldNameMatchingTypeName">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/basic.xml/DoubleCheckedLocking">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/naming.xml/AvoidFieldNameMatchingMethodName">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/coupling.xml/ExcessiveImports">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/basic.xml/OverrideBothEqualsAndHashcode">
+ <priority>2</priority>
+ </rule>
+ <rule ref="rulesets/java/naming.xml/ShortMethodName">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/basic.xml/BooleanInstantiation">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/codesize.xml/TooManyFields">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/controversial.xml/AvoidUsingNativeCode">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/optimizations.xml/UseStringBufferForStringAppends">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/coupling.xml/LooseCoupling">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/design.xml/NonThreadSafeSingleton">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/j2ee.xml/DoNotUseThreads">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/sunsecure.xml/ArrayIsStoredDirectly">
+ <priority>5</priority>
+ </rule>
+ <rule ref="rulesets/java/sunsecure.xml/MethodReturnsInternalArray">
+ <priority>2</priority>
+ </rule>
+ <rule ref="rulesets/java/design.xml/AssignmentToNonFinalStatic">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/strictexception.xml/AvoidCatchingGenericException">
+ <priority>3</priority>
+ </rule>
+</ruleset>
+
diff --git a/northbound/dataChange/README.txt b/northbound/dataChange/README.txt new file mode 100755 index 000000000..f9f4a2ab5 --- /dev/null +++ b/northbound/dataChange/README.txt @@ -0,0 +1,35 @@ +====================== +Introduction +====================== +You have generated an MD-SAL module using the Brocade Archetype. + +* You should be able to successfully run 'mvn clean install' on this project. +* This will produce a .zip file under the karaf.extension directory which you can deploy using +Brocade's extension deployment mechanism. + +====================== +Next Steps: +====================== +* run a 'mvn clean install' if you haven't already. This will generate some code from the yang models. +* Modify the model yang file under the model project. +* Follow the comments in the generated provider class to wire your new provider into the generated +code. +* Modify the generated provider model to respond to and handle the yang model. Depending on what +you added to your model you may need to inherit additional interfaces or make other changes to +the provider model. + +====================== +Generated Bundles: +====================== +* model + - Provides the yang model for your application. This is your primary northbound interface. +* provider + - Provides a template implementation for a provider to respond to your yang model. +* features + - Defines a karaf feature. If you add dependencies on third-party bundles then you will need to + modify the features.xml to list out the dependencies. +* karaf.extension + - Bundles all of the jars and third party dependencies (minus ODL dependencies) into a single + .zip file with the necessary configuration files to work correctly with the Brocade extension + mechanism. + diff --git a/northbound/dataChange/installer/pom.xml b/northbound/dataChange/installer/pom.xml new file mode 100755 index 000000000..60217baa6 --- /dev/null +++ b/northbound/dataChange/installer/pom.xml @@ -0,0 +1,135 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>odlparent-lite</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>dataChange-installer</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>ccsdk-sli-northbound :: dataChange :: ${project.artifactId}</name> + + <properties> + <application.name>ccsdk-dataChange</application.name> + <features.boot>${application.name}</features.boot> + <features.repositories>mvn:org.onap.ccsdk.sli.northbound/${features.boot}/${project.version}/xml/features</features.repositories> + <include.transitive.dependencies>false</include.transitive.dependencies> + </properties> + + <dependencies> + + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>dataChange-model</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>dataChange-provider</artifactId> + <version>${project.version}</version> + </dependency> + + + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>maven-repo-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>true</attach> + <finalName>stage/${application.name}-${project.version}</finalName> + <descriptors> + <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>true</appendAssemblyId> + </configuration> + </execution> + <execution> + <id>installer-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>true</attach> + <finalName>${application.name}-${project.version}-installer</finalName> + <descriptors> + <descriptor>src/assembly/assemble_installer_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>false</appendAssemblyId> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <phase>prepare-package</phase> + <configuration> + <transitive>false</transitive> + <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + <useRepositoryLayout>true</useRepositoryLayout> + <addParentPoms>false</addParentPoms> + <copyPom>false</copyPom> + <includeGroupIds>org.onap.ccsdk.sli.northbound</includeGroupIds> + <scope>provided</scope> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>copy-version</id> + <goals> + <goal>copy-resources</goal> + </goals><!-- here the phase you need --> + <phase>validate</phase> + <configuration> + <outputDirectory>${basedir}/target/stage</outputDirectory> + <resources> + <resource> + <directory>src/main/resources/scripts</directory> + <includes> + <include>install-feature.sh</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + + </executions> + </plugin> + + </plugins> + </build> +</project> diff --git a/northbound/dataChange/installer/src/assembly/assemble_installer_zip.xml b/northbound/dataChange/installer/src/assembly/assemble_installer_zip.xml new file mode 100644 index 000000000..3bed4b5ef --- /dev/null +++ b/northbound/dataChange/installer/src/assembly/assemble_installer_zip.xml @@ -0,0 +1,59 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>installer_zip</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>755</fileMode> + <includes> + <include>*.sh</include> + </includes> + </fileSet> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>644</fileMode> + <excludes> + <exclude>*.sh</exclude> + </excludes> + </fileSet> + </fileSets> + + + +</assembly> diff --git a/northbound/dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml b/northbound/dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100644 index 000000000..479896182 --- /dev/null +++ b/northbound/dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,47 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>repo</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/assembly/</directory> + <outputDirectory>.</outputDirectory> + <excludes> + </excludes> + </fileSet> + </fileSets> + +</assembly> diff --git a/northbound/dataChange/installer/src/main/resources/scripts/install-feature.sh b/northbound/dataChange/installer/src/main/resources/scripts/install-feature.sh new file mode 100644 index 000000000..cee4a4952 --- /dev/null +++ b/northbound/dataChange/installer/src/main/resources/scripts/install-feature.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} +ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} +INSTALLERDIR=$(dirname $0) + +REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip + +if [ -f ${REPOZIP} ] +then + unzip -d ${ODL_HOME} ${REPOZIP} +else + echo "ERROR : repo zip ($REPOZIP) not found" + exit 1 +fi + +${ODL_KARAF_CLIENT} feature:repo-add ${features.repositories} +${ODL_KARAF_CLIENT} feature:install ${features.boot} diff --git a/northbound/dataChange/model/pom.xml b/northbound/dataChange/model/pom.xml new file mode 100755 index 000000000..bce47e949 --- /dev/null +++ b/northbound/dataChange/model/pom.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>binding-parent</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>dataChange-model</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>bundle</packaging> + + <name>ccsdk-sli-northbound :: dataChange :: ${project.artifactId}</name> + + <properties> + <ccsdk.sli.northbound.version>${project.version}</ccsdk.sli.northbound.version> + </properties> + + <dependencies> + <dependency> + <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId> + <artifactId>rfc6991</artifactId> + </dependency> + + + </dependencies> +</project> diff --git a/northbound/dataChange/model/src/main/resources/dataChange.20150519.json b/northbound/dataChange/model/src/main/resources/dataChange.20150519.json new file mode 100644 index 000000000..be17d564b --- /dev/null +++ b/northbound/dataChange/model/src/main/resources/dataChange.20150519.json @@ -0,0 +1,132 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0" + }, + "basePath": "/restconf", + "paths": { + "/operations/DataChange:data-change-notification": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(data-change-notification)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(data-change-notification)output-TOP" + } + } + }, + "operationId": "data-change-notification" + } + } + }, + "definitions": { + "(config)DataChange_modulePOST": { + "type": "object" + }, + "(config)key-dataPOST": { + "properties": { + "key-name": { + "$ref": "#/definitions/Optional.empty" + }, + "key-value": { + "$ref": "#/definitions/Optional.empty" + } + }, + "type": "object" + }, + "(data-change-notification)input": { + "properties": { + "DataChange:aai-event-id": { + "$ref": "#/definitions/Optional.empty" + }, + "DataChange:aai-event-trigger": { + "$ref": "#/definitions/Optional.empty" + }, + "DataChange:aai-node-type": { + "$ref": "#/definitions/Optional.empty" + }, + "DataChange:key-data": { + "items": { + "$ref": "#/definitions/DataChange(config)key-data" + }, + "type": "array" + }, + "DataChange:selflink": { + "$ref": "#/definitions/Optional.empty" + } + }, + "type": "object" + }, + "(data-change-notification)input-TOP": { + "properties": { + "DataChange:input": { + "items": { + "$ref": "#/definitions/(data-change-notification)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(data-change-notification)output": { + "properties": { + "DataChange:data-change-response-code": { + "$ref": "#/definitions/Optional.empty" + } + }, + "type": "object" + }, + "(data-change-notification)output-TOP": { + "properties": { + "DataChange:output": { + "items": { + "$ref": "#/definitions/(data-change-notification)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "DataChange(config)key-data": { + "properties": { + "DataChange:key-name": { + "$ref": "#/definitions/Optional.empty" + }, + "DataChange:key-value": { + "$ref": "#/definitions/Optional.empty" + } + }, + "type": "object" + }, + "DataChange(config)key-data-TOP": { + "properties": { + "DataChange:key-data": { + "items": { + "$ref": "#/definitions/DataChange(config)key-data" + }, + "type": "array" + } + }, + "type": "object" + }, + "unique_empty_identifier": {} + } +} diff --git a/northbound/dataChange/model/src/main/yang/DataChange.yang b/northbound/dataChange/model/src/main/yang/DataChange.yang new file mode 100755 index 000000000..8f9a8e6f7 --- /dev/null +++ b/northbound/dataChange/model/src/main/yang/DataChange.yang @@ -0,0 +1,73 @@ +module DataChange { + + yang-version 1; + + namespace "org:onap:ccsdk:sli:northbound:datachange"; + + prefix datachg; + + organization "AT&T, Inc."; + + contact + "Dan Timoney <dt5972@att.com>"; + + description + "Defines API interface for notification of data changes"; + + revision "2015-05-19" { + description + "Initial draft"; + } + + grouping data-change-request { + + leaf aai-event-id { + type string; + } + + leaf aai-node-type { + type string; + } + + leaf aai-event-trigger { + type enumeration { + enum "Update"; + enum "Delete"; + } + } + + list key-data { + key key-name; + leaf key-name { + type string; + } + leaf key-value { + type string; + } + } + + leaf selflink { + type string; + } + + } + + grouping data-change-response { + + leaf data-change-response-code { + type string; + } + } + + rpc data-change-notification { + + input { + uses data-change-request; + } + + output { + uses data-change-response; + } + } + +} diff --git a/northbound/dataChange/pom.xml b/northbound/dataChange/pom.xml new file mode 100755 index 000000000..6110bdf1d --- /dev/null +++ b/northbound/dataChange/pom.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>odlparent-lite</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>dataChange</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>ccsdk-sli-northbound :: dataChange</name> + + <modules> + <module>model</module> + <module>provider</module> + <module>installer</module> + </modules> +</project> diff --git a/northbound/dataChange/provider/pom.xml b/northbound/dataChange/provider/pom.xml new file mode 100755 index 000000000..cdefb5437 --- /dev/null +++ b/northbound/dataChange/provider/pom.xml @@ -0,0 +1,89 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>binding-parent</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>dataChange-provider</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>bundle</packaging> + + <name>ccsdk-sli-northbound :: dataChange :: ${project.artifactId}</name> + + <properties> + <ccsdk.sli.northbound.version>${project.version}</ccsdk.sli.northbound.version> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-core-artifacts</artifactId> + <version>${ccsdk.sli.core.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>dataChange-model</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-api</artifactId> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-common</artifactId> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-provider</artifactId> + </dependency> + + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-test-model</artifactId> + <scope>test</scope> + </dependency> + + + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-broker-impl</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-broker-impl</artifactId> + <type>test-jar</type> + <classifier>tests</classifier> + <scope>test</scope> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/northbound/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeClient.java b/northbound/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeClient.java new file mode 100644 index 000000000..959b2b6fb --- /dev/null +++ b/northbound/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeClient.java @@ -0,0 +1,98 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound; + +import java.util.Properties; + +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper; +import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutputBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DataChangeClient { + + private static final Logger LOG = LoggerFactory.getLogger(DataChangeClient.class); + + private SvcLogicService svcLogicService = null; + + public DataChangeClient(final SvcLogicService svcLogicService) { + this.svcLogicService = svcLogicService; + } + + public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException + { + return svcLogicService.hasGraph(module, rpc, version, mode); + } + + public Properties execute(String module, String rpc, String version, String mode, DataChangeNotificationOutputBuilder serviceData) + throws SvcLogicException { + + Properties parms = new Properties(); + + return execute(module,rpc,version, mode,serviceData,parms); + } + + public Properties execute(String module, String rpc, String version, String mode, DataChangeNotificationOutputBuilder serviceData, Properties parms) + throws SvcLogicException { + + Properties localProp; + localProp = MdsalHelper.toProperties(parms, serviceData); + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters passed to SLI"); + + for (Object key : localProp.keySet()) { + String parmName = (String) key; + String parmValue = localProp.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + + Properties respProps = svcLogicService.execute(module, rpc, version, mode, localProp); + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters returned by SLI"); + + for (Object key : respProps.keySet()) { + String parmName = (String) key; + String parmValue = respProps.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) { + return respProps; + } + + MdsalHelper.toBuilder(respProps, serviceData); + + return respProps; + } + +} diff --git a/northbound/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeProvider.java b/northbound/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeProvider.java new file mode 100644 index 000000000..3301ca8e0 --- /dev/null +++ b/northbound/dataChange/provider/src/main/java/org/onap/ccsdk/sli/northbound/DataChangeProvider.java @@ -0,0 +1,161 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound; + +import java.util.Properties; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper; +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; +import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationInput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeService; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.opendaylight.yangtools.yang.common.RpcResultBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; + +/** + * Defines a base implementation for your provider. This class extends from a helper class + * which provides storage for the most commonly used components of the MD-SAL. Additionally the + * base class provides some basic logging and initialization / clean up methods. + * + */ +public class DataChangeProvider implements AutoCloseable, DataChangeService { + + private static final Logger LOG = LoggerFactory.getLogger(DataChangeProvider.class); + + private static final String APPLICATION_NAME = "DataChange"; + + private final ExecutorService executor; + + protected DataBroker dataBroker; + protected NotificationPublishService notificationService; + protected RpcProviderRegistry rpcRegistry; + protected BindingAwareBroker.RpcRegistration<DataChangeService> rpcRegistration; + private final DataChangeClient dataChangeClient; + + + public DataChangeProvider(final DataBroker dataBroker, + final NotificationPublishService notificationPublishService, + final RpcProviderRegistry rpcProviderRegistry, + final DataChangeClient dataChangeClient) { + + this.LOG.info( "Creating provider for {}", APPLICATION_NAME); + executor = Executors.newFixedThreadPool(1); + this.dataBroker = dataBroker; + this.notificationService = notificationPublishService; + this.rpcRegistry = rpcProviderRegistry; + this.dataChangeClient = dataChangeClient; + initialize(); + } + + public void initialize(){ + LOG.info( "Initializing provider for {}", APPLICATION_NAME); + rpcRegistration = rpcRegistry.addRpcImplementation(DataChangeService.class, this); + LOG.info( "Initialization complete for {}", APPLICATION_NAME); + } + + protected void initializeChild() { + //Override if you have custom initialization intelligence + } + + @Override + public void close() throws Exception { + LOG.info( "Closing provider for {}", APPLICATION_NAME); + executor.shutdown(); + rpcRegistration.close(); + LOG.info( "Successfully closed provider for {}", APPLICATION_NAME); + } + + @Override + public ListenableFuture<RpcResult<DataChangeNotificationOutput>> dataChangeNotification( + DataChangeNotificationInput input) { + final String svcOperation = "data-change-notification"; + + Properties parms = new Properties(); + DataChangeNotificationOutputBuilder serviceDataBuilder = new DataChangeNotificationOutputBuilder(); + + LOG.info( svcOperation +" called." ); + + if(input == null || input.getAaiEventId() == null) { + LOG.debug("exiting " +svcOperation+ " because of invalid input"); + serviceDataBuilder.setDataChangeResponseCode("403"); + RpcResult<DataChangeNotificationOutput> rpcResult = + RpcResultBuilder.<DataChangeNotificationOutput> status(true).withResult(serviceDataBuilder.build()).build(); + return Futures.immediateFuture(rpcResult); + } + + // add input to parms + LOG.info("Adding INPUT data for "+svcOperation+" input: " + input); + DataChangeNotificationInputBuilder inputBuilder = new DataChangeNotificationInputBuilder(input); + MdsalHelper.toProperties(parms, inputBuilder.build()); + + // Call SLI sync method + try + { + if (dataChangeClient.hasGraph(APPLICATION_NAME, svcOperation , null, "sync")) + { + try + { + dataChangeClient.execute(APPLICATION_NAME, svcOperation, null, "sync", serviceDataBuilder, parms); + } + catch (Exception e) + { + LOG.error("Caught exception executing service logic for "+ svcOperation, e); + serviceDataBuilder.setDataChangeResponseCode("500"); + } + } else { + LOG.error("No service logic active for DataChange: '" + svcOperation + "'"); + serviceDataBuilder.setDataChangeResponseCode("503"); + } + } + catch (Exception e) + { + LOG.error("Caught exception looking for service logic", e); + serviceDataBuilder.setDataChangeResponseCode("500"); + } + + String errorCode = serviceDataBuilder.getDataChangeResponseCode(); + + if (!("0".equals(errorCode) || "200".equals(errorCode))) { + LOG.error("Returned FAILED for "+svcOperation+" error code: '" + errorCode + "'"); + } else { + LOG.info("Returned SUCCESS for "+svcOperation+" "); + } + + RpcResult<DataChangeNotificationOutput> rpcResult = + RpcResultBuilder.<DataChangeNotificationOutput> status(true).withResult(serviceDataBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } +} diff --git a/northbound/dataChange/provider/src/main/resources/OSGI-INF/blueprint/datachange-blueprint.xml b/northbound/dataChange/provider/src/main/resources/OSGI-INF/blueprint/datachange-blueprint.xml new file mode 100644 index 000000000..5a38c81f1 --- /dev/null +++ b/northbound/dataChange/provider/src/main/resources/OSGI-INF/blueprint/datachange-blueprint.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" + xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0" + odl:use-default-for-reference-types="true"> + + <reference id="svcLogicService" + interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService" /> + + <bean id="client" class="org.onap.ccsdk.sli.northbound.DataChangeClient"> + <argument ref="svcLogicService" /> + </bean> + + <reference id="dataBroker" + interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" + odl:type="default" /> + + <reference id="notificationService" + interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService" + odl:type="default" /> + + <reference id="rpcRegistry" + interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry" + odl:type="default" /> + + <bean id="provider" class="org.onap.ccsdk.sli.northbound.DataChangeProvider"> + <argument ref="dataBroker" /> + <argument ref="notificationService" /> + <argument ref="rpcRegistry" /> + <argument ref="client" /> + </bean> + +</blueprint>
\ No newline at end of file diff --git a/northbound/dataChange/provider/src/main/resources/org/opendaylight/blueprint/datachange-blueprint.xml b/northbound/dataChange/provider/src/main/resources/org/opendaylight/blueprint/datachange-blueprint.xml new file mode 100644 index 000000000..5a38c81f1 --- /dev/null +++ b/northbound/dataChange/provider/src/main/resources/org/opendaylight/blueprint/datachange-blueprint.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" + xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0" + odl:use-default-for-reference-types="true"> + + <reference id="svcLogicService" + interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService" /> + + <bean id="client" class="org.onap.ccsdk.sli.northbound.DataChangeClient"> + <argument ref="svcLogicService" /> + </bean> + + <reference id="dataBroker" + interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" + odl:type="default" /> + + <reference id="notificationService" + interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService" + odl:type="default" /> + + <reference id="rpcRegistry" + interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry" + odl:type="default" /> + + <bean id="provider" class="org.onap.ccsdk.sli.northbound.DataChangeProvider"> + <argument ref="dataBroker" /> + <argument ref="notificationService" /> + <argument ref="rpcRegistry" /> + <argument ref="client" /> + </bean> + +</blueprint>
\ No newline at end of file diff --git a/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java b/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java new file mode 100644 index 000000000..9ba6c8742 --- /dev/null +++ b/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/DataChangeClientTest.java @@ -0,0 +1,56 @@ +package org.onap.sdnc.northbound.dataChange; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; + +import java.util.Properties; + +import org.junit.Before; +import org.junit.Test; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper; +import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService; +import org.onap.ccsdk.sli.northbound.DataChangeClient; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutputBuilder; + +public class DataChangeClientTest { + + SvcLogicService mockSvcLogicService; + String module = "test-module"; + String rpc = "test-rpc"; + String version = "test-version"; + String mode = "test-mode"; + Properties localProp = new Properties(); + + @Before + public void setUp() throws Exception { + mockSvcLogicService = mock(SvcLogicService.class); + when(mockSvcLogicService.hasGraph(module, rpc, version, mode)).thenReturn(true); + } + + @Test + public void testDataChangeClientConstructor() { + DataChangeClient dataChangeClient = new DataChangeClient(mockSvcLogicService); + assertNotNull(dataChangeClient); + } + + @Test + public void testHasGraph() throws SvcLogicException { + DataChangeClient dataChangeClient = new DataChangeClient(mockSvcLogicService); + boolean result = dataChangeClient.hasGraph(module, rpc, version, mode); + assertTrue(result); + } + + @Test + public void testExecuteSvcLogicStatusFailure() throws SvcLogicException { + DataChangeNotificationOutputBuilder serviceData = mock(DataChangeNotificationOutputBuilder.class); + Properties parms = mock(Properties.class); + SvcLogicService svcLogicService = mock(SvcLogicService.class); + Properties properties = new Properties(); + properties.setProperty("SvcLogic.status", "failure"); + when(svcLogicService.execute(module, rpc, version, mode, properties)).thenReturn(properties); + DataChangeClient sliClient = new DataChangeClient(svcLogicService); + Properties prop = sliClient.execute(module, rpc, version, mode, serviceData, properties); + assertTrue(prop != null); + } +}
\ No newline at end of file diff --git a/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/TestDataChange.java b/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/TestDataChange.java new file mode 100644 index 000000000..f9c39b703 --- /dev/null +++ b/northbound/dataChange/provider/src/test/java/org/onap/sdnc/northbound/dataChange/TestDataChange.java @@ -0,0 +1,95 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.sdnc.northbound.dataChange; + +import org.junit.Before; +import org.junit.Test; +import org.onap.ccsdk.sli.northbound.DataChangeProvider; +import org.onap.ccsdk.sli.northbound.DataChangeClient; +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; +import org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest; +import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationInput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.datachange.rev150519.DataChangeNotificationOutput; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; + +public class TestDataChange extends AbstractConcurrentDataBrokerTest { + + private DataChangeProvider dataChangeProvider; + private static final Logger LOG = LoggerFactory.getLogger(DataChangeProvider.class); + + @Before + public void setUp() throws Exception { + if (null == dataChangeProvider) { + DataBroker dataBroker = getDataBroker(); + NotificationPublishService mockNotification = mock(NotificationPublishService.class); + RpcProviderRegistry mockRpcRegistry = mock(RpcProviderRegistry.class); + DataChangeClient mockSliClient = mock(DataChangeClient.class); + dataChangeProvider = new DataChangeProvider(dataBroker, mockNotification, mockRpcRegistry, mockSliClient); + } + } + + //Testcase should return error 503 when No service logic active for dataChange. + @Test + public void testDataChangeNotification() { + + DataChangeNotificationInputBuilder inputBuilder = new DataChangeNotificationInputBuilder(); + + inputBuilder.setAaiEventId("1"); + + + // TODO: currently initialize SvcLogicServiceClient is failing, need to fix + java.util.concurrent.Future<RpcResult<DataChangeNotificationOutput>> future = dataChangeProvider + .dataChangeNotification(inputBuilder.build()); + RpcResult<DataChangeNotificationOutput> rpcResult = null; + try { + rpcResult = future.get(); + } catch (Exception e) { + fail("Error : " + e); + } + LOG.info("result: {}", rpcResult); + assertEquals("503", rpcResult.getResult().getDataChangeResponseCode()); + } + + //Input parameter validation + @Test + public void testDataChangeNotificationInputValidation() { + + java.util.concurrent.Future<RpcResult<DataChangeNotificationOutput>> future = dataChangeProvider + .dataChangeNotification(null); + RpcResult<DataChangeNotificationOutput> rpcResult = null; + try { + rpcResult = future.get(); + } catch (Exception e) { + fail("Error : " + e); + } + LOG.info("result: {}", rpcResult); + assertEquals("403", rpcResult.getResult().getDataChangeResponseCode()); + } +} diff --git a/northbound/dmaap-listener/.gitignore b/northbound/dmaap-listener/.gitignore new file mode 100755 index 000000000..1b8a6ba9d --- /dev/null +++ b/northbound/dmaap-listener/.gitignore @@ -0,0 +1,12 @@ +org.eclipse.core.resources.prefs +.classpath
+.project
+.settings
+.idea
+.externalToolBuilders
+maven-eclipse.xml
+*.class
+target/
+MANIFEST.MF
+.DS_STORE
+.metadata
diff --git a/northbound/dmaap-listener/.sonar/checkstyle.xml b/northbound/dmaap-listener/.sonar/checkstyle.xml new file mode 100755 index 000000000..3fa231535 --- /dev/null +++ b/northbound/dmaap-listener/.sonar/checkstyle.xml @@ -0,0 +1 @@ +<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"><!-- Generated by Sonar --><module name="Checker"><module name="SuppressionCommentFilter"/><module name="TreeWalker"><module name="FileContentsHolder"/> <module name="ClassFanOutComplexity"><property name="severity" value="warning"/></module><module name="NestedForDepth"><property name="severity" value="warning"/><property name="max" value="1"/></module><module name="ClassDataAbstractionCoupling"><property name="severity" value="warning"/></module></module></module>
\ No newline at end of file diff --git a/northbound/dmaap-listener/.sonar/pmd.xml b/northbound/dmaap-listener/.sonar/pmd.xml new file mode 100755 index 000000000..80343b3bd --- /dev/null +++ b/northbound/dmaap-listener/.sonar/pmd.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<ruleset>
+ <rule ref="rulesets/java/naming.xml/BooleanGetMethodName">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/j2ee.xml/StaticEJBFieldShouldBeFinal">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/coupling.xml/CouplingBetweenObjects">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/codesize.xml/TooManyMethods">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/naming.xml/AvoidFieldNameMatchingTypeName">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/basic.xml/DoubleCheckedLocking">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/naming.xml/AvoidFieldNameMatchingMethodName">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/coupling.xml/ExcessiveImports">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/basic.xml/OverrideBothEqualsAndHashcode">
+ <priority>2</priority>
+ </rule>
+ <rule ref="rulesets/java/naming.xml/ShortMethodName">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/basic.xml/BooleanInstantiation">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/codesize.xml/TooManyFields">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/controversial.xml/AvoidUsingNativeCode">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/optimizations.xml/UseStringBufferForStringAppends">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/coupling.xml/LooseCoupling">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/design.xml/NonThreadSafeSingleton">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/j2ee.xml/DoNotUseThreads">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/sunsecure.xml/ArrayIsStoredDirectly">
+ <priority>5</priority>
+ </rule>
+ <rule ref="rulesets/java/sunsecure.xml/MethodReturnsInternalArray">
+ <priority>2</priority>
+ </rule>
+ <rule ref="rulesets/java/design.xml/AssignmentToNonFinalStatic">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/strictexception.xml/AvoidCatchingGenericException">
+ <priority>3</priority>
+ </rule>
+</ruleset>
+
diff --git a/northbound/dmaap-listener/pom.xml b/northbound/dmaap-listener/pom.xml new file mode 100755 index 000000000..65e43886c --- /dev/null +++ b/northbound/dmaap-listener/pom.xml @@ -0,0 +1,150 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>standalone-parent</artifactId> + <version>2.1.0</version> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>dmaap-listener</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>jar</packaging> + + <name>ccsdk-sli-northbound :: dmaap-listener</name> + <description>DMAAP Listener</description> + + <properties> + <skip.SWM>true</skip.SWM> + <dmaap.listener.base>/opt/app/dmaap-listener</dmaap.listener.base> + + <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format> + <build.number>${maven.build.timestamp}</build.number> + <SWM_VERSION>${project.version}-${build.number}</SWM_VERSION> + + <ccsdk.sli.core.version>1.1.0</ccsdk.sli.core.version> + <ccsdk.sli.northbound.version>${project.version}</ccsdk.sli.northbound.version> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-core-artifacts</artifactId> + <version>${ccsdk.sli.core.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + + <!-- dmaapClient needs this version of this jar --> + <dependency> + <groupId>javax.ws.rs</groupId> + <artifactId>javax.ws.rs-api</artifactId> + <version>2.1</version> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> + + <dependency> + <groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId> + <artifactId>dmaapClient</artifactId> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-annotations</artifactId> + </dependency> + <dependency> + <groupId>org.apache.velocity</groupId> + <artifactId>velocity-engine-core</artifactId> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>ch.vorburger.mariaDB4j</groupId> + <artifactId>mariaDB4j</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>dblib-provider</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + + <!-- ================================================== --> + <!-- Set the JDK compiler version. --> + <!-- ================================================== --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.5.1</version> + <inherited>true</inherited> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.6</version> + <configuration> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <mainClass>org.onap.ccsdk.sli.northbound.dmaapclient.DmaapListener</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>create-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>true</attach> + <finalName>${project.artifactId}.${project.version}</finalName> + <attach>true</attach> + <descriptors> + <descriptor>src/assembly/assemble_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>false</appendAssemblyId> + </configuration> + </execution> + </executions> + </plugin> + + </plugins> + </build> +</project> diff --git a/northbound/dmaap-listener/src/assembly/assemble_zip.xml b/northbound/dmaap-listener/src/assembly/assemble_zip.xml new file mode 100644 index 000000000..632172d77 --- /dev/null +++ b/northbound/dmaap-listener/src/assembly/assemble_zip.xml @@ -0,0 +1,62 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>assemble_zip</id> + <formats> + <format>zip</format> + </formats> + + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>src/main/scripts</directory> + <outputDirectory>bin</outputDirectory> + </fileSet> + <fileSet> + <directory>target</directory> + <outputDirectory>lib</outputDirectory> + <includes> + <include>*.jar</include> + </includes> + </fileSet> + <fileSet> + <directory>src/main/resources</directory> + <outputDirectory>lib</outputDirectory> + <includes> + <include>*.properties</include> + <include>*.map</include> + <include>*.vt</include> + </includes> + </fileSet> + </fileSets> + <dependencySets> + <dependencySet> + <outputDirectory>lib</outputDirectory> + <useProjectArtifact>true</useProjectArtifact> + <scope>runtime</scope> + </dependencySet> + </dependencySets> +</assembly> diff --git a/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/A1AdapterPolicyDmaapConsumer.java b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/A1AdapterPolicyDmaapConsumer.java new file mode 100644 index 000000000..dd59f5868 --- /dev/null +++ b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/A1AdapterPolicyDmaapConsumer.java @@ -0,0 +1,108 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2019 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class A1AdapterPolicyDmaapConsumer extends SdncDmaapConsumerImpl { + + private static final Logger LOG = LoggerFactory.getLogger(A1AdapterPolicyDmaapConsumer.class); + + private static final String BODY = "body"; + private static final String RPC = "rpc-name"; + private static final String INPUT = "input"; + private static final String PAYLOAD = "Payload"; + + + @Override + public void processMsg(String msg) throws InvalidMessageException { + + if (msg == null) { + throw new InvalidMessageException("Null A1-ADAPTER-DMAAP message"); + } + + ObjectMapper oMapper = new ObjectMapper(); + JsonNode a1AdapterRootNode; + try { + a1AdapterRootNode = oMapper.readTree(msg); + } catch (Exception e) { + throw new InvalidMessageException("Cannot parse A1-ADAPTER-DMAAP json input", e); + } + + JsonNode bodyNode = a1AdapterRootNode.get(BODY); + if(bodyNode == null) { + LOG.warn("Missing body in A1-ADAPTER-DMAAP message"); + return; + } + + JsonNode input = bodyNode.get(INPUT); + if(input == null) { + LOG.info("Missing input node."); + return; + } + + JsonNode payloadNode = input.get(PAYLOAD); + if(payloadNode == null) { + LOG.info("Missing payload node."); + return; + } + + String rpcMsgbody; + try { + ObjectMapper mapper = new ObjectMapper(); + rpcMsgbody = mapper.writeValueAsString(payloadNode); + + } catch (Exception e) { + LOG.error("Unable to parse payload in A1-ADAPTER-DMAAP message", e); + return; + } + + JsonNode rpcNode = a1AdapterRootNode.get(RPC); + if(rpcNode == null) { + LOG.warn("Missing node in A1-ADAPTER-DMAAP message- " + RPC); + return; + } + String rpc = rpcNode.textValue(); + String sdncEndpoint = "A1-ADAPTER-API:" + rpc; + + try { + String odlUrlBase = getProperty("sdnc.odl.url-base"); + String odlUser = getProperty("sdnc.odl.user"); + String odlPassword = getProperty("sdnc.odl.password"); + LOG.info("POST A1-ADAPTER-API Request " + rpcMsgbody); + if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) { + SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + "/" + sdncEndpoint, odlUser, odlPassword); + + conn.send("POST", "application/json", rpcMsgbody); + } else { + LOG.warn("Unable to POST A1-ADAPTER-API message. SDNC URL not available. body:\n" + rpcMsgbody); + } + } catch (Exception e) { + LOG.error("Unable to process message", e); + } + } +} diff --git a/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/CMNotifyDmaapConsumer.java b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/CMNotifyDmaapConsumer.java new file mode 100644 index 000000000..fa14fbb24 --- /dev/null +++ b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/CMNotifyDmaapConsumer.java @@ -0,0 +1,108 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2019 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.json.JSONObject; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CMNotifyDmaapConsumer extends SdncDmaapConsumerImpl { + + private static final Logger LOG = LoggerFactory.getLogger(CMNotifyDmaapConsumer.class); + + private static final String BODY = "body"; + private static final String RPC = "rpc-name"; + private static final String INPUT = "input"; + private static final String PAYLOAD = "Payload"; + + @Override + public void processMsg(String msg) throws InvalidMessageException { + + if (msg == null) { + throw new InvalidMessageException("Null CMNotify-DMAAP message"); + } + + ObjectMapper oMapper = new ObjectMapper(); + JsonNode CMNotifyRootNode; + try { + CMNotifyRootNode = oMapper.readTree(msg); + } catch (Exception e) { + throw new InvalidMessageException("Cannot parse CMNotify-DMAAP json input", e); + } + + JsonNode bodyNode = CMNotifyRootNode.get(BODY); + if(bodyNode == null) { + LOG.warn("Missing body in CMNotify-DMAAP message"); + return; + } + + JsonNode input = bodyNode.get(INPUT); + if(input == null) { + LOG.info("Missing input node."); + return; + } + + JsonNode payloadNode = input.get(PAYLOAD); + if(payloadNode == null) { + LOG.info("Missing payload node."); + return; + } + + String rpcMsgbody; + try { + ObjectMapper mapper = new ObjectMapper(); + rpcMsgbody = "{\"input\":" + mapper.writeValueAsString(payloadNode) + "}"; + + } catch (Exception e) { + LOG.error("Unable to parse payload in CMNotify-DMAAP message", e); + return; + } + + JsonNode rpcNode = CMNotifyRootNode.get(RPC); + if(rpcNode == null) { + LOG.warn("Missing node in CMNotify-DMAAP message- " + RPC); + return; + } + String rpc = rpcNode.textValue(); + String sdncEndpoint = "CM-NOTIFY-API:" + rpc; + + try { + String odlUrlBase = getProperty("sdnc.odl.url-base"); + String odlUser = getProperty("sdnc.odl.user"); + String odlPassword = getProperty("sdnc.odl.password"); + LOG.info("POST CM-NOTIFY-API Request " + rpcMsgbody); + if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) { + SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + "/" + sdncEndpoint, odlUser, odlPassword); + + conn.send("POST", "application/json", rpcMsgbody); + } else { + LOG.warn("Unable to POST CM-NOTIFY-API message. SDNC URL not available. body:\n" + rpcMsgbody); + } + } catch (Exception e) { + LOG.error("Unable to process message", e); + } + } +} diff --git a/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/DmaapListener.java b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/DmaapListener.java new file mode 100755 index 000000000..18c00d563 --- /dev/null +++ b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/DmaapListener.java @@ -0,0 +1,185 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import java.io.File; +import java.io.FileInputStream; +import java.util.LinkedList; +import java.util.List; +import java.util.Properties; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DmaapListener { + + private static final String DMAAP_LISTENER_PROPERTIES = "dmaap-listener.properties"; + private static final String DMAAP_LISTENER_PROPERTIES_DIR = "/opt/onap/ccsdk/data/properties"; + private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR"; + private static final Logger LOG = LoggerFactory.getLogger(DmaapListener.class); + + public static void main(String[] args) { + + Properties properties = new Properties(); + String propFileName = DMAAP_LISTENER_PROPERTIES; + String propPath = null; + String propDir = System.getProperty(SDNC_CONFIG_DIR); + if(propDir == null) { + propDir = System.getenv(SDNC_CONFIG_DIR); + LOG.debug(SDNC_CONFIG_DIR + " read from environment variable with value " + propDir); + } + List<SdncDmaapConsumer> consumers = new LinkedList<>(); + + if (args.length > 0) { + propFileName = args[0]; + } + + if (propDir == null) { + propDir = DMAAP_LISTENER_PROPERTIES_DIR; + } + + if (!propFileName.startsWith("/")) { + propPath = propDir + "/" + propFileName; + } + + if (propPath != null) { + properties = loadProperties(propPath, properties); + + String subscriptionStr = properties.getProperty("subscriptions"); + + boolean threadsRunning = false; + + LOG.debug("Dmaap subscriptions : " + subscriptionStr); + + if (subscriptionStr != null) { + threadsRunning = handleSubscriptions(subscriptionStr, propDir, properties, consumers); + } + + while (threadsRunning) { + threadsRunning = updateThreadState(consumers); + if (!threadsRunning) { + break; + } + + try { + Thread.sleep(10000); + } catch (InterruptedException e) { + LOG.error(e.getLocalizedMessage(), e); + } + } + + LOG.info("No listener threads running - exiting"); + } + } + + private static boolean updateThreadState(List<SdncDmaapConsumer> consumers) { + boolean threadsRunning = false; + for (SdncDmaapConsumer consumer : consumers) { + if (consumer.isRunning()) { + threadsRunning = true; + } + } + return threadsRunning; + } + + static Properties loadProperties(String propPath, Properties properties) { + File propFile = new File(propPath); + + if (!propFile.canRead()) { + LOG.error("Cannot read properties file " + propPath); + System.exit(1); + } + + try (FileInputStream in = new FileInputStream(propFile)) { + properties.load(in); + } catch (Exception e) { + LOG.error("Caught exception loading properties from " + propPath, e); + System.exit(1); + } + return properties; + } + + static boolean handleSubscriptions(String subscriptionStr, String propDir, Properties properties, + List<SdncDmaapConsumer> consumers) { + String[] subscriptions = subscriptionStr.split(";"); + + for (String subscription1 : subscriptions) { + String[] subscription = subscription1.split(":"); + String consumerClassName = subscription[0]; + String propertyPath = subscription[1]; + + LOG.debug(String.format("Handling subscription [%s,%s]", consumerClassName, propertyPath)); + + if (propertyPath == null) { + LOG.error(String.format("Invalid subscription (%s) property file missing", subscription1)); + continue; + } + + if (!propertyPath.startsWith("/")) { + propertyPath = propDir + "/" + propertyPath; + } + + Class<?> consumerClass = null; + + try { + consumerClass = Class.forName(consumerClassName); + } catch (Exception e) { + LOG.error("Could not find DMaap consumer class {}", consumerClassName, e); + } + + if (consumerClass != null) { + handleConsumerClass(consumerClass, consumerClassName, propertyPath, + properties, consumers); + } + } + return !consumers.isEmpty(); + } + + private static boolean handleConsumerClass(Class<?> consumerClass, String consumerClassName, String propertyPath, + Properties properties, List<SdncDmaapConsumer> consumers) { + + SdncDmaapConsumer consumer = null; + + try { + consumer = (SdncDmaapConsumer) consumerClass.newInstance(); + } catch (Exception e) { + LOG.error("Could not create consumer from class " + consumerClassName, e); + } + + if (consumer != null) { + LOG.debug(String.format("Initializing consumer %s(%s)", consumerClassName, propertyPath)); + consumer.init(properties, propertyPath); + + if (consumer.isReady()) { + Thread consumerThread = new Thread(consumer); + consumerThread.start(); + consumers.add(consumer); + + LOG.info(String.format("Started consumer thread (%s : %s)", consumerClassName, + propertyPath)); + return true; + } else { + LOG.debug(String.format("Consumer %s is not ready", consumerClassName)); + } + } + return false; + } +} diff --git a/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/DummyDmaapConsumer.java b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/DummyDmaapConsumer.java new file mode 100644 index 000000000..57fcd8809 --- /dev/null +++ b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/DummyDmaapConsumer.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DummyDmaapConsumer extends SdncDmaapConsumerImpl { + + private static final Logger LOG = LoggerFactory + .getLogger(DummyDmaapConsumer.class); + + @Override + public void processMsg(String msg) { + LOG.info("Consumed message: \n"+msg); + } + +} diff --git a/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/InvalidMessageException.java b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/InvalidMessageException.java new file mode 100644 index 000000000..cab8b901c --- /dev/null +++ b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/InvalidMessageException.java @@ -0,0 +1,37 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +public class InvalidMessageException extends Exception { + + public InvalidMessageException() { + super(); + } + + public InvalidMessageException(String msg) { + super(msg); + } + + public InvalidMessageException(String msg, Throwable t) { + super(msg, t); + } +} diff --git a/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClient.java b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClient.java new file mode 100755 index 000000000..2a9e0b145 --- /dev/null +++ b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClient.java @@ -0,0 +1,219 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URI; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import java.util.Properties; +import java.util.concurrent.TimeUnit; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import javax.ws.rs.client.Invocation; +import javax.ws.rs.client.Invocation.Builder; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.UriBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/* + * jax-rs based client to build message router consumers + */ +public class MessageRouterHttpClient implements SdncDmaapConsumer { + private static final Logger Log = LoggerFactory.getLogger(MessageRouterHttpClient.class); + + protected Boolean isReady = false; + protected Boolean isRunning = false; + protected Client client; + protected URI uri; + protected Invocation getMessages; + protected Integer fetchPause; + protected Properties properties; + protected final String DEFAULT_CONNECT_TIMEOUT_SECONDS = "30"; + protected final String DEFAULT_READ_TIMEOUT_MINUTES = "3"; + protected final String DEFAULT_TIMEOUT_QUERY_PARAM_VALUE = "15000"; + protected final String DEFAULT_LIMIT = null; + protected final String DEFAULT_FETCH_PAUSE = "5000"; + + public MessageRouterHttpClient() { + + } + + @Override + public void run() { + if (isReady) { + isRunning = true; + while (isRunning) { + try { + Response response = getMessages.invoke(); + Log.info("GET " + uri + " returned http status " + response.getStatus()); + String entity = response.readEntity(String.class); + if (response.getStatus() < 300) { + if (entity.contains("{")) { + // Get rid of opening [" + entity = entity.substring(2); + // Get rid of closing "] + entity = entity.substring(0, entity.length() - 2); + // This replacement effectively un-escapes the JSON + for (String message : entity.split("\",\"")) { + try { + processMsg(message.replace("\\\"", "\"")); + } catch (InvalidMessageException e) { + Log.error("Message could not be processed", e); + } + } + } else { + if (entity.length() < 1) { + Log.info("GET was successful, but the server returned an empty message body."); + } else { + Log.info( + "GET was successful, but entity is not valid JSON. Message body will be logged, but not processed"); + Log.info(entity); + } + } + } else { + Log.info("GET failed, message body will be logged, but not processed."); + Log.info(entity); + } + } catch (Exception e) { + Log.error("GET " + uri + " failed.", e); + } finally { + Log.info("Pausing " + fetchPause + " milliseconds before fetching from " + uri + " again."); + try { + Thread.sleep(fetchPause); + } catch (InterruptedException e) { + Log.error("Could not sleep thread", e); + Thread.currentThread().interrupt(); + } + } + } + } + } + + @Override + public void init(Properties baseProperties, String consumerPropertiesPath) { + try { + baseProperties.load(new FileInputStream(new File(consumerPropertiesPath))); + processProperties(baseProperties); + } catch (FileNotFoundException e) { + Log.error("FileNotFoundException while reading consumer properties", e); + } catch (IOException e) { + Log.error("IOException while reading consumer properties", e); + } + } + + protected void processProperties(Properties properties) { + this.properties = properties; + String username = properties.getProperty("username"); + String password = properties.getProperty("password"); + String topic = properties.getProperty("topic"); + String group = properties.getProperty("group"); + String host = properties.getProperty("host"); + String id = properties.getProperty("id"); + + String filter = properties.getProperty("filter"); + if (filter != null) { + if (filter.length() > 0) { + try { + filter = URLEncoder.encode(filter, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + Log.error("Filter could not be encoded, setting to null", e); + filter = null; + } + } else { + filter = null; + } + } + + String limitString = properties.getProperty("limit", DEFAULT_LIMIT); + Integer limit = null; + if (limitString != null && limitString.length() > 0) { + limit = Integer.valueOf(limitString); + } + + Integer timeoutQueryParamValue = + Integer.valueOf(properties.getProperty("timeout", DEFAULT_TIMEOUT_QUERY_PARAM_VALUE)); + Integer connectTimeoutSeconds = Integer + .valueOf(properties.getProperty("connectTimeoutSeconds", DEFAULT_CONNECT_TIMEOUT_SECONDS)); + Integer readTimeoutMinutes = + Integer.valueOf(properties.getProperty("readTimeoutMinutes", DEFAULT_READ_TIMEOUT_MINUTES)); + this.client = getClient(connectTimeoutSeconds, readTimeoutMinutes); + this.uri = buildUri(topic, group, id, host, timeoutQueryParamValue, limit, filter); + Builder builder = client.target(uri).request("application/json"); + if (username != null && password != null && username.length() > 0 && password.length() > 0) { + String authorizationString = buildAuthorizationString(username, password); + builder.header("Authorization", authorizationString); + } + + this.getMessages = builder.buildGet(); + this.fetchPause = Integer.valueOf(properties.getProperty("fetchPause",DEFAULT_FETCH_PAUSE)); + this.isReady = true; + } + + @Override + public void processMsg(String msg) throws InvalidMessageException { + System.out.println(msg); + } + + @Override + public boolean isReady() { + return isReady; + } + + @Override + public boolean isRunning() { + return isRunning; + } + + protected String buildAuthorizationString(String userName, String password) { + String basicAuthString = userName + ":" + password; + basicAuthString = Base64.getEncoder().encodeToString(basicAuthString.getBytes()); + return "Basic " + basicAuthString; + } + + protected Client getClient(Integer connectTimeoutSeconds, Integer readTimeoutMinutes) { + ClientBuilder clientBuilder = ClientBuilder.newBuilder(); + clientBuilder.connectTimeout(connectTimeoutSeconds, TimeUnit.SECONDS); + clientBuilder.readTimeout(readTimeoutMinutes, TimeUnit.MINUTES); + return clientBuilder.build(); + } + + protected URI buildUri(String topic, String consumerGroup, String consumerId, String host, Integer timeout, + Integer limit, String filter) { + UriBuilder builder = UriBuilder.fromPath("http://" + host + "/events/{topic}/{consumerGroup}/{consumderId}"); + builder.queryParam("timeout", timeout); + if (limit != null) { + builder.queryParam("limit", limit); + } + if (filter != null) { + builder.queryParam("filter", filter); + } + return builder.build(topic, consumerGroup, consumerId); + } + +} diff --git a/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientJdk.java b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientJdk.java new file mode 100644 index 000000000..a6744045d --- /dev/null +++ b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientJdk.java @@ -0,0 +1,222 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import java.util.Properties; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/* + * java.net based client to build message router consumers + */ +public class MessageRouterHttpClientJdk implements SdncDmaapConsumer { + private static final Logger Log = LoggerFactory.getLogger(MessageRouterHttpClientJdk.class); + + protected Boolean isReady = false; + protected Boolean isRunning = false; + protected URL url; + protected Integer fetchPause; + protected Properties properties; + protected final String DEFAULT_CONNECT_TIMEOUT = "30000"; + protected final String DEFAULT_READ_TIMEOUT = "180000"; + protected final String DEFAULT_TIMEOUT_QUERY_PARAM_VALUE = "15000"; + protected final String DEFAULT_LIMIT = null; + protected final String DEFAULT_FETCH_PAUSE = "5000"; + + private String authorizationString; + protected Integer connectTimeout; + protected Integer readTimeout; + protected String topic; + + public MessageRouterHttpClientJdk() {} + + @Override + public void run() { + if (isReady) { + isRunning = true; + while (isRunning) { + HttpURLConnection httpUrlConnection = null; + try { + httpUrlConnection = buildHttpURLConnection(); + httpUrlConnection.connect(); + int status = httpUrlConnection.getResponseCode(); + Log.info("GET " + url + " returned http status " + status); + if (status < 300) { + BufferedReader br = + new BufferedReader(new InputStreamReader(httpUrlConnection.getInputStream())); + StringBuilder sb = new StringBuilder(); + String line; + while ((line = br.readLine()) != null) { + sb.append(line + "\n"); + } + br.close(); + String responseBody = sb.toString(); + if (responseBody.contains("{")) { + // Get rid of opening [" entity = + responseBody = responseBody.substring(2); + // Get rid of closing "] + responseBody = responseBody.substring(0, responseBody.length() - 2); + // Split the json array into individual elements to process + for (String message : responseBody.split("\",\"")) { + // unescape the json + message = message.replace("\\\"", "\""); + // Topic names cannot contain periods + processMsg(message); + } + } else { + Log.info("Entity doesn't appear to contain JSON elements, logging body"); + Log.info(responseBody); + } + } + } catch (Exception e) { + Log.error("GET " + url + " failed.", e); + } finally { + if (httpUrlConnection != null) { + httpUrlConnection.disconnect(); + } + Log.info("Pausing " + fetchPause + " milliseconds before fetching from " + url + " again."); + try { + Thread.sleep(fetchPause); + } catch (InterruptedException e) { + Log.error("Could not sleep thread", e); + Thread.currentThread().interrupt(); + } + } + } + } + } + + @Override + public void init(Properties baseProperties, String consumerPropertiesPath) { + try { + baseProperties.load(new FileInputStream(new File(consumerPropertiesPath))); + processProperties(baseProperties); + } catch (FileNotFoundException e) { + Log.error("FileNotFoundException while reading consumer properties", e); + } catch (IOException e) { + Log.error("IOException while reading consumer properties", e); + } + } + + protected void processProperties(Properties properties) throws MalformedURLException { + this.properties = properties; + String username = properties.getProperty("username"); + String password = properties.getProperty("password"); + topic = properties.getProperty("topic"); + String group = properties.getProperty("group"); + String host = properties.getProperty("host"); + String id = properties.getProperty("id"); + + String filter = properties.getProperty("filter"); + if (filter != null) { + if (filter.length() > 0) { + try { + filter = URLEncoder.encode(filter, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException e) { + Log.error("Couldn't encode filter string", e); + } + } else { + filter = null; + } + } + + String limitString = properties.getProperty("limit", DEFAULT_LIMIT); + Integer limit = null; + if (limitString != null && limitString.length() > 0) { + limit = Integer.valueOf(limitString); + } + + Integer timeoutQueryParamValue = + Integer.valueOf(properties.getProperty("timeout", DEFAULT_TIMEOUT_QUERY_PARAM_VALUE)); + connectTimeout = Integer.valueOf(properties.getProperty("connectTimeoutSeconds", DEFAULT_CONNECT_TIMEOUT)); + readTimeout = Integer.valueOf(properties.getProperty("readTimeoutMinutes", DEFAULT_READ_TIMEOUT)); + if (username != null && password != null && username.length() > 0 && password.length() > 0) { + authorizationString = buildAuthorizationString(username, password); + } + String urlString = buildlUrlString(topic, group, id, host, timeoutQueryParamValue, limit, filter); + this.url = new URL(urlString); + this.fetchPause = Integer.valueOf(properties.getProperty("fetchPause", DEFAULT_FETCH_PAUSE)); + this.isReady = true; + } + + public void processMsg(String msg) { + Log.info(msg); + } + + protected String buildAuthorizationString(String userName, String password) { + String basicAuthString = userName + ":" + password; + basicAuthString = Base64.getEncoder().encodeToString(basicAuthString.getBytes()); + return "Basic " + basicAuthString; + } + + protected String buildlUrlString(String topic, String consumerGroup, String consumerId, String host, + Integer timeout, Integer limit, String filter) { + StringBuilder sb = new StringBuilder(); + sb.append("http://" + host + "/events/" + topic + "/" + consumerGroup + "/" + consumerId); + sb.append("?timeout=" + timeout); + + if (limit != null) { + sb.append("&limit=" + limit); + } + if (filter != null) { + sb.append("&filter=" + filter); + } + return sb.toString(); + } + + @Override + public boolean isReady() { + return isReady; + } + + @Override + public boolean isRunning() { + return isRunning; + } + + protected HttpURLConnection buildHttpURLConnection() throws IOException { + HttpURLConnection httpUrlConnection = (HttpURLConnection) url.openConnection(); + if (authorizationString != null) { + httpUrlConnection.setRequestProperty("Authorization", authorizationString); + } + httpUrlConnection.setRequestMethod("GET"); + httpUrlConnection.setRequestProperty("Accept", "application/json"); + httpUrlConnection.setUseCaches(false); + httpUrlConnection.setConnectTimeout(connectTimeout); + httpUrlConnection.setReadTimeout(readTimeout); + return httpUrlConnection; + } + +} diff --git a/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/OofPciPocDmaapConsumers.java b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/OofPciPocDmaapConsumers.java new file mode 100644 index 000000000..9ff6fd616 --- /dev/null +++ b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/OofPciPocDmaapConsumers.java @@ -0,0 +1,564 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; +import java.time.Instant; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.VelocityEngine; +import org.json.JSONArray; +import org.json.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class OofPciPocDmaapConsumers extends SdncDmaapConsumerImpl { + + private static final Logger LOG = LoggerFactory.getLogger(OofPciPocDmaapConsumers.class); + private static final String SDNC_ENDPOINT = "SDNC.endpoint"; + private static final String TEMPLATE = "SDNC.template"; + private static final String DMAAPLISTENERROOT = "DMAAPLISTENERROOT"; + private static final String UTF_8 = "UTF-8"; + + private static final String PARAMETER_NAME = "parameter-name"; + private static final String STRING_VALUE = "string-value"; + private static final String PHYSICAL_CELL_ID_INPUT_FAP_SERVICE = "configuration-phy-cell-id-input.fap-service"; + private static final String EVENT_HEADER = "event-header"; + private static final String ACTION = "Action"; + private static final String CONFIGURATIONS = "Configurations"; + private static final String MODIFY_CONFIG = "ModifyConfig"; + private static final String DATA = "data"; + private static final String FAP_SERVICE = "FAPService"; + + private static final String PAYLOAD = "Payload"; + private static final String PCI_CHANGES_MAP_FILE_NAME = "pci-changes-from-policy-to-sdnr"; + private static final String SLI_PARAMETERS = "sli_parameters"; + private static final String RPC_NAME = "rpc-name"; + private static final String BODY = "body"; + private static final String INPUT = "input"; + private static final String COMMON_HEADER = "CommonHeader"; + private static final String TIME_STAMP = "TimeStamp"; + private static final String REQUEST_ID = "RequestID"; + private static final String SUB_REQUEST_ID = "SubRequestID"; + + private static final String TIME_STAMP_FOR_SLI = "timeStamp"; + private static final String REQUEST_ID_FOR_SLI = "requestID"; + private static final String SUB_REQUEST_ID_FOR_SLI = "subRequestID"; + + private static final String CONFIGURATION_PHY_CELL_ID_INPUT = "configuration-phy-cell-id-input."; + + private static final String EMPTY = ""; + private static final String ESCAPE_SEQUENCE_QUOTES = "\""; + + private static final String GENERIC_NEIGHBOR_CONFIGURATION_INPUT = "generic-neighbor-configuration-input."; + private static final String GENERIC_NEIGHBOR_CONFIGURATION_INPUT_NEIGHBOR_LIST_IN_USE = GENERIC_NEIGHBOR_CONFIGURATION_INPUT.concat("neighbor-list-in-use"); + private static final String MODIFY_CONFIG_ANR = "ModifyConfigANR"; + private static final String ANR_CHANGES_MAP_FILE_NAME = "anr-changes-from-policy-to-sdnr"; + + private String rootDir; + + protected VelocityEngine velocityEngine; + + public OofPciPocDmaapConsumers() { + velocityEngine = new VelocityEngine(); + Properties props = new Properties(); + rootDir = System.getenv(DMAAPLISTENERROOT); + + if ((rootDir == null) || (rootDir.length() == 0)) { + rootDir = "/opt/onap/sdnc/dmaap-listener/lib/"; + } + else { + rootDir = rootDir + "/lib/"; + } + + props.put("file.resource.loader.path", rootDir); + velocityEngine.init(props); + } + + /* + * for testing purposes + */ + OofPciPocDmaapConsumers(Properties props) { + velocityEngine = new VelocityEngine(); + velocityEngine.init(props); + } + + protected String publish(String templatePath, String jsonString, JsonNode configurationsOrDataNode, boolean invokePciChangesPublish, boolean invokeAnrChangesPublish) throws IOException, InvalidMessageException + { + if (invokePciChangesPublish){ + return publishPciChangesFromPolicyToSDNR(templatePath, configurationsOrDataNode, jsonString); + } else if (invokeAnrChangesPublish){ + return publishANRChangesFromPolicyToSDNR(templatePath, configurationsOrDataNode, jsonString); + } else { + return publishFullMessage(templatePath, jsonString); + } + } + + private String publishFullMessage(String templatePath, String jsonString) throws IOException + { + JSONObject jsonObj = new JSONObject(jsonString); + VelocityContext context = new VelocityContext(); + for(Object key : jsonObj.keySet()) + { + context.put((String)key, jsonObj.get((String)key)); + } + + String id = jsonObj.getJSONObject(EVENT_HEADER).get("id").toString(); + context.put("req_id", id); + + context.put("curr_time", Instant.now()); + + ObjectMapper oMapper = new ObjectMapper(); + + String rpcMsgbody = oMapper.writeValueAsString(jsonString); + context.put("full_message", rpcMsgbody); + + Writer writer = new StringWriter(); + velocityEngine.mergeTemplate(templatePath, UTF_8, context, writer); + writer.flush(); + + return writer.toString(); + } + + private String publishANRChangesFromPolicyToSDNR(String templatePath, JsonNode dataNode, String msg) throws IOException, InvalidMessageException + { + VelocityContext context = new VelocityContext(); + + String RPC_NAME_KEY_IN_VT = "rpc_name"; + String RPC_NAME_VALUE_IN_VT = "generic-neighbor-configuration"; + + String CELL_CONFIG = "CellConfig"; + String ALIAS_LABEL = "alias"; + String LTE = "LTE"; + String RAN = "RAN"; + String LTE_CELL = "LTECell"; + String NEIGHBOR_LIST_IN_USE = "NeighborListInUse"; + + JSONObject numberOfEntries = new JSONObject(); + JSONObject alias = new JSONObject(); + JSONArray sliParametersArray = new JSONArray(); + + ObjectMapper oMapper = new ObjectMapper(); + + JsonNode dmaapMessageRootNode; + try { + dmaapMessageRootNode = oMapper.readTree(msg); + } catch (Exception e) { + throw new InvalidMessageException("Cannot parse json object", e); + } + + JsonNode commonHeader = dmaapMessageRootNode.get(BODY).get(INPUT).get(COMMON_HEADER); + + JsonNode timeStamp = commonHeader.get(TIME_STAMP); + + JsonNode requestID = commonHeader.get(REQUEST_ID); + + JsonNode subRequestID = commonHeader.get(SUB_REQUEST_ID); + + sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT+TIME_STAMP_FOR_SLI).put(STRING_VALUE,timeStamp)); + + sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT+REQUEST_ID_FOR_SLI).put(STRING_VALUE,requestID)); + + sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT+SUB_REQUEST_ID_FOR_SLI).put(STRING_VALUE,subRequestID)); + + String aliasValue = dataNode.get(DATA).get(FAP_SERVICE).get(ALIAS_LABEL).textValue(); + + JsonNode nbrListInUse = dataNode.get(DATA).get(FAP_SERVICE).get(CELL_CONFIG).get(LTE).get(RAN).get(NEIGHBOR_LIST_IN_USE).get(LTE_CELL); + + int entryCount = 0; + + if(nbrListInUse.isArray()) { + for(JsonNode lteCell:nbrListInUse) { + sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT_NEIGHBOR_LIST_IN_USE+"["+entryCount+"]."+"plmnid") + .put(STRING_VALUE, lteCell.get("PLMNID").toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY))); + sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT_NEIGHBOR_LIST_IN_USE+"["+entryCount+"]."+"cid") + .put(STRING_VALUE, lteCell.get("CID").toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY))); + sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT_NEIGHBOR_LIST_IN_USE+"["+entryCount+"]."+"phy-cell-id") + .put(STRING_VALUE, lteCell.get("PhyCellID").toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY))); + sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT_NEIGHBOR_LIST_IN_USE+"["+entryCount+"]."+"pnf-name") + .put(STRING_VALUE, lteCell.get("PNFName").toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY))); + sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT_NEIGHBOR_LIST_IN_USE+"["+entryCount+"]."+"blacklisted") + .put(STRING_VALUE, lteCell.get("Blacklisted").toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY))); + + entryCount++; + } + + alias.put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT+ALIAS_LABEL); + alias.put(STRING_VALUE, aliasValue); + + numberOfEntries.put(PARAMETER_NAME, GENERIC_NEIGHBOR_CONFIGURATION_INPUT+"lte-cell-number-of-entries"); + numberOfEntries.put(STRING_VALUE, entryCount); + + sliParametersArray.put(alias); + sliParametersArray.put(numberOfEntries); + + context.put(SLI_PARAMETERS, sliParametersArray); + + context.put(RPC_NAME_KEY_IN_VT, RPC_NAME_VALUE_IN_VT); + + Writer writer = new StringWriter(); + velocityEngine.mergeTemplate(templatePath, UTF_8, context, writer); + writer.flush(); + + return writer.toString(); + + }else { + throw new InvalidMessageException("nbrListInUse is not of Type Array. Could not read neighbor list elements"); + } + + } + + private String publishPciChangesFromPolicyToSDNR(String templatePath, JsonNode configurationsJsonNode, String msg) throws IOException, InvalidMessageException + { + String RPC_NAME_KEY_IN_VT = "rpc_name"; + String RPC_NAME_VALUE_IN_VT = "configuration-phy-cell-id"; + String ALIAS = "alias"; + String X0005b9Lte = "X0005b9Lte"; + + VelocityContext context = new VelocityContext(); + + JSONObject numberOfEntries = new JSONObject(); + JSONArray sliParametersArray = new JSONArray(); + + JsonNode configurations = configurationsJsonNode.get(CONFIGURATIONS); + + ObjectMapper oMapper = new ObjectMapper(); + + JsonNode dmaapMessageRootNode; + try { + dmaapMessageRootNode = oMapper.readTree(msg); + } catch (Exception e) { + throw new InvalidMessageException("Cannot parse json object", e); + } + + JsonNode commonHeader = dmaapMessageRootNode.get(BODY).get(INPUT).get(COMMON_HEADER); + + JsonNode timeStamp = commonHeader.get(TIME_STAMP); + + JsonNode requestID = commonHeader.get(REQUEST_ID); + + JsonNode subRequestID = commonHeader.get(SUB_REQUEST_ID); + + sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, CONFIGURATION_PHY_CELL_ID_INPUT+TIME_STAMP_FOR_SLI).put(STRING_VALUE,timeStamp)); + + sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, CONFIGURATION_PHY_CELL_ID_INPUT+REQUEST_ID_FOR_SLI).put(STRING_VALUE,requestID)); + + sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, CONFIGURATION_PHY_CELL_ID_INPUT+SUB_REQUEST_ID_FOR_SLI).put(STRING_VALUE,subRequestID)); + + int entryCount = 0; + + if(configurations.isArray()) { + for(JsonNode dataNode:configurations) { + sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, PHYSICAL_CELL_ID_INPUT_FAP_SERVICE+"["+entryCount+"]."+ALIAS) + .put(STRING_VALUE, dataNode.get(DATA).get(FAP_SERVICE).get(ALIAS).toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY))); + sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, PHYSICAL_CELL_ID_INPUT_FAP_SERVICE+"["+entryCount+"]."+"cid") + .put(STRING_VALUE, dataNode.get(DATA).get(FAP_SERVICE).get("CellConfig").get("LTE").get("RAN").get("Common").get("CellIdentity").toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY))); + sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, PHYSICAL_CELL_ID_INPUT_FAP_SERVICE+"["+entryCount+"]."+"phy-cell-id-in-use") + .put(STRING_VALUE, dataNode.get(DATA).get(FAP_SERVICE).get(X0005b9Lte).get("phyCellIdInUse").toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY))); + sliParametersArray.put(new JSONObject().put(PARAMETER_NAME, PHYSICAL_CELL_ID_INPUT_FAP_SERVICE+"["+entryCount+"]."+"pnf-name") + .put(STRING_VALUE, dataNode.get(DATA).get(FAP_SERVICE).get(X0005b9Lte).get("pnfName").toString().replace(ESCAPE_SEQUENCE_QUOTES, EMPTY))); + entryCount++; + } + + numberOfEntries.put(PARAMETER_NAME, PHYSICAL_CELL_ID_INPUT_FAP_SERVICE+"-number-of-entries"); + numberOfEntries.put(STRING_VALUE, entryCount); + + sliParametersArray.put(numberOfEntries); + + context.put(SLI_PARAMETERS, sliParametersArray); + + context.put(RPC_NAME_KEY_IN_VT, RPC_NAME_VALUE_IN_VT); + + Writer writer = new StringWriter(); + velocityEngine.mergeTemplate(templatePath, UTF_8, context, writer); + writer.flush(); + + return writer.toString(); + + }else { + throw new InvalidMessageException("Configurations is not of Type Array. Could not read configuration changes"); + } + + } + + @Override + public void processMsg(String msg) throws InvalidMessageException { + + if (msg == null) { + throw new InvalidMessageException("Null message"); + } + + ObjectMapper oMapper = new ObjectMapper(); + JsonNode dmaapMessageRootNode; + try { + dmaapMessageRootNode = oMapper.readTree(msg); + } catch (Exception e) { + throw new InvalidMessageException("Cannot parse json object", e); + } + + + JsonNode rpcnameNode = dmaapMessageRootNode.get(RPC_NAME); + if(rpcnameNode == null) { + LOG.info("Unable to identify the respective consumer to invoke. Please verify the dmaap message.."); + return; + } + + String rpcname = rpcnameNode.textValue(); + + if(!MODIFY_CONFIG.toLowerCase().equals(rpcname) && !MODIFY_CONFIG_ANR.toLowerCase().equals(rpcname)) { + LOG.info("Unknown rpc name {}", rpcname); + return; + } + + if(MODIFY_CONFIG.toLowerCase().equals(rpcname)) { + invokePCIChangesConsumer(dmaapMessageRootNode, oMapper, msg); + return; + } + + if(MODIFY_CONFIG_ANR.toLowerCase().equals(rpcname)) { + invokeANRChangesConsumer(dmaapMessageRootNode, oMapper, msg); + return; + } + + } + + private void invokeANRChangesConsumer(JsonNode dmaapMessageRootNode, ObjectMapper oMapper, + String msg) throws InvalidMessageException { + JsonNode body = dmaapMessageRootNode.get(BODY); + if(body == null) { + LOG.info("Missing body node."); + return; + } + + JsonNode input = body.get(INPUT); + if(input == null) { + LOG.info("Missing input node."); + return; + } + + JsonNode action = input.get(ACTION); + if(action == null) { + LOG.info("Missing action node."); + return; + } + + if(!MODIFY_CONFIG_ANR.equals(action.textValue())) { + LOG.info("Unknown Action {}", action); + return; + } + + JsonNode payload = input.get(PAYLOAD); + if(payload == null) { + LOG.info("Missing payload node."); + return; + } + + String payloadText = payload.asText(); + + if(!payloadText.contains(CONFIGURATIONS)) { + LOG.info("Missing configurations node."); + return; + } + + JsonNode configurationsJsonNode; + try { + configurationsJsonNode = oMapper.readTree(payloadText); + } catch (Exception e) { + throw new InvalidMessageException("Cannot parse payload value", e); + } + + String mapFilename = rootDir + ANR_CHANGES_MAP_FILE_NAME + ".map"; + Map<String, String> fieldMap = loadMap(mapFilename); + if (fieldMap == null) { + return; + } + + if (!fieldMap.containsKey(SDNC_ENDPOINT)) { + return; + } + String sdncEndpoint = fieldMap.get(SDNC_ENDPOINT); + + if (!fieldMap.containsKey(TEMPLATE)) { + throw new InvalidMessageException("No SDNC template known for message "); + } + String templateName = fieldMap.get(TEMPLATE); + + JsonNode configurations = configurationsJsonNode.get(CONFIGURATIONS); + + if(configurations.isArray()) { + for(JsonNode dataNode:configurations) { + if(dataNode.get(DATA).get(FAP_SERVICE) == null) { + LOG.info("Could not make a rpc call. Missing fapService node for dataNode element::", dataNode.textValue()); + }else { + buildAndInvokeANRChangesRPC(sdncEndpoint, templateName,msg, dataNode); + } + } + }else { + throw new InvalidMessageException("Configurations is not of Type Array. Could not read configuration changes"); + } + } + + private void invokePCIChangesConsumer(JsonNode dmaapMessageRootNode, ObjectMapper oMapper, + String msg) throws InvalidMessageException { + JsonNode body = dmaapMessageRootNode.get(BODY); + if(body == null) { + LOG.info("Missing body node."); + return; + } + + JsonNode input = body.get(INPUT); + if(input == null) { + LOG.info("Missing input node."); + return; + } + + JsonNode action = input.get(ACTION); + if(action == null) { + LOG.info("Missing action node."); + return; + } + + + if(!MODIFY_CONFIG.equals(action.textValue())) { + LOG.info("Unknown Action {}", action); + return; + } + + JsonNode payload = input.get(PAYLOAD); + if(payload == null) { + LOG.info("Missing payload node."); + return; + } + + String configurations = payload.asText(); + + if(!configurations.contains(CONFIGURATIONS)) { + LOG.info("Missing configurations node."); + return; + } + + JsonNode configurationsJsonNode; + try { + configurationsJsonNode = oMapper.readTree(configurations); + } catch (Exception e) { + throw new InvalidMessageException("Cannot parse payload value", e); + } + + String mapFilename = rootDir + PCI_CHANGES_MAP_FILE_NAME + ".map"; + Map<String, String> fieldMap = loadMap(mapFilename); + if (fieldMap == null) { + return; + } + + if (!fieldMap.containsKey(SDNC_ENDPOINT)) { + return; + } + String sdncEndpoint = fieldMap.get(SDNC_ENDPOINT); + + if (!fieldMap.containsKey(TEMPLATE)) { + throw new InvalidMessageException("No SDNC template known for message "); + } + String templateName = fieldMap.get(TEMPLATE); + + buildAndInvokePCIChangesRPC(sdncEndpoint, templateName, msg, configurationsJsonNode); + } + + private void buildAndInvokePCIChangesRPC(String sdncEndpoint, String templateName, String msg, JsonNode configurationsOrDataNode) { + try { + String rpcMsgbody = publish(templateName, msg, configurationsOrDataNode, true, false); + String odlUrlBase = getProperty("sdnc.odl.url-base"); + String odlUser = getProperty("sdnc.odl.user"); + String odlPassword = getProperty("sdnc.odl.password"); + + if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) { + SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + "/" + sdncEndpoint, odlUser, odlPassword); + + conn.send("POST", "application/json", rpcMsgbody); + } else { + LOG.info("POST message body would be:\n" + rpcMsgbody); + } + } catch (Exception e) { + LOG.error("Unable to process message", e); + } + } + + private void buildAndInvokeANRChangesRPC(String sdncEndpoint, String templateName, String msg, JsonNode configurationsOrDataNode) { + try { + String rpcMsgbody = publish(templateName, msg, configurationsOrDataNode, false, true); + String odlUrlBase = getProperty("sdnc.odl.url-base"); + String odlUser = getProperty("sdnc.odl.user"); + String odlPassword = getProperty("sdnc.odl.password"); + + if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) { + SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + "/" + sdncEndpoint, odlUser, odlPassword); + + conn.send("POST", "application/json", rpcMsgbody); + } else { + LOG.info("POST message body would be:\n" + rpcMsgbody); + } + } catch (Exception e) { + LOG.error("Unable to process message", e); + } + } + + private Map<String, String> loadMap(String mapFilename) { + File mapFile = new File(mapFilename); + + if (!mapFile.canRead()) { + LOG.error(String.format("Cannot read map file (%s)", mapFilename)); + return null; + } + + Map<String, String> results = new HashMap<>(); + try (BufferedReader mapReader = new BufferedReader(new FileReader(mapFile))) { + + String curLine; + + while ((curLine = mapReader.readLine()) != null) { + curLine = curLine.trim(); + + if ((curLine.length() > 0) && (!curLine.startsWith("#")) && curLine.contains("=>")) { + String[] entry = curLine.split("=>"); + if (entry.length == 2) { + results.put(entry[0].trim(), entry[1].trim()); + } + } + } + mapReader.close(); + } catch (Exception e) { + LOG.error("Caught exception reading map " + mapFilename, e); + return null; + } + + return results; + } + +} diff --git a/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncAaiDmaapConsumer.java b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncAaiDmaapConsumer.java new file mode 100644 index 000000000..f35e6f1e3 --- /dev/null +++ b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncAaiDmaapConsumer.java @@ -0,0 +1,280 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; +import java.time.Instant; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import org.apache.velocity.VelocityContext; +import org.apache.velocity.app.VelocityEngine; +import org.json.JSONArray; +import org.json.JSONObject; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class SdncAaiDmaapConsumer extends SdncDmaapConsumerImpl { + + private static final Logger LOG = LoggerFactory.getLogger(SdncAaiDmaapConsumer.class); + private static final String SDNC_ENDPOINT = "SDNC.endpoint"; + private static final String TEMPLATE = "SDNC.template"; + private static final String DMAAPLISTENERROOT = "DMAAPLISTENERROOT"; + + private static final String ESR_SYSTEM_INFO = "esr-system-info"; + private static final String RELATIONSHIP_LIST = "relationship-list"; + private static final String ESR_SYSTEM_INFO_LIST = "esr-system-info-list"; + private static final String AAI_EVENT = "AAI-EVENT"; + + private static final String EVENT_TYPE = "event-type"; + private static final String ENTITY = "entity"; + private static final String ENTITY_TYPE = "entity-type"; + private static final String EVENT_HEADER = "event-header"; + + private String rootDir; + + protected VelocityEngine velocityEngine; + + public SdncAaiDmaapConsumer() { + velocityEngine = new VelocityEngine(); + Properties props = new Properties(); + rootDir = System.getenv(DMAAPLISTENERROOT); + + if ((rootDir == null) || (rootDir.length() == 0)) { + rootDir = "/opt/onap/sdnc/dmaap-listener/lib/"; + } + else { + rootDir = rootDir + "/lib/"; + } + + props.put("file.resource.loader.path", rootDir); + velocityEngine.init(props); + } + + /* + * for testing purposes + */ + SdncAaiDmaapConsumer(Properties props) { + velocityEngine = new VelocityEngine(); + velocityEngine.init(props); + } + + protected String publish(String templatePath, String jsonString) throws IOException + { + if (templatePath.contains("esr-thirdparty-sdnc")){ + return publishEsrThirdPartySdnc(templatePath, jsonString); + } else { + return publishFullMessage(templatePath, jsonString); + } + } + + private String publishFullMessage(String templatePath, String jsonString) throws IOException + { + JSONObject jsonObj = new JSONObject(jsonString); + VelocityContext context = new VelocityContext(); + for(Object key : jsonObj.keySet()) + { + context.put((String)key, jsonObj.get((String)key)); + } + + String id = jsonObj.getJSONObject(EVENT_HEADER).get("id").toString(); + context.put("req_id", id); + + context.put("curr_time", Instant.now()); + + ObjectMapper oMapper = new ObjectMapper(); + + String rpcMsgbody = oMapper.writeValueAsString(jsonString); + context.put("full_message", rpcMsgbody); + + Writer writer = new StringWriter(); + velocityEngine.mergeTemplate(templatePath, "UTF-8", context, writer); + writer.flush(); + + return writer.toString(); + } + + private String publishEsrThirdPartySdnc(String templatePath, String jsonString) throws IOException + { + JSONObject jsonObj = new JSONObject(jsonString); + VelocityContext context = new VelocityContext(); + + JSONObject eventHeader = jsonObj.getJSONObject(EVENT_HEADER); + for(Object key : eventHeader.keySet()) + { + if (!("action").equals(key)) { + context.put(((String)key).replaceAll("-", ""), eventHeader.get((String)key)); + } else { + String action = (String) eventHeader.get((String) key); + if (("create").equalsIgnoreCase(action)) { + context.put((String)key,"Update"); + } else if (("delete").equalsIgnoreCase(action)) { + context.put((String) key, "Delete"); + } else { + throw new IOException("Action type not supported " + action); + } + } + } + + JSONObject entityObj = jsonObj.getJSONObject(ENTITY); + for(Object key : entityObj.keySet()) + { + switch((String)key) + { + case ESR_SYSTEM_INFO_LIST : + JSONArray esrSystemInfo = entityObj.getJSONObject((String)key) + .getJSONArray(ESR_SYSTEM_INFO); + + for (int i = 0; i < esrSystemInfo.length(); i++) { + JSONObject objects = esrSystemInfo.getJSONObject(i); + + for (Object name : objects.keySet()) { + context.put(((String)name).replaceAll("-", ""), + objects.get((String)name).toString()); + } + } + break; + + case RELATIONSHIP_LIST : + //convertion not required for relationship + break; + + default : + context.put(((String)key).replaceAll("-", ""), + entityObj.get((String)key).toString()); + break; + } + } + + Writer writer = new StringWriter(); + velocityEngine.mergeTemplate(templatePath, "UTF-8", context, writer); + writer.flush(); + + return writer.toString(); + } + + @Override + public void processMsg(String msg) throws InvalidMessageException { + + if (msg == null) { + throw new InvalidMessageException("Null message"); + } + + ObjectMapper oMapper = new ObjectMapper(); + JsonNode aaiRootNode; + try { + aaiRootNode = oMapper.readTree(msg); + } catch (Exception e) { + throw new InvalidMessageException("Cannot parse json object", e); + } + + JsonNode eventHeaderNode = aaiRootNode.get(EVENT_HEADER); + if(eventHeaderNode == null) { + LOG.info("Missing Event Header node."); + return; + } + JsonNode eventTypeNode = eventHeaderNode.get(EVENT_TYPE); + String eventType = eventTypeNode.textValue(); + + if(!AAI_EVENT.equals(eventType)) { + LOG.info("Unknown Event Type {}", eventType); + return; + } + + JsonNode entityTypeNode = eventHeaderNode.get(ENTITY_TYPE); + String entityType = entityTypeNode.textValue(); + + String mapFilename = rootDir + entityType + ".map"; + Map<String, String> fieldMap = loadMap(mapFilename); + if (fieldMap == null) { + return; + } + + if (!fieldMap.containsKey(SDNC_ENDPOINT)) { + return; + } + String sdncEndpoint = fieldMap.get(SDNC_ENDPOINT); + + if (!fieldMap.containsKey(TEMPLATE)) { + throw new InvalidMessageException("No SDNC template known for message " + entityType); + } + String templateName = fieldMap.get(TEMPLATE); + + try { + String rpcMsgbody = publish(templateName, msg); + String odlUrlBase = getProperty("sdnc.odl.url-base"); + String odlUser = getProperty("sdnc.odl.user"); + String odlPassword = getProperty("sdnc.odl.password"); + + if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) { + SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + "/" + sdncEndpoint, odlUser, odlPassword); + + conn.send("POST", "application/json", rpcMsgbody); + } else { + LOG.info("POST message body would be:\n" + rpcMsgbody); + } + } catch (Exception e) { + LOG.error("Unable to process message", e); + } + } + + private Map<String, String> loadMap(String mapFilename) { + File mapFile = new File(mapFilename); + + if (!mapFile.canRead()) { + LOG.error(String.format("Cannot read map file (%s)", mapFilename)); + return null; + } + + Map<String, String> results = new HashMap<>(); + try (BufferedReader mapReader = new BufferedReader(new FileReader(mapFile))) { + + String curLine; + + while ((curLine = mapReader.readLine()) != null) { + curLine = curLine.trim(); + + if ((curLine.length() > 0) && (!curLine.startsWith("#")) && curLine.contains("=>")) { + String[] entry = curLine.split("=>"); + if (entry.length == 2) { + results.put(entry[0].trim(), entry[1].trim()); + } + } + } + mapReader.close(); + } catch (Exception e) { + LOG.error("Caught exception reading map " + mapFilename, e); + return null; + } + + return results; + } + +} diff --git a/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDhcpEventConsumer.java b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDhcpEventConsumer.java new file mode 100644 index 000000000..7b68ceb63 --- /dev/null +++ b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDhcpEventConsumer.java @@ -0,0 +1,130 @@ +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.sql.SQLException; +import java.util.Properties; +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class SdncDhcpEventConsumer extends SdncDmaapConsumerImpl { + private static final Logger LOG = LoggerFactory.getLogger(SdncDhcpEventConsumer.class); + + private static final String MAC_ADDR_TAG = "macaddr"; + private static final String MSG_NAME_TAG = "msg_name"; + private static final String IP_ADDR_TAG = "yiaddr"; + + private static DBResourceManager jdbcDataSource = null; + private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR"; + + private class MissingDhcpAttributeException extends InvalidMessageException { + + public MissingDhcpAttributeException(String fieldName) { + super("Invalid DHCP event - missing " + fieldName + " attribute"); + } + } + + private static void setJdbcDataSource() throws IOException { + + String propPath; + String propDir = System.getenv(SDNC_CONFIG_DIR); + if (propDir == null) { + propDir = "/opt/onap/sdnc/data/properties"; + } + propPath = propDir + "/dblib.properties"; + File propFile = new File(propPath); + + if (!propFile.exists()) { + + throw new FileNotFoundException("Missing configuration properties file : " + propFile); + } + + Properties props = new Properties(); + props.load(new FileInputStream(propFile)); + + setJdbcDataSource(new DBResourceManager(props)); + + } + + static void setJdbcDataSource(DBResourceManager dbMgr) { + + jdbcDataSource = dbMgr; + + if (jdbcDataSource.isActive()) { + LOG.warn("DBLIB: JDBC DataSource has been initialized."); + } else { + LOG.warn("DBLIB: JDBC DataSource did not initialize successfully."); + } + } + + @Override + public void processMsg(String msg) throws InvalidMessageException { + if (msg == null) { + throw new InvalidMessageException("Null message"); + } + + ObjectMapper oMapper = new ObjectMapper(); + + JsonNode dhcpRootNode; + String msgName; + String macAddr; + String ipAddr; + + try { + dhcpRootNode = oMapper.readTree(msg); + + } catch (IOException e) { + throw new InvalidMessageException("Cannot parse json object", e); + } + + JsonNode msgNameNode = dhcpRootNode.get(MSG_NAME_TAG); + if (msgNameNode != null) { + msgName = msgNameNode.textValue(); + + } else { + throw new MissingDhcpAttributeException(MSG_NAME_TAG); + } + + JsonNode macAddrNode = dhcpRootNode.get(MAC_ADDR_TAG); + if (macAddrNode != null) { + macAddr = macAddrNode.textValue(); + + } else { + throw new MissingDhcpAttributeException(MAC_ADDR_TAG); + } + + JsonNode ipAddrNode = dhcpRootNode.get(IP_ADDR_TAG); + if (ipAddrNode != null) { + ipAddr = ipAddrNode.textValue(); + + } else { + throw new MissingDhcpAttributeException(IP_ADDR_TAG); + } + + LOG.debug("Got DHCP event : msg name {}; mac addr {}; ip addr {}", msgName, macAddr, ipAddr); + + if (jdbcDataSource == null) { + try { + setJdbcDataSource(); + } catch (IOException e) { + LOG.error("Could not create JDBC connection", e); + return; + } + } + + try { + + jdbcDataSource.writeData("INSERT INTO DHCP_MAP(mac_addr, ip_addr) VALUES('" + macAddr + "','" + ipAddr + "') ON DUPLICATE KEY UPDATE ip_addr = '"+ipAddr+"'", null, null); + + } catch (SQLException e) { + LOG.error("Could not insert DHCP event data into the database ", e); + } + + } + +} diff --git a/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDmaapConsumer.java b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDmaapConsumer.java new file mode 100644 index 000000000..3fc769d35 --- /dev/null +++ b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDmaapConsumer.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import java.util.Properties; + +public abstract interface SdncDmaapConsumer extends Runnable { + public abstract void init(Properties baseProperties, String consumerPropertiesPath); + + public abstract void processMsg(String msg) throws InvalidMessageException; + + public abstract boolean isReady(); + + public abstract boolean isRunning(); +} diff --git a/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDmaapConsumerImpl.java b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDmaapConsumerImpl.java new file mode 100644 index 000000000..ee8bb4d6e --- /dev/null +++ b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncDmaapConsumerImpl.java @@ -0,0 +1,160 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import java.io.File; +import java.io.FileInputStream; +import java.util.Properties; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.att.nsa.mr.client.MRClientFactory; +import com.att.nsa.mr.client.MRConsumer; +import com.att.nsa.mr.client.response.MRConsumerResponse; + +public abstract class SdncDmaapConsumerImpl implements SdncDmaapConsumer { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncDmaapConsumer.class); + + private final String name = this.getClass().getSimpleName(); + private Properties properties = null; + private MRConsumer consumer = null; + private MRConsumerResponse consumerResponse = null; + private boolean running = false; + private boolean ready = false; + private int fetchPause = 5000; // Default pause between fetch - 5 seconds + private int timeout = 15000; // Default timeout - 15 seconds + + public SdncDmaapConsumerImpl() { + + } + + public SdncDmaapConsumerImpl(Properties properties, String propertiesPath) { + init(properties, propertiesPath); + } + + public boolean isReady() { + return ready; + } + + public boolean isRunning() { + return running; + } + + public String getProperty(String name) { + return properties.getProperty(name, ""); + } + + public void init(Properties properties, String propertiesPath) { + + try (FileInputStream in = new FileInputStream(new File(propertiesPath))) { + + LOG.debug("propertiesPath: " + propertiesPath); + this.properties = (Properties) properties.clone(); + this.properties.load(in); + + + String timeoutStr = this.properties.getProperty("timeout"); + LOG.debug("timeoutStr: " + timeoutStr); + + if ((timeoutStr != null) && (timeoutStr.length() > 0)) { + timeout = parseTimeOutValue(timeoutStr); + } + + String fetchPauseStr = this.properties.getProperty("fetchPause"); + LOG.debug("fetchPause(Str): " + fetchPauseStr); + if ((fetchPauseStr != null) && (fetchPauseStr.length() > 0)) { + fetchPause = parseFetchPause(fetchPauseStr); + } + LOG.debug("fetchPause: " + fetchPause); + + + this.consumer = MRClientFactory.createConsumer(propertiesPath); + ready = true; + } catch (Exception e) { + LOG.error("Error initializing DMaaP consumer from file " + propertiesPath, e); + } + } + + private int parseTimeOutValue(String timeoutStr) { + try { + return Integer.parseInt(timeoutStr); + } catch (NumberFormatException e) { + LOG.error("Non-numeric value specified for timeout (" + timeoutStr + ")"); + } + return timeout; + } + + private int parseFetchPause(String fetchPauseStr) { + try { + return Integer.parseInt(fetchPauseStr); + } catch (NumberFormatException e) { + LOG.error("Non-numeric value specified for fetchPause (" + fetchPauseStr + ")"); + } + return fetchPause; + } + + + @Override + public void run() { + if (ready) { + + running = true; + + while (running) { + + try { + boolean noData = true; + consumerResponse = consumer.fetchWithReturnConsumerResponse(timeout, -1); + for (String msg : consumerResponse.getActualMessages()) { + noData = false; + LOG.info(name + " received ActualMessage from DMaaP:\n"+msg); + processMsg(msg); + } + + if (noData) { + LOG.info(name + " received ResponseCode: " + consumerResponse.getResponseCode()); + LOG.info(name + " received ResponseMessage: " + consumerResponse.getResponseMessage()); + pauseThread(); + } + } catch (Exception e) { + LOG.error("Caught exception reading from DMaaP", e); + running = false; + } + + + } + } + } + + private void pauseThread() throws InterruptedException { + if (fetchPause > 0) { + LOG.info(String.format("No data received from fetch. Pausing %d ms before retry", fetchPause)); + Thread.sleep(fetchPause); + } else { + LOG.info("No data received from fetch. No fetch pause specified - retrying immediately"); + } + } + + public abstract void processMsg(String msg) throws InvalidMessageException; +} diff --git a/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncFlatJsonDmaapConsumer.java b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncFlatJsonDmaapConsumer.java new file mode 100644 index 000000000..6c90c7199 --- /dev/null +++ b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncFlatJsonDmaapConsumer.java @@ -0,0 +1,170 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.node.ObjectNode; + + +public class SdncFlatJsonDmaapConsumer extends SdncDmaapConsumerImpl { + + private static final Logger LOG = LoggerFactory.getLogger(SdncFlatJsonDmaapConsumer.class); + + private static final String DMAAPLISTENERROOT = "DMAAPLISTENERROOT"; + private static final String SDNC_ENDPOINT = "SDNC.endpoint"; + + @Override + public void processMsg(String msg) throws InvalidMessageException { + + processMsg(msg, null); + } + + public void processMsg(String msg, String mapDirName) throws InvalidMessageException { + + if (msg == null) { + throw new InvalidMessageException("Null message"); + } + + ObjectMapper oMapper = new ObjectMapper(); + JsonNode instarRootNode; + ObjectNode sdncRootNode; + + String instarMsgName = null; + + try { + instarRootNode = oMapper.readTree(msg); + } catch (Exception e) { + throw new InvalidMessageException("Cannot parse json object", e); + } + + Iterator<Map.Entry<String, JsonNode>> instarFields = instarRootNode.fields(); + + while (instarFields.hasNext()) { + Map.Entry<String, JsonNode> entry = instarFields.next(); + + instarMsgName = entry.getKey(); + instarRootNode = entry.getValue(); + break; + } + + Map<String, String> fieldMap = loadMap(instarMsgName, mapDirName); + + if (fieldMap == null) { + throw new InvalidMessageException("Unable to process message - cannot load field mappings"); + } + + if (!fieldMap.containsKey(SDNC_ENDPOINT)) { + throw new InvalidMessageException("No SDNC endpoint known for message " + instarMsgName); + } + + String sdncEndpoint = fieldMap.get(SDNC_ENDPOINT); + + sdncRootNode = oMapper.createObjectNode(); + ObjectNode inputNode = oMapper.createObjectNode(); + + for (Map.Entry<String, String> entry : fieldMap.entrySet()) { + + if (!SDNC_ENDPOINT.equals(entry.getKey())) { + JsonNode curNode = instarRootNode.get(entry.getKey()); + if (curNode != null) { + String fromValue = curNode.textValue(); + + inputNode.put(entry.getValue(), fromValue); + } + } + } + sdncRootNode.put("input", inputNode); + + try { + String rpcMsgbody = oMapper.writeValueAsString(sdncRootNode); + String odlUrlBase = getProperty("sdnc.odl.url-base"); + String odlUser = getProperty("sdnc.odl.user"); + String odlPassword = getProperty("sdnc.odl.password"); + + if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) { + SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + sdncEndpoint, odlUser, odlPassword); + + conn.send("POST", "application/json", rpcMsgbody); + } else { + LOG.info("POST message body would be:\n" + rpcMsgbody); + } + } catch (Exception e) { + LOG.error("Unable to process message", e); + } + } + + private Map<String, String> loadMap(String msgType, String mapDirName) { + Map<String, String> results = new HashMap<>(); + + String dirName = mapDirName; + + if (mapDirName == null) { + String rootdir = System.getenv(DMAAPLISTENERROOT); + + if ((rootdir == null) || (rootdir.length() == 0)) { + rootdir = "/opt/app/dmaap-listener"; + } + + dirName = rootdir + "/lib"; + } + + String mapFilename = dirName + "/" + msgType + ".map"; + + File mapFile = new File(mapFilename); + + if (!mapFile.canRead()) { + LOG.error(String.format("Cannot read map file (%s)", mapFilename)); + return null; + } + + try (BufferedReader mapReader = new BufferedReader(new FileReader(mapFile))) { + + String curLine; + + while ((curLine = mapReader.readLine()) != null) { + curLine = curLine.trim(); + + if ((curLine.length() > 0) && (!curLine.startsWith("#")) && curLine.contains("=>")) { + String[] entry = curLine.split("=>"); + if (entry.length == 2) { + results.put(entry[0].trim(), entry[1].trim()); + } + } + } + mapReader.close(); + } catch (Exception e) { + LOG.error("Caught exception reading map " + mapFilename, e); + return null; + } + + return results; + } +} diff --git a/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncLcmDmaapConsumer.java b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncLcmDmaapConsumer.java new file mode 100644 index 000000000..f2153789f --- /dev/null +++ b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncLcmDmaapConsumer.java @@ -0,0 +1,93 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncLcmDmaapConsumer extends SdncDmaapConsumerImpl { + + private static final Logger LOG = LoggerFactory.getLogger(SdncLcmDmaapConsumer.class); + + private static final String BODY = "body"; + private static final String RPC = "rpc-name"; + + @Override + public void processMsg(String msg) throws InvalidMessageException { + + if (msg == null) { + throw new InvalidMessageException("Null LCM message"); + } + + ObjectMapper oMapper = new ObjectMapper(); + JsonNode lcmRootNode; + try { + lcmRootNode = oMapper.readTree(msg); + } catch (Exception e) { + throw new InvalidMessageException("Cannot parse LCM json input", e); + } + + JsonNode bodyNode = lcmRootNode.get(BODY); + if(bodyNode == null) { + LOG.warn("Missing body in LCM message"); + return; + } + String rpcMsgbody; + try { + ObjectMapper mapper = new ObjectMapper(); + rpcMsgbody = mapper.writeValueAsString(bodyNode); + + } catch (Exception e) { + LOG.error("Unable to parse body in LCM message", e); + return; + } + + JsonNode rpcNode = lcmRootNode.get(RPC); + if(rpcNode == null) { + LOG.warn("Missing node in LCM message- " + RPC); + return; + } + String rpc = rpcNode.textValue(); + String sdncEndpoint = "LCM:" + rpc; + + try { + String odlUrlBase = getProperty("sdnc.odl.url-base"); + String odlUser = getProperty("sdnc.odl.user"); + String odlPassword = getProperty("sdnc.odl.password"); + LOG.info("POST LCM Request " + rpcMsgbody); + if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) { + SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + "/" + sdncEndpoint, odlUser, odlPassword); + + conn.send("POST", "application/json", rpcMsgbody); + } else { + LOG.warn("Unable to POST LCM message. SDNC URL not available. body:\n" + rpcMsgbody); + } + } catch (Exception e) { + LOG.error("Unable to process message", e); + } + } +} + diff --git a/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncOdlConnection.java b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncOdlConnection.java new file mode 100644 index 000000000..6eeef9b48 --- /dev/null +++ b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncOdlConnection.java @@ -0,0 +1,151 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import java.io.BufferedReader; +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.Authenticator; +import java.net.HttpURLConnection; +import java.net.PasswordAuthentication; +import java.net.URL; +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLSession; +import org.apache.commons.codec.binary.Base64; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +public class SdncOdlConnection { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncOdlConnection.class); + + private HttpURLConnection httpConn = null; + + private String url = null; + private String user = null; + private String password = null; + + private class SdncAuthenticator extends Authenticator { + + private String user; + private String passwd; + + SdncAuthenticator(String user, String passwd) { + this.user = user; + this.passwd = passwd; + } + + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(user, passwd.toCharArray()); + } + } + + private SdncOdlConnection() { + + } + + private SdncOdlConnection(String url, String user, String password) { + this.url = url; + this.user = user; + this.password = password; + + try { + URL sdncUrl = new URL(url); + Authenticator.setDefault(new SdncAuthenticator(user, password)); + + this.httpConn = (HttpURLConnection) sdncUrl.openConnection(); + } catch (Exception e) { + LOG.error("Unable to create http connection", e); + } + } + + public static SdncOdlConnection newInstance(String url, String user, String password) { + return new SdncOdlConnection(url, user, password); + } + + + public String send(String method, String contentType, String msg) throws IOException { + + LOG.info(String.format("Sending REST %s to %s", method, url)); + LOG.info(String.format("Message body:%n%s", msg)); + String authStr = user + ":" + password; + String encodedAuthStr = new String(Base64.encodeBase64(authStr.getBytes())); + + httpConn.addRequestProperty("Authentication", "Basic " + encodedAuthStr); + + httpConn.setRequestMethod(method); + httpConn.setRequestProperty("Content-Type", contentType); + httpConn.setRequestProperty("Accept", contentType); + + httpConn.setDoInput(true); + httpConn.setDoOutput(true); + httpConn.setUseCaches(false); + + if (httpConn instanceof HttpsURLConnection) { + HostnameVerifier hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + ((HttpsURLConnection) httpConn).setHostnameVerifier(hostnameVerifier); + } + + // Write message + httpConn.setRequestProperty("Content-Length", Integer.toString(msg.length())); + DataOutputStream outStr = new DataOutputStream(httpConn.getOutputStream()); + outStr.write(msg.getBytes()); + outStr.close(); + + // Read response + BufferedReader respRdr; + + LOG.info("Response: " + httpConn.getResponseCode() + " " + httpConn.getResponseMessage()); + + if (httpConn.getResponseCode() < 300) { + + respRdr = new BufferedReader(new InputStreamReader(httpConn.getInputStream())); + } else { + respRdr = new BufferedReader(new InputStreamReader(httpConn.getErrorStream())); + } + + StringBuilder respBuff = new StringBuilder(); + + String respLn; + + while ((respLn = respRdr.readLine()) != null) { + respBuff.append(respLn).append("\n"); + } + respRdr.close(); + + String respString = respBuff.toString(); + + LOG.info(String.format("Response body :%n%s", respString)); + + return respString; + } +} diff --git a/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncRANSliceDmaapConsumer.java b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncRANSliceDmaapConsumer.java new file mode 100644 index 000000000..f1749f99b --- /dev/null +++ b/northbound/dmaap-listener/src/main/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncRANSliceDmaapConsumer.java @@ -0,0 +1,92 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncRANSliceDmaapConsumer extends SdncDmaapConsumerImpl { + + private static final Logger LOG = LoggerFactory.getLogger(SdncRANSliceDmaapConsumer.class); + + private static final String BODY = "body"; + private static final String RPC = "rpc-name"; + + @Override + public void processMsg(String msg) throws InvalidMessageException { + + if (msg == null) { + throw new InvalidMessageException("Null RANSlice message"); + } + + ObjectMapper oMapper = new ObjectMapper(); + JsonNode ranSliceRootNode; + try { + ranSliceRootNode = oMapper.readTree(msg); + } catch (Exception e) { + throw new InvalidMessageException("Cannot parse RANSlice json input", e); + } + + JsonNode bodyNode = ranSliceRootNode.get(BODY); + if(bodyNode == null) { + LOG.warn("Missing body in RANSlice message"); + return; + } + String rpcMsgbody; + try { + ObjectMapper mapper = new ObjectMapper(); + rpcMsgbody = mapper.writeValueAsString(bodyNode); + + } catch (Exception e) { + LOG.error("Unable to parse body in RANSlice message", e); + return; + } + + JsonNode rpcNode = ranSliceRootNode.get(RPC); + if(rpcNode == null) { + LOG.warn("Missing node in RANSlice message- " + RPC); + return; + } + String rpc = rpcNode.textValue(); + String sdncEndpoint = "ran-slice-api:" + rpc; + + try { + String odlUrlBase = getProperty("sdnc.odl.url-base"); + String odlUser = getProperty("sdnc.odl.user"); + String odlPassword = getProperty("sdnc.odl.password"); + LOG.info("POST RANSlice Request " + rpcMsgbody); + if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) { + SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + "/" + sdncEndpoint, odlUser, odlPassword); + + conn.send("POST", "application/json", rpcMsgbody); + } else { + LOG.warn("Unable to POST RANSlice message. SDNC URL not available. body:\n" + rpcMsgbody); + } + } catch (Exception e) { + LOG.error("Unable to process message", e); + } + } +} diff --git a/northbound/dmaap-listener/src/main/resources/anr-changes-from-policy-to-sdnr.map b/northbound/dmaap-listener/src/main/resources/anr-changes-from-policy-to-sdnr.map new file mode 100644 index 000000000..5cd2b8371 --- /dev/null +++ b/northbound/dmaap-listener/src/main/resources/anr-changes-from-policy-to-sdnr.map @@ -0,0 +1,5 @@ +# SDN-C URL +SDNC.endpoint => SLI-API:execute-graph + +# Field mapping +SDNC.template => anr-pci-changes-from-policy-to-sdnr.vt diff --git a/northbound/dmaap-listener/src/main/resources/anr-pci-changes-from-policy-to-sdnr.vt b/northbound/dmaap-listener/src/main/resources/anr-pci-changes-from-policy-to-sdnr.vt new file mode 100644 index 000000000..1ded88dc7 --- /dev/null +++ b/northbound/dmaap-listener/src/main/resources/anr-pci-changes-from-policy-to-sdnr.vt @@ -0,0 +1,8 @@ +{ + "input": { + "module-name": "oofpcipoc-api", + "rpc-name": "$rpc_name", + "mode": "sync", + "sli-parameter": $sli_parameters + } +} diff --git a/northbound/dmaap-listener/src/main/resources/edgeRouterStatusChange.map b/northbound/dmaap-listener/src/main/resources/edgeRouterStatusChange.map new file mode 100644 index 000000000..fa5ff0784 --- /dev/null +++ b/northbound/dmaap-listener/src/main/resources/edgeRouterStatusChange.map @@ -0,0 +1,44 @@ +# SDN-C URL +SDNC.endpoint => FLOWRED-API:process-edge-router-status-change + +# Field mapping +equip_id => equip_id +ptnii_equip_name => equip-name +equip_type.equip_type => equip-type +ip_addr => loopback0 +router_prov_status => prov-status +country.region => region +country_abbr => country +equip_name_code => equip-name-code +as_number => as-number +loopback1 => loopback1 +loopback2 => loopback2 +loopback3 => loopback3 +loopback40 => loopback40 +loopback65535 => loopback65535 +inms_list => inms-list +encrypted_access_flag => encrypted-access-flag +sw_name => sw-name +nmipaddr => nm-addr +function_code => function-code + +EquipmentId => equip-id +PTNIIEquipmentName => equip-name +EquipmentType => equip-type +Loopback0 => loopback0 +RouterStatus => prov-status +Region => region +CountryAbbreviation => country +EquipmentNameCode => equip-name-code +ASNumber => as-number +SoftwareName => sw-name +NetworkManagementIPAddress => nm-addr +FunctionCode => function-code +Loopback1 => loopback1 +Loopback2 => loopback2 +Loopback3 => loopback3 +Loopback40 => loopback40 +Loopback65535 => loopback65535 +InmsList => inms-list +EncryptedAccessFlag => encrypted-access-flag + diff --git a/northbound/dmaap-listener/src/main/resources/esr-thirdparty-sdnc.map b/northbound/dmaap-listener/src/main/resources/esr-thirdparty-sdnc.map new file mode 100644 index 000000000..603645ebe --- /dev/null +++ b/northbound/dmaap-listener/src/main/resources/esr-thirdparty-sdnc.map @@ -0,0 +1,5 @@ +# SDN-C URL +SDNC.endpoint => DataChange:data-change-notification + +# Field mapping +SDNC.template => template-esr-thirdparty-sdnc.vt diff --git a/northbound/dmaap-listener/src/main/resources/generic-vnf.map b/northbound/dmaap-listener/src/main/resources/generic-vnf.map new file mode 100644 index 000000000..bc375eb28 --- /dev/null +++ b/northbound/dmaap-listener/src/main/resources/generic-vnf.map @@ -0,0 +1,5 @@ +# SDN-C URL +SDNC.endpoint => config-selfservice-api:notification-callback + +# Field mapping +SDNC.template => template-generic-vnf.vt diff --git a/northbound/dmaap-listener/src/main/resources/log4j2.xml b/northbound/dmaap-listener/src/main/resources/log4j2.xml new file mode 100644 index 000000000..01ee93714 --- /dev/null +++ b/northbound/dmaap-listener/src/main/resources/log4j2.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<Configuration status="debug"> + <Properties> + <Property name="logDir">$${env:LOGDIR:-logs}</Property> + </Properties> + <Appenders> + <RollingFile name="LOGFILE" fileName="${logDir}/dmaap-listener.log" + filePattern="${logDir}/dmaap-listener-%i.log"> + <PatternLayout pattern="%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n" /> + <Policies> + <SizeBasedTriggeringPolicy size="10 MB" /> + </Policies> + <DefaultRolloverStrategy max="10"/> + </RollingFile> + <Console name="CONSOLE" target="SYSTEM_OUT"> + <PatternLayout pattern="%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n" /> + </Console> + </Appenders> + <Loggers> + <Root level="debug"> + <AppenderRef ref="LOGFILE"/> + <AppenderRef ref="CONSOLE"/> + </Root> + </Loggers> +</Configuration>
\ No newline at end of file diff --git a/northbound/dmaap-listener/src/main/resources/pci-changes-from-policy-to-sdnr.map b/northbound/dmaap-listener/src/main/resources/pci-changes-from-policy-to-sdnr.map new file mode 100644 index 000000000..5cd2b8371 --- /dev/null +++ b/northbound/dmaap-listener/src/main/resources/pci-changes-from-policy-to-sdnr.map @@ -0,0 +1,5 @@ +# SDN-C URL +SDNC.endpoint => SLI-API:execute-graph + +# Field mapping +SDNC.template => anr-pci-changes-from-policy-to-sdnr.vt diff --git a/northbound/dmaap-listener/src/main/resources/preferredRoute.txt b/northbound/dmaap-listener/src/main/resources/preferredRoute.txt new file mode 100644 index 000000000..662b0aa7d --- /dev/null +++ b/northbound/dmaap-listener/src/main/resources/preferredRoute.txt @@ -0,0 +1 @@ +preferredRouteKey=MR1
\ No newline at end of file diff --git a/northbound/dmaap-listener/src/main/resources/pserver.map b/northbound/dmaap-listener/src/main/resources/pserver.map new file mode 100644 index 000000000..8b3e463e7 --- /dev/null +++ b/northbound/dmaap-listener/src/main/resources/pserver.map @@ -0,0 +1,5 @@ +# SDN-C URL +SDNC.endpoint => config-selfservice-api:notification-callback + +# Field mapping +SDNC.template => template-pserver.vt diff --git a/northbound/dmaap-listener/src/main/resources/template-esr-thirdparty-sdnc.vt b/northbound/dmaap-listener/src/main/resources/template-esr-thirdparty-sdnc.vt new file mode 100644 index 000000000..225fce026 --- /dev/null +++ b/northbound/dmaap-listener/src/main/resources/template-esr-thirdparty-sdnc.vt @@ -0,0 +1,100 @@ +{ + "DataChange:input": { + "DataChange:aai-node-type": "$entitytype", + "DataChange:selflink": "$entitylink", + "DataChange:aai-event-id": "$id", + "DataChange:aai-event-trigger": "$action", + "DataChange:key-data": [{ + "DataChange:key-name": "thirdparty-sdnc-id", + "DataChange:key-value": "$thirdpartysdncid" + }, + { + "DataChange:key-name": "resource-version", + "DataChange:key-value": "$resourceversion" + }, + { + "DataChange:key-name": "location", + "DataChange:key-value": "$location" + }, + { + "DataChange:key-name": "product-name", + "DataChange:key-value": "$productname" + }, + { + "DataChange:key-name": "esr-system-info-id", + "DataChange:key-value": "$esrsysteminfoid" + }, + { + "DataChange:key-name": "system-type", + "DataChange:key-value": "$systemtype" + }, + { + "DataChange:key-name": "service-url", + "DataChange:key-value": "$serviceurl" + }, + { + "DataChange:key-name": "ssl-cacert", + "DataChange:key-value": "$sslcacert" + }, + { + "DataChange:key-name": "type", + "DataChange:key-value": "$type" + }, + { + "DataChange:key-name": "ssl-insecure", + "DataChange:key-value": "$sslinsecure" + }, + { + "DataChange:key-name": "system-status", + "DataChange:key-value": "$systemstatus" + }, + { + "DataChange:key-name": "version", + "DataChange:key-value": "$version" + }, + { + "DataChange:key-name": "passive", + "DataChange:key-value": "$passive" + }, + { + "DataChange:key-name": "password", + "DataChange:key-value": "$password" + }, + { + "DataChange:key-name": "protocol", + "DataChange:key-value": "$protocol" + }, + { + "DataChange:key-name": "ip-address", + "DataChange:key-value": "$ipaddress" + }, + { + "DataChange:key-name": "cloud-domain", + "DataChange:key-value": "$clouddomain" + }, + { + "DataChange:key-name": "user-name", + "DataChange:key-value": "$username" + }, + { + "DataChange:key-name": "system-name", + "DataChange:key-value": "$systemname" + }, + { + "DataChange:key-name": "port", + "DataChange:key-value": "$port" + }, + { + "DataChange:key-name": "vendor", + "DataChange:key-value": "$vendor" + }, + { + "DataChange:key-name": "remote-path", + "DataChange:key-value": "$remotepath" + }, + { + "DataChange:key-name": "default-tenant", + "DataChange:key-value": "$defaulttenant" + }] + } +} diff --git a/northbound/dmaap-listener/src/main/resources/template-generic-vnf.vt b/northbound/dmaap-listener/src/main/resources/template-generic-vnf.vt new file mode 100644 index 000000000..d57c9a0a4 --- /dev/null +++ b/northbound/dmaap-listener/src/main/resources/template-generic-vnf.vt @@ -0,0 +1,11 @@ +{ + "input": { + "common-header": { + "request-id": "$req_id", + "timestamp": "$curr_time", + "originator-id": "AAI", + "api-ver": "2.00" + }, + "payload": $full_message + } +}
\ No newline at end of file diff --git a/northbound/dmaap-listener/src/main/resources/template-pserver.vt b/northbound/dmaap-listener/src/main/resources/template-pserver.vt new file mode 100644 index 000000000..d57c9a0a4 --- /dev/null +++ b/northbound/dmaap-listener/src/main/resources/template-pserver.vt @@ -0,0 +1,11 @@ +{ + "input": { + "common-header": { + "request-id": "$req_id", + "timestamp": "$curr_time", + "originator-id": "AAI", + "api-ver": "2.00" + }, + "payload": $full_message + } +}
\ No newline at end of file diff --git a/northbound/dmaap-listener/src/main/scripts/start-dmaap-listener.sh b/northbound/dmaap-listener/src/main/scripts/start-dmaap-listener.sh new file mode 100644 index 000000000..f767d3cd1 --- /dev/null +++ b/northbound/dmaap-listener/src/main/scripts/start-dmaap-listener.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +PROPERTY_DIR=${PROPERTY_DIR:-/opt/onap/ccsdk/data/properties} + +LISTENER=dmaap-listener + + + +PIDFILE=/tmp/.${LISTENER}-pid +UEBLISTENERROOT=${UEBLISTENERROOT:-/opt/onap/dmaap-listener} +JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-8-oracle} +JAVA_OPTS=${JAVA_OPTS:--Dhttps.protocols=TLSv1.1,TLSv1.2} +JAVA=${JAVA:-${JAVA_HOME}/bin/java} + +# Redirect output from script to $LISTENER.out +exec >> ${UEBLISTENERROOT}/logs/$LISTENER.out +exec 2>&1 + +if [ -f $PIDFILE ] +then + pid=$(cat $PIDFILE) + if [ "$pid" != "" ] + then + if kill -0 $pid + then + echo "$LISTENER already running" + exit 0 + fi + fi +fi + +if [ ! -d ${UEBLISTENERROOT}/logs ] +then + mkdir ${UEBLISTENERROOT}/logs +fi + +for file in ${UEBLISTENERROOT}/lib/*.jar +do + LISTENERCLASSPATH=$LISTENERCLASSPATH:$file +done + +${JAVA} ${JAVA_OPTS} -Dlog4j.configuration=file:${UEBLISTENERROOT}/lib/log4j.properties -cp ${LISTENERCLASSPATH} org.onap.ccsdk.sli.northbound.dmaapclient.DmaapListener & + + +echo $! > $PIDFILE + +echo "$LISTENER started!" +exit 0 diff --git a/northbound/dmaap-listener/src/main/scripts/stop-dmaap-listener.sh b/northbound/dmaap-listener/src/main/scripts/stop-dmaap-listener.sh new file mode 100644 index 000000000..ab242044f --- /dev/null +++ b/northbound/dmaap-listener/src/main/scripts/stop-dmaap-listener.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +PROPERTY_DIR=${PROPERTY_DIR:-/opt/onap/ccsdk/data/properties} + +LISTENER=dmaap-listener + + +PIDFILE=/tmp/.${LISTENER}-pid +UEBLISTENERROOT=${UEBLISTENERROOT:-/opt/onap/dmaap-listener} + +if [ -f $PIDFILE ] +then + pid=$(cat $PIDFILE) + if [ "$pid" != "" ] + then + if kill -0 $pid + then + echo "Stopping $LISTENER" + kill $pid && rm $PIDFILE + exit 0 + else + echo "$LISTENER not running" + exit 1 + fi + else + echo "$LISTENER not running" + exit 1 + fi +fi + + diff --git a/northbound/dmaap-listener/src/site/apt/index.apt b/northbound/dmaap-listener/src/site/apt/index.apt new file mode 100644 index 000000000..370ddd4db --- /dev/null +++ b/northbound/dmaap-listener/src/site/apt/index.apt @@ -0,0 +1,46 @@ +~~~ +~~ ============LICENSE_START======================================================= +~~ openECOMP : SDN-C +~~ ================================================================================ +~~ Copyright (C) 2017 AT&T Intellectual Property. All rights +~~ reserved. +~~ ================================================================================ +~~ Licensed under the Apache License, Version 2.0 (the "License"); +~~ you may not use this file except in compliance with the License. +~~ You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, software +~~ distributed under the License is distributed on an "AS IS" BASIS, +~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +~~ See the License for the specific language governing permissions and +~~ limitations under the License. +~~ ============LICENSE_END========================================================= +~~~ + + --- + UEB Listener + --- + + +UEB Listener + + The UEB Listener is a daemon that listens for notifications from SDC, posted to UEB (Universal Event Bus). + On receipt of an event, the UEB listener downloads any artifacts posted and examines them to determine if + the format (the outer XML tag) matches a supported format. If so, it posts the file to the ASDC-API REST + API in order to update the SDN-C database. + +File Locations + + * Root directory : /opt/app/ueb-listener + + * Log files : /opt/app/ueb-listener/logs + + * Incoming files to be processed : /opt/app/ueb-listener/spool/asdc/incoming + + * Files already processed : /opt/app/ueb-listener/spool/asdc/archive + + + + diff --git a/northbound/dmaap-listener/src/site/site.xml b/northbound/dmaap-listener/src/site/site.xml new file mode 100644 index 000000000..6b97d925e --- /dev/null +++ b/northbound/dmaap-listener/src/site/site.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<project> + + <body> + <menu ref="modules"/> + + <menu ref="reports"/> + + </body> +</project> diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientJdkTest.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientJdkTest.java new file mode 100644 index 000000000..03f832801 --- /dev/null +++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientJdkTest.java @@ -0,0 +1,100 @@ +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Properties; +import org.junit.Test; + +public class MessageRouterHttpClientJdkTest { + public MessageRouterHttpClientJdk getClient() throws MalformedURLException { + Properties properties = new Properties(); + properties.put("username", "my_user"); + properties.put("password", "my_password"); + properties.put("topic", "network_automation"); + properties.put("group", "message_processors"); + properties.put("host", "dmaap-server.com"); + properties.put("id", "machine_one"); + properties.put("fetchPause", "3000"); + MessageRouterHttpClientJdk client = new MessageRouterHttpClientJdk(); + client.processProperties(properties); + return client; + } + + @Test + public void processMsg() throws InvalidMessageException, MalformedURLException { + MessageRouterHttpClientJdk client = getClient(); + client.processMsg(null); + } + + @Test + public void isReady() throws InvalidMessageException, MalformedURLException { + MessageRouterHttpClientJdk client = getClient(); + assertEquals(true, client.isReady()); + } + + @Test + public void isRunning() throws InvalidMessageException, MalformedURLException { + MessageRouterHttpClientJdk client = getClient(); + assertEquals(false, client.isRunning()); + } + + @Test + public void buidUrl() throws InvalidMessageException, MalformedURLException { + MessageRouterHttpClientJdk client = getClient(); + assertEquals(new URL( + "http://dmaap-server.com/events/network_automation/message_processors/machine_one?timeout=15000"), + client.url); + } + + @Test + public void buidUrlWithFilter() throws InvalidMessageException, MalformedURLException { + Properties properties = new Properties(); + properties.put("username", "my_user"); + properties.put("password", "my_password"); + properties.put("topic", "network_automation"); + properties.put("group", "message_processors"); + properties.put("host", "dmaap-server.com"); + properties.put("id", "machine_one"); + properties.put("filter", "{\"class\":\"Contains\",\"string\":\"hello\",\"value\":\"world\"}"); + properties.put("fetchPause", "3000"); + MessageRouterHttpClientJdk client = new MessageRouterHttpClientJdk(); + client.processProperties(properties); + assertEquals(new URL( + "http://dmaap-server.com/events/network_automation/message_processors/machine_one?timeout=15000&filter=%7B%22class%22%3A%22Contains%22%2C%22string%22%3A%22hello%22%2C%22value%22%3A%22world%22%7D"), + client.url); + } + + @Test + public void buildAuthorizationString() throws InvalidMessageException, MalformedURLException { + MessageRouterHttpClientJdk client = getClient(); + String authString = client.buildAuthorizationString("Hello", "World"); + assertEquals("Basic SGVsbG86V29ybGQ=", authString); + } + + @Test + public void clientFromProperties() throws InvalidMessageException, MalformedURLException { + MessageRouterHttpClientJdk client = new MessageRouterHttpClientJdk(); + Properties props = new Properties(); + client.init(props, "src/test/resources/dmaap-consumer-1.properties"); + assertEquals(new URL( + "http://localhost:3904/events/ccsdk-topic/ccsdk-unittest/ccsdk_unittest?timeout=15000&limit=1000"), + client.url); + } + + @Test + public void buildHttpURLConnection() throws InvalidMessageException, IOException { + MessageRouterHttpClientJdk client = getClient(); + HttpURLConnection connection = client.buildHttpURLConnection(); + assertEquals("GET", connection.getRequestMethod()); + assertTrue(connection.getRequestProperties().get("Accept").contains("application/json")); + assertEquals(false, connection.getUseCaches()); + Integer defaultConnectTimeout = Integer.valueOf(client.DEFAULT_CONNECT_TIMEOUT); + Integer defaultReadTimeout = Integer.valueOf(client.DEFAULT_READ_TIMEOUT); + assertEquals(defaultConnectTimeout.intValue(), connection.getConnectTimeout()); + assertEquals(defaultReadTimeout.intValue(), connection.getReadTimeout()); + } +} diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientTest.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientTest.java new file mode 100644 index 000000000..7567e2a9e --- /dev/null +++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/MessageRouterHttpClientTest.java @@ -0,0 +1,97 @@ +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import static org.junit.Assert.assertEquals; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Properties; +import javax.ws.rs.client.Client; +import javax.ws.rs.client.ClientBuilder; +import org.junit.Test; + +public class MessageRouterHttpClientTest { + + class MockMessageRouterHttpClient extends MessageRouterHttpClient { + protected Client getClient(Integer connectTimeoutSeconds, Integer readTimeoutMinutes) { + ClientBuilder clientBuilder = ClientBuilder.newBuilder(); + return clientBuilder.build(); + } + } + + public MessageRouterHttpClient getClient() { + Properties properties = new Properties(); + properties.put("username", "my_user"); + properties.put("password", "my_password"); + properties.put("topic", "network_automation"); + properties.put("group", "message_processors"); + properties.put("host", "dmaap-server.com"); + properties.put("id", "machine_one"); + properties.put("fetch", "machine_one"); + + MockMessageRouterHttpClient client = new MockMessageRouterHttpClient(); + client.processProperties(properties); + return client; + } + + @Test + public void processMsg() throws InvalidMessageException, MalformedURLException { + MessageRouterHttpClient client = getClient(); + client.processMsg(null); + } + + @Test + public void isReady() throws InvalidMessageException, MalformedURLException { + MessageRouterHttpClient client = getClient(); + assertEquals(true, client.isReady()); + } + + @Test + public void isRunning() throws InvalidMessageException, MalformedURLException { + MessageRouterHttpClient client = getClient(); + assertEquals(false, client.isRunning()); + } + + @Test + public void buidUrl() throws InvalidMessageException, MalformedURLException, URISyntaxException { + MessageRouterHttpClient client = getClient(); + assertEquals(new URI( + "http://dmaap-server.com/events/network_automation/message_processors/machine_one?timeout=15000"), + client.uri); + } + + @Test + public void buidUrlWithFilter() throws InvalidMessageException, MalformedURLException, URISyntaxException { + Properties properties = new Properties(); + properties.put("username", "my_user"); + properties.put("password", "my_password"); + properties.put("topic", "network_automation"); + properties.put("group", "message_processors"); + properties.put("host", "dmaap-server.com"); + properties.put("id", "machine_one"); + properties.put("filter", "{\"class\":\"Contains\",\"string\":\"hello\",\"value\":\"world\"}"); + properties.put("fetchPause", "3000"); + MessageRouterHttpClient client = new MockMessageRouterHttpClient(); + client.processProperties(properties); + assertEquals(new URI( + "http://dmaap-server.com/events/network_automation/message_processors/machine_one?timeout=15000&filter=%7B%22class%22%3A%22Contains%22%2C%22string%22%3A%22hello%22%2C%22value%22%3A%22world%22%7D"), + client.uri); + } + + @Test + public void buildAuthorizationString() throws InvalidMessageException, MalformedURLException { + MessageRouterHttpClient client = getClient(); + String authString = client.buildAuthorizationString("Hello", "World"); + assertEquals("Basic SGVsbG86V29ybGQ=", authString); + } + + @Test + public void clientFromProperties() throws InvalidMessageException, MalformedURLException, URISyntaxException { + MessageRouterHttpClient client = new MockMessageRouterHttpClient(); + Properties props = new Properties(); + client.init(props, "src/test/resources/dmaap-consumer-1.properties"); + assertEquals(new URI( + "http://localhost:3904/events/ccsdk-topic/ccsdk-unittest/ccsdk_unittest?timeout=15000&limit=1000"), + client.uri); + } + +} diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncFlatJsonDmaapConsumerTest.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncFlatJsonDmaapConsumerTest.java new file mode 100644 index 000000000..d1aee634d --- /dev/null +++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/SdncFlatJsonDmaapConsumerTest.java @@ -0,0 +1,41 @@ +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import static org.junit.Assert.*; + + +import java.io.File; + +import org.junit.Before; +import org.junit.Test; + +public class SdncFlatJsonDmaapConsumerTest { + + private static final String DMAAP_LISTENER_PROPERTIES = "dmaap-listener.properties"; + private static final String DMAAP_LISTENER_PROPERTIES_DIR = "src/test/resources"; + + SdncFlatJsonDmaapConsumer consumer; + + @Before + public void setUp() throws Exception { + consumer = new SdncFlatJsonDmaapConsumer(); + } + + @Test(expected = InvalidMessageException.class) + public void testProcessMsgString_NullInvalidMessageException() throws InvalidMessageException { + // expected = InvalidMessageException: Null message + consumer.processMsg(null); + } + + @Test(expected = InvalidMessageException.class) + public void testProcessMsgString_UnformatedMessageInvalidMessageException() throws InvalidMessageException { + // expected = InvalidMessageException: Cannot parse json object + consumer.processMsg("TESTING", null); + } + + @Test(expected = InvalidMessageException.class) + public void testing()throws InvalidMessageException { + // Expected = InvalidMessageException: Unable to process message - cannot load field mappings + String msg = "{\"test\":\"string\"}"; + consumer.processMsg(msg, null); + } +}
\ No newline at end of file diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestA1AdapterPolicyDmaapConsumer.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestA1AdapterPolicyDmaapConsumer.java new file mode 100644 index 000000000..8b7044f69 --- /dev/null +++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestA1AdapterPolicyDmaapConsumer.java @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit. + * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. + * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. + * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. + * Vestibulum commodo. Ut rhoncus gravida arcu. + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.util.Map; +import java.util.Properties; + +import org.apache.commons.io.FileUtils; + +import org.junit.Before; +import org.junit.Test; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class TestA1AdapterPolicyDmaapConsumer { + private static final String a1AdapterInput = "{\n" + + " \"body\": {\n" + + " \"input\": {\n" + + " \"CommonHeader\": {\n" + + " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" + + " \"APIver\": \"1.0\",\n" + + " \"RequestID\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459\",\n" + + " \"SubRequestID\": \"1\",\n" + + " \"RequestTrack\": {},\n" + + " \"Flags\": {}\n },\n" + + " \"Action\": \"getHealthCheck\",\n" + + " \"Payload\": {\n" + + " \"near-rt-ric-id\": \"near-RT-ric1\",\n" + + " \"policy-type-id\": \"20000\",\n" + + " \"description\": \"parameters to control policy \",\n" + + " \"name\": \"admission_control_policy\",\n" + + " \"policy-type\": \"object\"\n" + + " }\n" + + " },\n" + + " \"version\": \"1.0\",\n" + + " \"rpc-name\": \"getHealthCheck\",\n" + + " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" + + " \"type\": \"request\"\n" + + " }\n" + + "}"; + + @Test + public void test() throws Exception { + Properties props = new Properties(); + + A1AdapterPolicyDmaapConsumer consumer = new A1AdapterPolicyDmaapConsumer(); + InputStream propStr = TestA1AdapterPolicyDmaapConsumer.class.getResourceAsStream("/dmaap-consumer-a1Adapter-policy-1.properties"); + props.load(propStr); + consumer.init(props, "src/test/resources/dmaap-consumer-1.properties"); + consumer.processMsg(a1AdapterInput); + } + + @Test(expected = InvalidMessageException.class) + public void testProcessMsgNullMessage() throws Exception { + A1AdapterPolicyDmaapConsumer consumer = new A1AdapterPolicyDmaapConsumer(); + consumer.processMsg(null); + } + + @Test + public void testProcessMsgMissingBody() throws Exception { + String msg = "{\n" + + " \"body1\": {\n" + + " \"input\": {\n" + + " \"CommonHeader\": {\n" + + " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" + + " \"APIver\": \"1.0\",\n" + + " \"RequestID\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459\",\n" + + " \"SubRequestID\": \"1\",\n" + + " \"RequestTrack\": {},\n" + + " \"Flags\": {}\n },\n" + + " \"Action\": \"getHealthCheck\",\n" + + " \"Payload\": {\n" + + " \"near-rt-ric-id\": \"near-RT-ric1\",\n" + + " \"policy-type-id\": \"20000\",\n" + + " \"description\": \"parameters to control policy \",\n" + + " \"name\": \"admission_control_policy\",\n" + + " \"policy-type\": \"object\"\n" + + " }\n" + + " },\n" + + " \"version\": \"1.0\",\n" + + " \"rpc-name\": \"getHealthCheck\",\n" + + " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" + + " \"type\": \"request\"\n" + + " }\n" + + "}"; + + A1AdapterPolicyDmaapConsumer consumer = new A1AdapterPolicyDmaapConsumer(); + consumer.processMsg(msg); + } + + @Test + public void testProcessMsgInvalidRPC() throws Exception { + String msg = "{\n" + + " \"body\": {\n" + + " \"input\": {\n" + + " \"CommonHeader\": {\n" + + " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" + + " \"APIver\": \"1.0\",\n" + + " \"RequestID\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459\",\n" + + " \"SubRequestID\": \"1\",\n" + + " \"RequestTrack\": {},\n" + + " \"Flags\": {}\n },\n" + + " \"Action\": \"getHealthCheck\",\n" + + " \"Payload\": {\n" + + " \"near-rt-ric-id\": \"near-RT-ric1\",\n" + + " \"policy-type-id\": \"20000\",\n" + + " \"description\": \"parameters to control policy \",\n" + + " \"name\": \"admission_control_policy\",\n" + + " \"policy-type\": \"object\"\n" + + " }\n" + + " },\n" + + " \"version\": \"1.0\",\n" + + " \"rpc-name1\": \"getHealthCheck\",\n" + + " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" + + " \"type\": \"request\"\n" + + " }\n" + + "}"; + + A1AdapterPolicyDmaapConsumer consumer = new A1AdapterPolicyDmaapConsumer(); + consumer.processMsg(msg); + } + +} diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestCMNotifyDmaapConsumer.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestCMNotifyDmaapConsumer.java new file mode 100644 index 000000000..122a6d40b --- /dev/null +++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestCMNotifyDmaapConsumer.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit. + * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. + * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. + * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. + * Vestibulum commodo. Ut rhoncus gravida arcu. + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.util.Map; +import java.util.Properties; + +import org.apache.commons.io.FileUtils; + +import org.junit.Before; +import org.junit.Test; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + + +public class TestCMNotifyDmaapConsumer { + private static final String cMNotifyInput = "{\n" + + " \"body\": {\n" + + " \"input\": {\n" + + " \"CommonHeader\": {\n" + + " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" + + " \"APIver\": \"1.0\",\n" + + " \"RequestID\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459\",\n" + + " \"SubRequestID\": \"1\",\n" + + " \"RequestTrack\": {},\n" + + " \"Flags\": {}\n },\n" + + " \"Action\": \"nbrlist-change-notification\",\n" + + " \"Payload\": {\n" + + " \"fap-service-number-of-entries-changed\": 1,\n" + + " \"fap-service\": [{ \"alias\": \n" + + " \"Chn0001\", \"cid\": \"Chn0001\", \"lte-cell-number-of-entries\": 1,\n" + + " \"lte-ran-neighbor-list-in-use-lte-cell-changed\": \n" + + " [{ \"plmnid\": \"ran-1\", \"cid\": \"Chn0002\", \"phy-cell-id\": 4,\n" + + " \"pnf-name\": \"ncserver1\",\n" + + " \"blacklisted\": false }] }] }\n" + + " }\n" + + " },\n" + + " \"version\": \"1.0\",\n" + + " \"rpc-name\": \"nbrlist-change-notification\",\n" + + " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" + + " \"type\": \"request\"\n" + + "}"; + + + @Test + public void test() throws Exception { + Properties props = new Properties(); + + CMNotifyDmaapConsumer consumer = new CMNotifyDmaapConsumer(); + InputStream propStr = TestCMNotifyDmaapConsumer.class.getResourceAsStream("/dmaap-consumer-cMNotify-1.properties"); + props.load(propStr); + consumer.init(props, "src/test/resources/dmaap-consumer-1.properties"); + consumer.processMsg(cMNotifyInput); + } + + @Test(expected = InvalidMessageException.class) + public void testProcessMsgNullMessage() throws Exception { + CMNotifyDmaapConsumer consumer = new CMNotifyDmaapConsumer(); + consumer.processMsg(null); + } + + @Test + public void testProcessMsgMissingBody() throws Exception { + String msg = "{\n" + + " \"bodyTest\": {\n" + + " \"input\": {\n" + + " \"CommonHeader\": {\n" + + " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" + + " \"APIver\": \"1.0\",\n" + + " \"RequestID\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459\",\n" + + " \"SubRequestID\": \"1\",\n" + + " \"RequestTrack\": {},\n" + + " \"Flags\": {}\n },\n" + + " \"Action\": \"nbrlist-change-notification\",\n" + + " \"Payload\": {\n" + + " \"fap-service-number-of-entries-changed\": 1,\n" + + " \"fap-service\": [{ \"alias\": \n" + + " \"Chn0001\", \"cid\": \"Chn0001\", \"lte-cell-number-of-entries\": 1,\n" + + " \"lte-ran-neighbor-list-in-use-lte-cell-changed\": \n" + + " [{ \"plmnid\": \"ran-1\", \"cid\": \"Chn0002\", \"phy-cell-id\": 4,\n" + + " \"pnf-name\": \"ncserver1\",\n" + + " \"blacklisted\": false }] }] }\n" + + " }\n" + + " },\n" + + " \"version\": \"1.0\",\n" + + " \"rpc-name\": \"nbrlist-change-notification\",\n" + + " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" + + " \"type\": \"request\"\n" + + "}"; + CMNotifyDmaapConsumer consumer = new CMNotifyDmaapConsumer(); + consumer.processMsg(msg); + } + + @Test + public void testProcessMsgInvalidRPC() throws Exception { + String msg = "{\n" + + " \"body\": {\n" + + " \"input\": {\n" + + " \"CommonHeader\": {\n" + + " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" + + " \"APIver\": \"1.0\",\n" + + " \"RequestID\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459\",\n" + + " \"SubRequestID\": \"1\",\n" + + " \"RequestTrack\": {},\n" + + " \"Flags\": {}\n },\n" + + " \"Action\": \"nbrlist-change-notification\",\n" + + " \"Payload\": {\n" + + " \"fap-service-number-of-entries-changed\": 1,\n" + + " \"fap-service\": [{ \"alias\": \n" + + " \"Chn0001\", \"cid\": \"Chn0001\", \"lte-cell-number-of-entries\": 1,\n" + + " \"lte-ran-neighbor-list-in-use-lte-cell-changed\": \n" + + " [{ \"plmnid\": \"ran-1\", \"cid\": \"Chn0002\", \"phy-cell-id\": 4,\n" + + " \"pnf-name\": \"ncserver1\",\n" + + " \"blacklisted\": false }] }] }\n" + + " }\n" + + " },\n" + + " \"version\": \"1.0\",\n" + + " \"rpc-nameTest\": \"nbrlist-change-notification\",\n" + + " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" + + " \"type\": \"request\"\n" + + "}"; + + CMNotifyDmaapConsumer consumer = new CMNotifyDmaapConsumer(); + consumer.processMsg(msg); + } + +} diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestDmaapListener.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestDmaapListener.java new file mode 100644 index 000000000..943ef0204 --- /dev/null +++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestDmaapListener.java @@ -0,0 +1,52 @@ +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import static org.junit.Assert.*; + +import java.util.LinkedList; +import java.util.List; +import java.util.Properties; + +import org.junit.Before; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TestDmaapListener { + + private static final String DMAAP_LISTENER_PROPERTIES = "dmaap-listener.properties"; + private static final String DMAAP_LISTENER_PROPERTIES_DIR = "src/test/resources"; + + private static final Logger LOG = LoggerFactory.getLogger(TestDmaapListener.class); + + @Before + public void setUp() throws Exception { + } + + @Test + public void test() { + Properties properties = new Properties(); + String propFileName = DMAAP_LISTENER_PROPERTIES; + String propPath = null; + String propDir = DMAAP_LISTENER_PROPERTIES_DIR; + + List<SdncDmaapConsumer> consumers = new LinkedList<>(); + + + propPath = propDir + "/" + propFileName; + + if (propPath != null) { + properties = DmaapListener.loadProperties(propPath, properties); + + String subscriptionStr = properties.getProperty("subscriptions"); + + boolean threadsRunning = false; + + LOG.debug("Dmaap subscriptions : " + subscriptionStr); + + if (subscriptionStr != null) { + threadsRunning = DmaapListener.handleSubscriptions(subscriptionStr, propDir, properties, consumers); + } + } + } + +} diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestDummyDmaapConsumer.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestDummyDmaapConsumer.java new file mode 100644 index 000000000..47330c622 --- /dev/null +++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestDummyDmaapConsumer.java @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit. + * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. + * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. + * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. + * Vestibulum commodo. Ut rhoncus gravida arcu. + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import org.junit.Test; + +import static org.junit.Assert.assertEquals; + +public class TestDummyDmaapConsumer { + private static final String DMAAP_LISTENER_PROPERTIES = "dmaap-listener.properties"; + private static final String DMAAP_LISTENER_PROPERTIES_DIR = "src/test/resources"; + + DummyDmaapConsumer consumer = new DummyDmaapConsumer(); + + @Test + public void testProcessMsg(){ + consumer.processMsg(null); + } + +} diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestOofPciPocDmaapConsumers.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestOofPciPocDmaapConsumers.java new file mode 100644 index 000000000..cd2ea6eb0 --- /dev/null +++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestOofPciPocDmaapConsumers.java @@ -0,0 +1,314 @@ +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.util.Properties; + +import org.junit.Before; +import org.junit.Test; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class TestOofPciPocDmaapConsumers { + + private static final String pciChangesFromPolicyToSDNRInput = "{\n" + + " \"body\": {\n" + + " \"input\": {\n" + + " \"CommonHeader\": {\n" + + " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" + + " \"APIVer\": \"1.0\",\n" + + " \"RequestID\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459\",\n" + + " \"SubRequestID\": \"1\",\n" + + " \"RequestTrack\": {},\n" + + " \"Flags\": {}\n" + + " },\n" + + " \"Action\": \"ModifyConfig\",\n" + + " \"Payload\": \"{\\\"Configurations\\\":[{\\\"data\\\":{\\\"FAPService\\\":{\\\"alias\\\":\\\"Chn0330\\\",\\\"X0005b9Lte\\\":{\\\"phyCellIdInUse\\\":6,\\\"pnfName\\\":\\\"ncserver23\\\"},\\\"CellConfig\\\":{\\\"LTE\\\":{\\\"RAN\\\":{\\\"Common\\\":{\\\"CellIdentity\\\":\\\"Chn0330\\\"}}}}}}},{\\\"data\\\":{\\\"FAPService\\\":{\\\"alias\\\":\\\"Chn0331\\\",\\\"X0005b9Lte\\\":{\\\"phyCellIdInUse\\\":7,\\\"pnfName\\\":\\\"ncserver23\\\"},\\\"CellConfig\\\":{\\\"LTE\\\":{\\\"RAN\\\":{\\\"Common\\\":{\\\"CellIdentity\\\":\\\"Chn0331\\\"}}}}}}}]}\"\n" + + " }\n" + + " },\n" + + " \"version\": \"1.0\",\n" + + " \"rpc-name\": \"modifyconfig\",\n" + + " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" + + " \"type\": \"request\"\n" + + "}"; + + private static final String anrChangesFromPolicyToSDNRInput = "{\n" + + " \"body\": {\n" + + " \"input\": {\n" + + " \"CommonHeader\": {\n" + + " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" + + " \"APIVer\": \"1.0\",\n" + + " \"RequestID\": \"722ee65a-8afd-48df-bf57-c152ae45bacc\",\n" + + " \"SubRequestID\": \"1\",\n" + + " \"RequestTrack\": {},\n" + + " \"Flags\": {}\n" + + " },\n" + + "\"Action\": \"ModifyConfigANR\",\n" + + " \"Payload\": \"{ \\\"Configurations\\\":[ { \\\"data\\\":{ \\\"FAPService\\\":{ \\\"alias\\\":\\\"Cell1\\\", \\\"CellConfig\\\":{ \\\"LTE\\\":{ \\\"RAN\\\":{ \\\"Common\\\":{ \\\"CellIdentity\\\":\\\"1\\\" }, \\\"NeighborListInUse\\\" : { \\\"LTECellNumberOfEntries\\\" : \\\"1\\\" , \\\"LTECell\\\" : [{ \\\"PLMNID\\\" :\\\"plmnid1\\\", \\\"CID\\\":\\\"Chn0001\\\", \\\"PhyCellID\\\":\\\"3\\\", \\\"PNFName\\\":\\\"ncserver01\\\", \\\"Blacklisted\\\":\\\"false\\\"}] } } } } } } } ] }\"\n" + + " }\n" + + " },\n" + + " \"version\": \"1.0\",\n" + + " \"rpc-name\": \"modifyconfiganr\",\n" + + " \"correlation-id\": \"722ee65a-8afd-48df-bf57-c152ae45bacc-1\",\n" + + " \"type\": \"request\"\n" + + "}\n" + + ""; + + @Before + public void setUp() throws Exception { + } + + /* ---------- PCI Changes DMAAP messages test cases ------------------- */ + + @Test + public void testPCIChangesDmaapRPCMessageBodyResponse() throws Exception { + Properties props = new Properties(); + + ObjectMapper oMapper = new ObjectMapper(); + JsonNode pciChangesRootNode = oMapper.readTree(pciChangesFromPolicyToSDNRInput); + JsonNode body = pciChangesRootNode.get("body"); + JsonNode input = body.get("input"); + JsonNode payload = input.get("Payload"); + String payloadText = payload.asText(); + JsonNode configurationsJsonNode = oMapper.readTree(payloadText); + + String rpcMsgbody = new OofPciPocDmaapConsumers(props).publish("src/main/resources/anr-pci-changes-from-policy-to-sdnr.vt", pciChangesFromPolicyToSDNRInput,configurationsJsonNode, true, false); + + JsonNode rootNode; + try { + rootNode = oMapper.readTree(rpcMsgbody); + } catch (Exception e) { + throw new InvalidMessageException("Cannot parse json object", e); + } + + assertTrue(rootNode.get("input").get("module-name") != null); + assertTrue(rootNode.get("input").get("rpc-name") != null); + assertTrue(rootNode.get("input").get("mode") != null); + assertTrue(rootNode.get("input").get("sli-parameter") != null); + + } + + @Test(expected = InvalidMessageException.class) + public void testPCIChangesDmaapProcessMsgNullMessage() throws Exception { + OofPciPocDmaapConsumers consumer = new OofPciPocDmaapConsumers(); + consumer.processMsg(null); + } + + @Test(expected = InvalidMessageException.class) + public void testPCIChangesDmaapProcessMsgInvalidMessage() throws Exception { + OofPciPocDmaapConsumers consumer = new OofPciPocDmaapConsumers(); + consumer.processMsg("test"); + } + + @Test + public void testPCIChangesDmaapProcessMsgMissingActionHeader() throws Exception { + OofPciPocDmaapConsumers consumer = new OofPciPocDmaapConsumers(); + consumer.processMsg("{\n" + + " \"body\": {\n" + + " \"input\": {\n" + + " \"CommonHeader\": {\n" + + " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" + + " \"APIVer\": \"1.0\",\n" + + " \"RequestID\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459\",\n" + + " \"SubRequestID\": \"1\",\n" + + " \"RequestTrack\": {},\n" + + " \"Flags\": {}\n" + + " },\n" + + " \"RenamedAction\": \"ModifyConfig\",\n" + + " \"Payload\": {\n" + + " \"Configurations \": {\n" + + " \"data \": {\n" + + " \"FAPService \": {\n" + + " \"alias\": \"Chn0330\",\n" + + " \"X0005b9Lte\": {\n" + + " \"phyCellIdInUse\": 6,\n" + + " \"pnfName\": \"ncserver23\"\n" + + " },\n" + + " \"CellConfig\": {\n" + + " \"LTE\": {\n" + + " \"RAN\": {\n" + + " \"Common\": {\n" + + " \"CellIdentity\": \"Chn0330\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + "\n" + + " }\n" + + " }\n" + + " },\n" + + " \"version\": \"1.0\",\n" + + " \"rpc-name\": \"modifyconfig\",\n" + + " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" + + " \"type\": \"request\"\n" + + "}"); + } + + @Test + public void testPCIChangesDmaapProcessMsgInvalidPayloadConfigurations() throws Exception { + String msg = "{\n" + + " \"body\": {\n" + + " \"input\": {\n" + + " \"CommonHeader\": {\n" + + " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" + + " \"APIVer\": \"1.0\",\n" + + " \"RequestID\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459\",\n" + + " \"SubRequestID\": \"1\",\n" + + " \"RequestTrack\": {},\n" + + " \"Flags\": {}\n" + + " },\n" + + " \"Action\": \"ModifyConfig\",\n" + + " \"Payload\": {\n" + + " \"Configurations \": {\n" + + " \"data \": {\n" + + " \"FAPService \": {\n" + + " \"alias\": \"Chn0330\",\n" + + " \"X0005b9Lte\": {\n" + + " \"phyCellIdInUse\": 6,\n" + + " \"pnfName\": \"ncserver23\"\n" + + " },\n" + + " \"CellConfig\": {\n" + + " \"LTE\": {\n" + + " \"RAN\": {\n" + + " \"Common\": {\n" + + " \"CellIdentity\": \"Chn0330\"\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + " }\n" + + "\n" + + " }\n" + + " }\n" + + " },\n" + + " \"version\": \"1.0\",\n" + + " \"rpc-name\": \"modifyconfig\",\n" + + " \"correlation-id\": \"9d2d790e-a5f0-11e8-98d0-529269fb1459-1\",\n" + + " \"type\": \"request\"\n" + + "}"; + + try { + OofPciPocDmaapConsumers consumer = new OofPciPocDmaapConsumers(); + consumer.processMsg(msg); + + } catch (final InvalidMessageException e) { + final String errorMsg = "Configurations is not of Type Array. Could not read configuration changes"; + assertEquals(errorMsg, e.getMessage()); + } + } + + /* ---------- PCI Changes DMAAP messages test cases ------------------- */ + + /* ---------- ANR Changes DMAAP messages test cases ------------------- */ + + @Test + public void testANRChangesDmaapRPCMessageBodyResponse() throws Exception { + Properties props = new Properties(); + + ObjectMapper oMapper = new ObjectMapper(); + JsonNode anrChangesRootNode = oMapper.readTree(anrChangesFromPolicyToSDNRInput); + JsonNode body = anrChangesRootNode.get("body"); + JsonNode input = body.get("input"); + JsonNode payload = input.get("Payload"); + String payloadText = payload.asText(); + JsonNode configurationsJsonNode = oMapper.readTree(payloadText); + JsonNode configurations = configurationsJsonNode.get("Configurations"); + + for(JsonNode dataNode:configurations) { + String rpcMsgbody = new OofPciPocDmaapConsumers(props).publish("src/main/resources/anr-pci-changes-from-policy-to-sdnr.vt", anrChangesFromPolicyToSDNRInput,dataNode, false, true); + + JsonNode rootNode; + try { + rootNode = oMapper.readTree(rpcMsgbody); + } catch (Exception e) { + throw new InvalidMessageException("Cannot parse json object", e); + } + + assertTrue(rootNode.get("input").get("module-name") != null); + assertTrue(rootNode.get("input").get("rpc-name") != null); + assertTrue(rootNode.get("input").get("mode") != null); + assertTrue(rootNode.get("input").get("sli-parameter") != null); + } + } + + @Test(expected = InvalidMessageException.class) + public void testANRChangesDmaapProcessMsgNullMessage() throws Exception { + OofPciPocDmaapConsumers consumer = new OofPciPocDmaapConsumers(); + consumer.processMsg(null); + } + + @Test(expected = InvalidMessageException.class) + public void testANRChangesDmaapProcessMsgInvalidMessage() throws Exception { + OofPciPocDmaapConsumers consumer = new OofPciPocDmaapConsumers(); + consumer.processMsg("test"); + } + + @Test + public void testANRChangesDmaapProcessMsgMissingActionHeader() throws Exception { + OofPciPocDmaapConsumers consumer = new OofPciPocDmaapConsumers(); + consumer.processMsg("{\n" + + " \"body\": {\n" + + " \"input\": {\n" + + " \"CommonHeader\": {\n" + + " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" + + " \"APIVer\": \"1.0\",\n" + + " \"RequestID\": \"722ee65a-8afd-48df-bf57-c152ae45bacc\",\n" + + " \"SubRequestID\": \"1\",\n" + + " \"RequestTrack\": {},\n" + + " \"Flags\": {}\n" + + " },\n" + + "\"NoAction\": \"ModifyConfigANR\",\n" + + " \"Payload\": \"{ \\\"Configurations\\\":[ { \\\"data\\\":{ \\\"FAPService\\\":{ \\\"alias\\\":\\\"Cell1\\\", \\\"CellConfig\\\":{ \\\"LTE\\\":{ \\\"RAN\\\":{ \\\"Common\\\":{ \\\"CellIdentity\\\":\\\"1\\\" }, \\\"NeighborListInUse\\\" : { \\\"LTECellNumberOfEntries\\\" : \\\"1\\\" , \\\"LTECell\\\" : [{ \\\"PLMNID\\\" :\\\"plmnid1\\\", \\\"CID\\\":\\\"Chn0001\\\", \\\"PhyCellID\\\":\\\"3\\\", \\\"PNFName\\\":\\\"ncserver01\\\", \\\"Blacklisted\\\":\\\"false\\\"}] } } } } } } } ] }\"\n" + + " }\n" + + " },\n" + + " \"version\": \"1.0\",\n" + + " \"rpc-name\": \"modifyconfiganr\",\n" + + " \"correlation-id\": \"722ee65a-8afd-48df-bf57-c152ae45bacc-1\",\n" + + " \"type\": \"request\"\n" + + "}\n" + + ""); + } + + @Test + public void testANRChangesDmaapProcessMsgInvalidPayloadConfigurations() throws Exception { + String msg = "{\n" + + " \"body\": {\n" + + " \"input\": {\n" + + " \"CommonHeader\": {\n" + + " \"TimeStamp\": \"2018-11-30T09:13:37.368Z\",\n" + + " \"APIVer\": \"1.0\",\n" + + " \"RequestID\": \"722ee65a-8afd-48df-bf57-c152ae45bacc\",\n" + + " \"SubRequestID\": \"1\",\n" + + " \"RequestTrack\": {},\n" + + " \"Flags\": {}\n" + + " },\n" + + "\"Action\": \"ModifyConfigANR\",\n" + + " \"Payload\": \"{ \\\"Configurations\\\":{ { \\\"data\\\":{ \\\"FAPService\\\":{ \\\"alias\\\":\\\"Cell1\\\", \\\"CellConfig\\\":{ \\\"LTE\\\":{ \\\"RAN\\\":{ \\\"Common\\\":{ \\\"CellIdentity\\\":\\\"1\\\" }, \\\"NeighborListInUse\\\" : { \\\"LTECellNumberOfEntries\\\" : \\\"1\\\" , \\\"LTECell\\\" : [{ \\\"PLMNID\\\" :\\\"plmnid1\\\", \\\"CID\\\":\\\"Chn0001\\\", \\\"PhyCellID\\\":\\\"3\\\", \\\"PNFName\\\":\\\"ncserver01\\\", \\\"Blacklisted\\\":\\\"false\\\"}} } } } } } } } ] }\"\n" + + " }\n" + + " },\n" + + " \"version\": \"1.0\",\n" + + " \"rpc-name\": \"modifyconfiganr\",\n" + + " \"correlation-id\": \"722ee65a-8afd-48df-bf57-c152ae45bacc-1\",\n" + + " \"type\": \"request\"\n" + + "}\n" + + ""; + + try { + OofPciPocDmaapConsumers consumer = new OofPciPocDmaapConsumers(); + consumer.processMsg(msg); + + } catch (final InvalidMessageException e) { + final String errorMsg = "Cannot parse payload value"; + assertEquals(errorMsg, e.getMessage()); + } + } + + /* ---------- ANR Changes DMAAP messages test cases ------------------- */ +} diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncDhcpEventConsumer.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncDhcpEventConsumer.java new file mode 100644 index 000000000..04f098ade --- /dev/null +++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncDhcpEventConsumer.java @@ -0,0 +1,139 @@ +/** + * + */ +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import static org.junit.Assert.*; + +import java.io.InputStream; +import java.net.URL; +import java.sql.SQLException; +import java.util.Properties; + +import javax.sql.rowset.CachedRowSet; + +import org.junit.After; +import org.junit.BeforeClass; +import org.junit.Test; +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ch.vorburger.mariadb4j.DB; +import ch.vorburger.mariadb4j.DBConfigurationBuilder; + +/** + * @author dt5972 + * + */ +public class TestSdncDhcpEventConsumer { + + private static final Logger LOG = LoggerFactory.getLogger(TestSdncDhcpEventConsumer.class); + + + private static final String DHCP_MAP_TABLE = "CREATE TABLE `DHCP_MAP` (\n" + + " mac_addr varchar(80) NOT NULL,\n" + + " ip_addr varchar(80),\n" + + " PRIMARY KEY(`mac_addr`)\n" + + ")"; + + + + private static final String VALID_DHCP_EVENT = "{\"msg_name\":\"DHCPACK\"," + + "\"macaddr\":\"fa:16:3e:8f:ea:68\"," + + "\"yiaddr\":\"10.3.0.2\"}"; + private static final String SECOND_DHCP_EVENT = "{\"msg_name\":\"DHCPACK\"," + + "\"macaddr\":\"fa:16:3e:8f:ea:68\"," + + "\"yiaddr\":\"10.3.0.3\"}"; + private static final String MISSING_MSG_NAME_DHCP_EVENT = "{\"macaddr\":\"fa:16:3e:8f:ea:68\"," + + "\"yiaddr\":\"10.3.0.2\"}"; + private static final String MISSING_MAC_ADDR_DHCP_EVENT = "{\"msg_name\":\"DHCPACK\"," + + "\"yiaddr\":\"10.3.0.2\"}"; + private static final String MISSING_IP_ADDR_DHCP_EVENT = "{\"msg_name\":\"DHCPACK\"," + + "\"macaddr\":\"fa:16:3e:8f:ea:68\"}"; + + private static final String GET_DHCP_MAPPING = "SELECT * FROM DHCP_MAP WHERE mac_addr = 'fa:16:3e:8f:ea:68'"; + + + private static DBResourceManager dblibSvc; + private static DB db; + + private static SdncDhcpEventConsumer consumer; + + /** + * @throws java.lang.Exception + */ + @BeforeClass + public static void setUpBeforeClass() throws Exception { + + LOG.debug("Setting up DHCP event testing"); + + InputStream propStr = TestSdncDhcpEventConsumer.class.getResourceAsStream("/dblib.properties"); + + Properties props = new Properties(); + + props.load(propStr); + + + // Start MariaDB4j database + + LOG.debug("Starting MariaDB instance"); + DBConfigurationBuilder config = DBConfigurationBuilder.newBuilder(); + config.setPort(0); // 0 => autom. detect free port + db = DB.newEmbeddedDB(config.build()); + db.start(); + + + // Override jdbc URL and database name + props.setProperty("org.onap.ccsdk.sli.jdbc.database", "test"); + props.setProperty("org.onap.ccsdk.sli.jdbc.url", config.getURL("test")); + + + // Create dblib connection + + LOG.debug("Getting DBResourceManager instance"); + dblibSvc = new DBResourceManager(props); + + // Create DHCP_MAP table + dblibSvc.writeData(DHCP_MAP_TABLE, null, null); + + consumer = new SdncDhcpEventConsumer(); + consumer.setJdbcDataSource(dblibSvc); + LOG.debug("Setup complete"); + + } + + + @Test + public void testValid() throws InvalidMessageException, SQLException { + consumer.processMsg(VALID_DHCP_EVENT); + consumer.processMsg(SECOND_DHCP_EVENT); + + CachedRowSet results = dblibSvc.getData(GET_DHCP_MAPPING, null, null); + + if (!results.next()) { + fail("Test query ["+GET_DHCP_MAPPING+"] returned no data"); + } else { + String ipAddr = results.getString("ip_addr"); + if (!"10.3.0.3".equals(ipAddr)) { + fail("Expecting ipAddr to be 10.3.0.3, but was "+ipAddr); + } + } + + } + + @Test (expected = InvalidMessageException.class) + public void testMissingMsgName() throws InvalidMessageException { + consumer.processMsg(MISSING_MSG_NAME_DHCP_EVENT); + } + + @Test (expected = InvalidMessageException.class) + public void testMissingMacAddress() throws InvalidMessageException { + consumer.processMsg(MISSING_MAC_ADDR_DHCP_EVENT); + } + + @Test (expected = InvalidMessageException.class) + public void testMissingIpAddress() throws InvalidMessageException { + consumer.processMsg(MISSING_IP_ADDR_DHCP_EVENT); + } +} diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncEsrDmaapReceiver.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncEsrDmaapReceiver.java new file mode 100644 index 000000000..623c96426 --- /dev/null +++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncEsrDmaapReceiver.java @@ -0,0 +1,140 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - CCSDK + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import org.apache.commons.io.FileUtils; +import org.junit.Test; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.util.Map; +import java.util.Properties; + +public class TestSdncEsrDmaapReceiver { + static String aaiInput = "{\"cambria.partition\":\"AAI\",\n" + + " \"event-header\":\n" + + " {\n" + + " \"severity\":\"NORMAL\",\n" + + " \"entity-type\":\"esr-thirdparty-sdnc\",\n" + + " \"top-entity-type\":\"esr-thirdparty-sdnc\",\n" + + " \"entity-link\":\"aai/v11/external-system/esr-thirdparty-sdnc-list/esr-thirdparty-sdnc/IP-WAN-Controller-1\",\n" + + " \"event-type\":\"AAI-EVENT\",\n" + + " \"domain\":\"dev\",\n" + + " \"action\":\"UPDATE\",\n" + + " \"sequence-number\":\"0\",\n" + + " \"id\":\"bf4df797-759a-4684-a63c-393b7d40ed55\",\n" + + " \"source-name\":\"postman\",\n" + + " \"version\":\"v11\",\n" + + " \"timestamp\":\"20180104-09:57:58:721\"\n" + + " },\n" + + " \"entity\":\n" + + " {\n" + + " \"thirdparty-sdnc-id\":\"IP-WAN-Controller-1\",\n" + + " \"relationship-list\":\n" + + " {\n" + + " \"relationship\":\n" + + " [\n" + + " {\n" + + " \"related-to\":\"pnf\",\n" + + " \"relationship-data\":\n" + + " [\n" + + " {\n" + + " \"relationship-value\":\"a8098c1a-f86e-11da-bd1a-00112444be1e\",\n" + + " \"relationship-key\":\"pnf.pnf-name\"\n" + + " }\n" + + " ],\n" + + " \"related-link\":\"aai/v11/network/pnfs/pnf/a8098c1a-f86e-11da-bd1a-00112444be1e\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " \"resource-version\":\"1515059878654\",\n" + + " \"location\":\"Core\",\n" + + " \"product-name\":\"AC-WAN\",\n" + + " \"esr-system-info-list\":\n" + + " {\"esr-system-info\":\n" + + " [\n" + + " {\n" + + " \"esr-system-info-id\":\"IP-WAN-Controller-ESR-1\",\n" + + " \"system-type\":\"example-system-type-val-12078\",\n" + + " \"service-url\":\"https://182.2.61.24:18002\",\n" + + " \"ssl-cacert\":\"example-ssl-cacert-val-20589\",\n" + + " \"type\":\"WAN\",\n" + + " \"ssl-insecure\":true,\n" + + " \"system-status\":\"example-system-status-val-23435\",\n" + + " \"version\":\"V3R1\",\n" + + " \"passive\":true,\n" + + " \"password\":\"Admin@12345\",\n" + + " \"protocol\":\"RESTCONF\",\n" + + " \"ip-address\":\"182.2.61.24\",\n" + + " \"cloud-domain\":\"example-cloud-domain-val-76077\",\n" + + " \"user-name\":\"admin\",\n" + + " \"system-name\":\"IP-WAN-Controller\",\n" + + " \"port\":\"18002\",\n" + + " \"vendor\":\"IP-WAN\",\n" + + " \"resource-version\":\"1515059878666\",\n" + + " \"remote-path\":\"example-remotepath-val-5833\",\n" + + " \"default-tenant\":\"example-default-tenant-val-71148\"\n" + + " }\n" + + " ]\n" + + " }\n" + + " }\n" + + " }"; + + @Test + public void testProcessMsgInvalidEventType() throws Exception { + String DMAAPLISTENERROOT = "DMAAPLISTENERROOT"; + File directory = new File("lib"); + + if (! directory.exists()){ + directory.mkdir(); + } + + File source = new File("src/main/resources"); + File dest = new File("lib/"); + try { + FileUtils.copyDirectory(source, dest); + } catch (IOException e) { + e.printStackTrace(); + } + + try { + Map<String, String> env = System.getenv(); + Class<?> cl = env.getClass(); + Field field = cl.getDeclaredField("m"); + field.setAccessible(true); + Map<String, String> writableEnv = (Map<String, String>) field.get(env); + writableEnv.put(DMAAPLISTENERROOT, "."); + } catch (Exception e) { + throw new IllegalStateException("Failed to set environment variable", e); + } + Properties props = new Properties(); + InputStream propStr = TestSdncEsrDmaapReceiver.class.getResourceAsStream("/dmaap-consumer-esrsysteminfo.properties"); + + props.load(propStr); + + SdncAaiDmaapConsumer consumer = new SdncAaiDmaapConsumer(); + + consumer.init(props, "src/test/resources/dmaap-consumer-esrsysteminfo.properties"); + consumer.processMsg(aaiInput); + } +} diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncJsonDmaapConsumer.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncJsonDmaapConsumer.java new file mode 100644 index 000000000..620098cb7 --- /dev/null +++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncJsonDmaapConsumer.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit. + * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. + * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. + * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. + * Vestibulum commodo. Ut rhoncus gravida arcu. + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import org.junit.Test; + + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.InputStream; +import java.lang.reflect.Field; + +import java.util.Map; +import java.util.Properties; + +public class TestSdncJsonDmaapConsumer { + private static final String DMAAP_LISTENER_PROPERTIES = "dmaap-listener.properties"; + private static final String DMAAP_LISTENER_PROPERTIES_DIR = "src/test/resources"; + + @Test(expected = InvalidMessageException.class) + public void testProcessMsg_shouldThrowException() throws Exception { + SdncFlatJsonDmaapConsumer consumer = new SdncFlatJsonDmaapConsumer(); + consumer.processMsg(null); + } + + @Test + public void testProcessMsgFieldMap() throws Exception { + SdncFlatJsonDmaapConsumer consumer = new SdncFlatJsonDmaapConsumer(); + + String DMAAPLISTENERROOT = "DMAAPLISTENERROOT"; + File directory = new File("lib"); + + if (! directory.exists()){ + directory.mkdir(); + } + + File file = new File("lib" + "/" + "input.map"); + try{ + FileWriter fw = new FileWriter(file.getAbsoluteFile()); + BufferedWriter bw = new BufferedWriter(fw); + bw.write("SDNC.endpoint=>http://localhost:8282/restconf/operations"); + bw.close(); + } + catch (Exception e){ + e.printStackTrace(); + } + + try { + Map<String, String> env = System.getenv(); + Class<?> cl = env.getClass(); + Field field = cl.getDeclaredField("m"); + field.setAccessible(true); + Map<String, String> writableEnv = (Map<String, String>) field.get(env); + writableEnv.put(DMAAPLISTENERROOT, "."); + } catch (Exception e) { + throw new IllegalStateException("Failed to set environment variable", e); + } + + String msg = "{\n" + + " \"input\" : { \n" + + " }\n" + + "}"; + + InputStream propStr = TestSdncJsonDmaapConsumer.class.getResourceAsStream("/dmaap-consumer-pserver.properties"); + Properties props = new Properties(); + + props.load(propStr); + + consumer.init(props, "src/test/resources/dmaap-consumer-pserver.properties"); + consumer.processMsg(msg); + } + + @Test(expected = InvalidMessageException.class) + public void testProcessMsgFieldMapNoSdncEndPoint() throws Exception { + SdncFlatJsonDmaapConsumer consumer = new SdncFlatJsonDmaapConsumer(); + + String DMAAPLISTENERROOT = "DMAAPLISTENERROOT"; + File directory = new File("lib"); + + if (! directory.exists()){ + directory.mkdir(); + } + + File file = new File("lib" + "/" + "input.map"); + try{ + FileWriter fw = new FileWriter(file.getAbsoluteFile()); + BufferedWriter bw = new BufferedWriter(fw); + bw.write("SDNC"); + bw.close(); + } + catch (Exception e){ + e.printStackTrace(); + } + + try { + Map<String, String> env = System.getenv(); + Class<?> cl = env.getClass(); + Field field = cl.getDeclaredField("m"); + field.setAccessible(true); + Map<String, String> writableEnv = (Map<String, String>) field.get(env); + writableEnv.put(DMAAPLISTENERROOT, "."); + } catch (Exception e) { + throw new IllegalStateException("Failed to set environment variable", e); + } + + String msg = "{\n" + + " \"input\" : { \n" + + " }\n" + + "}"; + + InputStream propStr = TestSdncJsonDmaapConsumer.class.getResourceAsStream("/dmaap-consumer-pserver.properties"); + Properties props = new Properties(); + + props.load(propStr); + + consumer.init(props, "src/test/resources/dmaap-consumer-pserver.properties"); + consumer.processMsg(msg); + } + + @Test(expected = InvalidMessageException.class) + public void testProcessMsgFieldMapNoFieldMap() throws Exception { + SdncFlatJsonDmaapConsumer consumer = new SdncFlatJsonDmaapConsumer(); + + String msg = "{\n" + + " \"input\" : { \n" + + " }\n" + + "}"; + + consumer.processMsg(msg); + } +} diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncLcmDmaapConsumer.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncLcmDmaapConsumer.java new file mode 100644 index 000000000..4073b5542 --- /dev/null +++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncLcmDmaapConsumer.java @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit. + * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. + * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. + * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. + * Vestibulum commodo. Ut rhoncus gravida arcu. + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.util.Map; +import java.util.Properties; + +import org.apache.commons.io.FileUtils; + +import org.junit.Before; +import org.junit.Test; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class TestSdncLcmDmaapConsumer { + private static final String lcmInput = + "{\r\n" + + " \"version\": \"lcm-dmaap.version\",\r\n" + + " \"cambria.partition\": \"SDNC\",\r\n" + + " \"correlation-id\": \"lcm-dmaap.correlation-id\",\r\n" + + " \"rpc-name\": \"upgrade-software\",\r\n" + + " \"type\": \"lcm-dmaap.type\",\r\n" + + " \"body\": {\r\n" + + " \"input\": {\r\n" + + " \"common-header\": {\r\n" + + " \"api-ver\": \"lcm-dmaap.api-ver\",\r\n" + + " \"flags\": {\r\n" + + " \"ttl\": \"lcm-dmaap.flags.mode\",\r\n" + + " \"force\": \"lcm-dmaap.flags.force\",\r\n" + + " \"mode\": \"lcm-dmaap.flags.mode\"\r\n" + + " },\r\n" + + " \"originator-id\": \"lcm-dmaap.originator-id\",\r\n" + + " \"request-id\": \"lcm-dmaap.request-id\",\r\n" + + " \"sub-request-id\": \"lcm-dmaap.sub-request-id\",\r\n" + + " \"timestamp\": \"lcm-dmaap.timestamp\"\r\n" + + " },\r\n" + + " \"payload\": \"lcm-dmaap.payload\"\r\n" + + " }\r\n" + + " }\r\n" + + "}"; + + + @Test + public void test() throws Exception { + Properties props = new Properties(); + + SdncLcmDmaapConsumer consumer = new SdncLcmDmaapConsumer(); + InputStream propStr = TestSdncLcmDmaapConsumer.class.getResourceAsStream("/dmaap-consumer-1.properties"); + props.load(propStr); + consumer.init(props, "src/test/resources/dmaap-consumer-1.properties"); + consumer.processMsg(lcmInput); + } + + @Test(expected = InvalidMessageException.class) + public void testProcessMsgNullMessage() throws Exception { + SdncLcmDmaapConsumer consumer = new SdncLcmDmaapConsumer(); + consumer.processMsg(null); + } + + @Test + public void testProcessMsgMissingBody() throws Exception { + String msg = "{\r\n" + + " \"version\": \"lcm-dmaap.version\",\r\n" + + " \"cambria.partition\": \"SDNC\",\r\n" + + " \"correlation-id\": \"lcm-dmaap.correlation-id\",\r\n" + + " \"rpc-name\": \"upgrade-software\",\r\n" + + " \"type\": \"lcm-dmaap.type\",\r\n" + + " \"body1\": {\r\n" + + " \"input\": {\r\n" + + " \"common-header\": {\r\n" + + " \"api-ver\": \"lcm-dmaap.api-ver\",\r\n" + + " \"flags\": {\r\n" + + " \"ttl\": \"lcm-dmaap.flags.mode\",\r\n" + + " \"force\": \"lcm-dmaap.flags.force\",\r\n" + + " \"mode\": \"lcm-dmaap.flags.mode\"\r\n" + + " },\r\n" + + " \"originator-id\": \"lcm-dmaap.originator-id\",\r\n" + + " \"request-id\": \"lcm-dmaap.request-id\",\r\n" + + " \"sub-request-id\": \"lcm-dmaap.sub-request-id\",\r\n" + + " \"timestamp\": \"lcm-dmaap.timestamp\"\r\n" + + " },\r\n" + + " \"payload\": \"lcm-dmaap.payload\"\r\n" + + " }\r\n" + + " }\r\n" + + "}"; + + SdncLcmDmaapConsumer consumer = new SdncLcmDmaapConsumer(); + consumer.processMsg(msg); + } + + @Test + public void testProcessMsgInvalidRPC() throws Exception { + String msg = "{\r\n" + + " \"version\": \"lcm-dmaap.version\",\r\n" + + " \"cambria.partition\": \"SDNC\",\r\n" + + " \"correlation-id\": \"lcm-dmaap.correlation-id\",\r\n" + + " \"rpc-name1\": \"upgrade-software\",\r\n" + + " \"type\": \"lcm-dmaap.type\",\r\n" + + " \"body\": {\r\n" + + " \"input\": {\r\n" + + " \"common-header\": {\r\n" + + " \"api-ver\": \"lcm-dmaap.api-ver\",\r\n" + + " \"flags\": {\r\n" + + " \"ttl\": \"lcm-dmaap.flags.mode\",\r\n" + + " \"force\": \"lcm-dmaap.flags.force\",\r\n" + + " \"mode\": \"lcm-dmaap.flags.mode\"\r\n" + + " },\r\n" + + " \"originator-id\": \"lcm-dmaap.originator-id\",\r\n" + + " \"request-id\": \"lcm-dmaap.request-id\",\r\n" + + " \"sub-request-id\": \"lcm-dmaap.sub-request-id\",\r\n" + + " \"timestamp\": \"lcm-dmaap.timestamp\"\r\n" + + " },\r\n" + + " \"payload\": \"lcm-dmaap.payload\"\r\n" + + " }\r\n" + + " }\r\n" + + "}"; + + SdncLcmDmaapConsumer consumer = new SdncLcmDmaapConsumer(); + consumer.processMsg(msg); + } + + @Test + public void testProcessMsgInvalidPartition() throws Exception { + String msg = "{\r\n" + + " \"version\": \"lcm-dmaap.version\",\r\n" + + " \"cambria.partition\": \"BAD\",\r\n" + + " \"correlation-id\": \"lcm-dmaap.correlation-id\",\r\n" + + " \"rpc-name\": \"upgrade-software\",\r\n" + + " \"type\": \"lcm-dmaap.type\",\r\n" + + " \"body\": {\r\n" + + " \"input\": {\r\n" + + " \"common-header\": {\r\n" + + " \"api-ver\": \"lcm-dmaap.api-ver\",\r\n" + + " \"flags\": {\r\n" + + " \"ttl\": \"lcm-dmaap.flags.mode\",\r\n" + + " \"force\": \"lcm-dmaap.flags.force\",\r\n" + + " \"mode\": \"lcm-dmaap.flags.mode\"\r\n" + + " },\r\n" + + " \"originator-id\": \"lcm-dmaap.originator-id\",\r\n" + + " \"request-id\": \"lcm-dmaap.request-id\",\r\n" + + " \"sub-request-id\": \"lcm-dmaap.sub-request-id\",\r\n" + + " \"timestamp\": \"lcm-dmaap.timestamp\"\r\n" + + " },\r\n" + + " \"payload\": \"lcm-dmaap.payload\"\r\n" + + " }\r\n" + + " }\r\n" + + "}"; + + + SdncLcmDmaapConsumer consumer = new SdncLcmDmaapConsumer(); + consumer.processMsg(msg); + } +} diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncOdlConnection.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncOdlConnection.java new file mode 100644 index 000000000..db24a4545 --- /dev/null +++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncOdlConnection.java @@ -0,0 +1,26 @@ +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import org.junit.Test; + +import java.io.IOException; +import java.net.ConnectException; + +public class TestSdncOdlConnection { + + @Test + public void test() { + + try { + SdncOdlConnection sdncOdlConnection = SdncOdlConnection.newInstance("https://127.0.0.1:8447/aai/v11/network/pnfs/pnf/a8098c1a-f86e-11da-bd1a-00112444be1e", "", ""); + sdncOdlConnection.send("PUT", "application/json", "{\n" + + " \"input\" : { \n" + + " }\n" + + "}"); + } catch (ConnectException e) { + //Connection exception + } catch (IOException e) { + e.printStackTrace(); + } + } + +} diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java new file mode 100644 index 000000000..11201265d --- /dev/null +++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncPserverDmaapReceiver.java @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit. + * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. + * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. + * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. + * Vestibulum commodo. Ut rhoncus gravida arcu. + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.util.Map; +import java.util.Properties; + +import org.apache.commons.io.FileUtils; + +import org.junit.Before; +import org.junit.Test; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class TestSdncPserverDmaapReceiver { + private static final String aaiInput = "{\r\n" + + " \"cambria.partition\": \"AAI\",\r\n" + + " \"event-header\": {\r\n" + + " \"severity\": \"NORMAL\",\r\n" + + " \"entity-type\": \"pserver\",\r\n" + + " \"top-entity-type\": \"pserver\",\r\n" + + " \"entity-link\": \"https://aai.com:8443/aai/v11/cloud-infrastructure/pservers/pserver/a3d3d3d3/\",\r\n" + + " \"event-type\": \"AAI-EVENT\",\r\n" + + " \"domain\": \"e2e\",\r\n" + + " \"action\": \"UPDATE\",\r\n" + + " \"sequence-number\": \"0\",\r\n" + + " \"id\": \"20170415000111-1234\",\r\n" + + " \"source-name\": \"testclient\",\r\n" + + " \"version\": \"v11\",\r\n" + + " \"timestamp\": \"20170415-00:01:11:979\"\r\n" + + " },\r\n" + + " \"entity\": {\r\n" + + " \"hostname\": \"host1\",\r\n" + + " \"ptnii-equip-name\": \"lat111\",\r\n" + + " \"equip-type\": \"server\",\r\n" + + " \"equip-vendor\": \"HP\",\r\n" + + " \"equip-model\": \"model1\",\r\n" + + " \"fqdn\": \"l.global.net\",\r\n" + + " \"ipv4-oam-address\": \"12.12.12.12\",\r\n" + + " \"in-maint\": false,\r\n" + + " \"resource-version\": \"11111111111\",\r\n" + + " \"purpose\": \"Gamma\",\r\n" + + " \"relationship-list\": {\r\n" + + " \"relationship\": [\r\n" + + " {\r\n" + + " \"related-to\": \"complex\",\r\n" + + " \"relationship-data\": [\r\n" + + " {\r\n" + + " \"relationship-value\": \"L1L2L3\",\r\n" + + " \"relationship-key\": \"complex.physical-location-id\"\r\n" + + " }\r\n" + + " ],\r\n" + + " \"related-link\": \"https://aai.com:8443/aai/v11/cloud-infrastructure/complexes/complex/cmpl1\"\r\n" + + " }\r\n" + + " ]\r\n" + + " },\r\n" + + " \"p-interfaces\": {\r\n" + + " \"p-interface\": []\r\n" + + " },\r\n" + + " \"lag-interfaces\": {\r\n" + + " \"lag-interface\": []\r\n" + + " }\r\n" + + " }\r\n" + + "}"; + + @Before + public void setUp() throws Exception { + } + + @Test + public void test() throws Exception { + Properties props = new Properties(); + + String rpcMsgbody = new SdncAaiDmaapConsumer(props).publish("src/main/resources/template-pserver.vt", aaiInput); + + ObjectMapper oMapper = new ObjectMapper(); + JsonNode aaiRootNode; + try { + aaiRootNode = oMapper.readTree(rpcMsgbody); + } catch (Exception e) { + throw new InvalidMessageException("Cannot parse json object", e); + } + + assertTrue(aaiRootNode.get("input").get("payload") != null); + assertTrue(aaiRootNode.get("input").get("common-header") != null); + + } + + @Test + public void testProcessMsgFieldMap() throws Exception { + + + String DMAAPLISTENERROOT = "DMAAPLISTENERROOT"; + File directory = new File("lib"); + + if (! directory.exists()){ + directory.mkdir(); + } + + File source = new File("src/main/resources"); + File dest = new File("lib/"); + try { + FileUtils.copyDirectory(source, dest); + } catch (IOException e) { + e.printStackTrace(); + } + + try { + Map<String, String> env = System.getenv(); + Class<?> cl = env.getClass(); + Field field = cl.getDeclaredField("m"); + field.setAccessible(true); + Map<String, String> writableEnv = (Map<String, String>) field.get(env); + writableEnv.put(DMAAPLISTENERROOT, "."); + } catch (Exception e) { + throw new IllegalStateException("Failed to set environment variable", e); + } + Properties props = new Properties(); + + SdncAaiDmaapConsumer consumer = new SdncAaiDmaapConsumer(); + + InputStream propStr = TestSdncPserverDmaapReceiver.class.getResourceAsStream("/dmaap-consumer-pserver.properties"); + + + props.load(propStr); + + consumer.init(props, "src/test/resources/dmaap-consumer-pserver.properties"); + consumer.processMsg(aaiInput); + } + + @Test(expected = InvalidMessageException.class) + public void testProcessMsgNullMessage() throws Exception { + Properties props = new Properties(); + + SdncAaiDmaapConsumer consumer = new SdncAaiDmaapConsumer(); + consumer.processMsg(null); + } + + @Test(expected = InvalidMessageException.class) + public void testProcessMsgInvalidMessage() throws Exception { + Properties props = new Properties(); + + SdncAaiDmaapConsumer consumer = new SdncAaiDmaapConsumer(); + consumer.processMsg("test"); + } + + @Test + public void testProcessMsgMissingEventHeader() throws Exception { + Properties props = new Properties(); + + SdncAaiDmaapConsumer consumer = new SdncAaiDmaapConsumer(); + consumer.processMsg("{\n" + + " \"input\" : { \n" + + " }\n" + + "}"); + } + + @Test + public void testProcessMsgInvalidEventType() throws Exception { + Properties props = new Properties(); + + String msg = "{\"cambria.partition\": \"AAI\",\r\n" + + " \"event-header\": {\"event-type\": \"TEST-EVENT\"}}"; + + SdncAaiDmaapConsumer consumer = new SdncAaiDmaapConsumer(); + consumer.processMsg(msg); + } + + + + + +} diff --git a/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncRANSliceDmaapConsumer.java b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncRANSliceDmaapConsumer.java new file mode 100644 index 000000000..50c427ec1 --- /dev/null +++ b/northbound/dmaap-listener/src/test/java/org/onap/ccsdk/sli/northbound/dmaapclient/TestSdncRANSliceDmaapConsumer.java @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2017. Lorem ipsum dolor sit amet, consectetur adipiscing elit. + * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan. + * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna. + * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus. + * Vestibulum commodo. Ut rhoncus gravida arcu. + */ + +package org.onap.ccsdk.sli.northbound.dmaapclient; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.util.Map; +import java.util.Properties; + +import org.apache.commons.io.FileUtils; + +import org.junit.Before; +import org.junit.Test; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + +public class TestSdncRANSliceDmaapConsumer { + private static final String ranSliceInput = + "{\r\n" + + " \"version\": \"ranSlice-dmaap.version\",\r\n" + + " \"cambria.partition\": \"SDNC\",\r\n" + + " \"correlation-id\": \"ranSlice-dmaap.correlation-id\",\r\n" + + " \"rpc-name\": \"upgrade-software\",\r\n" + + " \"type\": \"ranSlice-dmaap.type\",\r\n" + + " \"body\": {\r\n" + + " \"input\": {\r\n" + + " \"common-header\": {\r\n" + + " \"api-ver\": \"ranSlice-dmaap.api-ver\",\r\n" + + " \"flags\": {\r\n" + + " \"ttl\": \"ranSlice-dmaap.flags.mode\",\r\n" + + " \"force\": \"ranSlice-dmaap.flags.force\",\r\n" + + " \"mode\": \"ranSlice-dmaap.flags.mode\"\r\n" + + " },\r\n" + + " \"originator-id\": \"ranSlice-dmaap.originator-id\",\r\n" + + " \"request-id\": \"ranSlice-dmaap.request-id\",\r\n" + + " \"sub-request-id\": \"ranSlice-dmaap.sub-request-id\",\r\n" + + " \"timestamp\": \"ranSlice-dmaap.timestamp\"\r\n" + + " },\r\n" + + " \"payload\": \"ranSlice-dmaap.payload\"\r\n" + + " }\r\n" + + " }\r\n" + + "}"; + + + @Test + public void test() throws Exception { + Properties props = new Properties(); + + SdncRANSliceDmaapConsumer consumer = new SdncRANSliceDmaapConsumer(); + InputStream propStr = TestSdncRANSliceDmaapConsumer.class.getResourceAsStream("/dmaap-consumer-1.properties"); + props.load(propStr); + consumer.init(props, "src/test/resources/dmaap-consumer-1.properties"); + consumer.processMsg(ranSliceInput); + } + + @Test(expected = InvalidMessageException.class) + public void testProcessMsgNullMessage() throws Exception { + SdncRANSliceDmaapConsumer consumer = new SdncRANSliceDmaapConsumer(); + consumer.processMsg(null); + } + + @Test + public void testProcessMsgMissingBody() throws Exception { + String msg = "{\r\n" + + " \"version\": \"ranSlice-dmaap.version\",\r\n" + + " \"cambria.partition\": \"SDNC\",\r\n" + + " \"correlation-id\": \"ranSlice-dmaap.correlation-id\",\r\n" + + " \"rpc-name\": \"upgrade-software\",\r\n" + + " \"type\": \"ranSlice-dmaap.type\",\r\n" + + " \"body1\": {\r\n" + + " \"input\": {\r\n" + + " \"common-header\": {\r\n" + + " \"api-ver\": \"ranSlice-dmaap.api-ver\",\r\n" + + " \"flags\": {\r\n" + + " \"ttl\": \"ranSlice-dmaap.flags.mode\",\r\n" + + " \"force\": \"ranSlice-dmaap.flags.force\",\r\n" + + " \"mode\": \"ranSlice-dmaap.flags.mode\"\r\n" + + " },\r\n" + + " \"originator-id\": \"ranSlice-dmaap.originator-id\",\r\n" + + " \"request-id\": \"ranSlice-dmaap.request-id\",\r\n" + + " \"sub-request-id\": \"ranSlice-dmaap.sub-request-id\",\r\n" + + " \"timestamp\": \"ranSlice-dmaap.timestamp\"\r\n" + + " },\r\n" + + " \"payload\": \"ranSlice-dmaap.payload\"\r\n" + + " }\r\n" + + " }\r\n" + + "}"; + + SdncRANSliceDmaapConsumer consumer = new SdncRANSliceDmaapConsumer(); + consumer.processMsg(msg); + } + + @Test + public void testProcessMsgInvalidRPC() throws Exception { + String msg = "{\r\n" + + " \"version\": \"ranSlice-dmaap.version\",\r\n" + + " \"cambria.partition\": \"SDNC\",\r\n" + + " \"correlation-id\": \"ranSlice-dmaap.correlation-id\",\r\n" + + " \"rpc-name1\": \"upgrade-software\",\r\n" + + " \"type\": \"ranSlice-dmaap.type\",\r\n" + + " \"body\": {\r\n" + + " \"input\": {\r\n" + + " \"common-header\": {\r\n" + + " \"api-ver\": \"ranSlice-dmaap.api-ver\",\r\n" + + " \"flags\": {\r\n" + + " \"ttl\": \"ranSlice-dmaap.flags.mode\",\r\n" + + " \"force\": \"ranSlice-dmaap.flags.force\",\r\n" + + " \"mode\": \"ranSlice-dmaap.flags.mode\"\r\n" + + " },\r\n" + + " \"originator-id\": \"ranSlice-dmaap.originator-id\",\r\n" + + " \"request-id\": \"ranSlice-dmaap.request-id\",\r\n" + + " \"sub-request-id\": \"ranSlice-dmaap.sub-request-id\",\r\n" + + " \"timestamp\": \"ranSlice-dmaap.timestamp\"\r\n" + + " },\r\n" + + " \"payload\": \"ranSlice-dmaap.payload\"\r\n" + + " }\r\n" + + " }\r\n" + + "}"; + + SdncRANSliceDmaapConsumer consumer = new SdncRANSliceDmaapConsumer(); + consumer.processMsg(msg); + } + + @Test + public void testProcessMsgInvalidPartition() throws Exception { + String msg = "{\r\n" + + " \"version\": \"ranSlice-dmaap.version\",\r\n" + + " \"cambria.partition\": \"BAD\",\r\n" + + " \"correlation-id\": \"ranSlice-dmaap.correlation-id\",\r\n" + + " \"rpc-name\": \"upgrade-software\",\r\n" + + " \"type\": \"ranSlice-dmaap.type\",\r\n" + + " \"body\": {\r\n" + + " \"input\": {\r\n" + + " \"common-header\": {\r\n" + + " \"api-ver\": \"ranSlice-dmaap.api-ver\",\r\n" + + " \"flags\": {\r\n" + + " \"ttl\": \"ranSlice-dmaap.flags.mode\",\r\n" + + " \"force\": \"ranSlice-dmaap.flags.force\",\r\n" + + " \"mode\": \"ranSlice-dmaap.flags.mode\"\r\n" + + " },\r\n" + + " \"originator-id\": \"ranSlice-dmaap.originator-id\",\r\n" + + " \"request-id\": \"ranSlice-dmaap.request-id\",\r\n" + + " \"sub-request-id\": \"ranSlice-dmaap.sub-request-id\",\r\n" + + " \"timestamp\": \"ranSlice-dmaap.timestamp\"\r\n" + + " },\r\n" + + " \"payload\": \"ranSlice-dmaap.payload\"\r\n" + + " }\r\n" + + " }\r\n" + + "}"; + + + SdncRANSliceDmaapConsumer consumer = new SdncRANSliceDmaapConsumer(); + consumer.processMsg(msg); + } +} diff --git a/northbound/dmaap-listener/src/test/resources/dblib.properties b/northbound/dmaap-listener/src/test/resources/dblib.properties new file mode 100644 index 000000000..9506ac8d1 --- /dev/null +++ b/northbound/dmaap-listener/src/test/resources/dblib.properties @@ -0,0 +1,38 @@ +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +# dblib.properrties +org.onap.ccsdk.sli.dbtype=jdbc + +org.onap.ccsdk.sli.jdbc.hosts=sdnctldb01 +org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://dbhost:3306/sdnctl +org.onap.ccsdk.sli.jdbc.driver=org.mariadb.jdbc.Driver +org.onap.ccsdk.sli.jdbc.database=sdnctl +org.onap.ccsdk.sli.jdbc.user=sdnctl +org.onap.ccsdk.sli.jdbc.password=gamma +org.onap.ccsdk.sli.jdbc.connection.name=sdnctldb01 +org.onap.ccsdk.sli.jdbc.connection.timeout=50 +org.onap.ccsdk.sli.jdbc.request.timeout=100 +org.onap.ccsdk.sli.jdbc.limit.init=10 +org.onap.ccsdk.sli.jdbc.limit.min=10 +org.onap.ccsdk.sli.jdbc.limit.max=20 +org.onap.dblib.connection.recovery=false + diff --git a/northbound/dmaap-listener/src/test/resources/dmaap-consumer-1.properties b/northbound/dmaap-listener/src/test/resources/dmaap-consumer-1.properties new file mode 100755 index 000000000..ae83ef8c2 --- /dev/null +++ b/northbound/dmaap-listener/src/test/resources/dmaap-consumer-1.properties @@ -0,0 +1,35 @@ +TransportType=HTTPAAF +Latitude =40.397443 +Longitude =-74.135602 +Version =1.0 +ServiceName =localhost/events +Environment =DEV +Partner = +SubContextPath =/ +Protocol =http +MethodType =GET +username =test +password =test +contenttype =application/json +authKey=ABC123 +authDate=2016-05-10T13:13:50-0700 +host=localhost:3904 +topic=ccsdk-topic +group=ccsdk-unittest +id=ccsdk_unittest +timeout=15000 +limit=1000 +filter= +AFT_DME2_EXCHANGE_REQUEST_HANDLERS=com.att.nsa.test.PreferredRouteRequestHandler +AFT_DME2_EXCHANGE_REPLY_HANDLERS=com.att.nsa.test.PreferredRouteReplyHandler +AFT_DME2_REQ_TRACE_ON=true +AFT_ENVIRONMENT=AFTUAT +AFT_DME2_EP_CONN_TIMEOUT=15000 +AFT_DME2_ROUNDTRIP_TIMEOUT_MS=240000 +AFT_DME2_EP_READ_TIMEOUT_MS=50000 +sessionstickinessrequired=NO +DME2preferredRouterFilePath=src/test/resources/dmaap-listener.preferredRoute.txt +sdnc.odl.user=admin +sdnc.odl.password=admin +sdnc.odl.url-base=http://localhost:8282/restconf/operations + diff --git a/northbound/dmaap-listener/src/test/resources/dmaap-consumer-a1Adapter-policy-1.properties b/northbound/dmaap-listener/src/test/resources/dmaap-consumer-a1Adapter-policy-1.properties new file mode 100644 index 000000000..edb7c453e --- /dev/null +++ b/northbound/dmaap-listener/src/test/resources/dmaap-consumer-a1Adapter-policy-1.properties @@ -0,0 +1,35 @@ +TransportType=HTTPNOAUTH +Latitude =50.000000 +Longitude =-100.000000 +Version =1.0 +ServiceName =message-router.onap:3904/events +Environment =TEST +Partner = +routeOffer=MR1 +SubContextPath =/ +Protocol =http +MethodType =GET +username =admin +password =admin +contenttype =application/json +authKey=fs20cKwalJ6ry4kX:7Hqm6BDZK47IKxGRkOPFk33qMYs= +authDate=2019-04-09T04:28:40-05:00 +host=message-router.onap:3904 +topic=A1-P +group=users +id=sdnc1 +timeout=15000 +limit=1000 +filter= +AFT_DME2_EXCHANGE_REQUEST_HANDLERS=com.att.nsa.test.PreferredRouteRequestHandler +AFT_DME2_EXCHANGE_REPLY_HANDLERS=com.att.nsa.test.PreferredRouteReplyHandler +AFT_DME2_REQ_TRACE_ON=true +AFT_ENVIRONMENT=AFTUAT +AFT_DME2_EP_CONN_TIMEOUT=15000 +AFT_DME2_ROUNDTRIP_TIMEOUT_MS=240000 +AFT_DME2_EP_READ_TIMEOUT_MS=50000 +sessionstickinessrequired=NO +DME2preferredRouterFilePath=/opt/onap/sdnc/data/properties/dmaap-listener.preferredRoute.txt +sdnc.odl.user=admin +sdnc.odl.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U +sdnc.odl.url-base=http://sdnc.onap:8282/restconf/operations diff --git a/northbound/dmaap-listener/src/test/resources/dmaap-consumer-cMNotify-1.properties b/northbound/dmaap-listener/src/test/resources/dmaap-consumer-cMNotify-1.properties new file mode 100644 index 000000000..aae34a26f --- /dev/null +++ b/northbound/dmaap-listener/src/test/resources/dmaap-consumer-cMNotify-1.properties @@ -0,0 +1,35 @@ +TransportType=HTTPNOAUTH +Latitude =50.000000 +Longitude =-100.000000 +Version =1.0 +ServiceName =message-router.onap:3904/events +Environment =TEST +Partner = +routeOffer=MR1 +SubContextPath =/ +Protocol =http +MethodType =GET +username =admin +password =admin +contenttype =application/json +authKey=fs20cKwalJ6ry4kX:7Hqm6BDZK47IKxGRkOPFk33qMYs= +authDate=2019-04-09T04:28:40-05:00 +host=message-router.onap:3904 +topic=CM-NOTIFICATION +group=users +id=sdnc1 +timeout=15000 +limit=1000 +filter= +AFT_DME2_EXCHANGE_REQUEST_HANDLERS=com.att.nsa.test.PreferredRouteRequestHandler +AFT_DME2_EXCHANGE_REPLY_HANDLERS=com.att.nsa.test.PreferredRouteReplyHandler +AFT_DME2_REQ_TRACE_ON=true +AFT_ENVIRONMENT=AFTUAT +AFT_DME2_EP_CONN_TIMEOUT=15000 +AFT_DME2_ROUNDTRIP_TIMEOUT_MS=240000 +AFT_DME2_EP_READ_TIMEOUT_MS=50000 +sessionstickinessrequired=NO +DME2preferredRouterFilePath=/opt/onap/sdnc/data/properties/dmaap-listener.preferredRoute.txt +sdnc.odl.user=admin +sdnc.odl.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U +sdnc.odl.url-base=http://sdnc.onap:8282/restconf/operations diff --git a/northbound/dmaap-listener/src/test/resources/dmaap-consumer-esrsysteminfo.properties b/northbound/dmaap-listener/src/test/resources/dmaap-consumer-esrsysteminfo.properties new file mode 100644 index 000000000..9f5cfe71f --- /dev/null +++ b/northbound/dmaap-listener/src/test/resources/dmaap-consumer-esrsysteminfo.properties @@ -0,0 +1,34 @@ +TransportType=DME2 +Latitude =47.778998 +Longitude =-122.182883 +Version =1.0 +ServiceName =dmaap-v1.dev.dmaap.dt.saat.acsi.att.com/events +Environment =TEST +Partner = +SubContextPath =/ +Protocol =https +MethodType =GET +username =test +password =test +contenttype =application/json +authKey=ABC123 +authDate=2016-05-10T13:13:50-0700 +host=localhost:3904 +topic=AAI-EVENT +group=pserver +id=1 +timeout=20000 +limit=10000 +filter={"class":"Equals","field":"event-header.entity-type","value":"pserver"} +AFT_DME2_EXCHANGE_REQUEST_HANDLERS=com.att.nsa.test.PreferredRouteRequestHandler +AFT_DME2_EXCHANGE_REPLY_HANDLERS=com.att.nsa.test.PreferredRouteReplyHandler +AFT_DME2_REQ_TRACE_ON=true +AFT_ENVIRONMENT=AFTUAT +AFT_DME2_EP_CONN_TIMEOUT=55000 +AFT_DME2_ROUNDTRIP_TIMEOUT_MS=240000 +AFT_DME2_EP_READ_TIMEOUT_MS=50000 +sessionstickinessrequired=NO +DME2preferredRouterFilePath=src/test/resources/dmaap-listener.preferredRoute.txt +sdnc.odl.user=admin +sdnc.odl.password=admin +sdnc.odl.url-base=http://localhost:8181/restconf/operations
\ No newline at end of file diff --git a/northbound/dmaap-listener/src/test/resources/dmaap-consumer-generic-vnf.properties b/northbound/dmaap-listener/src/test/resources/dmaap-consumer-generic-vnf.properties new file mode 100644 index 000000000..710a7c7c9 --- /dev/null +++ b/northbound/dmaap-listener/src/test/resources/dmaap-consumer-generic-vnf.properties @@ -0,0 +1,34 @@ +TransportType=DME2 +Latitude =47.778998 +Longitude =-122.182883 +Version =1.0 +ServiceName =dmaap-v1.dev.dmaap.dt.saat.acsi.att.com/events +Environment =TEST +Partner = +SubContextPath =/ +Protocol =https +MethodType =GET +username =test +password =test +contenttype =application/json +authKey=ABC123 +authDate=2016-05-10T13:13:50-0700 +host=localhost:3904 +topic=AAI-EVENT +group=vnf +id=1 +timeout=20000 +limit=10000 +filter={"class":"And","filters":[{"class":"Equals","field":"event-header.entity-type","value":"generic-vnf"},{"class":"Equals","field":"entity.vnf-type","value":"kvm-vpe"}]} +AFT_DME2_EXCHANGE_REQUEST_HANDLERS=com.att.nsa.test.PreferredRouteRequestHandler +AFT_DME2_EXCHANGE_REPLY_HANDLERS=com.att.nsa.test.PreferredRouteReplyHandler +AFT_DME2_REQ_TRACE_ON=true +AFT_ENVIRONMENT=AFTUAT +AFT_DME2_EP_CONN_TIMEOUT=55000 +AFT_DME2_ROUNDTRIP_TIMEOUT_MS=240000 +AFT_DME2_EP_READ_TIMEOUT_MS=50000 +sessionstickinessrequired=NO +DME2preferredRouterFilePath=src/test/resources/dmaap-listener.preferredRoute.txt +sdnc.odl.user=admin +sdnc.odl.password=admin +sdnc.odl.url-base=http://localhost:8181/restconf/operations
\ No newline at end of file diff --git a/northbound/dmaap-listener/src/test/resources/dmaap-consumer-pserver.properties b/northbound/dmaap-listener/src/test/resources/dmaap-consumer-pserver.properties new file mode 100644 index 000000000..9f5cfe71f --- /dev/null +++ b/northbound/dmaap-listener/src/test/resources/dmaap-consumer-pserver.properties @@ -0,0 +1,34 @@ +TransportType=DME2 +Latitude =47.778998 +Longitude =-122.182883 +Version =1.0 +ServiceName =dmaap-v1.dev.dmaap.dt.saat.acsi.att.com/events +Environment =TEST +Partner = +SubContextPath =/ +Protocol =https +MethodType =GET +username =test +password =test +contenttype =application/json +authKey=ABC123 +authDate=2016-05-10T13:13:50-0700 +host=localhost:3904 +topic=AAI-EVENT +group=pserver +id=1 +timeout=20000 +limit=10000 +filter={"class":"Equals","field":"event-header.entity-type","value":"pserver"} +AFT_DME2_EXCHANGE_REQUEST_HANDLERS=com.att.nsa.test.PreferredRouteRequestHandler +AFT_DME2_EXCHANGE_REPLY_HANDLERS=com.att.nsa.test.PreferredRouteReplyHandler +AFT_DME2_REQ_TRACE_ON=true +AFT_ENVIRONMENT=AFTUAT +AFT_DME2_EP_CONN_TIMEOUT=55000 +AFT_DME2_ROUNDTRIP_TIMEOUT_MS=240000 +AFT_DME2_EP_READ_TIMEOUT_MS=50000 +sessionstickinessrequired=NO +DME2preferredRouterFilePath=src/test/resources/dmaap-listener.preferredRoute.txt +sdnc.odl.user=admin +sdnc.odl.password=admin +sdnc.odl.url-base=http://localhost:8181/restconf/operations
\ No newline at end of file diff --git a/northbound/dmaap-listener/src/test/resources/dmaap-listener.preferredRoute.txt b/northbound/dmaap-listener/src/test/resources/dmaap-listener.preferredRoute.txt new file mode 100755 index 000000000..88705f73b --- /dev/null +++ b/northbound/dmaap-listener/src/test/resources/dmaap-listener.preferredRoute.txt @@ -0,0 +1 @@ +preferredRouteKey=ABC123
\ No newline at end of file diff --git a/northbound/dmaap-listener/src/test/resources/dmaap-listener.properties b/northbound/dmaap-listener/src/test/resources/dmaap-listener.properties new file mode 100755 index 000000000..defef0b43 --- /dev/null +++ b/northbound/dmaap-listener/src/test/resources/dmaap-listener.properties @@ -0,0 +1 @@ +subscriptions=org.onap.ccsdk.sli.northbound.dmaapclient.DummyDmaapConsumer:dmaap-consumer-1.properties;org.onap.ccsdk.sli.northbound.dmaapclient.SdncAaiDmaapConsumer:dmaap-consumer-esrsysteminfo.properties
\ No newline at end of file diff --git a/northbound/features/ccsdk-asdcApi/pom.xml b/northbound/features/ccsdk-asdcApi/pom.xml new file mode 100644 index 000000000..a744c4a08 --- /dev/null +++ b/northbound/features/ccsdk-asdcApi/pom.xml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>single-feature-parent</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>ccsdk-asdcApi</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>feature</packaging> + + <name>ccsdk-sli-northbound :: asdcApi :: ${project.artifactId}</name> + + <properties> + <ccsdk.sli.northbound.version>${project.version}</ccsdk.sli.northbound.version> + </properties> + + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>ccsdk-sli</artifactId> + <version>${ccsdk.sli.core.version}</version> + <type>xml</type> + <classifier>features</classifier> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>asdcApi-model</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>asdcApi-provider</artifactId> + <version>${project.version}</version> + </dependency> + + </dependencies> +</project> diff --git a/northbound/features/ccsdk-daexim-offsite-backup/pom.xml b/northbound/features/ccsdk-daexim-offsite-backup/pom.xml new file mode 100644 index 000000000..6f57b66ea --- /dev/null +++ b/northbound/features/ccsdk-daexim-offsite-backup/pom.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>single-feature-parent</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>ccsdk-daexim-offsite-backup</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>feature</packaging> + + <name>ccsdk-sli-northbound :: daexim-offsite-backup :: ${project.artifactId}</name> + + <dependencies> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>odl-mdsal-broker</artifactId> + <type>xml</type> + <classifier>features</classifier> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>ccsdk-sli</artifactId> + <version>${ccsdk.sli.core.version}</version> + <type>xml</type> + <classifier>features</classifier> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>daexim-offsite-backup-model</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>daexim-offsite-backup-provider</artifactId> + <version>${project.version}</version> + </dependency> + </dependencies> +</project> diff --git a/northbound/features/ccsdk-daexim-offsite-backup/src/main/feature/feature.xml b/northbound/features/ccsdk-daexim-offsite-backup/src/main/feature/feature.xml new file mode 100644 index 000000000..3dcb9002c --- /dev/null +++ b/northbound/features/ccsdk-daexim-offsite-backup/src/main/feature/feature.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes"?> +<features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="ccsdk-daexim-offsite-backup"> + <repository>mvn:org.onap.ccsdk.sli.core/ccsdk-sli/LATEST/xml/features</repository> + <feature name="ccsdk-daexim-offsite-backup"> + <feature version="${ccsdk.sli.core.version}">ccsdk-sli</feature> + </feature> +</features> diff --git a/northbound/features/ccsdk-dataChange/pom.xml b/northbound/features/ccsdk-dataChange/pom.xml new file mode 100644 index 000000000..ada12eccc --- /dev/null +++ b/northbound/features/ccsdk-dataChange/pom.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>single-feature-parent</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>ccsdk-dataChange</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>feature</packaging> + + <name>ccsdk-sli-northbound :: dataChange :: ${project.artifactId}</name> + + <properties> + <ccsdk.sli.northbound.version>${project.version}</ccsdk.sli.northbound.version> + </properties> + + <dependencies> + + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>ccsdk-sli</artifactId> + <version>${ccsdk.sli.core.version}</version> + <type>xml</type> + <classifier>features</classifier> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>dataChange-model</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>dataChange-provider</artifactId> + <version>${project.version}</version> + </dependency> + + </dependencies> +</project> diff --git a/northbound/features/ccsdk-lcm/pom.xml b/northbound/features/ccsdk-lcm/pom.xml new file mode 100644 index 000000000..013786d24 --- /dev/null +++ b/northbound/features/ccsdk-lcm/pom.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>single-feature-parent</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>ccsdk-lcm</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>feature</packaging> + + <name>ccsdk-sli-northbound :: lcm :: ${project.artifactId}</name> + + <properties> + <ccsdk.sli.northbound.version>${project.version}</ccsdk.sli.northbound.version> + </properties> + + <dependencies> + + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>ccsdk-sli</artifactId> + <version>${ccsdk.sli.core.version}</version> + <type>xml</type> + <classifier>features</classifier> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>lcm-model</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>lcm-provider</artifactId> + <version>${project.version}</version> + </dependency> + + </dependencies> +</project> diff --git a/northbound/features/ccsdk-sli-northbound-all/pom.xml b/northbound/features/ccsdk-sli-northbound-all/pom.xml new file mode 100644 index 000000000..fc7081fbc --- /dev/null +++ b/northbound/features/ccsdk-sli-northbound-all/pom.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>single-feature-parent</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>ccsdk-sli-northbound-all</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>feature</packaging> + + <name>ccsdk-sli-northbound :: features :: ${project.artifactId}</name> + + <properties> + <ccsdk.sli.northbound.version>${project.version}</ccsdk.sli.northbound.version> + </properties> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>ccsdk-asdcApi</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>features</classifier> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>ccsdk-dataChange</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>features</classifier> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>ccsdk-lcm</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>features</classifier> + </dependency> + + + </dependencies> +</project> diff --git a/northbound/features/features-sli-northbound/pom.xml b/northbound/features/features-sli-northbound/pom.xml new file mode 100644 index 000000000..37f961b9e --- /dev/null +++ b/northbound/features/features-sli-northbound/pom.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>feature-repo-parent</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>features-sli-northbound</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>feature</packaging> + + <name>ccsdk-sli-northbound :: features :: ${project.artifactId}</name> + + <properties> + <ccsdk.sli.northbound.version>${project.version}</ccsdk.sli.northbound.version> + </properties> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>ccsdk-sli-northbound-all</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>features</classifier> + </dependency> + + </dependencies> +</project> diff --git a/northbound/features/installer/pom.xml b/northbound/features/installer/pom.xml new file mode 100755 index 000000000..b87f855b8 --- /dev/null +++ b/northbound/features/installer/pom.xml @@ -0,0 +1,189 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>odlparent-lite</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>slinorthbound-features-installer</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>ccsdk-sli-northbound :: features :: ${project.artifactId}</name> + + <properties> + <application.name>ccsdk-sli-northbound-all</application.name> + <features.boot>${application.name}</features.boot> + <features.repositories>mvn:org.onap.ccsdk.sli.northbound/${features.boot}/${project.version}/xml/features</features.repositories> + <include.transitive.dependencies>false</include.transitive.dependencies> + </properties> + + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>ccsdk-asdcApi</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>features</classifier> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>ccsdk-daexim-offsite-backup</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>features</classifier> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>ccsdk-dataChange</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>features</classifier> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>ccsdk-lcm</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>features</classifier> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + + + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>${application.name}</artifactId> + <version>${project.version}</version> + <type>xml</type> + <classifier>features</classifier> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + + + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <executions> + <execution> + <id>maven-repo-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>true</attach> + <finalName>stage/${application.name}-${project.version}</finalName> + <descriptors> + <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>true</appendAssemblyId> + </configuration> + </execution> + <execution> + <id>installer-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>true</attach> + <finalName>${application.name}-${project.version}-installer</finalName> + <descriptors> + <descriptor>src/assembly/assemble_installer_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>false</appendAssemblyId> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <phase>prepare-package</phase> + <configuration> + <transitive>false</transitive> + <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + <useRepositoryLayout>true</useRepositoryLayout> + <addParentPoms>false</addParentPoms> + <copyPom>false</copyPom> + <includeGroupIds>org.onap.ccsdk.sli.northbound</includeGroupIds> + <scope>provided</scope> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>copy-version</id> + <goals> + <goal>copy-resources</goal> + </goals><!-- here the phase you need --> + <phase>validate</phase> + <configuration> + <outputDirectory>${basedir}/target/stage</outputDirectory> + <resources> + <resource> + <directory>src/main/resources/scripts</directory> + <includes> + <include>install-feature.sh</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + + </executions> + </plugin> + + </plugins> + </build> +</project> diff --git a/northbound/features/installer/src/assembly/assemble_installer_zip.xml b/northbound/features/installer/src/assembly/assemble_installer_zip.xml new file mode 100755 index 000000000..a6a22a9ba --- /dev/null +++ b/northbound/features/installer/src/assembly/assemble_installer_zip.xml @@ -0,0 +1,39 @@ +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>bin</id> + + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>755</fileMode> + <includes> + <include>*.sh</include> + </includes> + </fileSet> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>644</fileMode> + <excludes> + <exclude>*.sh</exclude> + </excludes> + </fileSet> + </fileSets> + + + +</assembly> diff --git a/northbound/features/installer/src/assembly/assemble_mvnrepo_zip.xml b/northbound/features/installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100755 index 000000000..86b07f1f3 --- /dev/null +++ b/northbound/features/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,29 @@ +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>repo</id> + + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/assembly/</directory> + <outputDirectory>.</outputDirectory> + <excludes> + </excludes> + </fileSet> + </fileSets> + + + +</assembly> diff --git a/northbound/features/installer/src/main/resources/scripts/install-feature.sh b/northbound/features/installer/src/main/resources/scripts/install-feature.sh new file mode 100644 index 000000000..e16e79a12 --- /dev/null +++ b/northbound/features/installer/src/main/resources/scripts/install-feature.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} +ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} +INSTALLERDIR=$(dirname $0) + +REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip + +if [ -f ${REPOZIP} ] +then + unzip -d ${ODL_HOME} ${REPOZIP} +else + echo "ERROR : repo zip ($REPOZIP) not found" + exit 1 +fi + +${ODL_KARAF_CLIENT} feature:repo-add ${features.repositories} +${ODL_KARAF_CLIENT} feature:install ${features.boot} diff --git a/northbound/features/pom.xml b/northbound/features/pom.xml new file mode 100755 index 000000000..88a4cbbec --- /dev/null +++ b/northbound/features/pom.xml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>odlparent-lite</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>slinorthbound-feature-aggregator</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>ccsdk-sli-northbound :: features</name> + + <modules> + <module>ccsdk-asdcApi</module> + <module>ccsdk-daexim-offsite-backup</module> + <module>ccsdk-dataChange</module> + <module>ccsdk-lcm</module> + <module>ccsdk-sli-northbound-all</module> + <module>features-sli-northbound</module> + <module>installer</module> + </modules> +</project> diff --git a/northbound/lcm/installer/pom.xml b/northbound/lcm/installer/pom.xml new file mode 100755 index 000000000..75bc22ac4 --- /dev/null +++ b/northbound/lcm/installer/pom.xml @@ -0,0 +1,134 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>odlparent-lite</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>lcm-installer</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>ccsdk-sli-northbound :: lcm :: ${project.artifactId}</name> + + <properties> + <application.name>ccsdk-lcm</application.name> + <features.boot>${application.name}</features.boot> + <features.repositories>mvn:org.onap.ccsdk.sli.northbound/${features.boot}/${project.version}/xml/features</features.repositories> + <include.transitive.dependencies>false</include.transitive.dependencies> + </properties> + + <dependencies> + + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>lcm-model</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>lcm-provider</artifactId> + <version>${project.version}</version> + </dependency> + + + </dependencies> + + <build> + <plugins> + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>maven-repo-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>true</attach> + <finalName>stage/${application.name}-${project.version}</finalName> + <descriptors> + <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>true</appendAssemblyId> + </configuration> + </execution> + <execution> + <id>installer-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>true</attach> + <finalName>${application.name}-${project.version}-installer</finalName> + <descriptors> + <descriptor>src/assembly/assemble_installer_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>false</appendAssemblyId> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <phase>prepare-package</phase> + <configuration> + <transitive>false</transitive> + <outputDirectory>${project.build.directory}/assembly/system</outputDirectory> + <overWriteReleases>false</overWriteReleases> + <overWriteSnapshots>true</overWriteSnapshots> + <overWriteIfNewer>true</overWriteIfNewer> + <useRepositoryLayout>true</useRepositoryLayout> + <addParentPoms>false</addParentPoms> + <copyPom>false</copyPom> + <includeGroupIds>org.onap.ccsdk.sli.northbound</includeGroupIds> + <scope>provided</scope> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-resources-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>copy-version</id> + <goals> + <goal>copy-resources</goal> + </goals><!-- here the phase you need --> + <phase>validate</phase> + <configuration> + <outputDirectory>${basedir}/target/stage</outputDirectory> + <resources> + <resource> + <directory>src/main/resources/scripts</directory> + <includes> + <include>install-feature.sh</include> + </includes> + <filtering>true</filtering> + </resource> + </resources> + </configuration> + </execution> + + </executions> + </plugin> + + </plugins> + </build> +</project> diff --git a/northbound/lcm/installer/src/assembly/assemble_installer_zip.xml b/northbound/lcm/installer/src/assembly/assemble_installer_zip.xml new file mode 100644 index 000000000..3bed4b5ef --- /dev/null +++ b/northbound/lcm/installer/src/assembly/assemble_installer_zip.xml @@ -0,0 +1,59 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>installer_zip</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>755</fileMode> + <includes> + <include>*.sh</include> + </includes> + </fileSet> + <fileSet> + <directory>target/stage/</directory> + <outputDirectory>${application.name}</outputDirectory> + <fileMode>644</fileMode> + <excludes> + <exclude>*.sh</exclude> + </excludes> + </fileSet> + </fileSets> + + + +</assembly> diff --git a/northbound/lcm/installer/src/assembly/assemble_mvnrepo_zip.xml b/northbound/lcm/installer/src/assembly/assemble_mvnrepo_zip.xml new file mode 100644 index 000000000..479896182 --- /dev/null +++ b/northbound/lcm/installer/src/assembly/assemble_mvnrepo_zip.xml @@ -0,0 +1,47 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>repo</id> + <formats> + <format>zip</format> + </formats> + + <!-- we want "system" and related files right at the root level + as this file is suppose to be unzip on top of a karaf + distro. --> + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>target/assembly/</directory> + <outputDirectory>.</outputDirectory> + <excludes> + </excludes> + </fileSet> + </fileSets> + +</assembly> diff --git a/northbound/lcm/installer/src/main/resources/scripts/install-feature.sh b/northbound/lcm/installer/src/main/resources/scripts/install-feature.sh new file mode 100644 index 000000000..cee4a4952 --- /dev/null +++ b/northbound/lcm/installer/src/main/resources/scripts/install-feature.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +ODL_HOME=${ODL_HOME:-/opt/opendaylight/current} +ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client} +INSTALLERDIR=$(dirname $0) + +REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip + +if [ -f ${REPOZIP} ] +then + unzip -d ${ODL_HOME} ${REPOZIP} +else + echo "ERROR : repo zip ($REPOZIP) not found" + exit 1 +fi + +${ODL_KARAF_CLIENT} feature:repo-add ${features.repositories} +${ODL_KARAF_CLIENT} feature:install ${features.boot} diff --git a/northbound/lcm/model/pom.xml b/northbound/lcm/model/pom.xml new file mode 100755 index 000000000..916345f68 --- /dev/null +++ b/northbound/lcm/model/pom.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>binding-parent</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>lcm-model</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>bundle</packaging> + + <name>ccsdk-sli-northbound :: lcm :: ${project.artifactId}</name> + + <properties> + <ccsdk.sli.northbound.version>${project.version}</ccsdk.sli.northbound.version> + </properties> + + <dependencies> + + <dependency> + <groupId>org.opendaylight.mdsal.binding.model.ietf</groupId> + <artifactId>rfc6991</artifactId> + </dependency> + + + </dependencies> +</project> diff --git a/northbound/lcm/model/src/main/resources/lcm.20180329.json b/northbound/lcm/model/src/main/resources/lcm.20180329.json new file mode 100644 index 000000000..b84189858 --- /dev/null +++ b/northbound/lcm/model/src/main/resources/lcm.20180329.json @@ -0,0 +1,4523 @@ +{ + "swagger": "2.0", + "info": { + "version": "1.0.0" + }, + "basePath": "/restconf", + "paths": { + "/operations/LCM:action-status": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(action-status)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(action-status)output-TOP" + } + } + }, + "description": "An operation to get the current state of the previously submitted LCM request", + "operationId": "action-status" + } + }, + "/operations/LCM:attach-volume": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(attach-volume)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(attach-volume)output-TOP" + } + } + }, + "description": "An operation to attach a cinder volume to a VM", + "operationId": "attach-volume" + } + }, + "/operations/LCM:audit": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(audit)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(audit)output-TOP" + } + } + }, + "description": "An operation to audit the configurations of a virtual network function (or VM)", + "operationId": "audit" + } + }, + "/operations/LCM:check-lock": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(check-lock)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(check-lock)output-TOP" + } + } + }, + "description": "An operation to check VNF lock status", + "operationId": "check-lock" + } + }, + "/operations/LCM:config-backup": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(config-backup)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config-backup)output-TOP" + } + } + }, + "description": "An operation to Backup configurations of a virtual network function\\n(or VM)", + "operationId": "config-backup" + } + }, + "/operations/LCM:config-backup-delete": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(config-backup-delete)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config-backup-delete)output-TOP" + } + } + }, + "description": "An operation to Delete backup configurations of a virtual network\\nfunction (or VM)", + "operationId": "config-backup-delete" + } + }, + "/operations/LCM:config-export": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(config-export)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config-export)output-TOP" + } + } + }, + "description": "An operation to Export configurations of a virtual network function\\n(or VM)", + "operationId": "config-export" + } + }, + "/operations/LCM:config-modify": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(config-modify)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config-modify)output-TOP" + } + } + }, + "description": "Use the ModifyConfig command when a full configuration cycle is either not required\\nor is considered too costly. The ModifyConfig LCM action affects only a subset of the\\ntotal configuration data of a VNF. The set of configuration parameters to be affected\\nis a subset of the total configuration data of the target VNF type. The payload Stop\\nApplication must contain the configuration parameters to be modified and their values.\\nA successful modify returns a success response. A failed modify returns a failure\\nresponse and the specific failure messages in the response payload Stop Application", + "operationId": "config-modify" + } + }, + "/operations/LCM:config-restore": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(config-restore)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config-restore)output-TOP" + } + } + }, + "description": "An operation to restore the configurations of a virtual network\\nfunction (or VM)", + "operationId": "config-restore" + } + }, + "/operations/LCM:config-scale-out": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(config-scale-out)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(config-scale-out)output-TOP" + } + } + }, + "description": "An operation to Modify the configuration or other action to support\\na ConfigScaleOut of a VNF.", + "operationId": "config-scale-out" + } + }, + "/operations/LCM:configure": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(configure)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(configure)output-TOP" + } + } + }, + "description": "An operation to configure the configurations of a virtual network\\nfunction (or VM)", + "operationId": "configure" + } + }, + "/operations/LCM:detach-volume": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(detach-volume)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(detach-volume)output-TOP" + } + } + }, + "description": "An operation to detach a cinder volume from a VM", + "operationId": "detach-volume" + } + }, + "/operations/LCM:evacuate": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(evacuate)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(evacuate)output-TOP" + } + } + }, + "description": "An operation to evacuate a virtual network function (or VM)", + "operationId": "evacuate" + } + }, + "/operations/LCM:health-check": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(health-check)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(health-check)output-TOP" + } + } + }, + "description": "An operation to perform health check of vSCP prior its upgrading", + "operationId": "health-check" + } + }, + "/operations/LCM:live-upgrade": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(live-upgrade)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(live-upgrade)output-TOP" + } + } + }, + "description": "An operation to perform upgrade of vSCP", + "operationId": "live-upgrade" + } + }, + "/operations/LCM:lock": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(lock)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(lock)output-TOP" + } + } + }, + "description": "An operation to perform VNF lock operation", + "operationId": "lock" + } + }, + "/operations/LCM:migrate": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(migrate)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(migrate)output-TOP" + } + } + }, + "description": "An operation to migrate a virtual network function (or VM)", + "operationId": "migrate" + } + }, + "/operations/LCM:query": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(query)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(query)output-TOP" + } + } + }, + "description": "An operation to query the status of a targe VNF.\\nReturns information on each VM, including state (active or standby)\\nand status (healthy or unhealthy)", + "operationId": "query" + } + }, + "/operations/LCM:quiesce-traffic": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(quiesce-traffic)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(quiesce-traffic)output-TOP" + } + } + }, + "description": "An operation to stop traffic gracefully on the VF.\\nIt stops traffic gracefully without stopping the application", + "operationId": "quiesce-traffic" + } + }, + "/operations/LCM:reboot": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(reboot)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(reboot)output-TOP" + } + } + }, + "description": "An operation to reboot a specified virtual machine (VM)", + "operationId": "reboot" + } + }, + "/operations/LCM:rebuild": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(rebuild)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(rebuild)output-TOP" + } + } + }, + "description": "An operation to rebuild a virtual network function (or VM)", + "operationId": "rebuild" + } + }, + "/operations/LCM:restart": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(restart)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(restart)output-TOP" + } + } + }, + "description": "An operation to restart a virtual network function (or VM)", + "operationId": "restart" + } + }, + "/operations/LCM:resume-traffic": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(resume-traffic)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(resume-traffic)output-TOP" + } + } + }, + "description": "An operation to resume traffic gracefully on the VF.\\nIt resumes traffic gracefully without stopping the application", + "operationId": "resume-traffic" + } + }, + "/operations/LCM:rollback": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(rollback)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(rollback)output-TOP" + } + } + }, + "description": "An operation to rollback to particular snapshot of a virtual network function (or VM)", + "operationId": "rollback" + } + }, + "/operations/LCM:snapshot": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(snapshot)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(snapshot)output-TOP" + } + } + }, + "description": "An operation to create a snapshot of a virtual network function (or VM)", + "operationId": "snapshot" + } + }, + "/operations/LCM:software-upload": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(software-upload)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(software-upload)output-TOP" + } + } + }, + "description": "An operation to upload a new version of vSCP image to vSCP for updating it", + "operationId": "software-upload" + } + }, + "/operations/LCM:start": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(start)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(start)output-TOP" + } + } + }, + "description": "An operation to start a virtual network function (or VM)", + "operationId": "start" + } + }, + "/operations/LCM:start-application": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(start-application)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(start-application)output-TOP" + } + } + }, + "description": "An operation to perform VNF Start Application operation", + "operationId": "start-application" + } + }, + "/operations/LCM:stop": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(stop)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(stop)output-TOP" + } + } + }, + "description": "An operation to stop the configurations of a virtual network function (or VM)", + "operationId": "stop" + } + }, + "/operations/LCM:stop-application": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(stop-application)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(stop-application)output-TOP" + } + } + }, + "description": "An operation to Stop Application traffic to a virtual network function", + "operationId": "stop-application" + } + }, + "/operations/LCM:sync": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(sync)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(sync)output-TOP" + } + } + }, + "description": "An operation to sync the configurations of a virtual network function (or VM)", + "operationId": "sync" + } + }, + "/operations/LCM:terminate": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(terminate)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(terminate)output-TOP" + } + } + }, + "description": "An operation to terminate the configurations of a virtual network function (or VM)", + "operationId": "terminate" + } + }, + "/operations/LCM:test": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(test)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(test)output-TOP" + } + } + }, + "description": "An operation to test the configurations of a virtual network function (or VM)", + "operationId": "test" + } + }, + "/operations/LCM:unlock": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(unlock)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(unlock)output-TOP" + } + } + }, + "description": "An operation to perform VNF unlock operation", + "operationId": "unlock" + } + }, + "/operations/LCM:upgrade-backout": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(upgrade-backout)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(upgrade-backout)output-TOP" + } + } + }, + "description": "An operation does a backout after an UpgradeSoftware is completed (either successfully or unsuccessfully).", + "operationId": "upgrade-backout" + } + }, + "/operations/LCM:upgrade-backup": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(upgrade-backup)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(upgrade-backup)output-TOP" + } + } + }, + "description": "An operation to do full backup of the VNF data prior to an upgrade.", + "operationId": "upgrade-backup" + } + }, + "/operations/LCM:upgrade-post-check": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(upgrade-post-check)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(upgrade-post-check)output-TOP" + } + } + }, + "description": "An operation to check the VNF upgrade has been successful completed and all processes are running properly.", + "operationId": "upgrade-post-check" + } + }, + "/operations/LCM:upgrade-pre-check": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(upgrade-pre-check)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(upgrade-pre-check)output-TOP" + } + } + }, + "description": "An operation to check that the VNF has the correct software version needed for a software upgrade.", + "operationId": "upgrade-pre-check" + } + }, + "/operations/LCM:upgrade-software": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(upgrade-software)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(upgrade-software)output-TOP" + } + } + }, + "description": "An operation to upgrade the target VNF to a new version and expected that the VNF is in a quiesced status .", + "operationId": "upgrade-software" + } + }, + "/operations/LCM:download-n-e-sw": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(download-n-e-sw)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(download-n-e-sw)output-TOP" + } + } + }, + "description": "An operation to download NE software.", + "operationId": "download-n-e-sw" + } + }, + "/operations/LCM:activate-n-e-sw": { + "post": { + "consumes": [ + "application/json", + "application/xml" + ], + "produces": [ + "application/json", + "application/xml" + ], + "parameters": [ + { + "in": "body", + "name": "body", + "required": false, + "schema": { + "$ref": "#/definitions/(activate-n-e-sw)input-TOP" + } + } + ], + "responses": { + "200": { + "description": "No response was specified", + "schema": { + "$ref": "#/definitions/(activate-n-e-sw)output-TOP" + } + } + }, + "description": "An operation to activate NE software.", + "operationId": "activate-n-e-sw" + } + } + }, + "definitions": { + "(action-status)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(action-status)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(action-status)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(action-status)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(action-status)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(action-status)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(attach-volume)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action", + "LCM:payload" + ], + "type": "object" + }, + "(attach-volume)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(attach-volume)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(attach-volume)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(attach-volume)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(attach-volume)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(audit)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(audit)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(audit)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(audit)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(audit)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(audit)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(check-lock)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(check-lock)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(check-lock)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(check-lock)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:locked": { + "$ref": "#/definitions/Optional.empty", + "description": "TRUE/FALSE - returns TRUE when the given VNF was locked, otherwise returns FALSE" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(check-lock)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(check-lock)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config)LCM_modulePOST": { + "type": "object" + }, + "(config)action-identifiersPOST": { + "properties": { + "service-instance-id": { + "$ref": "#/definitions/Optional.empty", + "description": "identifies a specific service the command refers to. When multiple\\n APP-C instances are used and applied to a subset of services,\\n this will become significant . The field is mandatory when the\\n vnf-id is empty" + }, + "vf-module-id": { + "$ref": "#/definitions/Optional.empty", + "description": "identifies the VF module to which this action is to be applied." + }, + "vnf-id": { + "$ref": "#/definitions/Optional.empty", + "description": "identifies the VNF to which this action is to be applied(vnf-id\\n uniquely identifies the service-instance referred to). Note that\\n some actions are applied to multiple VNFs in the same service.\\n When this is the case, vnf-id may be left out, but service-instance-id\\n must appear. The field is mandatory when service-instance-id is\\n empty" + }, + "vnfc-name": { + "$ref": "#/definitions/Optional.empty", + "description": "identifies the VNFC to which this action is to be applied. Some\\n actions apply only to a component within a VNF (e.g. RESTART is\\n sometimes applied to on VM only). In such a case, the name of\\n the VNFC is used to search for the component within the VNF" + }, + "vserver-id": { + "$ref": "#/definitions/Optional.empty", + "description": "identifies a specific VM within the given service/vnf to which\\n this action is to be applied" + }, + "pnf-name": { + "$ref": "#/definitions/Optional.empty", + "description": "identifies the PNF to which this action is to be applied." + } + }, + "type": "object" + }, + "(config)common-headerPOST": { + "properties": { + "api-ver": { + "$ref": "#/definitions/Optional.empty", + "description": "api-ver is the API version identifier. A given release of APPC\\n should support all previous versions of APPC API (correlate with\\n general requirements)" + }, + "flags": { + "items": { + "$ref": "#/definitions/LCM/common-header(config)flags" + }, + "type": "object" + }, + "originator-id": { + "$ref": "#/definitions/Optional.empty", + "description": "originator-id an identifier of the calling system which can be\\n used addressing purposes, i.e. returning asynchronous response\\n to the proper destination over DMaaP (especially in case of multiple\\n consumers of APP-C APIs)" + }, + "request-id": { + "$ref": "#/definitions/Optional.empty", + "description": "UUID for the request ID. An OSS/BSS identifier for the request\\n that caused the current action. Multiple API calls may be made\\n with the same request-id The request-id shall be recorded throughout\\n the operations on a single request" + }, + "sub-request-id": { + "$ref": "#/definitions/Optional.empty", + "description": "Uniquely identifies a specific LCM action. It is persistent over\\n the life-cycle of a single request" + }, + "timestamp": { + "$ref": "#/definitions/Optional.empty", + "description": "timestamp is in ISO 8601 timestamp format ZULU offset" + } + }, + "required": [ + "api-ver", + "originator-id", + "request-id", + "timestamp" + ], + "type": "object" + }, + "(config)flagsPOST": { + "properties": { + "force": { + "$ref": "#/definitions/Optional.empty", + "description": "TRUE/FALSE - Execute action even if target is in unstable (i.e.\\n locked, transiting, etc.) state" + }, + "mode": { + "$ref": "#/definitions/Optional.empty", + "description": "EXCLUSIVE (accept no queued requests on this VNF while processing)\\n or NORMAL (queue other requests until complete)" + }, + "ttl": { + "$ref": "#/definitions/Optional.empty", + "description": "<0....N> - The timeout value (expressed in seconds) for action\\n execution, between action being received by APPC and action initiation" + } + }, + "type": "object" + }, + "(config)query-resultsPOST": { + "properties": { + "vm-state": { + "$ref": "#/definitions/Optional.empty", + "description": "The state of the VM" + }, + "vm-status": { + "$ref": "#/definitions/Optional.empty", + "description": "the status of the VM" + }, + "vserver-id": { + "$ref": "#/definitions/Optional.empty", + "description": "Identifier of a VM" + } + }, + "required": [ + "vm-state", + "vm-status", + "vserver-id" + ], + "type": "object" + }, + "(config)statusPOST": { + "properties": { + "code": { + "$ref": "#/definitions/Optional.empty", + "description": "Response code" + }, + "message": { + "$ref": "#/definitions/Optional.empty", + "description": "Response message" + } + }, + "required": [ + "code", + "message" + ], + "type": "object" + }, + "(config-backup)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(config-backup)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(config-backup)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config-backup)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config-backup)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(config-backup)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config-backup-delete)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(config-backup-delete)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(config-backup-delete)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config-backup-delete)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config-backup-delete)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(config-backup-delete)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config-export)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(config-export)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(config-export)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config-export)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config-export)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(config-export)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config-modify)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(config-modify)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(config-modify)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config-modify)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config-modify)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(config-modify)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config-restore)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(config-restore)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(config-restore)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config-restore)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config-restore)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(config-restore)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config-scale-out)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(config-scale-out)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(config-scale-out)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config-scale-out)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(config-scale-out)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(config-scale-out)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(configure)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(configure)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(configure)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(configure)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(configure)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(configure)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(detach-volume)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action", + "LCM:payload" + ], + "type": "object" + }, + "(detach-volume)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(detach-volume)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(detach-volume)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(detach-volume)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(detach-volume)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(evacuate)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(evacuate)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(evacuate)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(evacuate)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(evacuate)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(evacuate)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(health-check)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(health-check)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(health-check)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(health-check)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(health-check)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(health-check)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(live-upgrade)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(live-upgrade)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(live-upgrade)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(live-upgrade)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(live-upgrade)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(live-upgrade)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(lock)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(lock)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(lock)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(lock)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(lock)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(lock)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(migrate)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(migrate)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(migrate)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(migrate)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(migrate)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(migrate)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(query)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(query)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(query)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(query)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:query-results": { + "items": { + "$ref": "#/definitions/LCM(config)query-results" + }, + "type": "array" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(query)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(query)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(quiesce-traffic)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action", + "LCM:payload" + ], + "type": "object" + }, + "(quiesce-traffic)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(quiesce-traffic)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(quiesce-traffic)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(quiesce-traffic)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(quiesce-traffic)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(reboot)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(reboot)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(reboot)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(reboot)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(reboot)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(reboot)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(rebuild)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(rebuild)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(rebuild)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(rebuild)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(rebuild)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(rebuild)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(restart)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(restart)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(restart)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(restart)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(restart)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(restart)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(resume-traffic)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action", + "LCM:payload" + ], + "type": "object" + }, + "(resume-traffic)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(resume-traffic)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(resume-traffic)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(resume-traffic)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(resume-traffic)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(rollback)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:identity-url": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:snapshot-id": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action", + "LCM:identity-url", + "LCM:snapshot-id" + ], + "type": "object" + }, + "(rollback)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(rollback)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(rollback)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(rollback)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(rollback)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(snapshot)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:identity-url": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action", + "LCM:identity-url" + ], + "type": "object" + }, + "(snapshot)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(snapshot)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(snapshot)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:snapshot-id": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(snapshot)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(snapshot)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(software-upload)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(software-upload)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(software-upload)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(software-upload)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(software-upload)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(software-upload)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(start)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(start)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(start)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(start)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(start)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(start)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(start-application)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(start-application)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(start-application)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(start-application)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(start-application)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(start-application)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(stop)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(stop)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(stop)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(stop)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(stop)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(stop)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(stop-application)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(stop-application)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(stop-application)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(stop-application)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(stop-application)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(stop-application)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(sync)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(sync)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(sync)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(sync)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(sync)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(sync)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(terminate)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(terminate)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(terminate)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(terminate)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(terminate)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(terminate)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(test)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(test)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(test)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(test)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(test)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(test)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(unlock)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action" + ], + "type": "object" + }, + "(unlock)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(unlock)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(unlock)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(unlock)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(unlock)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(upgrade-backout)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action", + "LCM:payload" + ], + "type": "object" + }, + "(upgrade-backout)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(upgrade-backout)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(upgrade-backout)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(upgrade-backout)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(upgrade-backout)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(upgrade-backup)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action", + "LCM:payload" + ], + "type": "object" + }, + "(upgrade-backup)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(upgrade-backup)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(upgrade-backup)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(upgrade-backup)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(upgrade-backup)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(upgrade-post-check)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action", + "LCM:payload" + ], + "type": "object" + }, + "(upgrade-post-check)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(upgrade-post-check)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(upgrade-post-check)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(upgrade-post-check)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(upgrade-post-check)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(upgrade-pre-check)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action", + "LCM:payload" + ], + "type": "object" + }, + "(upgrade-pre-check)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(upgrade-pre-check)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(upgrade-pre-check)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(upgrade-pre-check)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(upgrade-pre-check)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(upgrade-software)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action", + "LCM:payload" + ], + "type": "object" + }, + "(upgrade-software)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(upgrade-software)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(upgrade-software)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "(upgrade-software)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(upgrade-software)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(download-n-e-sw)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action", + "LCM:payload" + ], + "type": "object" + }, + "(download-n-e-sw)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(download-n-e-sw)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(download-n-e-sw)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "required": [ + "LCM:payload" + ], + "type": "object" + }, + "(download-n-e-sw)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(download-n-e-sw)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "(activate-n-e-sw)input": { + "properties": { + "LCM:action": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + }, + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + } + }, + "required": [ + "LCM:action", + "LCM:payload" + ], + "type": "object" + }, + "(activate-n-e-sw)input-TOP": { + "properties": { + "LCM:input": { + "items": { + "$ref": "#/definitions/(activate-n-e-sw)input" + }, + "type": "object" + } + }, + "type": "object" + }, + "(activate-n-e-sw)output": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + }, + "LCM:payload": { + "$ref": "#/definitions/Optional.empty" + }, + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "required": [ + "LCM:payload" + ], + "type": "object" + }, + "(activate-n-e-sw)output-TOP": { + "properties": { + "LCM:output": { + "items": { + "$ref": "#/definitions/(activate-n-e-sw)output" + }, + "type": "object" + } + }, + "type": "object" + }, + "LCM(config)action-identifiers": { + "properties": { + "LCM:service-instance-id": { + "$ref": "#/definitions/Optional.empty", + "description": "identifies a specific service the command refers to. When multiple\\n APP-C instances are used and applied to a subset of services,\\n this will become significant . The field is mandatory when the\\n vnf-id is empty" + }, + "LCM:vf-module-id": { + "$ref": "#/definitions/Optional.empty", + "description": "identifies the VF module to which this action is to be applied." + }, + "LCM:vnf-id": { + "$ref": "#/definitions/Optional.empty", + "description": "identifies the VNF to which this action is to be applied(vnf-id\\n uniquely identifies the service-instance referred to). Note that\\n some actions are applied to multiple VNFs in the same service.\\n When this is the case, vnf-id may be left out, but service-instance-id\\n must appear. The field is mandatory when service-instance-id is\\n empty" + }, + "LCM:vnfc-name": { + "$ref": "#/definitions/Optional.empty", + "description": "identifies the VNFC to which this action is to be applied. Some\\n actions apply only to a component within a VNF (e.g. RESTART is\\n sometimes applied to on VM only). In such a case, the name of\\n the VNFC is used to search for the component within the VNF" + }, + "LCM:vserver-id": { + "$ref": "#/definitions/Optional.empty", + "description": "identifies a specific VM within the given service/vnf to which\\n this action is to be applied" + }, + "LCM:pnf-name": { + "$ref": "#/definitions/Optional.empty", + "description": "identifies the PNF to which this action is to be applied." + } + }, + "type": "object" + }, + "LCM(config)action-identifiers-TOP": { + "properties": { + "LCM:action-identifiers": { + "description": "A block containing the action arguments. These are used to specify\\nthe object upon which APP-C LCM command is to operate", + "items": { + "$ref": "#/definitions/LCM(config)action-identifiers" + }, + "type": "object" + } + }, + "type": "object" + }, + "LCM(config)common-header": { + "properties": { + "LCM:api-ver": { + "$ref": "#/definitions/Optional.empty", + "description": "api-ver is the API version identifier. A given release of APPC\\n should support all previous versions of APPC API (correlate with\\n general requirements)" + }, + "LCM:flags": { + "description": "Flags are generic flags that apply to any and all commands, all are optional", + "items": { + "$ref": "#/definitions/LCM/common-header(config)flags" + }, + "type": "object" + }, + "LCM:originator-id": { + "$ref": "#/definitions/Optional.empty", + "description": "originator-id an identifier of the calling system which can be\\n used addressing purposes, i.e. returning asynchronous response\\n to the proper destination over DMaaP (especially in case of multiple\\n consumers of APP-C APIs)" + }, + "LCM:request-id": { + "$ref": "#/definitions/Optional.empty", + "description": "UUID for the request ID. An OSS/BSS identifier for the request\\n that caused the current action. Multiple API calls may be made\\n with the same request-id The request-id shall be recorded throughout\\n the operations on a single request" + }, + "LCM:sub-request-id": { + "$ref": "#/definitions/Optional.empty", + "description": "Uniquely identifies a specific LCM action. It is persistent over\\n the life-cycle of a single request" + }, + "LCM:timestamp": { + "$ref": "#/definitions/Optional.empty", + "description": "timestamp is in ISO 8601 timestamp format ZULU offset" + } + }, + "required": [ + "LCM:api-ver", + "LCM:originator-id", + "LCM:request-id", + "LCM:timestamp" + ], + "type": "object" + }, + "LCM(config)common-header-TOP": { + "properties": { + "LCM:common-header": { + "description": "A common header for all APP-C requests", + "items": { + "$ref": "#/definitions/LCM(config)common-header" + }, + "type": "object" + } + }, + "type": "object" + }, + "LCM(config)query-results": { + "properties": { + "LCM:vm-state": { + "$ref": "#/definitions/Optional.empty", + "description": "The state of the VM" + }, + "LCM:vm-status": { + "$ref": "#/definitions/Optional.empty", + "description": "the status of the VM" + }, + "LCM:vserver-id": { + "$ref": "#/definitions/Optional.empty", + "description": "Identifier of a VM" + } + }, + "required": [ + "LCM:vm-state", + "LCM:vm-status", + "LCM:vserver-id" + ], + "type": "object" + }, + "LCM(config)query-results-TOP": { + "properties": { + "LCM:query-results": { + "items": { + "$ref": "#/definitions/LCM(config)query-results" + }, + "type": "array" + } + }, + "type": "object" + }, + "LCM(config)status": { + "properties": { + "LCM:code": { + "$ref": "#/definitions/Optional.empty", + "description": "Response code" + }, + "LCM:message": { + "$ref": "#/definitions/Optional.empty", + "description": "Response message" + } + }, + "required": [ + "LCM:code", + "LCM:message" + ], + "type": "object" + }, + "LCM(config)status-TOP": { + "properties": { + "LCM:status": { + "description": "The specific response codes are to be aligned with SDC reference doc\\n(main table removed to avoid duplication and digression from main table).\\nSee SDC and ECOMP Distribution Consumer Interface Agreement", + "items": { + "$ref": "#/definitions/LCM(config)status" + }, + "type": "object" + } + }, + "type": "object" + }, + "LCM/common-header(config)flags": { + "properties": { + "LCM:force": { + "$ref": "#/definitions/Optional.empty", + "description": "TRUE/FALSE - Execute action even if target is in unstable (i.e.\\n locked, transiting, etc.) state" + }, + "LCM:mode": { + "$ref": "#/definitions/Optional.empty", + "description": "EXCLUSIVE (accept no queued requests on this VNF while processing)\\n or NORMAL (queue other requests until complete)" + }, + "LCM:ttl": { + "$ref": "#/definitions/Optional.empty", + "description": "<0....N> - The timeout value (expressed in seconds) for action\\n execution, between action being received by APPC and action initiation" + } + }, + "type": "object" + }, + "LCM/common-header(config)flags-TOP": { + "properties": { + "LCM:flags": { + "description": "Flags are generic flags that apply to any and all commands, all are optional", + "items": { + "$ref": "#/definitions/LCM/common-header(config)flags" + }, + "type": "object" + } + }, + "type": "object" + }, + "unique_empty_identifier": {} + } +} diff --git a/northbound/lcm/model/src/main/yang/lcm.yang b/northbound/lcm/model/src/main/yang/lcm.yang new file mode 100644 index 000000000..188068a68 --- /dev/null +++ b/northbound/lcm/model/src/main/yang/lcm.yang @@ -0,0 +1,1412 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +/* + * Yang model for the Application Controller (APP-C) component of ECOMP + * + * This model is used to define the data and services of the Application Controller + * component of ECOMP. The APP-C controller initiates the processing of directed + * graphs, which define the actual process implementations used. The name of the + * directed graph is set by properties and cannot be changed dynamically. + * + * The services exposed by this provider are: + * + * restart-vnf: + * Used to request a restart of a virtual network function (a VM). + * + * rebuild-vnf: + * Used to request a rebuild of a virtual network function (a VM). + * + */ + +module LCM { + + yang-version 1; + namespace "org:onap:ccsdk:sli:northbound:lcm"; + prefix lcm; + + description + "Defines the services and request/response requirements for the CCSDK LCM component."; + + /* + * Note, the revision changes the package name of the generated java code. Do not + * change the revision unless you also update all references to the bindings. + */ + revision "2018-03-29" { + description + "CCSDK LCM interface version 0.2.1"; + } + + /********************************************************************************** + * Data type definitions + * + * The following data type definitions are used to define common data structures, + * define constraints, or to impart special meanings to data objects related to the + * APP-C controller functions. + **********************************************************************************/ + + typedef ZULU { + description "Define a common definition of a time stamp (expressed as a formatted + string) as follows yyyy-MM-ddTHH:mm:ss.SSSSSSSSZ"; + type string { + length "16..28"; + pattern "[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}T[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}.[0-9]{1,6}Z"; + } + } + + typedef payload { + type string ; + description "The payload can be any valid JSON string value. Json escape characters need to be added when required to include an inner json within the payload to make it a valid json string value"; + } + + typedef action { + type enumeration { + enum "Restart"; + enum "Rebuild"; + enum "Migrate"; + enum "Evacuate"; + enum "Snapshot"; + enum "Rollback"; + enum "Sync"; + enum "Audit"; + enum "Stop"; + enum "Start"; + enum "Terminate"; + enum "SoftwareUpload"; + enum "HealthCheck"; + enum "LiveUpgrade"; + enum "Lock"; + enum "Unlock"; + enum "Test"; + enum "CheckLock"; + enum "Configure"; + enum "ConfigModify"; + enum "ConfigScaleOut"; + enum "ConfigRestore"; + enum "ConfigBackup"; + enum "ConfigBackupDelete"; + enum "ConfigExport"; + enum "StopApplication"; + enum "StartApplication"; + enum "QuiesceTraffic"; + enum "ResumeTraffic"; + enum "DistributeTraffic"; + enum "UpgradePreCheck"; + enum "UpgradeSoftware"; + enum "DownloadNESw"; + enum "ActivateNESw"; + enum "UpgradePostCheck"; + enum "UpgradeBackup"; + enum "UpgradeBackout"; + enum "ActionStatus"; + enum "Query"; + enum "Reboot"; + enum "AttachVolume"; + enum "DetachVolume"; + + } + description "The action to be taken by APP-C, e.g. Restart, Rebuild, Migrate"; + } + + typedef vm-state { + description "The state of a VM"; + type enumeration { + enum "active"; + enum "standby"; + enum "inactive"; + enum "unknown"; + } + } + + typedef vm-status { + description "The status of a VM"; + type enumeration { + enum "healthy"; + enum "unhealthy"; + enum "unknown"; + } + } + + + /********************************************************************************** + * Basic manipulation of a VNF (or VM) will typically include querying the current + * state, restarting, rebuilding, stopping, starting, etc. In all of these basic + * "state"-type operations, the services require the identification of the VNF to + * be operated on, and the region or LCP that contains that resource. This + * information is used across all of these services, so it has been defined as a + * common structure here and is referenced in the appropriate RPC definitions. + **********************************************************************************/ + + + /********************************************************************************** + * All requests will include this standard header + * + * The standard request header is used to define a correlation identification for + * the request that is returned on all responses. This correlation identifier + * (called the service-request-id) is meaningful to the caller and is included on + * all responses from the services. + **********************************************************************************/ + + /********************************************************************************** + * All responses will include this standard header + * + * The standard response header includes the time of completion as well as a + * success|failure indication + **********************************************************************************/ + + grouping common-header { + description "A common header for all APP-C requests"; + container common-header { + description "A common header for all APP-C requests"; + leaf timestamp { + description "timestamp is in ISO 8601 timestamp format ZULU offset"; + type ZULU; + mandatory true; + } + + leaf api-ver { + description "api-ver is the API version identifier. A given release of APPC + should support all previous versions of APPC API (correlate with + general requirements)"; + type string { + pattern "[2]\.\d\d" { + error-message "API Version 2.XX is supported at this end point"; + } + } + mandatory true; + } + + leaf originator-id { + description "originator-id an identifier of the calling system which can be + used addressing purposes, i.e. returning asynchronous response + to the proper destination over DMaaP (especially in case of multiple + consumers of APP-C APIs)"; + type string; + mandatory true; + } + + leaf request-id { + description "UUID for the request ID. An OSS/BSS identifier for the request + that caused the current action. Multiple API calls may be made + with the same request-id The request-id shall be recorded throughout + the operations on a single request"; + type string; + mandatory true; + } + + leaf sub-request-id { + description "Uniquely identifies a specific LCM action. It is persistent over + the life-cycle of a single request"; + type string; + mandatory false; + } + + + /********************************************************************************** + * Flags are generic flags that apply to any and all commands, all are optional + * force = TRUE/FALSE - Execute command even if target is in unstable (i.e. locked, transiting, etc) + * state. Specific behaviour of forced commands varies, but implies cancellation + * of previous command and an override by the new command. The FALSE value is + * used by default. + * ttl = <0....N> - The timeout value for command execution, expressed in seconds + * mode = EXCLUSIVE/NORMAL - defines execution mode as follows: + * - EXCLUSIVE ? on encountering an exclusive command, the APP-C will: + * * Cease accepting additional command requests + * * Complete execution of outstanding commands + * * Execute the exclusive command to completion + * * Optionally report the result of the command + * * Optionally resume command acceptance and processing + * - NORMAL - Obverse of EXCLUSIVE, the default one. + **********************************************************************************/ + container flags { + description "Flags are generic flags that apply to any and all commands, all are optional"; + leaf mode { + type enumeration { + enum "EXCLUSIVE"; + enum "NORMAL"; + } + description "EXCLUSIVE (accept no queued requests on this VNF while processing) + or NORMAL (queue other requests until complete)"; + mandatory false; + } + leaf force { + type enumeration { + enum "TRUE"; + enum "FALSE"; + } + description "TRUE/FALSE - Execute action even if target is in unstable (i.e. + locked, transiting, etc.) state"; + mandatory false; + } + leaf ttl { + description "<0....N> - The timeout value (expressed in seconds) for action + execution, between action being received by APPC and action initiation"; + type uint16; + mandatory false; + } + } + } + } + + + grouping action-identifiers { + description "A block containing the action arguments. These are used to specify + the object upon which APP-C LCM command is to operate"; + container action-identifiers { + description "A block containing the action arguments. These are used to specify + the object upon which APP-C LCM command is to operate"; + leaf service-instance-id { + description "identifies a specific service the command refers to. When multiple + APP-C instances are used and applied to a subset of services, + this will become significant . The field is mandatory when the + vnf-id is empty"; + type string; + mandatory false; + } + leaf vnf-id { + description "identifies the VNF to which this action is to be applied(vnf-id + uniquely identifies the service-instance referred to). Note that + some actions are applied to multiple VNFs in the same service. + When this is the case, vnf-id may be left out, but service-instance-id + must appear. The field is mandatory when service-instance-id is + empty"; + type string; + mandatory false; + } + leaf vf-module-id { + description "identifies the VF module to which this action is to be applied."; + type string; + mandatory false; + } + leaf vnfc-name { + description "identifies the VNFC to which this action is to be applied. Some + actions apply only to a component within a VNF (e.g. RESTART is + sometimes applied to on VM only). In such a case, the name of + the VNFC is used to search for the component within the VNF"; + type string; + mandatory false; + } + leaf vserver-id { + description "identifies a specific VM within the given service/vnf to which + this action is to be applied"; + type string; + mandatory false; + } + leaf pnf-name { + description "identifies the PNF to which this action is to be applied."; + type string; + mandatory false; + } + } + } + + + grouping status { + description "The specific response codes are to be aligned with SDC reference doc + (main table removed to avoid duplication and digression from main table). + See SDC and ECOMP Distribution Consumer Interface Agreement"; + container status { + description "The specific response codes are to be aligned with SDC reference doc + (main table removed to avoid duplication and digression from main table). + See SDC and ECOMP Distribution Consumer Interface Agreement"; + leaf code { + description "Response code"; + type uint16; + mandatory true; + } + leaf message { + description "Response message"; + type string; + mandatory true; + } + } + } + + typedef lcm-action-status { + type enumeration { + enum "IN_PROGRESS"; + enum "SUCCESSFUL"; + enum "FAILED"; + enum "NOT_FOUND"; + enum "ABORTED"; + enum "MULTIPLE_REQUESTS_FOUND"; + } + description "The status of the requested LCM action"; + } + + /********************************************************************************** + * Define the restart service + **********************************************************************************/ + rpc restart { + description "An operation to restart a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the rebuild service + **********************************************************************************/ + rpc rebuild { + description "An operation to rebuild a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the migrate service + **********************************************************************************/ + rpc migrate { + description "An operation to migrate a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the evacuate service + **********************************************************************************/ + rpc evacuate { + description "An operation to evacuate a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the snapshot service + **********************************************************************************/ + rpc snapshot { + description "An operation to create a snapshot of a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + leaf identity-url { + type string; + mandatory true; + } + } + output { + uses common-header; + uses status; + leaf snapshot-id { + type string; + } + } + } + /********************************************************************************** + * Define the VNF quiesce traffic service + **********************************************************************************/ + rpc quiesce-traffic { + description "An operation to stop traffic gracefully on the VF. + It stops traffic gracefully without stopping the application"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VNF resume traffic service + **********************************************************************************/ + rpc resume-traffic { + description "An operation to resume traffic gracefully on the VF. + It resumes traffic gracefully without stopping the application"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VNF distribute traffic service + **********************************************************************************/ + rpc distribute-traffic { + description "An operation to distribute traffic gracefully on the VF. + It distributes traffic gracefully without stopping the application"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VNF UpgradePreCheck service + **********************************************************************************/ + rpc upgrade-pre-check { + description "An operation to check that the VNF has the correct software version needed for a software upgrade."; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory true; + } + } + } + + /********************************************************************************** + * Define the VNF UpgradeSoftware service + **********************************************************************************/ + rpc upgrade-software { + description "An operation to upgrade the target VNF to a new version and expected that the VNF is in a quiesced status ."; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the downloadNESw operation + **********************************************************************************/ + rpc download-n-e-sw { + description "An operation to download NE software"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory true; + } + } + } + + /********************************************************************************** + * Define the activateNESw operation + **********************************************************************************/ + rpc activate-n-e-sw { + description "An operation to activate NE software"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory true; + } + } + } + + /********************************************************************************** + * Define the VNF UpgradePostCheck service + **********************************************************************************/ + rpc upgrade-post-check { + description "An operation to check the VNF upgrade has been successful completed and all processes are running properly."; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory true; + } + } + } + + /********************************************************************************** + * Define the VNF UpgradeBackup service + **********************************************************************************/ + rpc upgrade-backup { + description "An operation to do full backup of the VNF data prior to an upgrade."; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VNF UpgradeBackout service + **********************************************************************************/ + rpc upgrade-backout { + description "An operation does a backout after an UpgradeSoftware is completed (either successfully or unsuccessfully)."; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the rollback service + **********************************************************************************/ + rpc rollback { + description "An operation to rollback to particular snapshot of a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + leaf identity-url { + type string; + mandatory false; + } + leaf snapshot-id { + type string; + mandatory false; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory false; + } + } + } + + + /********************************************************************************** + * Additional RPCs added here... + **********************************************************************************/ + + + /********************************************************************************** + * Define the sync service + **********************************************************************************/ + rpc sync { + description "An operation to sync the configurations of a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory false; + } + } + } + + /********************************************************************************** + * Define the terminate service + **********************************************************************************/ + rpc terminate { + description "An operation to terminate the configurations of a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + + rpc configure { + description "An operation to configure the configurations of a virtual network + function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory false; + } + } + } + + rpc config-modify { + description "Use the ModifyConfig command when a full configuration cycle is either not required + or is considered too costly. The ModifyConfig LCM action affects only a subset of the + total configuration data of a VNF. The set of configuration parameters to be affected + is a subset of the total configuration data of the target VNF type. The payload Stop + Application must contain the configuration parameters to be modified and their values. + A successful modify returns a success response. A failed modify returns a failure + response and the specific failure messages in the response payload Stop Application"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory false; + } + } + } + + rpc config-scale-out { + description "An operation to Modify the configuration or other action to support + a ConfigScaleOut of a VNF."; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory false; + } + } + } + + rpc config-restore { + description "An operation to restore the configurations of a virtual network + function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory false; + } + } + } + + /********************************************************************************** + * Define the test service + **********************************************************************************/ + rpc test { + description "An operation to test the configurations of a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the stop service + **********************************************************************************/ + rpc stop { + description "An operation to stop the configurations of a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + rpc start { + description "An operation to start a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the audit service + **********************************************************************************/ + rpc audit { + description "An operation to audit the configurations of a virtual network function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory false; + } + } + } + + /********************************************************************************** + * Define the SoftwareUpload vSCP service + **********************************************************************************/ + rpc software-upload { + description "An operation to upload a new version of vSCP image to vSCP for updating it"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the PreHealthCheck vSCP service + **********************************************************************************/ + rpc health-check { + description "An operation to perform health check of vSCP prior its upgrading"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory true; + } + + } + } + + + /********************************************************************************** + * Define the Upgrade vSCP service + **********************************************************************************/ + rpc live-upgrade { + description "An operation to perform upgrade of vSCP"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + + /********************************************************************************** + * Define the VNF lock service + **********************************************************************************/ + rpc lock { + description "An operation to perform VNF lock operation"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VNF unlock service + **********************************************************************************/ + rpc unlock { + description "An operation to perform VNF unlock operation"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VNF check lock service + **********************************************************************************/ + rpc check-lock { + description "An operation to check VNF lock status"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + } + output { + uses common-header; + uses status; + leaf locked { + type enumeration { + enum "TRUE"; + enum "FALSE"; + } + description "TRUE/FALSE - returns TRUE when the given VNF was locked, otherwise returns FALSE"; + mandatory false; + } + } + } + + + rpc config-backup { + description "An operation to Backup configurations of a virtual network function + (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory false; + } + } + } + + rpc config-backup-delete { + description "An operation to Delete backup configurations of a virtual network + function (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + mandatory false; + } + } + } + + rpc config-export { + description "An operation to Export configurations of a virtual network function + (or VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + } + output { + uses common-header; + uses status; + } + } + rpc stop-application { + description "An operation to Stop Application traffic to a virtual network function"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VNF Start Application service + **********************************************************************************/ + rpc start-application { + description "An operation to perform VNF Start Application operation"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + + /********************************************************************************** + * Gets the current state of the previously submitted LCM request + **********************************************************************************/ + rpc action-status { + description "An operation to get the current state of the previously submitted LCM request"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + leaf payload { + type payload; + } + } + } + + /********************************************************************************** + * Define the VNF Query service + **********************************************************************************/ + rpc query { + description "An operation to query the status of a targe VNF. + Returns information on each VM, including state (active or standby) + and status (healthy or unhealthy)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + } + output { + uses common-header; + uses status; + list query-results { + leaf vserver-id { + description "Identifier of a VM"; + type string; + mandatory true; + } + leaf vm-state { + description "The state of the VM"; + type vm-state; + mandatory true; + } + leaf vm-status { + description "the status of the VM"; + type vm-status; + mandatory true; + } + } + } + } + + /********************************************************************************** + * Define the Reboot service + **********************************************************************************/ + rpc reboot { + description "An operation to reboot a specified virtual machine (VM)"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory false; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VM attach volume service + **********************************************************************************/ + rpc attach-volume { + description "An operation to attach a cinder volume to a VM"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + /********************************************************************************** + * Define the VM detach volume service + **********************************************************************************/ + rpc detach-volume { + description "An operation to detach a cinder volume from a VM"; + input { + uses common-header; + leaf action { + type action; + mandatory true; + } + uses action-identifiers; + leaf payload { + type payload; + mandatory true; + } + } + output { + uses common-header; + uses status; + } + } + + + + /********************************************************************************** + * Additional RPCs added here... + **********************************************************************************/ +} diff --git a/northbound/lcm/pom.xml b/northbound/lcm/pom.xml new file mode 100755 index 000000000..e210b2451 --- /dev/null +++ b/northbound/lcm/pom.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>odlparent-lite</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>lcm</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>pom</packaging> + + <name>ccsdk-sli-northbound :: lcm</name> + + <modules> + <module>model</module> + <module>provider</module> + <module>installer</module> + </modules> +</project> diff --git a/northbound/lcm/provider/pom.xml b/northbound/lcm/provider/pom.xml new file mode 100755 index 000000000..03f34e6ba --- /dev/null +++ b/northbound/lcm/provider/pom.xml @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>binding-parent</artifactId> + <version>2.1.0</version> + <relativePath/> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>lcm-provider</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>bundle</packaging> + + <name>ccsdk-sli-northbound :: lcm :: ${project.artifactId}</name> + + <properties> + <ccsdk.sli.northbound.version>${project.version}</ccsdk.sli.northbound.version> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-core-artifacts</artifactId> + <version>${ccsdk.sli.core.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>lcm-model</artifactId> + <version>${project.version}</version> + </dependency> + + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-api</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-binding-broker-impl</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-common-util</artifactId> + </dependency> + + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-common</artifactId> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-provider</artifactId> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-provider-base</artifactId> + <version>${ccsdk.sli.core.version}</version> + </dependency> + <dependency> + <groupId>org.opendaylight.controller</groupId> + <artifactId>sal-core-api</artifactId> + </dependency> + <dependency> + <groupId>org.opendaylight.yangtools</groupId> + <artifactId>yang-data-impl</artifactId> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>org.osgi.core</artifactId> + <scope>test</scope> + </dependency> + </dependencies> +</project> diff --git a/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java new file mode 100644 index 000000000..100496e39 --- /dev/null +++ b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmProvider.java @@ -0,0 +1,1126 @@ +package org.onap.ccsdk.sli.northbound; +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Properties; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; +import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper; +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; +import org.opendaylight.controller.md.sal.binding.impl.AbstractForwardedDataBroker; +import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; +import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.*; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.common.header.CommonHeaderBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.status.StatusBuilder; +import org.opendaylight.yangtools.yang.common.RpcResult; +import org.opendaylight.yangtools.yang.common.RpcResultBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; + +import org.onap.ccsdk.sli.northbound.LcmResponseCode.*; + +/** + * Defines a base implementation for your provider. This class extends from a + * helper class which provides storage for the most commonly used components of + * the MD-SAL. Additionally the base class provides some basic logging and + * initialization / clean up methods. + * + */ +public class LcmProvider implements AutoCloseable, LCMService { + + private class CommonLcmFields { + private StatusBuilder statusBuilder; + private CommonHeaderBuilder commonHeaderBuilder; + private Payload payload; + + public CommonLcmFields(StatusBuilder statusBuilder, CommonHeaderBuilder commonHeaderBuilder) { + this.statusBuilder = statusBuilder; + this.commonHeaderBuilder = commonHeaderBuilder; + this.payload = null; + } + + public CommonLcmFields(StatusBuilder statusBuilder, CommonHeaderBuilder commonHeaderBuilder, Payload payload) { + this.statusBuilder = statusBuilder; + this.commonHeaderBuilder = commonHeaderBuilder; + this.payload = payload; + } + + public StatusBuilder getStatusBuilder() { + return statusBuilder; + } + + public CommonHeaderBuilder getCommonHeaderBuilder() { + return commonHeaderBuilder; + } + + public Payload getPayload() { + return payload; + } + } + + private static final Logger LOG = LoggerFactory.getLogger(LcmProvider.class); + + private static final String exceptionMessage = "Caught exception"; + + private static final String APPLICATION_NAME = "LCM"; + + private final ExecutorService executor; + protected DataBroker dataBroker; + protected DOMDataBroker domDataBroker; + protected NotificationPublishService notificationService; + protected RpcProviderRegistry rpcRegistry; + private final LcmSliClient lcmSliClient; + + protected BindingAwareBroker.RpcRegistration<LCMService> rpcRegistration; + + public LcmProvider(final DataBroker dataBroker, final NotificationPublishService notificationPublishService, + final RpcProviderRegistry rpcProviderRegistry, final LcmSliClient lcmSliClient) { + + LOG.info("Creating provider for {}", APPLICATION_NAME); + executor = Executors.newFixedThreadPool(1); + this.dataBroker = dataBroker; + if (dataBroker instanceof AbstractForwardedDataBroker) { + domDataBroker = ((AbstractForwardedDataBroker) dataBroker).getDelegate(); + } + notificationService = notificationPublishService; + rpcRegistry = rpcProviderRegistry; + this.lcmSliClient = lcmSliClient; + initialize(); + } + + public void initialize() { + LOG.info("Initializing {} for {}", this.getClass().getName(), APPLICATION_NAME); + + if (rpcRegistration == null) { + if (rpcRegistry != null) { + rpcRegistration = rpcRegistry.addRpcImplementation(LCMService.class, this); + LOG.info("Initialization complete for {}", APPLICATION_NAME); + } else { + LOG.warn("Error initializing {} : rpcRegistry unset", APPLICATION_NAME); + } + } + } + + protected void initializeChild() { + // Override if you have custom initialization intelligence + } + + @Override + public void close() throws Exception { + LOG.info("Closing provider for " + APPLICATION_NAME); + executor.shutdown(); + rpcRegistration.close(); + LOG.info("Successfully closed provider for " + APPLICATION_NAME); + } + + + + @Override + public ListenableFuture<RpcResult<CheckLockOutput>> checkLock(CheckLockInput input) { + CheckLockInputBuilder iBuilder = new CheckLockInputBuilder(input); + CheckLockOutputBuilder oBuilder = new CheckLockOutputBuilder(); + + try { + CommonLcmFields retval = callDG("check-lock", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<CheckLockOutput> rpcResult = + RpcResultBuilder.<CheckLockOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + + } + + @Override + public ListenableFuture<RpcResult<RebootOutput>> reboot(RebootInput input) { + RebootInputBuilder iBuilder = new RebootInputBuilder(input); + RebootOutputBuilder oBuilder = new RebootOutputBuilder(); + + try { + CommonLcmFields retval = callDG("reboot", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<RebootOutput> rpcResult = + RpcResultBuilder.<RebootOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<UpgradeBackupOutput>> upgradeBackup(UpgradeBackupInput input) { + UpgradeBackupInputBuilder iBuilder = new UpgradeBackupInputBuilder(input); + UpgradeBackupOutputBuilder oBuilder = new UpgradeBackupOutputBuilder(); + + try { + CommonLcmFields retval = callDG("upgrade-backup", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<UpgradeBackupOutput> rpcResult = + RpcResultBuilder.<UpgradeBackupOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<RollbackOutput>> rollback(RollbackInput input) { + RollbackInputBuilder iBuilder = new RollbackInputBuilder(input); + RollbackOutputBuilder oBuilder = new RollbackOutputBuilder(); + + try { + CommonLcmFields retval = callDG("rollback", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + if (retval.getPayload() != null) { + oBuilder.setPayload(retval.getPayload()); + } + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<RollbackOutput> rpcResult = + RpcResultBuilder.<RollbackOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<SyncOutput>> sync(SyncInput input) { + SyncInputBuilder iBuilder = new SyncInputBuilder(input); + SyncOutputBuilder oBuilder = new SyncOutputBuilder(); + + try { + CommonLcmFields retval = callDG("sync", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<SyncOutput> rpcResult = + RpcResultBuilder.<SyncOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<QueryOutput>> query(QueryInput input) { + QueryInputBuilder iBuilder = new QueryInputBuilder(input); + QueryOutputBuilder oBuilder = new QueryOutputBuilder(); + + try { + CommonLcmFields retval = callDG("query", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<QueryOutput> rpcResult = + RpcResultBuilder.<QueryOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<ConfigExportOutput>> configExport(ConfigExportInput input) { + ConfigExportInputBuilder iBuilder = new ConfigExportInputBuilder(input); + ConfigExportOutputBuilder oBuilder = new ConfigExportOutputBuilder(); + + try { + CommonLcmFields retval = callDG("config-export", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<ConfigExportOutput> rpcResult = + RpcResultBuilder.<ConfigExportOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<StopApplicationOutput>> stopApplication(StopApplicationInput input) { + StopApplicationInputBuilder iBuilder = new StopApplicationInputBuilder(input); + StopApplicationOutputBuilder oBuilder = new StopApplicationOutputBuilder(); + + try { + CommonLcmFields retval = callDG("stop-application", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<StopApplicationOutput> rpcResult = + RpcResultBuilder.<StopApplicationOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<SoftwareUploadOutput>> softwareUpload(SoftwareUploadInput input) { + SoftwareUploadInputBuilder iBuilder = new SoftwareUploadInputBuilder(input); + SoftwareUploadOutputBuilder oBuilder = new SoftwareUploadOutputBuilder(); + + try { + CommonLcmFields retval = callDG("software-upload", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<SoftwareUploadOutput> rpcResult = + RpcResultBuilder.<SoftwareUploadOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<ResumeTrafficOutput>> resumeTraffic(ResumeTrafficInput input) { + ResumeTrafficInputBuilder iBuilder = new ResumeTrafficInputBuilder(input); + ResumeTrafficOutputBuilder oBuilder = new ResumeTrafficOutputBuilder(); + + try { + CommonLcmFields retval = callDG("resume-traffic", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<ResumeTrafficOutput> rpcResult = + RpcResultBuilder.<ResumeTrafficOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<DistributeTrafficOutput>> distributeTraffic(DistributeTrafficInput input) { + DistributeTrafficInputBuilder iBuilder = new DistributeTrafficInputBuilder(input); + DistributeTrafficOutputBuilder oBuilder = new DistributeTrafficOutputBuilder(); + + try { + CommonLcmFields retval = callDG("distribute-traffic", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<DistributeTrafficOutput> rpcResult = + RpcResultBuilder.<DistributeTrafficOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<ConfigureOutput>> configure(ConfigureInput input) { + ConfigureInputBuilder iBuilder = new ConfigureInputBuilder(input); + ConfigureOutputBuilder oBuilder = new ConfigureOutputBuilder(); + + try { + CommonLcmFields retval = callDG("configure", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<ConfigureOutput> rpcResult = + RpcResultBuilder.<ConfigureOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<ActionStatusOutput>> actionStatus(ActionStatusInput input) { + ActionStatusInputBuilder iBuilder = new ActionStatusInputBuilder(input); + ActionStatusOutputBuilder oBuilder = new ActionStatusOutputBuilder(); + + try { + CommonLcmFields retval = callDG("action-status", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<ActionStatusOutput> rpcResult = + RpcResultBuilder.<ActionStatusOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<UpgradePreCheckOutput>> upgradePreCheck(UpgradePreCheckInput input) { + UpgradePreCheckInputBuilder iBuilder = new UpgradePreCheckInputBuilder(input); + UpgradePreCheckOutputBuilder oBuilder = new UpgradePreCheckOutputBuilder(); + + try { + CommonLcmFields retval = callDG("upgrade-pre-check", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + if (retval.getPayload() != null) { + oBuilder.setPayload(retval.getPayload()); + } + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<UpgradePreCheckOutput> rpcResult = + RpcResultBuilder.<UpgradePreCheckOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<LiveUpgradeOutput>> liveUpgrade(LiveUpgradeInput input) { + LiveUpgradeInputBuilder iBuilder = new LiveUpgradeInputBuilder(input); + LiveUpgradeOutputBuilder oBuilder = new LiveUpgradeOutputBuilder(); + + try { + CommonLcmFields retval = callDG("live-upgrade", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<LiveUpgradeOutput> rpcResult = + RpcResultBuilder.<LiveUpgradeOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<ConfigModifyOutput>> configModify(ConfigModifyInput input) { + ConfigModifyInputBuilder iBuilder = new ConfigModifyInputBuilder(input); + ConfigModifyOutputBuilder oBuilder = new ConfigModifyOutputBuilder(); + + try { + CommonLcmFields retval = callDG("config-modify", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<ConfigModifyOutput> rpcResult = + RpcResultBuilder.<ConfigModifyOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<RestartOutput>> restart(RestartInput input) { + RestartInputBuilder iBuilder = new RestartInputBuilder(input); + RestartOutputBuilder oBuilder = new RestartOutputBuilder(); + + try { + CommonLcmFields retval = callDG("restart", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<RestartOutput> rpcResult = + RpcResultBuilder.<RestartOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<HealthCheckOutput>> healthCheck(HealthCheckInput input) { + HealthCheckInputBuilder iBuilder = new HealthCheckInputBuilder(input); + HealthCheckOutputBuilder oBuilder = new HealthCheckOutputBuilder(); + + try { + CommonLcmFields retval = callDG("health-check", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<HealthCheckOutput> rpcResult = + RpcResultBuilder.<HealthCheckOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<LockOutput>> lock(LockInput input) { + LockInputBuilder iBuilder = new LockInputBuilder(input); + LockOutputBuilder oBuilder = new LockOutputBuilder(); + + try { + CommonLcmFields retval = callDG("lock", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<LockOutput> rpcResult = + RpcResultBuilder.<LockOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<TerminateOutput>> terminate(TerminateInput input) { + TerminateInputBuilder iBuilder = new TerminateInputBuilder(input); + TerminateOutputBuilder oBuilder = new TerminateOutputBuilder(); + + try { + CommonLcmFields retval = callDG("terminate", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<TerminateOutput> rpcResult = + RpcResultBuilder.<TerminateOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<AttachVolumeOutput>> attachVolume(AttachVolumeInput input) { + AttachVolumeInputBuilder iBuilder = new AttachVolumeInputBuilder(input); + AttachVolumeOutputBuilder oBuilder = new AttachVolumeOutputBuilder(); + + try { + CommonLcmFields retval = callDG("attach-volume", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<AttachVolumeOutput> rpcResult = + RpcResultBuilder.<AttachVolumeOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<MigrateOutput>> migrate(MigrateInput input) { + MigrateInputBuilder iBuilder = new MigrateInputBuilder(input); + MigrateOutputBuilder oBuilder = new MigrateOutputBuilder(); + + try { + CommonLcmFields retval = callDG("migrate", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<MigrateOutput> rpcResult = + RpcResultBuilder.<MigrateOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<QuiesceTrafficOutput>> quiesceTraffic(QuiesceTrafficInput input) { + QuiesceTrafficInputBuilder iBuilder = new QuiesceTrafficInputBuilder(input); + QuiesceTrafficOutputBuilder oBuilder = new QuiesceTrafficOutputBuilder(); + + try { + CommonLcmFields retval = callDG("quiesce-traffic", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<QuiesceTrafficOutput> rpcResult = + RpcResultBuilder.<QuiesceTrafficOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<ConfigRestoreOutput>> configRestore(ConfigRestoreInput input) { + ConfigRestoreInputBuilder iBuilder = new ConfigRestoreInputBuilder(input); + ConfigRestoreOutputBuilder oBuilder = new ConfigRestoreOutputBuilder(); + + try { + CommonLcmFields retval = callDG("config-restore", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<ConfigRestoreOutput> rpcResult = + RpcResultBuilder.<ConfigRestoreOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<UpgradeBackoutOutput>> upgradeBackout(UpgradeBackoutInput input) { + UpgradeBackoutInputBuilder iBuilder = new UpgradeBackoutInputBuilder(input); + UpgradeBackoutOutputBuilder oBuilder = new UpgradeBackoutOutputBuilder(); + + try { + CommonLcmFields retval = callDG("upgrade-backout", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<UpgradeBackoutOutput> rpcResult = + RpcResultBuilder.<UpgradeBackoutOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<EvacuateOutput>> evacuate(EvacuateInput input) { + EvacuateInputBuilder iBuilder = new EvacuateInputBuilder(input); + EvacuateOutputBuilder oBuilder = new EvacuateOutputBuilder(); + + try { + CommonLcmFields retval = callDG("evacuate", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<EvacuateOutput> rpcResult = + RpcResultBuilder.<EvacuateOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<UnlockOutput>> unlock(UnlockInput input) { + UnlockInputBuilder iBuilder = new UnlockInputBuilder(input); + UnlockOutputBuilder oBuilder = new UnlockOutputBuilder(); + + try { + CommonLcmFields retval = callDG("unlock", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<UnlockOutput> rpcResult = + RpcResultBuilder.<UnlockOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<ConfigBackupDeleteOutput>> configBackupDelete(ConfigBackupDeleteInput input) { + ConfigBackupDeleteInputBuilder iBuilder = new ConfigBackupDeleteInputBuilder(input); + ConfigBackupDeleteOutputBuilder oBuilder = new ConfigBackupDeleteOutputBuilder(); + + try { + CommonLcmFields retval = callDG("config-backup-delete", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<ConfigBackupDeleteOutput> rpcResult = + RpcResultBuilder.<ConfigBackupDeleteOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<UpgradeSoftwareOutput>> upgradeSoftware(UpgradeSoftwareInput input) { + UpgradeSoftwareInputBuilder iBuilder = new UpgradeSoftwareInputBuilder(input); + UpgradeSoftwareOutputBuilder oBuilder = new UpgradeSoftwareOutputBuilder(); + + try { + CommonLcmFields retval = callDG("upgrade-software", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<UpgradeSoftwareOutput> rpcResult = + RpcResultBuilder.<UpgradeSoftwareOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<DownloadNESwOutput>> downloadNESw(DownloadNESwInput input) { + DownloadNESwInputBuilder iBuilder = new DownloadNESwInputBuilder(input); + DownloadNESwOutputBuilder oBuilder = new DownloadNESwOutputBuilder(); + + try { + CommonLcmFields retval = callDG("download-n-e-sw", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + if (retval.getPayload() != null) { + oBuilder.setPayload(retval.getPayload()); + } + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<DownloadNESwOutput> rpcResult = + RpcResultBuilder.<DownloadNESwOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<ActivateNESwOutput>> activateNESw(ActivateNESwInput input) { + ActivateNESwInputBuilder iBuilder = new ActivateNESwInputBuilder(input); + ActivateNESwOutputBuilder oBuilder = new ActivateNESwOutputBuilder(); + + try { + CommonLcmFields retval = callDG("activate-n-e-sw", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + if (retval.getPayload() != null) { + oBuilder.setPayload(retval.getPayload()); + } + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<ActivateNESwOutput> rpcResult = + RpcResultBuilder.<ActivateNESwOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<StopOutput>> stop(StopInput input) { + StopInputBuilder iBuilder = new StopInputBuilder(input); + StopOutputBuilder oBuilder = new StopOutputBuilder(); + + try { + CommonLcmFields retval = callDG("stop", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<StopOutput> rpcResult = + RpcResultBuilder.<StopOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<DetachVolumeOutput>> detachVolume(DetachVolumeInput input) { + DetachVolumeInputBuilder iBuilder = new DetachVolumeInputBuilder(input); + DetachVolumeOutputBuilder oBuilder = new DetachVolumeOutputBuilder(); + + try { + CommonLcmFields retval = callDG("detach-volume", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<DetachVolumeOutput> rpcResult = + RpcResultBuilder.<DetachVolumeOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<ConfigScaleOutOutput>> configScaleOut(ConfigScaleOutInput input) { + ConfigScaleOutInputBuilder iBuilder = new ConfigScaleOutInputBuilder(input); + ConfigScaleOutOutputBuilder oBuilder = new ConfigScaleOutOutputBuilder(); + + try { + CommonLcmFields retval = callDG("config-scale-out", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<ConfigScaleOutOutput> rpcResult = + RpcResultBuilder.<ConfigScaleOutOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<UpgradePostCheckOutput>> upgradePostCheck(UpgradePostCheckInput input) { + UpgradePostCheckInputBuilder iBuilder = new UpgradePostCheckInputBuilder(input); + UpgradePostCheckOutputBuilder oBuilder = new UpgradePostCheckOutputBuilder(); + + try { + CommonLcmFields retval = callDG("upgrade-post-check", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + if (retval.getPayload() != null) { + oBuilder.setPayload(retval.getPayload()); + } + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<UpgradePostCheckOutput> rpcResult = + RpcResultBuilder.<UpgradePostCheckOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<TestOutput>> test(TestInput input) { + TestInputBuilder iBuilder = new TestInputBuilder(input); + TestOutputBuilder oBuilder = new TestOutputBuilder(); + + try { + CommonLcmFields retval = callDG("test", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<TestOutput> rpcResult = + RpcResultBuilder.<TestOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<StartApplicationOutput>> startApplication(StartApplicationInput input) { + StartApplicationInputBuilder iBuilder = new StartApplicationInputBuilder(input); + StartApplicationOutputBuilder oBuilder = new StartApplicationOutputBuilder(); + + try { + CommonLcmFields retval = callDG("start-application", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<StartApplicationOutput> rpcResult = + RpcResultBuilder.<StartApplicationOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<ConfigBackupOutput>> configBackup(ConfigBackupInput input) { + ConfigBackupInputBuilder iBuilder = new ConfigBackupInputBuilder(input); + ConfigBackupOutputBuilder oBuilder = new ConfigBackupOutputBuilder(); + + try { + CommonLcmFields retval = callDG("config-backup", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<ConfigBackupOutput> rpcResult = + RpcResultBuilder.<ConfigBackupOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<RebuildOutput>> rebuild(RebuildInput input) { + RebuildInputBuilder iBuilder = new RebuildInputBuilder(input); + RebuildOutputBuilder oBuilder = new RebuildOutputBuilder(); + + try { + CommonLcmFields retval = callDG("rebuild", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<RebuildOutput> rpcResult = + RpcResultBuilder.<RebuildOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<AuditOutput>> audit(AuditInput input) { + AuditInputBuilder iBuilder = new AuditInputBuilder(input); + AuditOutputBuilder oBuilder = new AuditOutputBuilder(); + + try { + CommonLcmFields retval = callDG("audit", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<AuditOutput> rpcResult = + RpcResultBuilder.<AuditOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<StartOutput>> start(StartInput input) { + StartInputBuilder iBuilder = new StartInputBuilder(input); + StartOutputBuilder oBuilder = new StartOutputBuilder(); + + try { + CommonLcmFields retval = callDG("start", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<StartOutput> rpcResult = + RpcResultBuilder.<StartOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + @Override + public ListenableFuture<RpcResult<SnapshotOutput>> snapshot(SnapshotInput input) { + SnapshotInputBuilder iBuilder = new SnapshotInputBuilder(input); + SnapshotOutputBuilder oBuilder = new SnapshotOutputBuilder(); + + try { + CommonLcmFields retval = callDG("snapshot", iBuilder.build()); + oBuilder.setStatus(retval.getStatusBuilder().build()); + oBuilder.setCommonHeader(retval.getCommonHeaderBuilder().build()); + } catch (LcmRpcInvocationException e) { + LOG.debug(exceptionMessage, e); + oBuilder.setCommonHeader(e.getCommonHeader()); + oBuilder.setStatus(e.getStatus()); + } + + RpcResult<SnapshotOutput> rpcResult = + RpcResultBuilder.<SnapshotOutput> status(true).withResult(oBuilder.build()).build(); + // return error + return Futures.immediateFuture(rpcResult); + } + + private CommonLcmFields callDG(String rpcName, Object input) throws LcmRpcInvocationException { + + StatusBuilder statusBuilder = new StatusBuilder(); + + if (input == null) { + LOG.debug("Rejecting " +rpcName+ " because of invalid input"); + statusBuilder.setCode(LcmResponseCode.REJECT_INVALID_INPUT.getValue()); + statusBuilder.setMessage("REJECT - INVALID INPUT. Missing input"); + CommonHeaderBuilder hBuilder = new CommonHeaderBuilder(); + hBuilder.setApiVer("1"); + hBuilder.setOriginatorId("unknown"); + hBuilder.setRequestId("unset"); + hBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + throw new LcmRpcInvocationException(statusBuilder.build(), hBuilder.build()); + } + + CommonHeaderBuilder hBuilder = new CommonHeaderBuilder(((CommonHeader)input).getCommonHeader()); + + // add input to parms + LOG.info("Adding INPUT data for "+ rpcName +" input: " + input.toString()); + Properties inputProps = new Properties(); + MdsalHelper.toProperties(inputProps, input); + + Properties respProps = new Properties(); + + // Call SLI sync method + try + { + if (lcmSliClient.hasGraph("LCM", rpcName , null, "sync")) + { + try + { + respProps = lcmSliClient.execute("LCM", rpcName, null, "sync", inputProps, domDataBroker); + } + catch (Exception e) + { + LOG.error("Caught exception executing service logic for "+ rpcName, e); + statusBuilder.setCode(LcmResponseCode.FAILURE_DG_FAILURE.getValue()); + statusBuilder.setMessage("FAILURE - DG FAILURE ("+e.getMessage()+")"); + throw new LcmRpcInvocationException(statusBuilder.build(), hBuilder.build()); + } + } else { + LOG.error("No service logic active for LCM: '" + rpcName + "'"); + + statusBuilder.setCode(LcmResponseCode.REJECT_DG_NOT_FOUND.getValue()); + statusBuilder.setMessage("FAILURE - DG not found for action "+rpcName); + throw new LcmRpcInvocationException(statusBuilder.build(), hBuilder.build()); + } + } + catch (Exception e) + { + LOG.error("Caught exception looking for service logic", e); + + statusBuilder.setCode(LcmResponseCode.FAILURE_DG_FAILURE.getValue()); + statusBuilder.setMessage("FAILURE - Unexpected error looking for DG ("+e.getMessage()+")"); + throw new LcmRpcInvocationException(statusBuilder.build(), hBuilder.build()); + } + + + StatusBuilder sBuilder = new StatusBuilder(); + MdsalHelper.toBuilder(respProps, sBuilder); + MdsalHelper.toBuilder(respProps, hBuilder); + + Payload payload = null; + String payloadValue = respProps.getProperty("payload"); + if (payloadValue != null) { + payload = new Payload(payloadValue); + } + + String statusCode = sBuilder.getCode().toString(); + + if (!"400".equals(statusCode)) { + LOG.error("Returned FAILED for "+rpcName+" error code: '" + statusCode + "'"); + } else { + LOG.info("Returned SUCCESS for "+rpcName+" "); + } + + return new CommonLcmFields(sBuilder, hBuilder, payload); + + } + +} diff --git a/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmResponseCode.java b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmResponseCode.java new file mode 100644 index 000000000..76001c860 --- /dev/null +++ b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmResponseCode.java @@ -0,0 +1,51 @@ +package org.onap.ccsdk.sli.northbound; + +public enum LcmResponseCode { + + // Accepted category + ACCEPT_ACCEPTED(100), + // Error category + ERROR_UNEXPECTED_ERROR(200), + // Rejected category + REJECT_REJECTED(300), + REJECT_INVALID_INPUT(301), + REJECT_MISSING_PARAM(302), + REJECT_PARSING_FAILED(303), + REJECT_NO_TRANSITION(304), + REJECT_ACTION_NOT_SUPPORTED(305), + REJECT_VNF_NOT_FOUND(306), + REJECT_DG_NOT_FOUND(307), + REJECT_WORKFLOW_NOT_FOUND(308), + REJECT_UNSTABLE_VNF(309), + REJECT_LOCKING_FAILURE(310), + REJECT_EXPIRED_REQUEST(311), + REJECT_DUPLICATE_REQUEST(312), + REJECT_MISSING_AAI_DATA(313), + REJECT_MULTIPLE_REQUESTS_FOR_SEARCH(315), + REJECT_POLICY_VALIDATION_FAILURE(316), + // Success category + SUCCESS(400), + // Failure category + FAILURE_DG_FAILURE(401), + FAILURE_NO_TRANSITION(402), + FAILURE_AAI_FAILURE(403), + FAILURE_EXPIRED_REQUEST(404), + FAILURE_UNEXPECTED_FAILURE(405), + FAILURE_UNSTABLE_VNF(406), + FAILURE_REQUEST_NOT_SUPPORTED(450), + // Partial success + PARTIAL_SUCCESS(500); + + + + private int value; + private LcmResponseCode(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + + +} diff --git a/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmRpcInvocationException.java b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmRpcInvocationException.java new file mode 100644 index 000000000..2ae2200a8 --- /dev/null +++ b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmRpcInvocationException.java @@ -0,0 +1,25 @@ +package org.onap.ccsdk.sli.northbound; + +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.common.header.CommonHeader; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.status.Status; + +public class LcmRpcInvocationException extends SvcLogicException { + + private Status status; + private CommonHeader commonHeader; + + public LcmRpcInvocationException(Status status, CommonHeader commonHeader) { + this.status = status; + this.commonHeader = commonHeader; + } + + public Status getStatus() { + return status; + } + + public CommonHeader getCommonHeader() { + return commonHeader; + } + +} diff --git a/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java new file mode 100644 index 000000000..54e53c776 --- /dev/null +++ b/northbound/lcm/provider/src/main/java/org/onap/ccsdk/sli/northbound/LcmSliClient.java @@ -0,0 +1,99 @@ +package org.onap.ccsdk.sli.northbound; +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + + + +import java.util.Properties; + +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService; +import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class LcmSliClient { + + private static final Logger LOG = LoggerFactory.getLogger(LcmSliClient.class); + + private final SvcLogicService svcLogicService; + + private String ErrorCode = "error-code"; + + public LcmSliClient(final SvcLogicService svcLogicService) { + this.svcLogicService = svcLogicService; + } + + public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException + { + return svcLogicService.hasGraph(module, rpc, version, mode); + } + + + public Properties execute(String module, String rpc, String version, String mode, Properties parms, DOMDataBroker dataBroker) + throws SvcLogicException { + + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters passed to SLI"); + + for (Object key : parms.keySet()) { + String parmName = (String) key; + String parmValue = parms.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + + Properties respProps = svcLogicService.execute(module, rpc, version, mode, parms, dataBroker); + + if (LOG.isDebugEnabled()) + { + LOG.debug("Parameters returned by SLI"); + + for (Object key : respProps.keySet()) { + String parmName = (String) key; + String parmValue = respProps.getProperty(parmName); + + LOG.debug(parmName+" = "+parmValue); + + } + } + + if ("failure".equalsIgnoreCase(respProps.getProperty("SvcLogic.status"))) { + + if (!respProps.containsKey(ErrorCode)) { + respProps.setProperty(ErrorCode, "500"); + } + } else { + if (!respProps.containsKey(ErrorCode)) { + respProps.setProperty(ErrorCode, "200"); + } + } + + + return respProps; + } + +} diff --git a/northbound/lcm/provider/src/main/resources/OSGI-INF/blueprint/lcm-blueprint.xml b/northbound/lcm/provider/src/main/resources/OSGI-INF/blueprint/lcm-blueprint.xml new file mode 100644 index 000000000..5597d0801 --- /dev/null +++ b/northbound/lcm/provider/src/main/resources/OSGI-INF/blueprint/lcm-blueprint.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" + xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0" + odl:use-default-for-reference-types="true"> + + <reference id="svcLogicService" + interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService" /> + + <bean id="client" class="org.onap.ccsdk.sli.northbound.LcmSliClient"> + <argument ref="svcLogicService" /> + </bean> + + <reference id="dataBroker" + interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" + odl:type="default" /> + + <reference id="notificationService" + interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService" + odl:type="default" /> + + <reference id="rpcRegistry" + interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry" + odl:type="default" /> + + <bean id="provider" class="org.onap.ccsdk.sli.northbound.LcmProvider"> + <argument ref="dataBroker" /> + <argument ref="notificationService" /> + <argument ref="rpcRegistry" /> + <argument ref="client" /> + </bean> + + <odl:rpc-implementation ref="provider"/> + +</blueprint>
\ No newline at end of file diff --git a/northbound/lcm/provider/src/main/resources/org/opendaylight/blueprint/lcm-blueprint.xml b/northbound/lcm/provider/src/main/resources/org/opendaylight/blueprint/lcm-blueprint.xml new file mode 100644 index 000000000..5597d0801 --- /dev/null +++ b/northbound/lcm/provider/src/main/resources/org/opendaylight/blueprint/lcm-blueprint.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" + xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0" + odl:use-default-for-reference-types="true"> + + <reference id="svcLogicService" + interface="org.onap.ccsdk.sli.core.sli.provider.SvcLogicService" /> + + <bean id="client" class="org.onap.ccsdk.sli.northbound.LcmSliClient"> + <argument ref="svcLogicService" /> + </bean> + + <reference id="dataBroker" + interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" + odl:type="default" /> + + <reference id="notificationService" + interface="org.opendaylight.controller.md.sal.binding.api.NotificationPublishService" + odl:type="default" /> + + <reference id="rpcRegistry" + interface="org.opendaylight.controller.sal.binding.api.RpcProviderRegistry" + odl:type="default" /> + + <bean id="provider" class="org.onap.ccsdk.sli.northbound.LcmProvider"> + <argument ref="dataBroker" /> + <argument ref="notificationService" /> + <argument ref="rpcRegistry" /> + <argument ref="client" /> + </bean> + + <odl:rpc-implementation ref="provider"/> + +</blueprint>
\ No newline at end of file diff --git a/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java b/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java new file mode 100644 index 000000000..b73151e8d --- /dev/null +++ b/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmProvider.java @@ -0,0 +1,1601 @@ +package org.onap.ccsdk.sli.northbound; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.InputStream; +import java.net.URL; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Properties; +import java.util.concurrent.ExecutionException; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.ccsdk.sli.core.sli.SvcLogicLoader; +import org.onap.ccsdk.sli.core.sli.SvcLogicStore; +import org.onap.ccsdk.sli.core.sli.SvcLogicStoreFactory; +import org.onap.ccsdk.sli.core.sli.provider.SvcLogicClassResolver; +import org.onap.ccsdk.sli.core.sli.provider.SvcLogicPropertiesProviderImpl; +import org.onap.ccsdk.sli.core.sli.provider.SvcLogicServiceImpl; +import org.opendaylight.controller.md.sal.binding.api.DataBroker; +import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; +import org.opendaylight.controller.sal.binding.api.BindingAwareBroker; +import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.Action; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActionStatusInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActionStatusOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.AttachVolumeInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.AttachVolumeOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.AuditInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.AuditOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.CheckLockInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.CheckLockOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigBackupDeleteInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigBackupDeleteOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigBackupInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigBackupOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigExportInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigExportOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigModifyInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigModifyOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigRestoreInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigRestoreOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigScaleOutInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigScaleOutOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigureInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ConfigureOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DetachVolumeInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DetachVolumeOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DistributeTrafficInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DistributeTrafficOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.EvacuateInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.EvacuateOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.HealthCheckInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.HealthCheckOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.LCMService; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.LiveUpgradeInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.LiveUpgradeOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.LockInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.LockOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.MigrateInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.MigrateOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.Payload; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.QueryInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.QueryOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.QuiesceTrafficInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.QuiesceTrafficOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.RebootInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.RebootOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.RestartInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.RestartOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ResumeTrafficInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ResumeTrafficOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.RollbackInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.RollbackOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.SnapshotInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.SnapshotOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.SoftwareUploadInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.SoftwareUploadOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.StartApplicationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.StartApplicationOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.StartInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.StartOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.StopApplicationInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.StopApplicationOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.StopInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.StopOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.SyncInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.SyncOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.TerminateInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.TerminateOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.TestInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.TestOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UnlockInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UnlockOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradeBackoutInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradeBackoutOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradeBackupInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradeBackupOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradePostCheckInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradePostCheckOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradePreCheckInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradePreCheckOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradeSoftwareInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.UpgradeSoftwareOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DownloadNESwInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.DownloadNESwOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActivateNESwInputBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ActivateNESwOutput; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.ZULU; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.action.identifiers.ActionIdentifiersBuilder; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.common.header.CommonHeaderBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TestLcmProvider { + + Logger LOG = LoggerFactory.getLogger(LcmProvider.class); + private LcmProvider provider; + + /** + * @throws java.lang.Exception + */ + @Before + public void setUp() throws Exception { + DataBroker dataBroker = mock(DataBroker.class); + NotificationPublishService notifyService = mock(NotificationPublishService.class); + RpcProviderRegistry rpcRegistry = mock(RpcProviderRegistry.class); + BindingAwareBroker.RpcRegistration<LCMService> rpcRegistration = (BindingAwareBroker.RpcRegistration<LCMService>) mock(BindingAwareBroker.RpcRegistration.class); + when(rpcRegistry.addRpcImplementation(any(Class.class), any(LCMService.class))).thenReturn(rpcRegistration); + + + // Load svclogic.properties and get a SvcLogicStore + InputStream propStr = TestLcmProvider.class.getResourceAsStream("/svclogic.properties"); + Properties svcprops = new Properties(); + svcprops.load(propStr); + + SvcLogicStore store = SvcLogicStoreFactory.getSvcLogicStore(svcprops); + + assertNotNull(store); + + URL graphUrl = TestLcmProvider.class.getClassLoader().getResource("graphs"); + + if (graphUrl == null) { + fail("Cannot find graphs directory"); + } + + SvcLogicLoader loader = new SvcLogicLoader(graphUrl.getPath(), store); + loader.loadAndActivate(); + + // Create a ServiceLogicService + SvcLogicServiceImpl svc = new SvcLogicServiceImpl(new SvcLogicPropertiesProviderImpl(), + new SvcLogicClassResolver()); + + // Finally ready to create sliapiProvider + LcmSliClient client = new LcmSliClient(svc); + provider = new LcmProvider(dataBroker, notifyService, rpcRegistry, client); + } + + /** + * @throws java.lang.Exception + */ + @After + public void tearDown() throws Exception { + provider.close(); + } + + + @Test + public void testCheckLock() { + CheckLockInputBuilder builder = new CheckLockInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.CheckLock); + + try { + CheckLockOutput results = provider.checkLock(builder.build()).get().getResult(); + LOG.info("CheckLock returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("CheckLock threw exception"); + } + + } + + @Test + public void testReboot() { + RebootInputBuilder builder = new RebootInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Reboot); + builder.setPayload(mock(Payload.class)); + + + try { + RebootOutput results = provider.reboot(builder.build()).get().getResult(); + LOG.info("Reboot returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Reboot threw exception"); + } + } + + @Test + public void testUpgradeBackup() { + UpgradeBackupInputBuilder builder = new UpgradeBackupInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.UpgradeBackup); + builder.setPayload(mock(Payload.class)); + + + + try { + UpgradeBackupOutput results = provider.upgradeBackup(builder.build()).get().getResult(); + LOG.info("UpgradeBackout returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("CheckLock threw exception"); + } + } + + @Test + public void testRollback() { + RollbackInputBuilder builder = new RollbackInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Rollback); + builder.setPayload(mock(Payload.class)); + + + try { + RollbackOutput results = provider.rollback(builder.build()).get().getResult(); + LOG.info("Rollback returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Rollback threw exception"); + } + } + + @Test + public void testSync() { + SyncInputBuilder builder = new SyncInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Sync); + builder.setPayload(mock(Payload.class)); + + + try { + SyncOutput results = provider.sync(builder.build()).get().getResult(); + LOG.info("Sync returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Sync threw exception"); + } + } + + @Test + public void testQuery() { + QueryInputBuilder builder = new QueryInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Query); + + + try { + QueryOutput results = provider.query(builder.build()).get().getResult(); + LOG.info("Query returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Query threw exception"); + } + + } + + @Test + public void testConfigExport() { + ConfigExportInputBuilder builder = new ConfigExportInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ConfigExport); + + + try { + ConfigExportOutput results = provider.configExport(builder.build()).get().getResult(); + LOG.info("ConfigExport returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ConfigExport threw exception"); + } + } + + @Test + public void testStopApplication() { + + StopApplicationInputBuilder builder = new StopApplicationInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.StopApplication); + builder.setPayload(mock(Payload.class)); + + + try { + StopApplicationOutput results = provider.stopApplication(builder.build()).get().getResult(); + LOG.info("StopApplication returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("StopApplication threw exception"); + } + } + + @Test + public void testSoftwareUpload() { + SoftwareUploadInputBuilder builder = new SoftwareUploadInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.SoftwareUpload); + builder.setPayload(mock(Payload.class)); + + + try { + SoftwareUploadOutput results = provider.softwareUpload(builder.build()).get().getResult(); + LOG.info("SoftwareUpload returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("SoftwareUpload threw exception"); + } + } + + @Test + public void testResumeTraffic() { + ResumeTrafficInputBuilder builder = new ResumeTrafficInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ResumeTraffic); + builder.setPayload(mock(Payload.class)); + + + try { + ResumeTrafficOutput results = provider.resumeTraffic(builder.build()).get().getResult(); + LOG.info("ResumeTraffic returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ResumeTraffic threw exception"); + } + } + + @Test + public void testDistributeTraffic() { + DistributeTrafficInputBuilder builder = new DistributeTrafficInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.DistributeTraffic); + builder.setPayload(mock(Payload.class)); + + + try { + DistributeTrafficOutput results = provider.distributeTraffic(builder.build()).get().getResult(); + LOG.info("DistributeTraffic returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("DistributeTraffic threw exception"); + } + } + + @Test + public void testConfigure() { + ConfigureInputBuilder builder = new ConfigureInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Configure); + builder.setPayload(mock(Payload.class)); + + + try { + ConfigureOutput results = provider.configure(builder.build()).get().getResult(); + LOG.info("Configure returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Configure threw exception"); + } + } + + @Test + public void testActionStatus() { + ActionStatusInputBuilder builder = new ActionStatusInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ActionStatus); + builder.setPayload(mock(Payload.class)); + + + try { + ActionStatusOutput results = provider.actionStatus(builder.build()).get().getResult(); + LOG.info("ActionStatus returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ActionStatus threw exception"); + } + } + + @Test + public void testUpgradePreCheck() { + UpgradePreCheckInputBuilder builder = new UpgradePreCheckInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.UpgradePreCheck); + builder.setPayload(mock(Payload.class)); + + + try { + UpgradePreCheckOutput results = provider.upgradePreCheck(builder.build()).get().getResult(); + LOG.info("UpgradePreCheck returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("UpgradePreCheck threw exception"); + } + } + + @Test + public void testLiveUpgrade() { + LiveUpgradeInputBuilder builder = new LiveUpgradeInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.LiveUpgrade); + builder.setPayload(mock(Payload.class)); + + + try { + LiveUpgradeOutput results = provider.liveUpgrade(builder.build()).get().getResult(); + LOG.info("LiveUpgrade returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("LiveUpgrade threw exception"); + } + } + + @Test + public void testConfigModify() { + ConfigModifyInputBuilder builder = new ConfigModifyInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ConfigModify); + builder.setPayload(mock(Payload.class)); + + + try { + ConfigModifyOutput results = provider.configModify(builder.build()).get().getResult(); + LOG.info("ConfigModify returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ConfigModify threw exception"); + } + } + + @Test + public void testRestart() { + RestartInputBuilder builder = new RestartInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Restart); + builder.setPayload(mock(Payload.class)); + + + try { + RestartOutput results = provider.restart(builder.build()).get().getResult(); + LOG.info("Restart returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Restart threw exception"); + } + } + + @Test + public void testHealthCheck() { + HealthCheckInputBuilder builder = new HealthCheckInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.HealthCheck); + builder.setPayload(mock(Payload.class)); + + + try { + HealthCheckOutput results = provider.healthCheck(builder.build()).get().getResult(); + LOG.info("HealthCheck returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("HealthCheck threw exception"); + } + } + + @Test + public void testLock() { + LockInputBuilder builder = new LockInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Lock); + builder.setPayload(mock(Payload.class)); + + + try { + LockOutput results = provider.lock(builder.build()).get().getResult(); + LOG.info("Lock returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Lock threw exception"); + } + } + + @Test + public void testTerminate() { + TerminateInputBuilder builder = new TerminateInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Terminate); + builder.setPayload(mock(Payload.class)); + + + try { + TerminateOutput results = provider.terminate(builder.build()).get().getResult(); + LOG.info("Terminate returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Terminate threw exception"); + } + } + + @Test + public void testAttachVolume() { + AttachVolumeInputBuilder builder = new AttachVolumeInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.AttachVolume); + builder.setPayload(mock(Payload.class)); + + + try { + AttachVolumeOutput results = provider.attachVolume(builder.build()).get().getResult(); + LOG.info("AttachVolume returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("AttachVolume threw exception"); + } + } + + @Test + public void testMigrate() { + MigrateInputBuilder builder = new MigrateInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Migrate); + builder.setPayload(mock(Payload.class)); + + + try { + MigrateOutput results = provider.migrate(builder.build()).get().getResult(); + LOG.info("Migrate returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Migrate threw exception"); + } + } + + @Test + public void testQuiesceTraffic() { + QuiesceTrafficInputBuilder builder = new QuiesceTrafficInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.QuiesceTraffic); + builder.setPayload(mock(Payload.class)); + + + try { + QuiesceTrafficOutput results = provider.quiesceTraffic(builder.build()).get().getResult(); + LOG.info("QuiesceTraffic returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("QuiesceTraffic threw exception"); + } + } + + @Test + public void testConfigRestore() { + ConfigRestoreInputBuilder builder = new ConfigRestoreInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ConfigRestore); + builder.setPayload(mock(Payload.class)); + + + try { + ConfigRestoreOutput results = provider.configRestore(builder.build()).get().getResult(); + LOG.info("ConfigRestore returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ConfigRestore threw exception"); + } + } + + @Test + public void testUpgradeBackout() { + UpgradeBackoutInputBuilder builder = new UpgradeBackoutInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.UpgradeBackout); + builder.setPayload(mock(Payload.class)); + + + try { + UpgradeBackoutOutput results = provider.upgradeBackout(builder.build()).get().getResult(); + LOG.info("UpgradeBackout returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("UpgradeBackout threw exception"); + } + } + + @Test + public void testEvacuate() { + EvacuateInputBuilder builder = new EvacuateInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Evacuate); + builder.setPayload(mock(Payload.class)); + + + try { + EvacuateOutput results = provider.evacuate(builder.build()).get().getResult(); + LOG.info("Evacuate returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Evacuate threw exception"); + } + } + + @Test + public void testUnlock() { + UnlockInputBuilder builder = new UnlockInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Unlock); + builder.setPayload(mock(Payload.class)); + + + try { + UnlockOutput results = provider.unlock(builder.build()).get().getResult(); + LOG.info("Unlock returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Unlock threw exception"); + } + } + + @Test + public void testConfigBackupDelete() { + ConfigBackupDeleteInputBuilder builder = new ConfigBackupDeleteInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ConfigBackupDelete); + + + try { + ConfigBackupDeleteOutput results = provider.configBackupDelete(builder.build()).get().getResult(); + LOG.info("ConfigBackupDelete returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ConfigBackupDelete threw exception"); + } + } + + @Test + public void testUpgradeSoftware() { + UpgradeSoftwareInputBuilder builder = new UpgradeSoftwareInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.UpgradeSoftware); + builder.setPayload(mock(Payload.class)); + + + try { + UpgradeSoftwareOutput results = provider.upgradeSoftware(builder.build()).get().getResult(); + LOG.info("UpgradeSoftware returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("UpgradeSoftware threw exception"); + } + } + + @Test + public void testDownloadNESw() { + DownloadNESwInputBuilder builder = new DownloadNESwInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setPnfName("my-pnf"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.DownloadNESw); + builder.setPayload(mock(Payload.class)); + + + try { + DownloadNESwOutput results = provider.downloadNESw(builder.build()).get().getResult(); + LOG.info("DownloadNESw returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("DownloadNESw threw exception"); + } + } + + @Test + public void testActivateNESw() { + ActivateNESwInputBuilder builder = new ActivateNESwInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setPnfName("my-pnf"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ActivateNESw); + builder.setPayload(mock(Payload.class)); + + + try { + ActivateNESwOutput results = provider.activateNESw(builder.build()).get().getResult(); + LOG.info("ActivateNESw returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ActivateNESw threw exception"); + } + } + + @Test + public void testStop() { + StopInputBuilder builder = new StopInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Stop); + builder.setPayload(mock(Payload.class)); + + + try { + StopOutput results = provider.stop(builder.build()).get().getResult(); + LOG.info("Stop returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Stop threw exception"); + } + } + + @Test + public void testDetachVolume() { + DetachVolumeInputBuilder builder = new DetachVolumeInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.DetachVolume); + builder.setPayload(mock(Payload.class)); + + + try { + DetachVolumeOutput results = provider.detachVolume(builder.build()).get().getResult(); + LOG.info("DetachVolume returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("DetachVolume threw exception"); + } + } + + @Test + public void testConfigScaleOut() { + ConfigScaleOutInputBuilder builder = new ConfigScaleOutInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ConfigScaleOut); + builder.setPayload(mock(Payload.class)); + + + try { + ConfigScaleOutOutput results = provider.configScaleOut(builder.build()).get().getResult(); + LOG.info("ConfigScaleOut returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ConfigScaleOut threw exception"); + } + } + + @Test + public void testUpgradePostCheck() { + UpgradePostCheckInputBuilder builder = new UpgradePostCheckInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.UpgradePostCheck); + builder.setPayload(mock(Payload.class)); + + + try { + UpgradePostCheckOutput results = provider.upgradePostCheck(builder.build()).get().getResult(); + LOG.info("UpgradePostCheck returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("UpgradePostCheck threw exception"); + } + } + + @Test + public void testTest() { + TestInputBuilder builder = new TestInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Test); + builder.setPayload(mock(Payload.class)); + + + try { + TestOutput results = provider.test(builder.build()).get().getResult(); + LOG.info("Test returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Test threw exception"); + } + } + + @Test + public void testStartApplication() { + StartApplicationInputBuilder builder = new StartApplicationInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.StartApplication); + builder.setPayload(mock(Payload.class)); + + + try { + StartApplicationOutput results = provider.startApplication(builder.build()).get().getResult(); + LOG.info("StartApplication returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("StartApplication threw exception"); + } + } + + @Test + public void testConfigBackup() { + ConfigBackupInputBuilder builder = new ConfigBackupInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ConfigBackup); + builder.setPayload(mock(Payload.class)); + + + try { + ConfigBackupOutput results = provider.configBackup(builder.build()).get().getResult(); + LOG.info("ConfigBackup returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ConfigBackup threw exception"); + } + } + + @Test + public void testRebuild() { + ConfigBackupInputBuilder builder = new ConfigBackupInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.ConfigBackup); + builder.setPayload(mock(Payload.class)); + + + try { + ConfigBackupOutput results = provider.configBackup(builder.build()).get().getResult(); + LOG.info("ConfigBackup returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("ConfigBackup threw exception"); + } + } + + @Test + public void testAudit() { + AuditInputBuilder builder = new AuditInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Audit); + builder.setPayload(mock(Payload.class)); + + + try { + AuditOutput results = provider.audit(builder.build()).get().getResult(); + LOG.info("Audit returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Audit threw exception"); + } + } + + @Test + public void testStart() { + StartInputBuilder builder = new StartInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Start); + builder.setPayload(mock(Payload.class)); + + + try { + StartOutput results = provider.start(builder.build()).get().getResult(); + LOG.info("Start returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Start threw exception"); + } + } + + @Test + public void testSnapshot() { + SnapshotInputBuilder builder = new SnapshotInputBuilder(); + + CommonHeaderBuilder hdrBuilder = new CommonHeaderBuilder(); + hdrBuilder.setApiVer("1"); + hdrBuilder.setFlags(null); + hdrBuilder.setOriginatorId("jUnit"); + hdrBuilder.setRequestId("123"); + hdrBuilder.setTimestamp(new ZULU(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").format(new Date()))); + builder.setCommonHeader(hdrBuilder.build()); + + ActionIdentifiersBuilder aBuilder = new ActionIdentifiersBuilder(); + aBuilder.setServiceInstanceId("SVCID-123"); + aBuilder.setVfModuleId("vf-module-1"); + aBuilder.setVnfcName("my-vnfc"); + aBuilder.setVnfId("123"); + aBuilder.setVserverId("123"); + builder.setActionIdentifiers(aBuilder.build()); + + builder.setAction(Action.Snapshot); + builder.setPayload(mock(Payload.class)); + + + try { + SnapshotOutput results = provider.snapshot(builder.build()).get().getResult(); + LOG.info("Snapshot returned status {} : {}", results.getStatus().getCode(), results.getStatus().getMessage()); + assert(results.getStatus().getCode() == 400); + } catch (InterruptedException | ExecutionException e) { + LOG.error("Caught exception", e); + fail("Snapshot threw exception"); + } + } + +} diff --git a/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmRpcInvocationException.java b/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmRpcInvocationException.java new file mode 100644 index 000000000..f95e83250 --- /dev/null +++ b/northbound/lcm/provider/src/test/java/org/onap/ccsdk/sli/northbound/TestLcmRpcInvocationException.java @@ -0,0 +1,20 @@ +package org.onap.ccsdk.sli.northbound; + +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.common.header.CommonHeader; +import org.opendaylight.yang.gen.v1.org.onap.ccsdk.sli.northbound.lcm.rev180329.status.Status; + +public class TestLcmRpcInvocationException { + + @Test(expected = SvcLogicException.class) + public void testLcmRpcInvocationException() throws SvcLogicException{ + Status status = null; + CommonHeader commonHeader = null; + LcmRpcInvocationException exception = new LcmRpcInvocationException(status, commonHeader); + assert(exception.getStatus() == status); + assert(exception.getCommonHeader() == commonHeader); + throw exception; + } +} diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Audit.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Audit.xml new file mode 100644 index 000000000..34c84ed9a --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Audit.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='audit' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Configure.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Configure.xml new file mode 100644 index 000000000..a37f0675a --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Configure.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='configure' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Evacuate.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Evacuate.xml new file mode 100644 index 000000000..216bd418b --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Evacuate.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='evacuate' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Lock.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Lock.xml new file mode 100644 index 000000000..6479d3ec5 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Lock.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='lock' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Migrate.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Migrate.xml new file mode 100644 index 000000000..9c8959681 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Migrate.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='migrate' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Query.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Query.xml new file mode 100644 index 000000000..5d0312292 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Query.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='query' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Reboot.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Reboot.xml new file mode 100644 index 000000000..f117f9606 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Reboot.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='reboot' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Rebuild.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Rebuild.xml new file mode 100644 index 000000000..e721bc5a7 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Rebuild.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='rebuild' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Restart.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Restart.xml new file mode 100644 index 000000000..b47091af2 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Restart.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='restart' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Rollback.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Rollback.xml new file mode 100644 index 000000000..6844d0482 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Rollback.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='rollback' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Snapshot.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Snapshot.xml new file mode 100644 index 000000000..6d0f8b039 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Snapshot.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='snapshot' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Start.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Start.xml new file mode 100644 index 000000000..5998614ab --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Start.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='start' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Stop.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Stop.xml new file mode 100644 index 000000000..f752725de --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Stop.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='stop' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Sync.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Sync.xml new file mode 100644 index 000000000..5741175cf --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Sync.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='sync' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Terminate.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Terminate.xml new file mode 100644 index 000000000..0f2758a89 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Terminate.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='terminate' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Test.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Test.xml new file mode 100644 index 000000000..5ce002d0c --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Test.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='test' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Unlock.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Unlock.xml new file mode 100644 index 000000000..d506c2fd5 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_Unlock.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='unlock' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_action-status.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_action-status.xml new file mode 100644 index 000000000..435a62d95 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_action-status.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='action-status' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_activate-n-e-sw.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_activate-n-e-sw.xml new file mode 100644 index 000000000..44343dd5f --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_activate-n-e-sw.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='activate-n-e-sw' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_attach-volume.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_attach-volume.xml new file mode 100644 index 000000000..b073f9b7e --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_attach-volume.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='attach-volume' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_check-lock.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_check-lock.xml new file mode 100644 index 000000000..e07bf133d --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_check-lock.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='check-lock' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-backup-delete.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-backup-delete.xml new file mode 100644 index 000000000..5366c30a0 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-backup-delete.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='config-backup-delete' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-backup.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-backup.xml new file mode 100644 index 000000000..e32e5fe5b --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-backup.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='config-backup' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-export.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-export.xml new file mode 100644 index 000000000..fd6596bac --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-export.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='config-export' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-modify.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-modify.xml new file mode 100644 index 000000000..76782f432 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-modify.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='config-modify' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-restore.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-restore.xml new file mode 100644 index 000000000..e0ed71b8a --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-restore.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='config-restore' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-scale-out.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-scale-out.xml new file mode 100644 index 000000000..5200feb8a --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_config-scale-out.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='config-scale-out' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_detach-volume.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_detach-volume.xml new file mode 100644 index 000000000..117a3e31a --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_detach-volume.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='detach-volume' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_distribute-traffic.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_distribute-traffic.xml new file mode 100644 index 000000000..14ff1134c --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_distribute-traffic.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='distribute-traffic' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_download-n-e-sw.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_download-n-e-sw.xml new file mode 100644 index 000000000..6bb0e765c --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_download-n-e-sw.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='download-n-e-sw' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_health-check.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_health-check.xml new file mode 100644 index 000000000..cf0f773e6 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_health-check.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='health-check' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_live-upgrade.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_live-upgrade.xml new file mode 100644 index 000000000..02fb050f8 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_live-upgrade.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='live-upgrade' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_quiesce-traffic.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_quiesce-traffic.xml new file mode 100644 index 000000000..0770b3dfc --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_quiesce-traffic.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='quiesce-traffic' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_resume-traffic.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_resume-traffic.xml new file mode 100644 index 000000000..7e0f1d6b3 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_resume-traffic.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='resume-traffic' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_software-upload.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_software-upload.xml new file mode 100644 index 000000000..a9eb58ac4 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_software-upload.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='software-upload' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_start-application.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_start-application.xml new file mode 100644 index 000000000..9b422a83c --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_start-application.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='start-application' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_stop-application.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_stop-application.xml new file mode 100644 index 000000000..91dc4fca6 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_stop-application.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='stop-application' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_update-software.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_update-software.xml new file mode 100644 index 000000000..75440c2a0 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_update-software.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='upgrade-software' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-backout.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-backout.xml new file mode 100644 index 000000000..d48d6817a --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-backout.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='upgrade-backout' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-backup.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-backup.xml new file mode 100644 index 000000000..d81651a83 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-backup.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='upgrade-backup' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-post-check.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-post-check.xml new file mode 100644 index 000000000..ba2798a41 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-post-check.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='upgrade-post-check' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-pre-check.xml b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-pre-check.xml new file mode 100644 index 000000000..1aaf18fff --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/LCM_upgrade-pre-check.xml @@ -0,0 +1,30 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<service-logic xmlns="http://www.onap.org/sdnc/svclogic" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" + module='LCM' version='1.0.0'> + <method rpc='upgrade-pre-check' mode='sync'> + <set> + <parameter name='status.code' value='400' /> + <parameter name='status.message' value='SUCCESS' /> + </set> + </method> +</service-logic> diff --git a/northbound/lcm/provider/src/test/resources/graphs/lcm/graph.versions b/northbound/lcm/provider/src/test/resources/graphs/lcm/graph.versions new file mode 100644 index 000000000..420bcf619 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/graphs/lcm/graph.versions @@ -0,0 +1,42 @@ +LCM restart 1.0.0 sync +LCM rebuild 1.0.0 sync +LCM migrate 1.0.0 sync +LCM evacuate 1.0.0 sync +LCM snapshot 1.0.0 sync +LCM rollback 1.0.0 sync +LCM sync 1.0.0 sync +LCM audit 1.0.0 sync +LCM stop 1.0.0 sync +LCM start 1.0.0 sync +LCM terminate 1.0.0 sync +LCM software-upload 1.0.0 sync +LCM health-check 1.0.0 sync +LCM live-upgrade 1.0.0 sync +LCM lock 1.0.0 sync +LCM unlock 1.0.0 sync +LCM test 1.0.0 sync +LCM check-lock 1.0.0 sync +LCM configure 1.0.0 sync +LCM config-modify 1.0.0 sync +LCM config-scale-out 1.0.0 sync +LCM config-restore 1.0.0 sync +LCM config-backup 1.0.0 sync +LCM config-backup-delete 1.0.0 sync +LCM config-export 1.0.0 sync +LCM stop-application 1.0.0 sync +LCM start-application 1.0.0 sync +LCM quiesce-traffic 1.0.0 sync +LCM resume-traffic 1.0.0 sync +LCM distribute-traffic 1.0.0 sync +LCM upgrade-pre-check 1.0.0 sync +LCM upgrade-software 1.0.0 sync +LCM download-n-e-sw 1.0.0 sync +LCM activate-n-e-sw 1.0.0 sync +LCM upgrade-post-check 1.0.0 sync +LCM upgrade-backup 1.0.0 sync +LCM upgrade-backout 1.0.0 sync +LCM action-status 1.0.0 sync +LCM query 1.0.0 sync +LCM reboot 1.0.0 sync +LCM attach-volume 1.0.0 sync +LCM detach-volume 1.0.0 sync diff --git a/northbound/lcm/provider/src/test/resources/simplelogger.properties b/northbound/lcm/provider/src/test/resources/simplelogger.properties new file mode 100644 index 000000000..001dfd427 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/simplelogger.properties @@ -0,0 +1,22 @@ +### +# ============LICENSE_START======================================================= +# ONAP : CCSDK +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +org.slf4j.simpleLogger.defaultLogLevel=debug diff --git a/northbound/lcm/provider/src/test/resources/svclogic.properties b/northbound/lcm/provider/src/test/resources/svclogic.properties new file mode 100644 index 000000000..426960f76 --- /dev/null +++ b/northbound/lcm/provider/src/test/resources/svclogic.properties @@ -0,0 +1,27 @@ +### +# ============LICENSE_START======================================================= +# ONAP : CCSDK +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +org.onap.ccsdk.sli.dbtype = jdbc +org.onap.ccsdk.sli.jdbc.url=jdbc:derby:memory:sdnctl;create=true +org.onap.ccsdk.sli.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver +org.onap.ccsdk.sli.jdbc.database = sdnctl +org.onap.ccsdk.sli.jdbc.user = test +org.onap.ccsdk.sli.jdbc.password = test diff --git a/northbound/releases/0.5.0.yaml b/northbound/releases/0.5.0.yaml new file mode 100644 index 000000000..89e429e5d --- /dev/null +++ b/northbound/releases/0.5.0.yaml @@ -0,0 +1,5 @@ +--- +distribution_type: 'maven' +version: '0.5.0' +project: 'ccsdk-sli-northbound' +log_dir: 'ccsdk-sli-northbound-maven-stage-master/161/' diff --git a/northbound/releases/0.5.1.yaml b/northbound/releases/0.5.1.yaml new file mode 100644 index 000000000..0f10908d4 --- /dev/null +++ b/northbound/releases/0.5.1.yaml @@ -0,0 +1,5 @@ +--- +distribution_type: 'maven' +version: '0.5.1' +project: 'ccsdk-sli-northbound' +log_dir: 'ccsdk-sli-northbound-maven-stage-master/167/' diff --git a/northbound/releases/0.5.2.yaml b/northbound/releases/0.5.2.yaml new file mode 100644 index 000000000..e464af013 --- /dev/null +++ b/northbound/releases/0.5.2.yaml @@ -0,0 +1,5 @@ +--- +distribution_type: 'maven' +version: '0.5.2' +project: 'ccsdk-sli-northbound' +log_dir: 'ccsdk-sli-northbound-maven-stage-master/175/' diff --git a/northbound/releases/0.6.0.yaml b/northbound/releases/0.6.0.yaml new file mode 100644 index 000000000..5c2a60849 --- /dev/null +++ b/northbound/releases/0.6.0.yaml @@ -0,0 +1,5 @@ +--- +distribution_type: 'maven' +version: '0.6.0' +project: 'ccsdk-sli-northbound' +log_dir: 'ccsdk-sli-northbound-maven-stage-master/189/' diff --git a/northbound/releases/0.6.1.yaml b/northbound/releases/0.6.1.yaml new file mode 100644 index 000000000..d68cdc717 --- /dev/null +++ b/northbound/releases/0.6.1.yaml @@ -0,0 +1,5 @@ +--- +distribution_type: 'maven' +version: '0.6.1' +project: 'ccsdk-sli-northbound' +log_dir: 'ccsdk-sli-northbound-maven-stage-master/206/' diff --git a/northbound/releases/0.7.0.yaml b/northbound/releases/0.7.0.yaml new file mode 100644 index 000000000..ac468fd74 --- /dev/null +++ b/northbound/releases/0.7.0.yaml @@ -0,0 +1,5 @@ +--- +distribution_type: 'maven' +version: '0.7.0' +project: 'ccsdk-sli-northbound' +log_dir: 'ccsdk-sli-northbound-maven-stage-master/301/' diff --git a/northbound/releases/0.7.1.yaml b/northbound/releases/0.7.1.yaml new file mode 100644 index 000000000..4cda320e1 --- /dev/null +++ b/northbound/releases/0.7.1.yaml @@ -0,0 +1,5 @@ +--- +distribution_type: 'maven' +version: '0.7.1' +project: 'ccsdk-sli-northbound' +log_dir: 'ccsdk-sli-northbound-maven-stage-master/302/' diff --git a/northbound/releases/1.0.0.yaml b/northbound/releases/1.0.0.yaml new file mode 100644 index 000000000..2a0c585c6 --- /dev/null +++ b/northbound/releases/1.0.0.yaml @@ -0,0 +1,5 @@ +--- +distribution_type: 'maven' +version: '1.0.0' +project: 'ccsdk-sli-northbound' +log_dir: 'ccsdk-sli-northbound-maven-stage-master/303/' diff --git a/northbound/releases/1.0.1.yaml b/northbound/releases/1.0.1.yaml new file mode 100644 index 000000000..204f71f52 --- /dev/null +++ b/northbound/releases/1.0.1.yaml @@ -0,0 +1,5 @@ +--- +distribution_type: 'maven' +version: '1.0.1' +project: 'ccsdk-sli-northbound' +log_dir: 'ccsdk-sli-northbound-maven-stage-master/304/' diff --git a/northbound/releases/1.1.0.yaml b/northbound/releases/1.1.0.yaml new file mode 100644 index 000000000..5ac19ffcf --- /dev/null +++ b/northbound/releases/1.1.0.yaml @@ -0,0 +1,5 @@ +--- +distribution_type: 'maven' +version: '1.1.0' +project: 'ccsdk-sli-northbound' +log_dir: 'ccsdk-sli-northbound-maven-stage-master/305/' diff --git a/northbound/ueb-listener/.gitignore b/northbound/ueb-listener/.gitignore new file mode 100755 index 000000000..1b8a6ba9d --- /dev/null +++ b/northbound/ueb-listener/.gitignore @@ -0,0 +1,12 @@ +org.eclipse.core.resources.prefs +.classpath
+.project
+.settings
+.idea
+.externalToolBuilders
+maven-eclipse.xml
+*.class
+target/
+MANIFEST.MF
+.DS_STORE
+.metadata
diff --git a/northbound/ueb-listener/.sonar/checkstyle.xml b/northbound/ueb-listener/.sonar/checkstyle.xml new file mode 100755 index 000000000..3fa231535 --- /dev/null +++ b/northbound/ueb-listener/.sonar/checkstyle.xml @@ -0,0 +1 @@ +<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"><!-- Generated by Sonar --><module name="Checker"><module name="SuppressionCommentFilter"/><module name="TreeWalker"><module name="FileContentsHolder"/> <module name="ClassFanOutComplexity"><property name="severity" value="warning"/></module><module name="NestedForDepth"><property name="severity" value="warning"/><property name="max" value="1"/></module><module name="ClassDataAbstractionCoupling"><property name="severity" value="warning"/></module></module></module>
\ No newline at end of file diff --git a/northbound/ueb-listener/.sonar/pmd.xml b/northbound/ueb-listener/.sonar/pmd.xml new file mode 100755 index 000000000..80343b3bd --- /dev/null +++ b/northbound/ueb-listener/.sonar/pmd.xml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<ruleset>
+ <rule ref="rulesets/java/naming.xml/BooleanGetMethodName">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/j2ee.xml/StaticEJBFieldShouldBeFinal">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/coupling.xml/CouplingBetweenObjects">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/codesize.xml/TooManyMethods">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/naming.xml/AvoidFieldNameMatchingTypeName">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/basic.xml/DoubleCheckedLocking">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/naming.xml/AvoidFieldNameMatchingMethodName">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/coupling.xml/ExcessiveImports">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/basic.xml/OverrideBothEqualsAndHashcode">
+ <priority>2</priority>
+ </rule>
+ <rule ref="rulesets/java/naming.xml/ShortMethodName">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/basic.xml/BooleanInstantiation">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/codesize.xml/TooManyFields">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/controversial.xml/AvoidUsingNativeCode">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/optimizations.xml/UseStringBufferForStringAppends">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/coupling.xml/LooseCoupling">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/design.xml/NonThreadSafeSingleton">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/j2ee.xml/DoNotUseThreads">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/sunsecure.xml/ArrayIsStoredDirectly">
+ <priority>5</priority>
+ </rule>
+ <rule ref="rulesets/java/sunsecure.xml/MethodReturnsInternalArray">
+ <priority>2</priority>
+ </rule>
+ <rule ref="rulesets/java/design.xml/AssignmentToNonFinalStatic">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/strictexception.xml/AvoidCatchingGenericException">
+ <priority>3</priority>
+ </rule>
+</ruleset>
+
diff --git a/northbound/ueb-listener/pom.xml b/northbound/ueb-listener/pom.xml new file mode 100755 index 000000000..9e04efb07 --- /dev/null +++ b/northbound/ueb-listener/pom.xml @@ -0,0 +1,160 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.ccsdk.parent</groupId> + <artifactId>standalone-parent</artifactId> + <version>2.1.0</version> + </parent> + + <groupId>org.onap.ccsdk.sli.northbound</groupId> + <artifactId>ueb-listener</artifactId> + <version>1.1.1-SNAPSHOT</version> + <packaging>jar</packaging> + + <name>ccsdk-sli-northbound :: ueb-listener</name> + <description>UEB Listener</description> + + <properties> + <skip.SWM>true</skip.SWM> + <ueb.listener.base>/opt/app/ueb-listener</ueb.listener.base> + <maven.build.timestamp.format>yyyyMMdd'T'HHmmss'Z'</maven.build.timestamp.format> + <build.number>${maven.build.timestamp}</build.number> + <SWM_VERSION>${project.version}-${build.number}</SWM_VERSION> + <ccsdk.sli.core.version>1.1.0</ccsdk.sli.core.version> + <ccsdk.sli.northbound.version>${project.version}</ccsdk.sli.northbound.version> + <sdc.client.version>1.4.1</sdc.client.version> + <sdc.tosca.version>1.6.5</sdc.tosca.version> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>sli-core-artifacts</artifactId> + <version>${ccsdk.sli.core.version}</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + <dependencies> + + + <dependency> + <groupId>org.onap.sdc.sdc-distribution-client</groupId> + <artifactId>sdc-distribution-client</artifactId> + <version>${sdc.client.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.onap.sdc.sdc-tosca</groupId> + <artifactId>sdc-tosca</artifactId> + <version>${sdc.tosca.version}</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.logging.log4j</groupId> + <artifactId>log4j-slf4j-impl</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-core</artifactId> + </dependency> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>ch.vorburger.mariaDB4j</groupId> + <artifactId>mariaDB4j</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.ccsdk.sli.core</groupId> + <artifactId>dblib-provider</artifactId> + </dependency> + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + <version>1.13</version> + </dependency> + </dependencies> + + <build> + <plugins> + + <!-- ================================================== --> + <!-- Set the JDK compiler version. --> + <!-- ================================================== --> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.5.1</version> + <inherited>true</inherited> + <configuration> + <source>1.8</source> + <target>1.8</target> + </configuration> + </plugin> + + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.6</version> + <configuration> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <mainClass>org.onap.ccsdk.sli.northbound.uebclient.SdncUebClient</mainClass> + </manifest> + </archive> + </configuration> + </plugin> + + <plugin> + <artifactId>maven-assembly-plugin</artifactId> + <version>2.6</version> + <executions> + <execution> + <id>create-zip</id> + <goals> + <goal>single</goal> + </goals> + <phase>package</phase> + <configuration> + <attach>true</attach> + <finalName>${project.artifactId}.${project.version}</finalName> + <attach>true</attach> + <descriptors> + <descriptor>src/assembly/assemble_zip.xml</descriptor> + </descriptors> + <appendAssemblyId>false</appendAssemblyId> + </configuration> + </execution> + </executions> + </plugin> + + </plugins> + </build> +</project> diff --git a/northbound/ueb-listener/src/assembly/assemble_zip.xml b/northbound/ueb-listener/src/assembly/assemble_zip.xml new file mode 100644 index 000000000..7a21aca48 --- /dev/null +++ b/northbound/ueb-listener/src/assembly/assemble_zip.xml @@ -0,0 +1,63 @@ +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<!-- Defines how we build the .zip file which is our distribution. --> + +<assembly + xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd"> + <id>assemble_zip</id> + <formats> + <format>zip</format> + </formats> + + <includeBaseDirectory>false</includeBaseDirectory> + + <fileSets> + <fileSet> + <directory>src/main/scripts</directory> + <outputDirectory>bin</outputDirectory> + </fileSet> + <fileSet> + <directory>target</directory> + <outputDirectory>lib</outputDirectory> + <includes> + <include>*.jar</include> + </includes> + </fileSet> + <fileSet> + <directory>src/main/resources</directory> + <outputDirectory>lib</outputDirectory> + <includes> + <include>*.xslt</include> + <include>*.properties</include> + </includes> + </fileSet> + </fileSets> + <dependencySets> + <dependencySet> + <outputDirectory>lib</outputDirectory> + <useProjectArtifact>true</useProjectArtifact> + <scope>runtime</scope> + </dependencySet> + </dependencySets> +</assembly> diff --git a/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModel.java b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModel.java new file mode 100644 index 000000000..f1e514da4 --- /dev/null +++ b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModel.java @@ -0,0 +1,106 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.uebclient; + +import java.io.IOException; +import java.util.List; + +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.tosca.parser.elements.queries.EntityQuery; +import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery; +import org.onap.sdc.tosca.parser.enums.SdcTypes; +import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncARModel extends SdncBaseModel { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncARModel.class); + + private String type = null; + private String subcategory = null; + + public SdncARModel(ISdcCsarHelper sdcCsarHelper, IEntityDetails arEntity, DBResourceManager jdbcDataSource, SdncUebConfiguration config) throws IOException { + + super(sdcCsarHelper, arEntity, jdbcDataSource, config); + + // extract metadata + Metadata metadata = arEntity.getMetadata(); + type = extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_TYPE); + subcategory = extractValue (metadata, "subcategory"); + addParameter("type", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_TYPE)); + + // extract properties + addParameter("role", extractValue (arEntity, "nf_role")); + addParameter("type", extractValue (arEntity, "nf_type")); + addParameter("ecomp_generated_naming", extractBooleanValue (arEntity, "nf_naming", "ecomp_generated_naming")); + addParameter("naming_policy", extractValue (arEntity, "nf_naming", "naming_policy")); + } + + public void insertAllottedResourceModelData () throws IOException { + try { + cleanUpExistingToscaData("ALLOTTED_RESOURCE_MODEL", "customization_uuid", getCustomizationUUID()); + LOG.info("Call insertToscaData for ALLOTTED_RESOURCE_MODEL where customization_uuid = " + getCustomizationUUID()); + insertToscaData(buildSql("ALLOTTED_RESOURCE_MODEL", model_yaml), null); + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the ALLOTTED_RESOURCE_MODEL table"); + throw new IOException (e); + } + } + + public void insertAllottedResourceVfcModelData () throws IOException { + + // Insert the child VFCs (not CVFC) into VFC_MODEL + String vfCustomizationUuid = getCustomizationUUID().replace("\"", ""); + EntityQuery vfcEntityQuery = EntityQuery.newBuilder(SdcTypes.VFC).build(); + TopologyTemplateQuery vfcTopologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.VF) + .customizationUUID(vfCustomizationUuid) + .build(); + List<IEntityDetails> nestedVfcs = sdcCsarHelper.getEntity(vfcEntityQuery, vfcTopologyTemplateQuery, true); // true allows for nested search + if (nestedVfcs == null || nestedVfcs.isEmpty()) { + LOG.info("Could not find the nested VFCs for: " + vfCustomizationUuid); + } + + for (IEntityDetails nestedVfc: nestedVfcs) { + try { + SdncVFCModel arVfcModel = new SdncVFCModel (sdcCsarHelper, nestedVfc, jdbcDataSource, config); + arVfcModel.insertVFCModelData(); + } catch (IOException e) { + LOG.info("Could not find the nested VFCs for: " + vfCustomizationUuid); + } + } + } + + public String getSubcategory() { + return subcategory; + } + + public void setSubcategory(String subcategory) { + this.subcategory = subcategory; + } + +} diff --git a/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncArtifactMap.java b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncArtifactMap.java new file mode 100644 index 000000000..601569a19 --- /dev/null +++ b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncArtifactMap.java @@ -0,0 +1,125 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.uebclient; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.util.HashMap; +import java.util.Map; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncArtifactMap { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncArtifactMap.class); + + public class SdncArtifactType { + private String tag; + private String artifactType; + private String rpc; + private int pass; + + private SdncArtifactType(String tag, String rpc, String pass) { + this.tag = tag; + this.rpc = rpc; + try { + this.pass = Integer.parseInt(pass); + } catch (Exception e) { + LOG.error("Invalid pass value for artifact map entry ({} {} {})", tag, rpc, pass, e); + } + } + + public String getTag() { + return tag; + } + public String getArtifactType() { + return artifactType; + } + public String getRpc() { + return rpc; + } + + public int getPass() { + return pass; + } + + public String getRpcUrl(String base) { + return base+rpc; + } + } + + + + private Map<String, SdncArtifactType> mapItems = new HashMap<>(); + + private int numPasses = 1; + + public int getNumPasses() { + return numPasses; + } + + public void load(String fileName) { + + File mapFile = new File(fileName); + + if (mapFile.exists() && mapFile.canRead()) { + + try (BufferedReader rdr = new BufferedReader(new FileReader(mapFile))) { + + for (String ln ; (ln = rdr.readLine()) != null ; ) { + String[] lnFields = ln.split(","); + if (lnFields.length == 3) { + SdncArtifactType entry = new SdncArtifactType(lnFields[0], lnFields[1], lnFields[2]); + mapItems.put(entry.getTag(), entry); + if (entry.getPass() + 1 > numPasses ) { + numPasses = entry.getPass() + 1; + } + } + } + + + } catch (Exception e) { + LOG.error("Caught exception reading artifact map", e); + return; + } + } else { + LOG.info("Artifact map {} does not exist or is not readable", fileName); + } + } + + public SdncArtifactType getMapping(String tag) { + if (mapItems.containsKey(tag)) { + return mapItems.get(tag); + } else { + return null; + } + } + + public static SdncArtifactMap getInstance() { + return new SdncArtifactMap(); + } + +} diff --git a/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java new file mode 100644 index 000000000..bced6a830 --- /dev/null +++ b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncBaseModel.java @@ -0,0 +1,1123 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.uebclient; + +import java.io.IOException; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import javax.sql.rowset.CachedRowSet; + +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.tosca.parser.elements.queries.EntityQuery; +import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery; +import org.onap.sdc.tosca.parser.enums.SdcTypes; +import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; +import org.onap.sdc.toscaparser.api.CapabilityAssignment; +import org.onap.sdc.toscaparser.api.CapabilityAssignments; +import org.onap.sdc.toscaparser.api.Property; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncBaseModel { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncBaseModel.class); + + protected String customizationUUID = null; + protected String invariantUUID = null; + protected String UUID = null; + protected String model_yaml = null; + protected String version = null; + protected String name = null; + + protected String PARAM_INVARIANT_UUID_KEY = "invariant_uuid"; + protected String PARAM_CUSTOMIZATION_UUID_KEY = "customization_uuid"; + protected String PARAM_UUID_KEY = "uuid"; + protected String PARAM_VERSION_KEY = "version"; + protected String PARAM_NAME_KEY = "name"; + protected String PARAM_DESCRIPTION_KEY = "description"; + protected String PARAM_TYPE_KEY = "type"; + protected String PARAM_CATEGORY_KEY = "category"; + + protected Map<String, String> params = null; + protected Map<String, String> attributeValueParams = null; + protected ISdcCsarHelper sdcCsarHelper = null; + protected static DBResourceManager jdbcDataSource = null; + protected static SdncUebConfiguration config = null; + protected IEntityDetails entityDetails = null; + + + public SdncBaseModel(ISdcCsarHelper sdcCsarHelper, IEntityDetails entityDetails, DBResourceManager jdbcDataSource, SdncUebConfiguration config) throws IOException { + this (sdcCsarHelper, entityDetails); + this.sdcCsarHelper = sdcCsarHelper; + this.entityDetails = entityDetails; + SdncBaseModel.jdbcDataSource = jdbcDataSource; + SdncBaseModel.config = config; + } + + public SdncBaseModel(ISdcCsarHelper sdcCsarHelper, Metadata metadata, DBResourceManager jdbcDataSource) { + + params = new HashMap<String, String>(); + this.sdcCsarHelper = sdcCsarHelper; + SdncBaseModel.jdbcDataSource = jdbcDataSource; + + // extract service metadata + invariantUUID = extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID); + addParameter(PARAM_INVARIANT_UUID_KEY,invariantUUID); + addParameter(PARAM_VERSION_KEY,extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_VERSION)); + name = extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_NAME); + addParameter(PARAM_NAME_KEY,name); + addParameter(PARAM_DESCRIPTION_KEY,extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + addParameter(PARAM_TYPE_KEY,extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_TYPE)); + addParameter(PARAM_CATEGORY_KEY,extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_CATEGORY)); + } + + public SdncBaseModel(ISdcCsarHelper sdcCsarHelper, IEntityDetails entityDetails) { + + params = new HashMap<String, String>(); + attributeValueParams = new HashMap<String, String>(); + this.sdcCsarHelper = sdcCsarHelper; + this.entityDetails = entityDetails; + + // extract common nodeTemplate metadata + Metadata metadata = entityDetails.getMetadata(); + customizationUUID = extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); + invariantUUID = extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID); + addParameter(PARAM_INVARIANT_UUID_KEY, invariantUUID); + UUID = extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_UUID); + addParameter(PARAM_UUID_KEY, UUID); + addParameter(PARAM_VERSION_KEY, extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VERSION)); + } + + +/* This is the generic approach Shoujit attempted for 18.06 but can't be implemented without parser API to + * get properties with substring match on the name + * protected void extractRelevantAttributeData(List<Property> propList, SdncUebConfiguration config) { + + //List<Property> propList = nodeTemplate.getPropertiesObjects(); + for (Property prop : propList) { + String propName = prop.getName(); + Object propValue = prop.getValue(); + + if (propValue instanceof Map) + + LOG.info("Property: propertyName: " + propName + " propertyValue: " + propValue.toString()); + + // Compare this property name with each config.relevant-attribute-name + List<String> attributeNames = config.getRelevantAttributeNames(); + for (String attributeName : attributeNames) { + if (prop.getName().contains(attributeName)) + addParameter(prop.getName(), prop.getValue().toString(), attributeValueParams); + } + + } + + }*/ + + protected void insertRelevantAttributeData() throws IOException{ + + insertRelevantAttributeData(""); + } + + protected void insertRelevantAttributeData(String type) throws IOException{ + + // type can be passed as "group" or taken from the nodeTemplate + String metadataType = ""; + if (!type.isEmpty()) metadataType = type; + else { + Metadata metadata = entityDetails.getMetadata(); + metadataType = extractValue (metadata, PARAM_TYPE_KEY); + } + + // Clean up all attributes for this resource + try { + cleanUpExistingToscaData("ATTRIBUTE_VALUE_PAIR", "resource_uuid", getUUID(), "resource_type", "\"" + metadataType + "\""); + } catch (IOException e) { + LOG.error("Could not cleanup Tosca CSAR data from the ATTRIBUTE_VALUE_PAIR table"); + throw new IOException (e); + } + + for (String paramName : attributeValueParams.keySet()) { + String paramValue = attributeValueParams.get(paramName); + + Map<String, String> attributeParams = new HashMap<String, String>(); + addParameter("attribute_name", paramName, attributeParams); + addParameter("attribute_value", paramValue, attributeParams); + addParameter("resource_type", metadataType, attributeParams); + addParameter("resource_customization_uuid", getCustomizationUUID(), attributeParams); + + LOG.info("Call insertToscaData for ATTRIBUTE_VALUE_PAIR where resource_uuid = " + getUUID() + " and attribute_name = \"" + paramName + "\""); + try { + insertToscaData(buildSql("ATTRIBUTE_VALUE_PAIR", "resource_uuid", getUUID(), model_yaml, attributeParams), null); + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the ATTRIBUTE_VALUE_PAIR table"); + throw new IOException (e); + } + } + } + + protected void insertEntityGroupData (IEntityDetails entityDetails, IEntityDetails targetNode, String groupType) throws IOException { + + // Get the Groups on a node - Convert to use getEntity in 19.08 + EntityQuery entityQuery = EntityQuery.newBuilder(groupType).build(); + String customizationUuid = getCustomizationUUIDNoQuotes(); + SdcTypes entitySdcType = SdcTypes.valueOf(extractValue(entityDetails.getMetadata(), SdcPropertyNames.PROPERTY_NAME_TYPE)); + TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(entitySdcType) + .customizationUUID(customizationUuid).build(); + List<IEntityDetails> groupList = sdcCsarHelper.getEntity(entityQuery, topologyTemplateQuery, false); + if (groupList == null) { + return; + } + + for (IEntityDetails group : groupList){ + + // Insert into RESOURCE_GROUP/ATTRIBUTE_VALUE_PAIR and RESOURCE_GROUP_TO_TARGET_NODE_MAPPING + // RESOURCE_GROUP (group metadata): resource_uuid (CR node UUID), uuid, customization_uuid, invariant_uuid, name, version + // ATTRIBUTE_VALUE_PAIR (group properties): group_type, group_role, group_function + // RESOURCE_GROUP_TO_TARGET_NODE_MAPPING: group_uuid, parent_uuid (CR node UUID), target_node_uuid, target_type, table_name + + SdncGroupModel groupModel = new SdncGroupModel (sdcCsarHelper, group, entityDetails, config, jdbcDataSource); + String resourceUuid = getUUID(); + groupModel.insertGroupData(resourceUuid); + + // insert RESOURCE_GROUP_TO_TARGET_NODE_MAPPING + try { + Map<String, String> mappingCleanupParams = new HashMap<String, String>(); + addParameter("group_uuid", groupModel.getUUID(), mappingCleanupParams); + addParameter("parent_uuid", extractValue(entityDetails.getMetadata(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingCleanupParams); + addParameter("target_node_uuid", extractValue(targetNode.getMetadata(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingCleanupParams); + cleanupExistingToscaData("RESOURCE_GROUP_TO_TARGET_NODE_MAPPING", mappingCleanupParams); + + Map<String, String> mappingParams = new HashMap<String, String>(); + addParameter("parent_uuid", extractValue(entityDetails.getMetadata(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingParams); + addParameter("target_node_uuid", extractValue(targetNode.getMetadata(), SdcPropertyNames.PROPERTY_NAME_UUID), mappingParams); + String targetType = extractValue(targetNode.getMetadata(), PARAM_TYPE_KEY); + addParameter("target_type", targetType, mappingParams); + String tableName = ""; + switch (targetType) { + case "CVFC": + tableName = "VFC_MODEL"; + break; + case "VL": + tableName = "NETWORK_MODEL"; + break; + } + addParameter("table_name", tableName, mappingParams); + LOG.info("Call insertToscaData for RESOURCE_GROUP_TO_TARGET_NODE_MAPPING where group_uuid = " + groupModel.getUUID()); + insertToscaData(buildSql("RESOURCE_GROUP_TO_TARGET_NODE_MAPPING", "group_uuid", groupModel.getUUID(), model_yaml, mappingParams), null); + + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the RESOURCE_GROUP_TO_TARGET_NODE_MAPPING"); + throw new IOException (e); + } + } + } + + protected void insertEntityPolicyData (String nodeTemplateCustomizationUuid, String nodeTemplateUuid, SdcTypes queryType, String targetCustomizationUuid, String targetUuid, String targetType, String policyType) throws IOException { + + EntityQuery policyEntityQuery = EntityQuery.newBuilder(policyType).build(); + TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(queryType).customizationUUID(nodeTemplateCustomizationUuid).build(); + List<IEntityDetails> policyEntities = sdcCsarHelper.getEntity(policyEntityQuery, topologyTemplateQuery, false); + if (policyEntities == null || policyEntities.isEmpty()) { + LOG.debug("insertPolicyData: Could not find policy data for: " + nodeTemplateCustomizationUuid); + return; + } + + String resourceUuid = getUUID(); + + for (IEntityDetails policyEntity : policyEntities) { + + // extract policy metadata + String policyUuid = extractValue(policyEntity.getMetadata(), SdcPropertyNames.PROPERTY_NAME_UUID); + String policyCustomizationUuid = extractValue(policyEntity.getMetadata(), SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); + + insertResourcePolicyData(policyEntity, resourceUuid); + insertResourcePolicyToTargetNodeMappingData(policyUuid, nodeTemplateUuid, targetUuid, targetCustomizationUuid, policyCustomizationUuid, targetType); + } + } + + public void insertEntityPolicyData (String resourceCustomizationUuid, String resourceUuid, String parentUuid, String policyType, SdcTypes queryType) throws IOException { + + EntityQuery policyEntityQuery = EntityQuery.newBuilder(policyType).build(); + TopologyTemplateQuery topologyTemplateQuery; + if (queryType == SdcTypes.VF) { + topologyTemplateQuery = TopologyTemplateQuery.newBuilder(queryType).customizationUUID(resourceCustomizationUuid).build(); + } else { + topologyTemplateQuery = TopologyTemplateQuery.newBuilder(queryType).build(); + } + + List<IEntityDetails> policyEntities = sdcCsarHelper.getEntity(policyEntityQuery, topologyTemplateQuery, false); + if (policyEntities == null || policyEntities.isEmpty()) { + LOG.debug("insertPolicyData: Could not find policy data for Service/VF: " + resourceUuid); + return; + } + + for (IEntityDetails policyEntity : policyEntities) { + + // extract policy metadata + String policyUuid = extractValue(policyEntity.getMetadata(), SdcPropertyNames.PROPERTY_NAME_UUID); + String policyCustomizationUuid = extractValue(policyEntity.getMetadata(), SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); + + insertResourcePolicyData(policyEntity, resourceUuid); + List<IEntityDetails> targetEntities = policyEntity.getTargetEntities(); + if (targetEntities == null || targetEntities.isEmpty()) { + LOG.debug("insertPolicyData: Could not find targetEntites for policy: " + policyUuid); + continue; + } + + for (IEntityDetails targetEntity : targetEntities) { + + String targetUuid = extractValue(targetEntity.getMetadata(), SdcPropertyNames.PROPERTY_NAME_UUID); + String targetCustomizationUuid = extractValue(targetEntity.getMetadata(), SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); + String targetType = extractValue(targetEntity.getMetadata(), SdcPropertyNames.PROPERTY_NAME_TYPE); + insertResourcePolicyToTargetNodeMappingData(policyUuid, parentUuid, targetUuid, targetCustomizationUuid, policyCustomizationUuid, targetType); + } + } + } + + protected void insertResourcePolicyData (IEntityDetails policyEntity, String resourceUuid) throws IOException { + + // extract policy metadata + String policyUuid = extractValue(policyEntity.getMetadata(), SdcPropertyNames.PROPERTY_NAME_UUID); + String policyInvariantUuid = extractValue(policyEntity.getMetadata(), SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID); + String policyCustomizationUuid = extractValue(policyEntity.getMetadata(), SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); + + // cleanup existing RESOURCE_POLICY data + Map<String, String> cleanupParams = new HashMap<String, String>(); + addParameter("resource_uuid", resourceUuid, cleanupParams); + addParameter("policy_uuid", policyUuid, cleanupParams); + addParameter("policy_invariant_uuid", policyInvariantUuid, cleanupParams); + + // insert into RESOURCE_POLICY + Map<String, String> policyParams = new HashMap<String, String>(); + addParameter("policy_uuid", policyUuid, policyParams); + addParameter("policy_customization_uuid", policyCustomizationUuid, policyParams); + addParameter("policy_invariant_uuid", policyInvariantUuid, policyParams); + addParameter("policy_name", extractValue(policyEntity.getMetadata(), PARAM_NAME_KEY), policyParams); + addParameter(PARAM_VERSION_KEY, extractValue(policyEntity.getMetadata(), PARAM_VERSION_KEY), policyParams); + addParameter("policy_type", policyEntity.getToscaType(), policyParams); + + // extract properties + addParameter("property_type", extractValue(policyEntity, PARAM_TYPE_KEY), policyParams); + addParameter("property_source", extractValue(policyEntity, "source"), policyParams); + addParameter("property_name", extractValue(policyEntity, PARAM_NAME_KEY), policyParams); + + // Insert into RESOURCE_POLICY and RESOURCE_POLICY_TO_TARGET_NODE_MAPPING + // RESOURCE_POLICY: resource_uuid (CR node UUID), uuid, customization_uuid, invariant_uuid, name, version, policy_type, + // property_type, property_source, property_name + + try { + + // insert into RESOURCE_POLICY + cleanupExistingToscaData("RESOURCE_POLICY", cleanupParams); + LOG.info("Call insertToscaData for RESOURCE_POLICY where resource_uuid = " + resourceUuid + " and policy_uuid = " + "\"" + policyUuid + "\"" ); + insertToscaData(buildSql("RESOURCE_POLICY", "resource_uuid", resourceUuid, model_yaml, policyParams), null); + + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the RESOURCE_POLICY table"); + throw new IOException (e); + } + + } + + protected void insertResourcePolicyToTargetNodeMappingData(String policyUuid, String parentUuid, String targetUuid, String targetCustomizationUuid, String policyCustomizationUuid, String targetType) throws IOException { + + // insert RESOURCE_POLICY_TO_TARGET_NODE_MAPPING: policy_uuid, parent_uuid (CR node UUID), target_node_uuid, target_type, table_name + try { + Map<String, String> mappingCleanupParams = new HashMap<String, String>(); + addParameter("policy_uuid", policyUuid, mappingCleanupParams); + addParameter("parent_uuid", parentUuid, mappingCleanupParams); + addParameter("target_node_uuid", targetUuid, mappingCleanupParams); + cleanupExistingToscaData("RESOURCE_POLICY_TO_TARGET_NODE_MAPPING", mappingCleanupParams); + + Map<String, String> mappingParams = new HashMap<String, String>(); + addParameter("parent_uuid", parentUuid, mappingParams); + addParameter("target_node_uuid", targetUuid, mappingParams); + addParameter("target_node_customization_uuid", targetCustomizationUuid, mappingParams); + addParameter("policy_customization_uuid", policyCustomizationUuid, mappingParams); + addParameter("target_type", targetType, mappingParams); + LOG.info("Call insertToscaData for RESOURCE_POLICY_TO_TARGET_NODE_MAPPING where policy_uuid = " + "\"" + policyUuid + "\" and parent_uuid = " + "\"" + parentUuid + "\" and target_node_uuid = " + "\"" + targetUuid + "\""); + insertToscaData(buildSql("RESOURCE_POLICY_TO_TARGET_NODE_MAPPING", "policy_uuid", "\"" + policyUuid + "\"", model_yaml, mappingParams), null); + + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the RESOURCE_POLICY_TO_TARGET_NODE_MAPPING"); + throw new IOException (e); + } + } + + + protected void insertNodeCapabilitiesData (CapabilityAssignments capabilities) throws IOException { + + // Process the capabilities on the node template + + List<CapabilityAssignment> capabilityList = capabilities.getAll(); + + for (CapabilityAssignment capability : capabilities.getAll()) { + + // Insert into NODE_CAPABILITY: + // capability_id (generated) + // capability_provider_uuid - UUID of this node + // capability_provider_customization_uuid - customization UUID of this node + // capability_name - capability.getName() + // capability_type - ? + + // Check capability name against relevant capabilities + boolean capabilityIsRelevant = false; + /*List<String> relevantCapabilities = config.getRelevantCapabilityNames(); + for (String relevantCapabilityName : relevantCapabilities ) { + + if (capability.getName().toLowerCase().contains(relevantCapabilityName.toLowerCase())) { + capabilityIsRelevant = true; + } + }*/ + + if (capabilityIsRelevant == false){ + continue; + } + + String capabilityProviderUuid = getUUID(); + + Map<String, String> cleanupParams = new HashMap<String, String>(); + addParameter("capability_provider_uuid", capabilityProviderUuid, cleanupParams); // node customization UUID + addParameter("capability_provider_customization_uuid", getCustomizationUUIDNoQuotes(), cleanupParams); // node customization UUID + addParameter("capability_name", capability.getName(), cleanupParams); + + Map<String, String> nodeCapabilityParams = new HashMap<String, String>(); + addParameter("capability_provider_customization_uuid", getCustomizationUUIDNoQuotes(), nodeCapabilityParams); // node customization UUID + addParameter("capability_name", capability.getName(), nodeCapabilityParams); + addParameter("capability_type", extractValue(capability, PARAM_TYPE_KEY), nodeCapabilityParams); + + // Insert NODE_CAPABILITY data for each capability + String capabilityId = ""; + try { + + cleanupExistingToscaData("NODE_CAPABILITY", cleanupParams); // will also delete NODE_CAPABILITY_PROPERTY with same capability_id + LOG.info("Call insertToscaData for NODE_CAPABILITY where capability_provider_uuid = " + capabilityProviderUuid + " and capability_name = \"" + capability.getName() + "\""); + insertToscaData(buildSql("NODE_CAPABILITY", "capability_provider_uuid", capabilityProviderUuid, model_yaml, nodeCapabilityParams), null); + + // Get capabilityId for capability just inserted + CachedRowSet rowData = getToscaData("NODE_CAPABILITY", nodeCapabilityParams); + rowData.first(); + int capabilityIdint = rowData.getInt("capability_id"); + capabilityId = String.valueOf(capabilityIdint); + + } catch (IOException | SQLException e) { + LOG.error("Could not insert Tosca CSAR data into the NODE_CAPABILITY table"); + throw new IOException (e); + } + + insertNodeCapabilityPropertyData (capability, capabilityId); + } + } + + protected void insertNodeCapabilitiesEntityData (List<CapabilityAssignment> capabilities) throws IOException { + + // Process the capabilities + for (CapabilityAssignment capability : capabilities) { + + // Insert into NODE_CAPABILITY: + // capability_id (generated) + // capability_provider_uuid - UUID of this node + // capability_provider_customization_uuid - customization UUID of this node + // capability_name - capability.getName() + // capability_type - ? + + // Check capability name against relevant capabilities + boolean capabilityIsRelevant = false; + /*List<String> relevantCapabilities = config.getRelevantCapabilityNames(); + for (String relevantCapabilityName : relevantCapabilities ) { + + if (capability.getName().toLowerCase().contains(relevantCapabilityName.toLowerCase())) { + capabilityIsRelevant = true; + } + }*/ + + if (capabilityIsRelevant == false){ + continue; + } + + String capabilityProviderUuid = getUUID(); + + Map<String, String> cleanupParams = new HashMap<String, String>(); + addParameter("capability_provider_uuid", capabilityProviderUuid, cleanupParams); // node customization UUID + addParameter("capability_provider_customization_uuid", getCustomizationUUIDNoQuotes(), cleanupParams); // node customization UUID + addParameter("capability_name", capability.getName(), cleanupParams); + + Map<String, String> nodeCapabilityParams = new HashMap<String, String>(); + addParameter("capability_provider_customization_uuid", getCustomizationUUIDNoQuotes(), nodeCapabilityParams); // node customization UUID + addParameter("capability_name", capability.getName(), nodeCapabilityParams); + addParameter("capability_type", extractValue(capability, PARAM_TYPE_KEY), nodeCapabilityParams); + + // Insert NODE_CAPABILITY data for each capability + String capabilityId = ""; + try { + + cleanupExistingToscaData("NODE_CAPABILITY", cleanupParams); // will also delete NODE_CAPABILITY_PROPERTY with same capability_id + LOG.info("Call insertToscaData for NODE_CAPABILITY where capability_provider_uuid = " + capabilityProviderUuid + " and capability_name = \"" + capability.getName()+ "\""); + insertToscaData(buildSql("NODE_CAPABILITY", "capability_provider_uuid", capabilityProviderUuid, model_yaml, nodeCapabilityParams), null); + + // Get capabilityId for capability just inserted + CachedRowSet rowData = getToscaData("NODE_CAPABILITY", nodeCapabilityParams); + rowData.first(); + int capabilityIdint = rowData.getInt("capability_id"); + capabilityId = String.valueOf(capabilityIdint); + + } catch (IOException | SQLException e) { + LOG.error("Could not insert Tosca CSAR data into the NODE_CAPABILITY table"); + throw new IOException (e); + } + + insertNodeCapabilityPropertyData (capability, capabilityId); + } + } + + protected void insertNodeCapabilityPropertyData(CapabilityAssignment capability, String capabilityId) throws IOException { + + // Insert property name / value into NODE_CAPABILITY_PROPERTY + LinkedHashMap<String, Property> propertiesMap = capability.getProperties(); + Map<String, String> nodeCapabilityPropertyParams = new HashMap<String, String>(); + + for (String propertyMapKey : propertiesMap.keySet() ) { + //LOG.info("property map key = " + propertyMapKey); + Property property = propertiesMap.get(propertyMapKey); + + addParameter ("capability_property_name", property.getName(), nodeCapabilityPropertyParams); + addParameter ("capability_property_type", property.getValue().toString(), nodeCapabilityPropertyParams); + + try { + // Data from NODE_CAPABILITY_PROPERTY is cleaned up via cascade delete on NODE_CAPABILITY + LOG.info("Call insertToscaData for NODE_CAPABILITY_PROPERTY where capability_id = \"" + capabilityId + "\" and capability_property_name = \"" + property.getName() + "\" and capability_property_type = \"" + property.getValue().toString() + "\""); + insertToscaData(buildSql("NODE_CAPABILITY_PROPERTY", "capability_id", capabilityId, model_yaml, nodeCapabilityPropertyParams), null); + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the NODE_CAPABILITY_PROPERTY table"); + throw new IOException (e); + } + } + + } + + protected void addParameter (String name, String value) { + if (value != null && !value.isEmpty()) { + // check if value already contain quotes + if (value.startsWith("\"", 0) && value.endsWith("\"")) { + params.put(name, value); + } else { + params.put(name, "\"" + value + "\""); + } + } + } + + protected void addIntParameter (String name, String value) { + if (value != null && !value.isEmpty()) { + params.put(name, value); + } + } + + public static void addParameter (String name, String value, Map<String, String> params) { + if (value != null && !value.isEmpty()) { + // remove any quotes within the string + String strippedValue = value.replace("\"",""); + + // check if value already contain quotes + if (strippedValue.startsWith("\"", 0) && value.endsWith("\"")) { + params.put(name, strippedValue); + } else { + params.put(name, "\"" + strippedValue + "\""); + } + } + } + + protected String extractValue (Metadata metadata, String name) { + String value = metadata.getValue(name); + if (value != null) { + return value; + } else { + return ""; + } + } + + protected String extractBooleanValue (Metadata metadata, String name) { + String value = metadata.getValue(name); + if (value != null && !value.isEmpty()) { + return value.contains("true") ? "Y" : "N"; + } else { + return ""; + } + } + + public static String extractValue (ISdcCsarHelper sdcCsarHelper, Metadata metadata, String name) { + String value = metadata.getValue(name); + if (value != null) { + return value; + } else { + return ""; + } + } + + protected String extractValue (IEntityDetails entityDetails, String name) { + String value = ""; + if (entityDetails.getProperties().containsKey(name)) { + Property property = entityDetails.getProperties().get(name); + if (property != null && property.getValue() != null) { + value = property.getValue().toString(); + } + } + + if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("null")) { + return value; + } else { + return ""; + } + } + + protected String extractValue (IEntityDetails entityDetails, String path, String name) { + String value = ""; + + if (entityDetails.getProperties().containsKey(path)) { + Property property = entityDetails.getProperties().get(path); + if (property != null && !property.getLeafPropertyValue(name).isEmpty()) { + value = property.getLeafPropertyValue(name).get(0); + } + } + + if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("null")) { + return value; + } else { + return ""; + } + } + + protected String extractValue (IEntityDetails entityDetails, String path1, String path2, String name) { + String value = ""; + + value = extractNestedValue (entityDetails, path1, path2, name); + + if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("null")) { + return value; + } else { + return ""; + } + } + + protected String extractValue (IEntityDetails entityDetails, String path1, String path2, String path3, String name) { + String value = ""; + + value = extractNestedValue (entityDetails, path1, path2, path3, name); + + if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("null")) { + return value; + } else { + return ""; + } + } + + protected String extractBooleanValue (IEntityDetails entityDetails, String path1, String path2, String name) { + String value = ""; + + value = extractNestedValue (entityDetails, path1, path2, name); + + if (value != null && !value.isEmpty()) { + return value.contains("true") ? "Y" : "N"; + } else { + return ""; + } + } + + protected String extractNestedValue (IEntityDetails entityDetails, String path1, String path2, String name) { + String value = ""; + + if (entityDetails.getProperties().containsKey(path1)) { + Property path1Property = entityDetails.getProperties().get(path1); + if (path1Property != null) { + Map<String, Object> path1PropertyValue = (Map<String, Object>) path1Property.getValue(); + if (path1PropertyValue.containsKey(path2)) { + Map<String, Object> path2PropertyValue = (Map<String, Object>) path1PropertyValue.get(path2); + if (path2PropertyValue != null && path2PropertyValue.containsKey(name)) { + value = path2PropertyValue.get(name).toString(); + } + } + } + } + + return value; + } + + protected String extractNestedValue (IEntityDetails entityDetails, String path1, String path2, String path3, String name) { + String value = ""; + + if (entityDetails.getProperties().containsKey(path1)) { + Property path1Property = entityDetails.getProperties().get(path1); + if (path1Property != null) { + Map<String, Object> path1PropertyValue = (Map<String, Object>) path1Property.getValue(); + if (path1PropertyValue.containsKey(path2)) { + Map<String, Object> path2PropertyValue = (Map<String, Object>) path1PropertyValue.get(path2); + if (path2PropertyValue != null && path2PropertyValue.containsKey(path3)) { + Map<String, Object> path3PropertyValue = (Map<String, Object>) path2PropertyValue.get(path3); + if (path3PropertyValue != null && path3PropertyValue.containsKey(name)) { + value = path3PropertyValue.get(name).toString(); + } + } + } + } + } + + return value; + } + + protected String extractIntegerValue (Property property, String name) { + String value = ""; + + if (!property.getLeafPropertyValue(name).isEmpty()) { + value = property.getLeafPropertyValue(name).get(0); + } + + if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("null")) { + return value; + } else { + return ""; + } + } + + protected String extractGetInputValue (IEntityDetails group, IEntityDetails entityDetails, String name) { + + // Extract the property on entityDetails after getting the property name from the group + String getInputName = extractGetInputName (group, name); + String entityPropertyValue = ""; + + if (entityDetails.getProperties().containsKey(getInputName)) { + Property entityProperty = entityDetails.getProperties().get(getInputName); + entityPropertyValue = entityProperty.getValue().toString(); + } + + if (!entityPropertyValue.isEmpty()) { + return entityPropertyValue; + } else { + return ""; + } + } + + protected String extractGetInputName (IEntityDetails group, String name) { + + String getInputName = name; + String groupPropertyValue = ""; + if (group.getProperties().containsKey(name)) { + Property groupProperty = group.getProperties().get(name); + groupPropertyValue = groupProperty.getValue().toString(); + } + if (!groupPropertyValue.isEmpty()) { + int getInputIndex = groupPropertyValue.indexOf("{get_input="); + if (getInputIndex > -1) { + getInputName = groupPropertyValue.substring(getInputIndex+11, groupPropertyValue.length()-1); + } + } + + return getInputName; + + } + + protected String extractValue (CapabilityAssignment capability, String name) { + String value = ""; + + if (capability.getProperties().containsKey(name)) { + Property property = capability.getProperties().get(name); + value = property.getLeafPropertyValue(name).get(0); + } + + if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("null")) { + return value; + } else { + return ""; + } + } + + protected String extractValue (CapabilityAssignment capability, String path, String name) { + String value = ""; + + if (capability.getProperties().containsKey(path)) { + Property property = capability.getProperties().get(path); + if (property != null && !property.getLeafPropertyValue(name).isEmpty()) { + value = property.getLeafPropertyValue(name).get(0); + } + } + + if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("null")) { + return value; + } else { + return ""; + } + } + + protected String extractBooleanValue (IEntityDetails entityDetails, String name) { + String value = null; + if (entityDetails.getProperties().containsKey(name)) { + Property property = entityDetails.getProperties().get(name); + if (property != null && property.getValue() != null) { + value = property.getValue().toString(); + } + } + + if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("null")) { + return value.contains("true") ? "Y" : "N"; + } else { + return ""; + } + } + + protected String extractBooleanValue (IEntityDetails entityDetails, String path, String name) { + String value = null; + if (entityDetails.getProperties().containsKey(path)) { + Property property = entityDetails.getProperties().get(path); + if (property != null) { + if (property != null && !property.getLeafPropertyValue(name).isEmpty()) { + value = property.getLeafPropertyValue(name).get(0); + } + } + } + + if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("null")) { + return value.contains("true") ? "Y" : "N"; + } else { + return ""; + } + } + + protected Object extractObjectValue (IEntityDetails entityDetails, String name) { + Object value = ""; + if (entityDetails.getProperties().containsKey(name)) { + Property property = entityDetails.getProperties().get(name); + if (property != null && property.getValue() != null) { + value = property.getValue(); + } + } + + if (value != null) { + return value; + } else { + return ""; + } + } + + public static String extractSubstitutionMappingTypeName (ISdcCsarHelper sdcCsarHelper) { + String value = sdcCsarHelper.getServiceSubstitutionMappingsTypeName(); + if (value != null) { + return value; + } else { + return ""; + } + } + + protected String getUUID() { + return ("\"" + UUID + "\""); + } + public String getInvariantUUID() { + return ("\"" + invariantUUID + "\""); + } + public String getCustomizationUUID() { + return ("\"" + customizationUUID + "\""); + } + public String getCustomizationUUIDNoQuotes() { + return (customizationUUID); + } + public void setCustomizationUUID(String customizationUUID) { + this.customizationUUID = customizationUUID; + } + public String getName() { + return name; + } + + public String buildSql(String tableName, String model_yaml) { + + StringBuilder sb = new StringBuilder(); + sb.append("INSERT into " + tableName + " (customization_uuid, model_yaml, "); + + int paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + sb.append(paramKey); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(") values (" + getCustomizationUUID() + ", \"" + model_yaml + "\", "); + + paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + String paramValue = params.get(paramKey); + sb.append(paramValue); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(");"); + return sb.toString(); + } + + public String buildSql(String tableName, String keyName, String keyValue, String model_yaml, Map<String, String> params) { + + StringBuilder sb = new StringBuilder(); + sb.append("INSERT into " + tableName + " (" + keyName + ", "); + + int paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + sb.append(paramKey); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(") values (" + keyValue + ", "); + + paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + String paramValue = params.get(paramKey); + sb.append(paramValue); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(");"); + return sb.toString(); + } + + public static String getSql(String tableName, String keyName, String keyValue, String model_yaml, Map<String, String> params) { + + StringBuilder sb = new StringBuilder(); + sb.append("INSERT into " + tableName + " (" + keyName + ", "); + + int paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + sb.append(paramKey); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(") values (" + keyValue + ", "); + + paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + String paramValue = params.get(paramKey); + sb.append(paramValue); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(");"); + return sb.toString(); + } + + protected void insertToscaData(String toscaDataString, ArrayList<String> arguments) throws IOException + { + LOG.debug("insertToscaData: " + toscaDataString); + + try { + + jdbcDataSource.writeData(toscaDataString, arguments, null); + + } catch (SQLException e) { + LOG.error("Could not insert Tosca data into the database"); + throw new IOException (e); + } + + } + + protected void cleanUpExistingToscaData(String tableName, String keyName, String keyValue) throws IOException + { + + try { + int rowCount = 0; + CachedRowSet data = jdbcDataSource.getData("SELECT * from " + tableName + " where " + keyName + " = " + keyValue + ";", null, ""); + if (data != null) { + while(data.next()) { + rowCount ++; + } + if (rowCount != 0) { + LOG.debug("cleanUpExistingToscaData from: " + tableName + " for " + keyValue); + jdbcDataSource.writeData("DELETE from " + tableName + " where " + keyName + " = " + keyValue + ";", null, null); + } + } + + } catch (SQLException e) { + LOG.error("Could not clean up existing " + tableName + " for " + keyValue, e); + } + + } + + protected void cleanUpExistingToscaData(String tableName, String key1Name, String key1Value, String key2Name, String key2Value) throws IOException + { + + try { + int rowCount = 0; + CachedRowSet data = jdbcDataSource.getData("SELECT * from " + tableName + " where " + key1Name + " = " + key1Value + " AND " + key2Name + " = " + key2Value + ";", null, ""); + if (data != null) { + while(data.next()) { + rowCount ++; + } + if (rowCount != 0) { + LOG.debug("cleanUpExistingToscaData from : " + tableName + " for " + key1Value + " and " + key2Value); + jdbcDataSource.writeData("DELETE from " + tableName + " where " + key1Name + " = " + key1Value + " AND " + key2Name + " = " + key2Value + ";", null, null); + } + } + + } catch (SQLException e) { + LOG.error("Could not clean up existing " + tableName + " for " + key1Value + " and " + key2Value, e); + } + + } + + protected boolean cleanupExistingToscaData(String tableName, Map<String, String> keyParams) throws IOException + { + return SdncBaseModel.cleanupExistingToscaData(SdncBaseModel.jdbcDataSource, tableName, keyParams); + } + + public static boolean cleanupExistingToscaData(DBResourceManager jdbcDataSource, String tableName, Map<String, String> keyParams) throws IOException + { + boolean dataExists = false; + StringBuilder sb = new StringBuilder(); + sb.append("SELECT * from " + tableName + " where "); + + int paramCount = 0; + for (String paramKey : keyParams.keySet()) { + paramCount++; + String paramValue = keyParams.get(paramKey); + sb.append(paramKey); + sb.append(" = "); + sb.append(paramValue); + if (paramCount < keyParams.size()) sb.append(" AND "); + } + + sb.append(";"); + + try { + int rowCount = 0; + CachedRowSet data = jdbcDataSource.getData(sb.toString(), null, ""); + while(data.next()) { + rowCount ++; + data.deleteRow(); + } + if (rowCount != 0) { + LOG.debug("cleanupExistingToscaData in " + tableName + ": Data FOUND"); + String deleteStmt = sb.replace(sb.indexOf("SELECT *"), sb.indexOf("SELECT")+8, "DELETE").toString(); + jdbcDataSource.writeData(deleteStmt, null, null); + dataExists = true; + } + + } catch (SQLException e) { + LOG.error("Could not get data in " + tableName, e); + } + + return dataExists; + } + + protected boolean checkForExistingToscaData(String tableName, Map<String, String> keyParams) throws IOException + { + boolean dataExists = false; + StringBuilder sb = new StringBuilder(); + sb.append("SELECT * from " + tableName + " where "); + + int paramCount = 0; + for (String paramKey : keyParams.keySet()) { + paramCount++; + String paramValue = keyParams.get(paramKey); + sb.append(paramKey); + sb.append(" = "); + sb.append(paramValue); + if (paramCount < keyParams.size()) sb.append(" AND "); + } + + sb.append(";"); + + try { + int rowCount = 0; + CachedRowSet data = jdbcDataSource.getData(sb.toString(), null, ""); + while(data.next()) { + rowCount ++; + } + if (rowCount != 0) { + LOG.debug("checkForExistingToscaData in " + tableName + ": Data FOUND"); + dataExists = true; + } + + } catch (SQLException e) { + LOG.error("Could not get data in " + tableName, e); + } + + return dataExists; + } + + protected CachedRowSet getToscaData(String tableName, Map<String, String> keyParams) throws IOException + { + StringBuilder sb = new StringBuilder(); + sb.append("SELECT * from " + tableName + " where "); + + int paramCount = 0; + for (String paramKey : keyParams.keySet()) { + paramCount++; + String paramValue = keyParams.get(paramKey); + sb.append(paramKey); + sb.append(" = "); + sb.append(paramValue); + if (paramCount < keyParams.size()) sb.append(" AND "); + } + + sb.append(";"); + + CachedRowSet data = null; + try { + int rowCount = 0; + data = jdbcDataSource.getData(sb.toString(), null, ""); + while(data.next()) { + rowCount ++; + } + if (rowCount == 0) { + LOG.info("getToscaData in " + tableName + ": Data NOT found"); + } + + } catch (SQLException e) { + LOG.error("Could not get data in " + tableName, e); + } + + return data; + } + + protected void addParamsToMap (Map<String, String> fromMap, Map<String, String> toMap) { + for (String key : fromMap.keySet()) { + if (!toMap.containsKey(key)) { + toMap.put(key, fromMap.get(key)); + } + } + } + + protected String nullCheck (Object extractedObject) { + String stringValue = ""; + if (extractedObject != null) { + return extractedObject.toString(); + } + return stringValue; + } + +} diff --git a/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModel.java b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModel.java new file mode 100644 index 000000000..622936652 --- /dev/null +++ b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModel.java @@ -0,0 +1,84 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.uebclient; + +import java.io.IOException; + +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncGroupModel extends SdncBaseModel { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncGroupModel.class); + + private static final String groupType = "group_type"; + + public SdncGroupModel(ISdcCsarHelper sdcCsarHelper, IEntityDetails group, IEntityDetails entityDetails, SdncUebConfiguration config, DBResourceManager jdbcDataSource) throws IOException { + + super(sdcCsarHelper, group); + + // Metadata for Resource group is not extracted in base class due to inconsistency in TOSCA model Group object + Metadata metadata = group.getMetadata(); + params.remove("invariant_uuid"); // remove invariant_uuid which is added by base class, it does not apply for groups + invariantUUID = extractValue (metadata, "invariantUUID"); + addParameter("group_invariant_uuid", invariantUUID); + params.remove("uuid"); // remove uuid which is added by base class, it does not apply for groups + UUID = extractValue (metadata, "UUID"); + addParameter("group_uuid", UUID); + addParameter("group_name", extractValue (metadata, "name")); + addParameter(groupType, group.getToscaType()); + addParameter("version", extractValue (metadata, "version")); + + // extract properties + addParameter("vfc_parent_port_role", extractValue(group, "vfc_parent_port_role"), attributeValueParams); + addParameter("subinterface_role", extractValue(group, "subinterface_role"), attributeValueParams); + + // relevant complex group properties are extracted and inserted into ATTRIBUTE_VALUE_PAIR + addParameter(extractGetInputName (group, groupType), extractGetInputValue(group, entityDetails, groupType), attributeValueParams); + addParameter(extractGetInputName (group, "group_role"), extractGetInputValue(group, entityDetails, "group_role"), attributeValueParams); + addParameter(extractGetInputName (group, "group_function"), extractGetInputValue(group, entityDetails, "group_function"), attributeValueParams); + } + + public void insertGroupData(String resourceUuid) throws IOException { + + try { + + // insert into RESOURCE_GROUP/ATTRIBUTE_VALUE_PAIR + cleanUpExistingToscaData("RESOURCE_GROUP", "resource_uuid", resourceUuid, "group_uuid", getUUID()) ; + LOG.info("Call insertToscaData for RESOURCE_GROUP where group_uuid = " + getUUID() + " and resource_uuid = " + resourceUuid); + insertToscaData(buildSql("RESOURCE_GROUP", "resource_uuid", resourceUuid, model_yaml, params), null); + insertRelevantAttributeData("group"); + + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the RESOURCE_GROUP table"); + throw new IOException (e); + } + + } + +} diff --git a/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModel.java b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModel.java new file mode 100644 index 000000000..8e790d9be --- /dev/null +++ b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModel.java @@ -0,0 +1,220 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.uebclient; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; +import org.onap.sdc.toscaparser.api.Property; +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncNodeModel extends SdncBaseModel { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncNodeModel.class); + + private String serviceUUID = null; + private String ecompGeneratedNaming = null; + private String [] bindingUuids = null; + + // Using ASDC TOSCA Parser 17.07 + public SdncNodeModel(ISdcCsarHelper sdcCsarHelper, IEntityDetails nodeEntity, DBResourceManager jdbcDataSource, SdncUebConfiguration config) throws IOException { + + super(sdcCsarHelper, nodeEntity, jdbcDataSource, config); + + // extract properties + addParameter("ecomp_generated_naming", extractBooleanValue (nodeEntity, "exVL_naming", "ecomp_generated_naming")); // should be extractBooleanValue? + addParameter("naming_policy", extractValue (nodeEntity, "exVL_naming", "naming_policy")); + + addParameter("network_type", extractValue (nodeEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE)); + addParameter("network_role", extractValue (nodeEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE)); + addParameter("network_scope", extractValue (nodeEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE)); + addParameter("network_technology", extractValue (nodeEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY)); + + // extract properties - network_assignments + addParameter("is_shared_network", extractBooleanValue (nodeEntity, "network_assignments", "is_shared_network")); + addParameter("is_external_network", extractBooleanValue (nodeEntity, "network_assignments", "is_external_network")); + String trunkNetworkIndicator = extractBooleanValue(nodeEntity, "network_assignments", "is_trunked"); + addParameter("trunk_network_indicator", trunkNetworkIndicator); + + // extract properties - network_assignments - ipv4_subnet_default_assignment + String useIpv4 = extractBooleanValue(nodeEntity, "network_assignments", "ipv4_subnet_default_assignment", "use_ipv4"); + addParameter("use_ipv4", useIpv4); + addParameter("ipv4_dhcp_enabled", extractBooleanValue(nodeEntity, "network_assignments", "ipv4_subnet_default_assignment", "dhcp_enabled")); + addParameter("ipv4_ip_version", extractValue(nodeEntity, "network_assignments", "ipv4_subnet_default_assignment", "ip_version")); + addParameter("ipv4_cidr_mask", extractValue(nodeEntity, "network_assignments", "ipv4_subnet_default_assignment", "cidr_mask")); + addParameter("eipam_v4_address_plan", extractValue(nodeEntity, "network_assignments", "ipv4_subnet_default_assignment", "ip_network_address_plan")); + + // extract properties - network_assignments - ipv6_subnet_default_assignment + String useIpv6 = extractBooleanValue(nodeEntity, "network_assignments", "ipv6_subnet_default_assignment", "use_ipv6"); + addParameter("use_ipv6", useIpv6); + addParameter("ipv6_dhcp_enabled", extractBooleanValue(nodeEntity, "network_assignments", "ipv6_subnet_default_assignment", "dhcp_enabled")); + addParameter("ipv6_ip_version", extractValue(nodeEntity, "network_assignments", "ipv6_subnet_default_assignment", "ip_version")); + addParameter("ipv6_cidr_mask", extractValue(nodeEntity, "network_assignments", "ipv6_subnet_default_assignment", "cidr_mask")); + addParameter("eipam_v6_address_plan", extractValue(nodeEntity, "network_assignments", "ipv6_subnet_default_assignment", "ip_network_address_plan")); + + // extract properties - provider_network + addParameter("is_provider_network", extractBooleanValue (nodeEntity, "provider_network", "is_provider_network")); + addParameter("physical_network_name", extractValue(nodeEntity, "provider_network", "physical_network_name")); + + // extract properties - network_flows + addParameter("is_bound_to_vpn", extractBooleanValue (nodeEntity, "network_flows", "is_bound_to_vpn")); + + // extract properties - network_flows - vpn_bindings + String vpnBindingString = extractValue (nodeEntity, "network_flows", "vpn_binding"); + bindingUuids = vpnBindingString.split(","); + + } + + public String getServiceUUID() { + return serviceUUID; + } + public void setServiceUUID(String serviceUUID) { + this.serviceUUID = serviceUUID; + } + + public String getEcompGeneratedNaming() { + return ecompGeneratedNaming; + } + public void setEcompGeneratedNaming(String ecompGeneratedNaming) { + this.ecompGeneratedNaming = ecompGeneratedNaming; + if (ecompGeneratedNaming != null && !ecompGeneratedNaming.isEmpty()) { + params.put("ecomp_generated_naming", "\"" + ecompGeneratedNaming + "\""); + } + } + public void setComplexResourceUUID(String complexResourceUuid) { + if (complexResourceUuid != null && !complexResourceUuid.isEmpty()) { + params.put("complex_resource_uuid", complexResourceUuid); + } + } + + public void setComplexResourceCustomizationUUID(String complexResourceCustomizationUuid) { + if (complexResourceCustomizationUuid != null && !complexResourceCustomizationUuid.isEmpty()) { + params.put("complex_resource_customization_uuid", complexResourceCustomizationUuid); + } + } + + public void insertNetworkModelData () throws IOException { + try { + // Clean up NETWORK_MODEL data for this customization_uuid and service_uuid? + cleanUpExistingToscaData("NETWORK_MODEL", "customization_uuid", getCustomizationUUID()); + cleanUpExistingToscaData("VPN_BINDINGS", "network_customization_uuid", getCustomizationUUID()); + LOG.info("Call insertToscaData for NETWORK_MODEL where customization_uuid = " + getCustomizationUUID()); + insertToscaData(getSql(model_yaml), null); + insertToscaData(getVpnBindingsSql(), null); + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the NETWORK_MODEL table"); + throw new IOException (e); + } + } + + public void insertRelatedNetworkRoleData () throws IOException { + + if (entityDetails.getProperties().containsKey("network_assignments")) { + + Map<String, Object> networkAssignmentsPropertyValue = (Map<String, Object>) entityDetails.getProperties().get("network_assignments").getValue(); + + if (networkAssignmentsPropertyValue != null && networkAssignmentsPropertyValue.containsKey("related_networks")) { + + ArrayList<Map<String, String>> relatedNetworkList = (ArrayList) networkAssignmentsPropertyValue.get("related_networks"); + String networkModelCustomizationUUID = getCustomizationUUID(); + + try { + cleanUpExistingToscaData("RELATED_NETWORK_ROLE", "network_model_customization_uuid", networkModelCustomizationUUID); + } catch (IOException e) { + LOG.error("Could not clean up Tosca CSAR data in the RELATED_NETWORK_ROLE table"); + throw new IOException (e); + } + + for (Map<String, String> relatedNetworkValue : relatedNetworkList) { + String relatedNetworkRoleValue = relatedNetworkValue.get("related_network_role"); + LOG.debug("Node Template [" + entityDetails.getName() + "], property [" + "related_network_role" + "] property value: " + relatedNetworkRoleValue); + + try { + // Table cleanup RELATED_NETWORK_ROLE occurs per network + // If related_network_role for this service already exist in RELATED_NETWORK_ROLE, don't attempt insertion + Map<String, String> relatedNetworkRoleParamsCheck = new HashMap<String, String>(); + addParameter("related_network_role", relatedNetworkRoleValue, relatedNetworkRoleParamsCheck); + addParameter("network_model_customization_uuid", networkModelCustomizationUUID, relatedNetworkRoleParamsCheck); + if (checkForExistingToscaData("RELATED_NETWORK_ROLE", relatedNetworkRoleParamsCheck) == false) { + relatedNetworkRoleParamsCheck.remove("related_network_role"); + LOG.info("Call insertToscaData for RELATED_NETWORK_ROLE where network_model_customization_uuid = " + networkModelCustomizationUUID); + insertToscaData(buildSql("RELATED_NETWORK_ROLE", "related_network_role", "\"" + relatedNetworkRoleValue + "\"", model_yaml, relatedNetworkRoleParamsCheck), null); + } + } catch (IOException e) { + LOG.debug("Could not insert Tosca CSAR data into the RELATED_NETWORK_ROLE table"); + throw new IOException (e); + } + } + } + else { + LOG.debug("Node Template [" + entityDetails.getName() + "], property [" + "related_networks" + "] property value: " + null); + } + } + + } + + public String getSql(String model_yaml) { + + StringBuilder sb = new StringBuilder(); + sb.append("INSERT into NETWORK_MODEL (service_uuid, customization_uuid, model_yaml, "); + + int paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + sb.append(paramKey); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(") values (" + serviceUUID + ", " + getCustomizationUUID() + ", \"" + model_yaml + "\", "); + + paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + String paramValue = params.get(paramKey); + sb.append(paramValue); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(");"); + return sb.toString(); + } + + public String getVpnBindingsSql() { + + StringBuilder sb = new StringBuilder(); + for (int i=0; i < bindingUuids.length; i++) { + sb.append("INSERT into VPN_BINDINGS (network_customization_uuid, binding_uuid) values (" + getCustomizationUUID() + ", \"" + bindingUuids[i] + "\"); "); + } + + return sb.toString(); + } + +} diff --git a/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncOdlConnection.java b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncOdlConnection.java new file mode 100644 index 000000000..78d9c5bc9 --- /dev/null +++ b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncOdlConnection.java @@ -0,0 +1,158 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.uebclient; + +import java.io.BufferedReader; +import java.io.DataOutputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.Authenticator; +import java.net.HttpURLConnection; +import java.net.PasswordAuthentication; +import java.net.URL; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLSession; + +import org.apache.commons.codec.binary.Base64; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + +public class SdncOdlConnection { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncOdlConnection.class); + + private HttpURLConnection httpConn = null; + + private String url = null; + private String user = null; + private String password = null; + + private class SdncAuthenticator extends Authenticator { + + private String user; + private String passwd; + + SdncAuthenticator(String user, String passwd) { + this.user = user; + this.passwd = passwd; + } + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(user, passwd.toCharArray()); + } + + } + + private SdncOdlConnection() { + + } + + private SdncOdlConnection(String url, String user, String password) { + this.url = url; + this.user = user; + this.password = password; + + try { + URL sdncUrl = new URL(url); + Authenticator.setDefault(new SdncAuthenticator(user, password)); + + this.httpConn = (HttpURLConnection) sdncUrl.openConnection(); + } catch (Exception e) { + LOG.error("Unable to create http connection", e); + } + } + + public static SdncOdlConnection newInstance(String url, String user, String password) throws IOException + { + return new SdncOdlConnection(url, user, password); + } + + + + public String send(String method, String contentType, String msg) throws IOException { + + LOG.info("Sending REST " + method + " to " + url); + LOG.info("Message body:\n" + msg); + String authStr = user + ":" + password; + String encodedAuthStr = new String(Base64.encodeBase64(authStr.getBytes())); + + httpConn.addRequestProperty("Authentication", "Basic " + encodedAuthStr); + + httpConn.setRequestMethod(method); + httpConn.setRequestProperty("Content-Type", contentType); + httpConn.setRequestProperty("Accept", contentType); + + httpConn.setDoInput(true); + httpConn.setDoOutput(true); + httpConn.setUseCaches(false); + + if (httpConn instanceof HttpsURLConnection) { + HostnameVerifier hostnameVerifier = new HostnameVerifier() { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + }; + ((HttpsURLConnection) httpConn).setHostnameVerifier(hostnameVerifier); + } + + // Write message + httpConn.setRequestProperty("Content-Length", "" + msg.length()); + DataOutputStream outStr = new DataOutputStream(httpConn.getOutputStream()); + outStr.write(msg.getBytes()); + outStr.close(); + + // Read response + BufferedReader respRdr; + + LOG.info("Response: " + httpConn.getResponseCode() + " " + httpConn.getResponseMessage()); + + if (httpConn.getResponseCode() < 300) { + + respRdr = new BufferedReader(new InputStreamReader(httpConn.getInputStream())); + } else { + respRdr = new BufferedReader(new InputStreamReader(httpConn.getErrorStream())); + } + + StringBuilder respBuff = new StringBuilder(); + + String respLn; + + while ((respLn = respRdr.readLine()) != null) { + respBuff.append(respLn + "\n"); + } + respRdr.close(); + + String respString = respBuff.toString(); + + LOG.info("Response body :\n" + respString); + + return respString; + + } + + +} diff --git a/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncPNFModel.java b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncPNFModel.java new file mode 100644 index 000000000..296b13819 --- /dev/null +++ b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncPNFModel.java @@ -0,0 +1,142 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.uebclient; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncPNFModel extends SdncBaseModel { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncVFModel.class); + + private String vendor = null; + private String vendorModelDescription = null; + private String nfNamingCode = null; + private String serviceUUID = null; + private String serviceInvariantUUID = null; + + public SdncPNFModel(ISdcCsarHelper sdcCsarHelper, IEntityDetails entityDetails, DBResourceManager jdbcDataSource, SdncUebConfiguration config) throws IOException { + + super(sdcCsarHelper, entityDetails, jdbcDataSource, config); + + // extract metadata + Metadata metadata = entityDetails.getMetadata(); + addParameter("name", extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_NAME)); + vendor = extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_RESOURCEVENDOR); + addParameter("vendor", vendor); + vendorModelDescription = extractValue (metadata, "description"); + addParameter("vendor_version", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_RESOURCEVENDORRELEASE)); + + // extract properties + addParameter("ecomp_generated_naming", extractBooleanValue(entityDetails, "nf_naming#ecomp_generated_naming")); + addParameter("naming_policy", extractValue(entityDetails, "nf_naming#naming_policy")); + addParameter("nf_type", extractValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFTYPE)); + addParameter("nf_role", extractValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFROLE)); + nfNamingCode = extractValue(entityDetails, "nf_naming_code"); + addParameter("nf_code", nfNamingCode); + addParameter("nf_function", extractValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); + addIntParameter("avail_zone_max_count", extractValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONEMAXCOUNT)); + addParameter("sdnc_model_name", extractValue(entityDetails, "sdnc_model_name")); + addParameter("sdnc_model_version", extractValue(entityDetails, "sdnc_model_version")); + addParameter("sdnc_artifact_name", extractValue(entityDetails, "sdnc_artifact_name")); + + } + + public void insertData() throws IOException { + + insertPNFModelData(); + } + + private void insertPNFModelData () throws IOException { + + try { + cleanUpExistingToscaData("VF_MODEL", "customization_uuid", getCustomizationUUID()) ; + cleanUpExistingToscaData("SERVICE_MODEL_TO_VF_MODEL_MAPPING", "service_uuid", serviceUUID, "vf_customization_uuid", getCustomizationUUID()); + + // insert into VF_MODEL/ATTRIBUTE_VALUE_PAIR and SERVICE_MODEL_TO_VF_MODEL_MAPPING + LOG.info("Call insertToscaData for VF_MODEL where customization_uuid = " + getCustomizationUUID()); + insertToscaData(buildSql("VF_MODEL", model_yaml), null); + //insertRelevantAttributeData(); + + Map<String, String> mappingParams = new HashMap<String, String>(); + addParameter("service_invariant_uuid", serviceInvariantUUID, mappingParams); + addParameter("vf_uuid", getUUID(), mappingParams); + addParameter("vf_customization_uuid", getCustomizationUUIDNoQuotes(), mappingParams); + insertToscaData(buildSql("SERVICE_MODEL_TO_VF_MODEL_MAPPING", "service_uuid", serviceUUID, model_yaml, mappingParams), null); + + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the VF_MODEL table"); + throw new IOException (e); + } + + } + + public String getVendor() { + return vendor; + } + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + public String getVendorModelDescription() { + return vendorModelDescription; + } + + public void setVendorModelDescription(String vendorModelDescription) { + this.vendorModelDescription = vendorModelDescription; + } + + public String getNfNamingCode() { + return nfNamingCode; + } + + public void setNfNamingCode(String nfNamingCode) { + this.nfNamingCode = nfNamingCode; + } + + public String getServiceUUID() { + return serviceUUID; + } + public void setServiceUUID(String serviceUUID) { + this.serviceUUID = serviceUUID; + } + + public String getServiceInvariantUUID() { + return serviceInvariantUUID; + } + + public void setServiceInvariantUUID(String serviceInvariantUUID) { + this.serviceInvariantUUID = serviceInvariantUUID; + } + +} diff --git a/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncServiceModel.java b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncServiceModel.java new file mode 100644 index 000000000..52e38624a --- /dev/null +++ b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncServiceModel.java @@ -0,0 +1,125 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.uebclient; + +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncServiceModel extends SdncBaseModel { + + private String UUID = null; + private String resourceVendor = null; + private String resourceVendorRelease = null; + private String serviceInstanceNamePrefix = null; + private String filename = null; + + public SdncServiceModel(ISdcCsarHelper sdcCsarHelper, Metadata metadata, DBResourceManager jdbcDataSource) { + + super(sdcCsarHelper, metadata, jdbcDataSource); + + UUID = extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_UUID); + + // extract ecompGeneratedNaming and namingPolicy from Service Metadata + addParameter("ecomp_naming",extractBooleanValue(metadata, "ecompGeneratedNaming")); + addParameter("naming_policy",extractValue(metadata, "namingPolicy")); + + // extract service topology template input data - ecompGeneratedNaming and namingPolicy moved to Service Metadata + //addParameter("ecomp_naming",extractBooleanInputDefaultValue(SdcPropertyNames.PROPERTY_NAME_SERVICENAMING_DEFAULT_ECOMPGENERATEDNAMING)); + //addParameter("naming_policy",extractInputDefaultValue(SdcPropertyNames.PROPERTY_NAME_SERVICENAMING_DEFAULT_NAMINGPOLICY)); + + // extract resourceVendor and resourceVendorRelease for use in SdncServiceProxy class + resourceVendor = extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_RESOURCEVENDOR); + resourceVendorRelease = extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_RESOURCEVENDORRELEASE); + } + + public String getServiceUUID() { + return "\"" + UUID + "\""; + } + public void setServiceUUID(String serviceUUID) { + this.UUID = serviceUUID; + } + public String getServiceInvariantUUID() { + return "\"" + invariantUUID + "\""; + } + public String getServiceInstanceNamePrefix() { + return serviceInstanceNamePrefix; + } + public void setServiceInstanceNamePrefix(String serviceInstanceNamePrefix) { + if (serviceInstanceNamePrefix != null && !serviceInstanceNamePrefix.isEmpty()) { + this.serviceInstanceNamePrefix = serviceInstanceNamePrefix; + params.put("service_instance_name_prefix", "\"" + serviceInstanceNamePrefix + "\""); + } + } + public String getFilename() { + return filename; + } + public void setFilename(String filename) { + this.filename = filename; + } + + public String getSql(String model_yaml) { + + StringBuilder sb = new StringBuilder(); + sb.append("INSERT into SERVICE_MODEL (service_uuid, model_yaml, filename, "); + + int paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + sb.append(paramKey); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(") values (" + getServiceUUID() + ", \"" + model_yaml + "\", \"" + filename + "\", "); + + paramCount = 0; + for (String paramKey : params.keySet()) { + paramCount++; + String paramValue = params.get(paramKey); + sb.append(paramValue); + if (paramCount < params.size()) sb.append(", "); + } + + sb.append(");"); + return sb.toString(); + } + + public String getResourceVendor() { + return resourceVendor; + } + + public void setResourceVendor(String resourceVendor) { + this.resourceVendor = resourceVendor; + } + + public String getResourceVendorRelease() { + return resourceVendorRelease; + } + + public void setResourceVendorRelease(String resourceVendorRelease) { + this.resourceVendorRelease = resourceVendorRelease; + } + +} diff --git a/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java new file mode 100644 index 000000000..8c3a290e0 --- /dev/null +++ b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebCallback.java @@ -0,0 +1,1263 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.uebclient; + +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.net.Authenticator; +import java.net.HttpURLConnection; +import java.net.PasswordAuthentication; +import java.net.URL; +import java.nio.file.DirectoryStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.sql.SQLException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +import javax.sql.rowset.CachedRowSet; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.transform.Source; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; +import javax.xml.xpath.XPath; +import javax.xml.xpath.XPathFactory; +import javax.xml.XMLConstants; + +import org.apache.commons.codec.binary.Base64; +import org.onap.sdc.api.IDistributionClient; +import org.onap.sdc.api.consumer.IComponentDoneStatusMessage; +import org.onap.sdc.api.consumer.IDistributionStatusMessage; +import org.onap.sdc.api.consumer.INotificationCallback; +import org.onap.sdc.api.notification.IArtifactInfo; +import org.onap.sdc.api.notification.INotificationData; +import org.onap.sdc.api.notification.IResourceInstance; +import org.onap.sdc.api.results.IDistributionClientDownloadResult; +import org.onap.sdc.api.results.IDistributionClientResult; +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.tosca.parser.elements.queries.EntityQuery; +import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery; +import org.onap.sdc.tosca.parser.enums.SdcTypes; +import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException; +import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.sdc.utils.ArtifactTypeEnum; +import org.onap.sdc.utils.DistributionActionResultEnum; +import org.onap.sdc.utils.DistributionStatusEnum; +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; +import org.onap.ccsdk.sli.northbound.uebclient.SdncArtifactMap.SdncArtifactType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + + +public class SdncUebCallback implements INotificationCallback { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncUebCallback.class); + + protected static DBResourceManager jdbcDataSource = null; + private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR"; + private static final String COMPONENT_NAME = "SDNC"; + private static final int NUM_PASSES = 2; + + // If any ASDC artifact in a distribution fails to download or deploy send SDC event COMPONENT_DONE_ERROR + // once after the entire distribution is processed. Otherwise, send COMPONENT_DONE_OK. + private static boolean COMPONENT_DOWNLOAD_ERROR = false; + private static boolean COMPONENT_DEPLOY_ERROR = false; + private static boolean CSAR_ARTIFACT_DEPLOY_ERROR = false; + + private class SdncAuthenticator extends Authenticator { + + private final String user; + private final String passwd; + + SdncAuthenticator(String user, String passwd) { + this.user = user; + this.passwd = passwd; + } + @Override + protected PasswordAuthentication getPasswordAuthentication() { + return new PasswordAuthentication(user, passwd.toCharArray()); + } + + } + + private class DeployableArtifact { + SdncArtifactType type; + IArtifactInfo artifactInfo; + String svcName; + String resourceName; + String artifactName; + String artifactVersion; + File file; + + public String getArtifactName() { + return artifactName; + } + + + + public String getArtifactVersion() { + return artifactVersion; + } + + + public SdncArtifactType getType() { + return type; + } + + + + public IArtifactInfo getArtifactInfo() { + return artifactInfo; + } + + + public File getFile() { + return file; + } + + + + + public DeployableArtifact(SdncArtifactType type, String svcName, String resourceName, IArtifactInfo artifactInfo, File file) { + this.type = type; + this.artifactInfo = artifactInfo; + this.svcName = svcName; + this.resourceName = resourceName; + this.artifactName = artifactInfo.getArtifactName(); + this.artifactVersion = artifactInfo.getArtifactVersion(); + this.file = file; + } + + + public DeployableArtifact(SdncArtifactType type, String svcName, String resourceName, String artifactName, String artifactVersion, File file) { + this.type = type; + this.artifactInfo = null; + this.svcName = svcName; + this.resourceName = resourceName; + this.artifactName = artifactName; + this.artifactVersion = artifactVersion; + this.file = file; + } + + + + public String getSvcName() { + return svcName; + } + + + + public String getResourceName() { + return resourceName; + } + + } + + private final IDistributionClient client; + protected final SdncUebConfiguration config; + + private LinkedList<DeployableArtifact> deployList[]; + + + private static void setJdbcDataSource() throws IOException { + + String propPath = null; + String propDir = System.getenv(SDNC_CONFIG_DIR); + if (propDir == null) { + + propDir = "/opt/sdnc/data/properties"; + } + propPath = propDir + "/dblib.properties"; + File propFile = new File(propPath); + + if (!propFile.exists()) { + + throw new FileNotFoundException( + "Missing configuration properties file : " + + propFile); + } + + Properties props = new Properties(); + props.load(new FileInputStream(propFile)); + + setJdbcDataSource(new DBResourceManager(props)); + } + + static void setJdbcDataSource(DBResourceManager dbMgr) { + + jdbcDataSource = dbMgr; + + if(jdbcDataSource.isActive()){ + LOG.warn( "DBLIB: JDBC DataSource has been initialized."); + } else { + LOG.warn( "DBLIB: JDBC DataSource did not initialize successfully."); + } + } + + private static void loadArtifactMap() { + + } + + public SdncUebCallback(IDistributionClient client, SdncUebConfiguration config) { + this.client = client; + this.config = config; + + this.deployList = new LinkedList[NUM_PASSES]; + + for (int i = 0 ; i < NUM_PASSES ; i++) { + this.deployList[i] = new LinkedList<DeployableArtifact>(); + } + } + + @Override + public void activateCallback(INotificationData data) { + + LOG.info("Received notification : ("+data.getDistributionID()+","+data.getServiceName()+","+data.getServiceVersion()+ + ","+data.getServiceDescription() + ")"); + + COMPONENT_DOWNLOAD_ERROR = false; + COMPONENT_DEPLOY_ERROR = false; + CSAR_ARTIFACT_DEPLOY_ERROR = false; + + // TOSCA_TEMPLATE artifact should only be downloaded if TOSCA_CSAR artifact fails due to version non-compliance + IArtifactInfo toscaTemplateArtifact = null; + + String incomingDirName = config.getIncomingDir(); + String archiveDirName = config.getArchiveDir(); + + File incomingDir = new File(incomingDirName); + File archiveDir = new File(archiveDirName); + + LOG.debug("IncomingDirName is {}", incomingDirName); + + if (!incomingDir.exists()) { + incomingDir.mkdirs(); + } + + + if (!archiveDir.exists()) { + archiveDir.mkdirs(); + } + + // Process service level artifacts + List<IArtifactInfo> artifactList = data.getServiceArtifacts(); + + if (artifactList != null) { + + incomingDir = new File(incomingDirName + "/" + escapeFilename(data.getServiceName())); + if (!incomingDir.exists()) { + incomingDir.mkdirs(); + } + + archiveDir = new File(archiveDirName + "/" + escapeFilename(data.getServiceName())); + if (!archiveDir.exists()) { + archiveDir.mkdirs(); + } + for (IArtifactInfo curArtifact : artifactList) + { + + LOG.info("Received artifact " + curArtifact.getArtifactName()); + + // If artifact is TOSCA_TEMPLATE, don't handle it. We will handle if last TOSCA_CSAR ingestion fails. + if (curArtifact.getArtifactType().contains("TOSCA_TEMPLATE") || curArtifact.getArtifactName().contains(".yml")) { + toscaTemplateArtifact = curArtifact; + } else { + + handleArtifact(data, data.getServiceName(), null, null, curArtifact, incomingDir, archiveDir); + } + } + + // After all artifacts have been processed if CSAR_ARTIFACT_DEPLOY_ERROR is true, download and deploy the TOSCA_TEMPLATE artifact + if (CSAR_ARTIFACT_DEPLOY_ERROR == true) { + LOG.info("TOSCA_CSAR artifact deploy error encountered, downloading TOSCA_TEMPLATE artifact: " + toscaTemplateArtifact.getArtifactName()); + handleArtifact(data, data.getServiceName(), null, null, toscaTemplateArtifact, incomingDir, archiveDir); + } + } + + + // Process resource level artifacts + for (IResourceInstance curResource : data.getResources()) { + + LOG.info("Received resource : "+curResource.getResourceName()); + artifactList = curResource.getArtifacts(); + + if (artifactList != null) { + + incomingDir = new File(incomingDirName + "/" + escapeFilename(data.getServiceName()) + "/" + escapeFilename(curResource.getResourceName())); + if (!incomingDir.exists()) { + incomingDir.mkdirs(); + } + + archiveDir = new File(archiveDirName + "/" + escapeFilename(data.getServiceName()) + "/" + escapeFilename(curResource.getResourceName())); + if (!archiveDir.exists()) { + archiveDir.mkdirs(); + } + for (IArtifactInfo curArtifact : artifactList) + { + + LOG.info("Received artifact " + curArtifact.getArtifactName()); + + handleArtifact(data, data.getServiceName(), curResource.getResourceName(), curResource.getResourceType(), curArtifact, incomingDir, archiveDir); + } + } + } + + deployDownloadedFiles(incomingDir, archiveDir, data); + + // Send Component Status: COMPONENT_DONE_ERROR or COMPONENT_DONE_OK + LOG.info("Sending Component Status for Distribution: ("+data.getDistributionID()+","+data.getServiceName()+","+data.getServiceVersion()+ + ","+data.getServiceDescription() + ")"); + IDistributionClientResult result = null; + if (COMPONENT_DOWNLOAD_ERROR == true || COMPONENT_DEPLOY_ERROR == true) { + + String errorReason = (COMPONENT_DEPLOY_ERROR == true ? "SDN-C encountered an error deploying an artifact in this distribution" : ""); + errorReason = (COMPONENT_DOWNLOAD_ERROR == true ? "SDN-C encountered an error downloading an artifact in this distribution" : errorReason); + result = client.sendComponentDoneStatus(buildComponentStatusMessage( + client, data, DistributionStatusEnum.COMPONENT_DONE_ERROR), errorReason); + if (result != null) { + LOG.info("Sending Component Status COMPONENT_DONE_ERROR for Distribution result: " + result.getDistributionMessageResult()); + } + } else { + + result = client.sendComponentDoneStatus(buildComponentStatusMessage( + client, data, DistributionStatusEnum.COMPONENT_DONE_OK)); + if (result != null) { + LOG.info("Sending Component Status COMPONENT_DONE_OK for Distribution result: " + result.getDistributionMessageResult()); + } + } + + } + + + public void deployDownloadedFiles(File incomingDir, File archiveDir, INotificationData data) { + + if (incomingDir == null) { + LOG.debug("incomingDir is null - using {}", config.getIncomingDir()); + incomingDir = new File(config.getIncomingDir()); + + if (!incomingDir.exists()) { + incomingDir.mkdirs(); + } + + } else { + LOG.debug("incomingDir is not null - it is {}", incomingDir.getPath()); + } + + if (archiveDir == null) { + archiveDir = new File(config.getArchiveDir()); + + if (!archiveDir.exists()) { + archiveDir.mkdirs(); + } + } + + String curFileName = ""; + try (DirectoryStream<Path> stream = Files.newDirectoryStream(incomingDir.toPath())) { + for (Path file: stream) { + curFileName = file.toString(); + // Skip TOSCA files (csar and yml) if we are deploying files that were downloaded from ASDC (data is not NULL), + // they have already been deployed. If they are still in the incoming directory there was an error during ingestion. + if (data != null && (curFileName.contains(".csar") || curFileName.contains(".yml"))) { + LOG.info("Skipping deploy of file TOSCA file: "+ curFileName + " it has already been handled"); + continue; + } + + try { + handleSuccessfulDownload(null,null, null, null, file.toFile(), archiveDir); + } catch (Exception x) { + COMPONENT_DEPLOY_ERROR = true; + LOG.error("Exception in handleSuccessfulDownload: Cannot process spool file "+ curFileName, x); + } + + } + } catch (Exception x) { + // IOException can never be thrown by the iteration. + // In this snippet, it can only be thrown by newDirectoryStream. + LOG.warn("Cannot process spool file "+ curFileName, x); + } + + // Deploy scheduled deployments + /*int numPasses = config.getMaxPasses(); + + deployList = new LinkedList[numPasses]; + + for (int i = 0 ; i < numPasses ; i++) { + deployList[i] = new LinkedList<DeployableArtifact>(); + }*/ + for (int pass = 0 ; pass < config.getMaxPasses() ; pass++) { + + if (deployList[pass] != null) { + while (! deployList[pass].isEmpty()) { + DeployableArtifact artifact = deployList[pass].pop(); + + DistributionStatusEnum deployResult = DistributionStatusEnum.DEPLOY_ERROR; + + + try { + + deployResult = deploySpoolFile(artifact); + } catch (Exception e) { + LOG.error("Caught exception trying to deploy file", e); + } + + + IArtifactInfo artifactInfo = artifact.getArtifactInfo(); + + if ((artifactInfo != null) && (data != null)) { + IDistributionClientResult deploymentStatus; + deploymentStatus = client.sendDeploymentStatus(buildStatusMessage( + client, data, artifactInfo, + deployResult)); + if (deployResult == DistributionStatusEnum.DEPLOY_ERROR) { + COMPONENT_DEPLOY_ERROR = true; + } + } + + } + } + } + } + + private void handleArtifact(INotificationData data, String svcName, String resourceName, String resourceType, IArtifactInfo artifact, File incomingDir, File archiveDir) { + + // Download Artifact + IDistributionClientDownloadResult downloadResult = client.download(artifact); + + if (downloadResult == null) { + + handleFailedDownload(data, artifact); + return; + } + + byte[] payloadBytes = downloadResult.getArtifactPayload(); + + if (payloadBytes == null) { + handleFailedDownload(data, artifact); + return; + } + + boolean writeSucceeded = false; + File spoolFile = new File(incomingDir.getAbsolutePath() + "/" + artifact.getArtifactName()); + + // Save zip if TOSCA_CSAR + if (artifact.getArtifactType().contains("TOSCA_CSAR") || artifact.getArtifactName().contains(".csar")) { + + try(FileOutputStream outFile = new FileOutputStream(incomingDir.getAbsolutePath() + "/" + artifact.getArtifactName())) { + outFile.write(payloadBytes, 0, payloadBytes.length); + writeSucceeded = true; + } catch (Exception e) { + LOG.error("Unable to save downloaded zip file to spool directory ("+ incomingDir.getAbsolutePath() +")", e); + } + + } else { + + String payload = new String(payloadBytes); + + try(FileWriter spoolFileWriter = new FileWriter(spoolFile)) { + spoolFileWriter.write(payload); + writeSucceeded = true; + } catch (Exception e) { + LOG.error("Unable to save downloaded file to spool directory ("+ incomingDir.getAbsolutePath() +")", e); + } + } + + + if (writeSucceeded && (downloadResult.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS)) { + handleSuccessfulDownload(data, svcName, resourceName, artifact, spoolFile, archiveDir); + + + } else { + handleFailedDownload(data, artifact); + } + + } + + private void handleFailedDownload(INotificationData data, + IArtifactInfo relevantArtifact) { + // Send Download Status + client.sendDownloadStatus(buildStatusMessage(client, data, relevantArtifact, DistributionStatusEnum.DOWNLOAD_ERROR)); + COMPONENT_DOWNLOAD_ERROR = true; + } + + private void handleSuccessfulDownload(INotificationData data, String svcName, String resourceName, + IArtifactInfo artifact, File spoolFile, File archiveDir) { + + if ((data != null) && (artifact != null)) { + // Send Download Status + IDistributionClientResult sendDownloadStatus = client + .sendDownloadStatus(buildStatusMessage(client, data, artifact, DistributionStatusEnum.DOWNLOAD_OK)); + } + + // If an override file exists, read that instead of the file we just downloaded + ArtifactTypeEnum artifactEnum = ArtifactTypeEnum.YANG_XML; + + String overrideFileName = config.getOverrideFile(); + if ((overrideFileName != null) && (overrideFileName.length() > 0)) { + File overrideFile = new File(overrideFileName); + + if (overrideFile.exists()) { + artifactEnum = ArtifactTypeEnum.YANG_XML; + spoolFile = overrideFile; + } + + } + + // If the artifact is a TOSCA artifact, don't schedule a deployment to SDN-C REST intfc, process it in ueb-listener + if (artifactIsTosca(artifact, spoolFile) == true) + { + handleToscaArtifact (data, svcName, resourceName, artifact, spoolFile, archiveDir); + return; + } + + processSpoolFile (data, svcName, resourceName, artifact, spoolFile, archiveDir); + + } + + protected void processSpoolFile(INotificationData data, String svcName, String resourceName, + IArtifactInfo artifact, File spoolFile, File archiveDir) { + + // Process spool file + Document spoolDoc = null; + File transformedFile = null; + + // Apply XSLTs and get Doc object + try { + if (!spoolFile.isDirectory()) { + transformedFile = applyXslts(spoolFile); + } + } catch (Exception e) { + LOG.error("Caught exception trying to parse XML file", e); + } + + if (transformedFile != null) { + try { + + try { + + DocumentBuilderFactory dbf = DocumentBuilderFactory + .newInstance(); + dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + dbf.setFeature("http://xml.org/sax/features/external-general-entities", false); + dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + DocumentBuilder db = dbf.newDocumentBuilder(); + + spoolDoc = db.parse(transformedFile); + } catch (Exception e) { + LOG.error( + "Caught exception trying to parse transformed XML file " + + transformedFile.getAbsolutePath(), e); + } + + } catch (Exception e) { + LOG.error("Caught exception trying to deploy file", e); + } + } + + ArtifactTypeEnum artifactEnum = ArtifactTypeEnum.YANG_XML; + if (spoolDoc != null) { + // Analyze file type + SdncArtifactType artifactType = analyzeFileType(artifactEnum, + spoolFile, spoolDoc); + + if (artifactType != null) { + + scheduleDeployment(artifactType, svcName, resourceName, artifact, spoolFile.getName(), transformedFile); + + } + + // SDNGC-2660 : Move file to archive directory even if it is an unrecognized type so that + // we do not keep trying and failing to process it. + try { + Path source = spoolFile.toPath(); + Path targetDir = archiveDir.toPath(); + + Files.move(source, targetDir.resolve(source.getFileName()), StandardCopyOption.REPLACE_EXISTING); + } catch (IOException e) { + LOG.warn("Could not move "+spoolFile.getAbsolutePath()+" to "+archiveDir.getAbsolutePath(), e); + } + } + + } + + private void handleToscaArtifact (INotificationData data, String svcName, String resourceName, IArtifactInfo artifact, + File spoolFile, File archiveDir) { + + DistributionStatusEnum deployStatus = DistributionStatusEnum.DEPLOY_ERROR; + if ((artifact != null && artifact.getArtifactType().contains("TOSCA_TEMPLATE")) || spoolFile.toString().contains(".yml")) { + deployStatus = processToscaYaml (spoolFile); + } else if ((artifact != null && artifact.getArtifactType().contains("TOSCA_CSAR")) || spoolFile.toString().contains(".csar")) { + deployStatus = processToscaCsar (data, svcName, resourceName, artifact, spoolFile, archiveDir); + // if parser error on CSAR, process the TOSCA_TEMPLATE artifact last + if (deployStatus.equals(DistributionStatusEnum.DEPLOY_ERROR)) { + CSAR_ARTIFACT_DEPLOY_ERROR = true; + } + + } else { + LOG.error("handleToscaArtifact: Encountered unknown TOSCA artifact"); + } + + if (deployStatus.equals(DistributionStatusEnum.DEPLOY_OK)) { + LOG.info("Update to SDN-C succeeded"); + + try { + Path source = spoolFile.toPath(); + Path targetDir = archiveDir.toPath(); + + Files.move(source, targetDir.resolve(source.getFileName()), StandardCopyOption.REPLACE_EXISTING); + } catch (IOException e) { + LOG.warn("Could not move "+spoolFile.getAbsolutePath()+" to "+archiveDir.getAbsolutePath(), e); + } + + } else { + LOG.info("Update to SDN-C failed"); + COMPONENT_DEPLOY_ERROR = true; + } + + // Send deployment status for ingestion + if ((artifact != null) && (data != null)) { + client.sendDeploymentStatus(buildStatusMessage(client, data, artifact,deployStatus)); + } + } + + protected DistributionStatusEnum processToscaYaml(File spoolFile) { + + return DistributionStatusEnum.DEPLOY_OK; + } + + + private DistributionStatusEnum processToscaCsar(INotificationData data, String svcName, String resourceName, IArtifactInfo artifact, + File spoolFile, File archiveDir) { + + // Use ASDC Dist Client 1.1.5 with TOSCA parsing APIs to extract relevant TOSCA model data + + // TOSCA data extraction flow 1707: + // Use ASDC dist-client to get yaml string - not yet available + String model_yaml = null; + LOG.info("Process TOSCA CSAR file: "+spoolFile.toString()); + ISdcCsarHelper sdcCsarHelper = null; + DistributionStatusEnum deployStatus = DistributionStatusEnum.DEPLOY_OK; + + try { + SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance(); + sdcCsarHelper = factory.getSdcCsarHelper(spoolFile.getAbsolutePath()); + } catch (SdcToscaParserException e) { + LOG.error("Could not create SDC TOSCA Parser ", e); + return DistributionStatusEnum.DEPLOY_ERROR; + } + + // Ingest Service Data - 1707 + Metadata serviceMetadata = sdcCsarHelper.getServiceMetadata(); + SdncServiceModel serviceModel = new SdncServiceModel(sdcCsarHelper, serviceMetadata, jdbcDataSource); + serviceModel.setFilename(spoolFile.toString().substring(spoolFile.toString().lastIndexOf("/")+1)); // will be csar file name + serviceModel.setServiceInstanceNamePrefix(SdncBaseModel.extractSubstitutionMappingTypeName(sdcCsarHelper).substring(SdncBaseModel.extractSubstitutionMappingTypeName(sdcCsarHelper).lastIndexOf(".")+1)); + + try { + cleanUpExistingToscaServiceData(serviceModel.getServiceUUID()); + LOG.info("Call insertToscaData for SERVICE_MODEL where service_uuid = " + serviceModel.getServiceUUID()); + insertToscaData(serviceModel.getSql(model_yaml), null); + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the SERVICE_MODEL table ", e); + return DistributionStatusEnum.DEPLOY_ERROR; + + } + + // Ingest Network (VL) Data - 1707 / migrate to getEntity - 1908 + EntityQuery vlEntityQuery = EntityQuery.newBuilder(SdcTypes.VL).build(); + TopologyTemplateQuery vlTopologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE).build(); + List<IEntityDetails> vlEntities = sdcCsarHelper.getEntity(vlEntityQuery, vlTopologyTemplateQuery, false); // false to not recurse + if (vlEntities != null && !vlEntities.isEmpty()) { + for (IEntityDetails vlEntity : vlEntities){ + + try { + SdncNodeModel nodeModel = new SdncNodeModel (sdcCsarHelper, vlEntity, jdbcDataSource, config); + nodeModel.setServiceUUID(serviceModel.getServiceUUID()); + + nodeModel.insertNetworkModelData(); + nodeModel.insertRelatedNetworkRoleData(); + } catch (IOException e) { + deployStatus = DistributionStatusEnum.DEPLOY_ERROR; + } + } + } + + // Ingest Allotted Resource Data - 1707 / migrate to getEntity - 1908 + // Use getEntity to get all VFs in the service filter by metadata Category = Allotted Resource + EntityQuery vfEntityQuery = EntityQuery.newBuilder(SdcTypes.VF).build(); + TopologyTemplateQuery vfTopologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE).build(); + List<IEntityDetails> vfEntities = sdcCsarHelper.getEntity(vfEntityQuery, vfTopologyTemplateQuery, true); + if (vfEntities != null) { + for (IEntityDetails vfEntity : vfEntities){ + + // If this VF has metadata Category: Allotted Resource, insert it into ALLOTTED_RESOURCE_MODEL table + String vfCategory = SdncBaseModel.extractValue(sdcCsarHelper, vfEntity.getMetadata(), "category"); + if (vfCategory.contains("Allotted Resource")) { + + try { + SdncARModel arModel = new SdncARModel (sdcCsarHelper, vfEntity, jdbcDataSource, config); + arModel.insertAllottedResourceModelData (); + arModel.insertAllottedResourceVfcModelData(); + } catch (IOException e) { + deployStatus = DistributionStatusEnum.DEPLOY_ERROR; + } + } + } + } + + // Ingest Network (VF) Data - 1707 / migrate to getEntity - 1911 + // Use getEntity to get all VFs in the service + if (vfEntities != null) { + for (IEntityDetails vfEntity : vfEntities){ + + SdncVFModel vfNodeModel = null; + try { + vfNodeModel = new SdncVFModel (sdcCsarHelper, vfEntity, jdbcDataSource, config); + vfNodeModel.setServiceUUID(serviceModel.getServiceUUID()); + vfNodeModel.setServiceInvariantUUID(serviceModel.getServiceInvariantUUID()); + vfNodeModel.insertData(); + + } catch (IOException e) { + deployStatus = DistributionStatusEnum.DEPLOY_ERROR; + } + + // For each VF, insert VNF Configuration data + DistributionStatusEnum vnfConfigDeployStatus = customProcessVnfConfig(sdcCsarHelper, vfNodeModel, jdbcDataSource); + if (vnfConfigDeployStatus == DistributionStatusEnum.DEPLOY_ERROR) { + deployStatus = DistributionStatusEnum.DEPLOY_ERROR; + } + + } // VF loop + } + + + // Ingest Network (PNF) Data - Dublin/1906 + EntityQuery entityQuery = EntityQuery.newBuilder(SdcTypes.PNF).build(); + TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE).build(); + + List<IEntityDetails> pnfs = sdcCsarHelper.getEntity(entityQuery, topologyTemplateQuery, false); + if (!pnfs.isEmpty()) { + + for (IEntityDetails pnf : pnfs) { + + try { + SdncPNFModel pnfModel = new SdncPNFModel(sdcCsarHelper, pnf, jdbcDataSource, config); + pnfModel.setServiceUUID(serviceModel.getServiceUUID()); + pnfModel.setServiceInvariantUUID(serviceModel.getServiceInvariantUUID()); + pnfModel.insertData(); + + } catch (IOException e) { + deployStatus = DistributionStatusEnum.DEPLOY_ERROR; + } + } // PNF loop + } + + DistributionStatusEnum complexToscaDeployStatus = customProcessComplexTosca(sdcCsarHelper, config, jdbcDataSource, serviceModel, + data, svcName, resourceName, artifact, archiveDir); + if (complexToscaDeployStatus == DistributionStatusEnum.DEPLOY_ERROR) { + deployStatus = DistributionStatusEnum.DEPLOY_ERROR; + } + + return deployStatus; + } + + protected DistributionStatusEnum customProcessVnfConfig(ISdcCsarHelper sdcCsarHelper, + SdncVFModel vfNodeModel, DBResourceManager jdbcDataSource2) { + return DistributionStatusEnum.DEPLOY_OK; + } + + protected DistributionStatusEnum customProcessComplexTosca(ISdcCsarHelper sdcCsarHelper, + SdncUebConfiguration config, DBResourceManager jdbcDataSource2, SdncServiceModel serviceModelINotification, + INotificationData data, String svcName, String resourceName, IArtifactInfo artifact, File archiveDir) { + return DistributionStatusEnum.DEPLOY_OK; + } + + protected void cleanUpExistingToscaData(String tableName, String keyName, String keyValue) throws IOException + { + + if (jdbcDataSource == null) { + setJdbcDataSource(); + } + try { + int rowCount = 0; + CachedRowSet data = jdbcDataSource.getData("SELECT * from " + tableName + " where " + keyName + " = " + keyValue + ";", null, ""); + while(data.next()) { + rowCount ++; + } + if (rowCount != 0) { + LOG.info("cleanUpExistingToscaData: " + keyValue); + jdbcDataSource.writeData("DELETE from " + tableName + " where " + keyName + " = " + keyValue + ";", null, null); + } + + } catch (SQLException e) { + LOG.error("Could not clean up existing " + tableName + " for " + keyValue, e); + } + + } + + + protected void cleanUpExistingToscaServiceData(String serviceUUID) throws IOException + { + + if (jdbcDataSource == null) { + setJdbcDataSource(); + } + try { + int rowCount = 0; + CachedRowSet data = jdbcDataSource.getData("SELECT * from SERVICE_MODEL where service_uuid = " + serviceUUID + ";", null, ""); + while(data.next()) { + rowCount ++; + } + if (rowCount != 0) { + LOG.info("cleanUpExistingToscaData: " + serviceUUID); + jdbcDataSource.writeData("DELETE from NETWORK_MODEL where service_uuid = " + serviceUUID + ";", null, null); + jdbcDataSource.writeData("DELETE from SERVICE_MODEL where service_uuid = " + serviceUUID + ";", null, null); + } + + } catch (SQLException e) { + LOG.error("Could not clean up existing NETWORK_MODEL and SERVICE_MODEL for service_UUID " + serviceUUID, e); + } + + } + + + protected void insertToscaData(String toscaDataString, ArrayList<String> arguments) throws IOException + { + LOG.debug("insertToscaData: " + toscaDataString); + + if (jdbcDataSource == null) { + setJdbcDataSource(); + } + try { + + jdbcDataSource.writeData(toscaDataString, arguments, null); + + } catch (SQLException e) { + LOG.error("Could not insert Tosca YAML data into the database "); + throw new IOException (e); + } + + } + + + private SdncArtifactType analyzeFileType(ArtifactTypeEnum artifactType, File spoolFile, Document spoolDoc) { + + if (artifactType != ArtifactTypeEnum.YANG_XML) { + LOG.error("Unexpected artifact type - expecting YANG_XML, got "+artifactType); + return null; + } + + // Examine outer tag + + try { + + + Element root = spoolDoc.getDocumentElement(); + + String rootName = root.getTagName(); + + if (rootName.contains(":")) { + String[] rootNameElems = rootName.split(":"); + rootName = rootNameElems[rootNameElems.length - 1]; + } + + if (rootName != null) { + SdncArtifactType mapEntry = config.getMapping(rootName); + + + if (mapEntry == null) { + + LOG.error("Unexpected file contents - root tag is "+rootName); + } + return mapEntry; + } else { + LOG.error("Cannot get root tag from file"); + return null; + } + + } catch (Exception e) { + LOG.error("Could not parse YANG_XML file "+spoolFile.getName(), e); + return null; + } + } + + private void scheduleDeployment(SdncArtifactType type, String svcName, String resourceName, IArtifactInfo artifactInfo, String spoolFileName, File spoolFile) { + + if (type.getPass() < deployList.length) { + + if (artifactInfo != null) { + LOG.debug("Scheduling "+artifactInfo.getArtifactName()+" version "+artifactInfo.getArtifactVersion()+" for deployment"); + + deployList[type.getPass()].add(new DeployableArtifact(type, svcName, resourceName, artifactInfo, spoolFile)); + } else { + SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS");//dd/MM/yyyy + Date now = new Date(); + String artifactVersion = sdfDate.format(now); + LOG.debug("Scheduling "+spoolFileName+" version "+artifactVersion+" for deployment"); + String artifactName = spoolFileName; + if (artifactInfo != null) { + artifactName = artifactInfo.getArtifactName(); + } + deployList[type.getPass()].add(new DeployableArtifact(type, svcName, resourceName, artifactName, artifactVersion, spoolFile)); + } + } else { + LOG.info("Pass for type "+type.getTag()+" is "+type.getPass()+" which is not <= "+deployList.length); + } + } + + + private DistributionStatusEnum deploySpoolFile(DeployableArtifact artifact) { + + DistributionStatusEnum deployResult = DistributionStatusEnum.DEPLOY_OK; + + StringBuffer msgBuffer = new StringBuffer(); + + + String namespace = config.getAsdcApiNamespace(); + //String namespace = artifact.getType().getNamespace(); + + msgBuffer.append("<input xmlns='"); + msgBuffer.append(namespace); + msgBuffer.append("'>\n"); + + String svcName = artifact.getSvcName(); + String resourceName = artifact.getResourceName(); + String artifactName = artifact.getArtifactName(); + + if (svcName != null) { + if (resourceName != null) { + artifactName = svcName + "/" + resourceName + "/" + artifactName; + } else { + artifactName = svcName + "/" + artifactName; + } + } + + // don't add artifact name/version for get-path-segments + if (!artifactName.contains("get-path-segments")) { + msgBuffer.append("<artifact-name>"+artifactName+"</artifact-name>\n"); + msgBuffer.append("<artifact-version>"+artifact.getArtifactVersion()+"</artifact-version>\n"); + } + + try(BufferedReader rdr = new BufferedReader(new FileReader(artifact.getFile()))) { + + String curLine = rdr.readLine(); + + while (curLine != null) { + + if (!curLine.startsWith("<?")) { + + // skip get-path-segments tags + boolean skipThisLine = false; + if (artifactName.contains("get-path-segments")) { + if (curLine.contains("<get-path-segments>") || curLine.contains("</get-path-segments>")) { + skipThisLine = true; + } + } + + if (!skipThisLine) { + msgBuffer.append(curLine+"\n"); + } + } + curLine = rdr.readLine(); + } + } catch (Exception e) { + LOG.error("Could not process spool file "+artifact.getFile().getName(), e); + return(DistributionStatusEnum.DEPLOY_ERROR); + } + + msgBuffer.append("</input>\n"); + + + byte[] msgBytes = msgBuffer.toString().getBytes(); + + Document results = postRestXml(artifact.getType().getRpcUrl(config.getAsdcApiBaseUrl()), msgBytes); + + if (results == null) { + + deployResult = DistributionStatusEnum.DEPLOY_ERROR; + } else { + + XPathFactory xpf = XPathFactory.newInstance(); + XPath xp = xpf.newXPath(); + + String asdcApiResponseCode = "500"; + + try { + + asdcApiResponseCode = xp.evaluate("//asdc-api-response-code[position()=1]/text()", results.getDocumentElement()); + } catch (Exception e) { + LOG.error("Caught exception retrying to evaluate xpath", e); + } + + if (asdcApiResponseCode.contains("200")) { + LOG.info("Update to SDN-C succeeded"); + deployResult = DistributionStatusEnum.DEPLOY_OK; + } else { + LOG.info("Update to SDN-C failed (response code "+asdcApiResponseCode+")"); + + if (asdcApiResponseCode.contains("409")) { + deployResult = DistributionStatusEnum.ALREADY_DEPLOYED; + } else { + + deployResult = DistributionStatusEnum.DEPLOY_ERROR; + } + } + } + + + + return deployResult; + } + + + + + + public static IDistributionStatusMessage buildStatusMessage( + final IDistributionClient client, final INotificationData data, + final IArtifactInfo relevantArtifact, + final DistributionStatusEnum status) { + IDistributionStatusMessage statusMessage = new IDistributionStatusMessage() { + + @Override + public long getTimestamp() { + long currentTimeMillis = System.currentTimeMillis(); + return currentTimeMillis; + } + + @Override + public DistributionStatusEnum getStatus() { + return status; + } + + @Override + public String getDistributionID() { + return data.getDistributionID(); + } + + @Override + public String getConsumerID() { + return client.getConfiguration().getConsumerID(); + } + + @Override + public String getArtifactURL() { + return relevantArtifact.getArtifactURL(); + } + }; + return statusMessage; + + } + + public static IComponentDoneStatusMessage buildComponentStatusMessage( + final IDistributionClient client, final INotificationData data, + final DistributionStatusEnum status) { + IComponentDoneStatusMessage statusMessage = new IComponentDoneStatusMessage() { + + @Override + public long getTimestamp() { + long currentTimeMillis = System.currentTimeMillis(); + return currentTimeMillis; + } + + @Override + public DistributionStatusEnum getStatus() { + return status; + } + + @Override + public String getDistributionID() { + return data.getDistributionID(); + } + + @Override + public String getConsumerID() { + return client.getConfiguration().getConsumerID(); + } + + @Override + public String getComponentName() { + // TODO Auto-generated method stub + return COMPONENT_NAME; + } + }; + return statusMessage; + + } + + private HttpURLConnection getRestXmlConnection(String urlString, String method) throws IOException + { + URL sdncUrl = new URL(urlString); + Authenticator.setDefault(new SdncAuthenticator(config.getSdncUser(), config.getSdncPasswd())); + + HttpURLConnection conn = (HttpURLConnection) sdncUrl.openConnection(); + + String authStr = config.getSdncUser()+":"+config.getSdncPasswd(); + String encodedAuthStr = new String(Base64.encodeBase64(authStr.getBytes())); + + conn.addRequestProperty("Authentication", "Basic "+encodedAuthStr); + + conn.setRequestMethod(method); + conn.setRequestProperty("Content-Type", "application/xml"); + conn.setRequestProperty("Accept", "application/xml"); + + conn.setDoInput(true); + conn.setDoOutput(true); + conn.setUseCaches(false); + + return conn; + + } + + private Document postRestXml(String urlString, byte[] msgBytes) { + Document response = null; + + try { + SdncOdlConnection odlConn = SdncOdlConnection.newInstance(urlString, config.getSdncUser(), config.getSdncPasswd()); + + String sdncResp = odlConn.send("POST", "application/xml", new String(msgBytes)); + + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + + dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + dbf.setFeature("http://xml.org/sax/features/external-general-entities", false); + dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + + DocumentBuilder db = dbf.newDocumentBuilder(); + + response = db.parse(new ByteArrayInputStream(sdncResp.getBytes())); + } catch (Exception e) { + LOG.error("Caught exception posting to ODL tier", e); + } + + return(response); + + } + + private File applyXslts(File srcFile) { + + Document doc = null; + + + File inFile = srcFile; + File outFile = null; + + String xsltPathList = config.getXsltPathList(); + + if ((xsltPathList == null) || (xsltPathList.length() == 0)) { + outFile = inFile; + } else { + + String[] xsltPaths = xsltPathList.split(","); + + for (String xsltPath : xsltPaths) { + try{ + + outFile = File.createTempFile("tmp", "xml"); + TransformerFactory factory = TransformerFactory.newInstance(); + factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + //factory.setFeature("http://xml.org/sax/features/external-general-entities", false); -- breaks transform + //factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + Source xslt = new StreamSource(new File(xsltPath)); + Transformer transformer = factory.newTransformer(xslt); + Source text = new StreamSource(inFile); + + + transformer.transform(text, new StreamResult(outFile)); + + inFile = outFile; + + } catch (Exception e) { + LOG.error("Caught exception trying to apply XSLT template "+xsltPath, e); + + } + + } + } + + // After transformations, parse transformed XML + + + return outFile; + } + + private String escapeFilename(String str) { + if (str == null) { + str = ""; + } + + StringBuffer retval = new StringBuffer(); + + for (int i = 0 ; i < str.length() ; i++) { + char curchar = str.charAt(i); + if (Character.isJavaIdentifierPart(curchar)) { + retval.append(curchar); + } + } + + return retval.toString(); + + } + + private boolean artifactIsTosca(IArtifactInfo artifact, File spoolFile) { + + boolean toscaYamlType = false; + boolean toscaCsarType = false; + if (artifact != null) { + String artifactTypeString = artifact.getArtifactType(); + if (artifactTypeString.contains("TOSCA_TEMPLATE")) { + toscaYamlType = true; + } else if (artifactTypeString.contains("TOSCA_CSAR")) { + toscaCsarType = true; + } + } else { + if (spoolFile.toString().contains(".yml")) { + toscaYamlType = true; + } else if (spoolFile.toString().contains(".csar")) { + toscaCsarType = true; + } + } + + return (toscaYamlType||toscaCsarType ? true : false); + } + +} diff --git a/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebClient.java b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebClient.java new file mode 100644 index 000000000..e5dec14c7 --- /dev/null +++ b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebClient.java @@ -0,0 +1,107 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.uebclient; + +import org.onap.sdc.api.IDistributionClient; +import org.onap.sdc.api.results.IDistributionClientResult; +import org.onap.sdc.impl.DistributionClientFactory; +import org.onap.sdc.utils.DistributionActionResultEnum; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.onap.sdc.utils.DistributionActionResultEnum; + +public class SdncUebClient { + + private static final Logger LOG = LoggerFactory.getLogger(SdncUebConfiguration.class); + + public static void main(String[] args) { + + SdncUebConfiguration config = new SdncUebConfiguration(); + + long startTm = System.currentTimeMillis(); + int sleepTm = config.getPollingInterval() * 1000; + long maxWaitTm = config.getClientStartupTimeout() * 1000L; + + boolean keepWaiting = true; + boolean listenerStarted = false; + boolean processDownloads = true; + + while (keepWaiting) { + LOG.info("Initializing ASDC distribution client"); + + IDistributionClient client = DistributionClientFactory.createDistributionClient(); + SdncUebCallback cb = new SdncUebCallback(client, config); + IDistributionClientResult result = client.init(config, cb); + LOG.info("Initialized ASDC distribution client - results = {}", result.getDistributionMessageResult()); + + if (result.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS) { + if (processDownloads) { + LOG.info("Scanning for local distribution artifacts before starting client"); + cb.deployDownloadedFiles(null, null, null); + processDownloads = false; + } + LOG.info("Starting client..."); + try { + IDistributionClientResult start = client.start(); + LOG.info("Client startup result = {}", start.getDistributionMessageResult()); + + // Only stop waiting if the result is success + if (start.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS) { + + keepWaiting = false; + listenerStarted = true; + } else { + LOG.info("SDC returned {} - exitting", start.getDistributionActionResult().toString()); + try { + client.stop(); + } catch (Exception e1) { + // Ignore exception on stop + } + } + } catch (Exception e) { + LOG.info("Client startup failure", e); + } + } + + if (System.currentTimeMillis() - startTm < maxWaitTm) { + keepWaiting = false; + } else { + + try { + Thread.sleep(sleepTm); + } catch (InterruptedException e) { + // Ignore + } + } + + } + + if (!listenerStarted) { + LOG.info("Timed out waiting to connect to SDC"); + System.exit(0); + } + + + + } + +} diff --git a/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java new file mode 100644 index 000000000..0088a14a8 --- /dev/null +++ b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncUebConfiguration.java @@ -0,0 +1,317 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.uebclient; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.LinkedList; +import java.util.List; +import java.util.Properties; + +import org.onap.sdc.api.consumer.IConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncUebConfiguration implements IConfiguration{ + + private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR"; + private static final Logger LOG = LoggerFactory + .getLogger(SdncUebConfiguration.class); + + private String asdcAddress = null; + private String consumerGroup = null; + private String consumerID = null; + private String environmentName = null; + private String password = null; + private int pollingInterval = 30; + private int pollingTimeout = 15; + private int clientStartupTimeout = 900; + private List<String> relevantArtifactTypes = null; + private String user = null; + + private String sdncUser = null; + private String sdncPasswd = null; + private String asdcApiBaseUrl = null; + private String asdcApiNamespace = null; + private List<String> msgBusAddress = null; + + private SdncArtifactMap artifactMap = SdncArtifactMap.getInstance(); + + private String incomingDir = null; + + private String archiveDir = null; + + private String overrideFile = null; + + private boolean activateServerTLSAuth; + private String keyStorePassword; + private String keyStorePath; + + private String xsltPathList; + + public SdncUebConfiguration() { + String propDir = System.getenv(SDNC_CONFIG_DIR); + if (propDir == null) { + + propDir = "/opt/sdnc/data/properties"; + } + try { + init(propDir); + } catch (Exception e) { + LOG.error("Cannot initialize SdncUebConfiguration", e); + } + } + + public SdncUebConfiguration(String propDir) { + try { + init(propDir); + } catch (Exception e) { + LOG.error("Cannot initialize SdncUebConfiguration", e); + } + } + + public String getAsdcApiNamespace() { + return asdcApiNamespace; + } + + public String getXsltPathList() { + return xsltPathList; + } + + public String getOverrideFile() { + return overrideFile; + } + + public void init(String propDir) throws IOException { + String propPath; + + + propPath = propDir + "/ueb-listener.properties"; + File propFile = new File(propPath); + + + if (!propFile.exists()) { + + throw new FileNotFoundException( + "Missing configuration properties file : " + + propFile); + } + + Properties props = new Properties(); + props.load(new FileInputStream(propFile)); + + asdcAddress = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.asdc-address"); + consumerGroup = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.consumer-group"); + consumerID = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.consumer-id"); + environmentName = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.environment-name"); + password = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.password"); + user = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.user"); + + sdncUser = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.sdnc-user"); + sdncPasswd = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.sdnc-passwd"); + asdcApiBaseUrl = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.asdc-api-base-url"); + asdcApiNamespace = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.asdc-api-namespace"); + + incomingDir = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.spool.incoming"); + archiveDir = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.spool.archive"); + overrideFile = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.override-file"); + + String curval = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.polling-interval"); + if ((curval != null) && (curval.length() > 0)) { + try { + pollingInterval = Integer.parseInt(curval); + } catch (Exception e) { + LOG.warn("Illegal value for org.onap.ccsdk.sli.northbound.uebclient.polling-interval ({}) ", curval, e); + } + } + + curval = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.polling-timeout"); + if ((curval != null) && (curval.length() > 0)) { + try { + pollingTimeout = Integer.parseInt(curval); + } catch (Exception e) { + LOG.warn("Illegal value for org.onap.ccsdk.sli.northbound.uebclient.polling-timeout ({}) ", curval, e); + } + } + + curval = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.client-startup-timeout"); + if ((curval != null) && (curval.length() > 0)) { + try { + clientStartupTimeout = Integer.parseInt(curval); + } catch (Exception e) { + LOG.warn("Illegal value for org.onap.ccsdk.sli.northbound.uebclient.polling-timeout ({}) ", curval, e); + } + } + curval = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.relevant-artifact-types"); + if ((curval != null) && (curval.length() > 0)) { + String[] artifactTypes = curval.split(","); + + relevantArtifactTypes = new LinkedList<>(); + + for (String artifactType : artifactTypes) { + + relevantArtifactTypes.add(artifactType); + + } + + } + + curval = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.activate-server-tls-auth", "false"); + activateServerTLSAuth = "true".equalsIgnoreCase(curval); + keyStorePath = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.keystore-path"); + keyStorePassword = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.keystore-password"); + xsltPathList = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.xslt-path-list"); + + + String artifactMapFile = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.artifact-map"); + if (artifactMapFile != null) { + LOG.info("Loading artifactMapFile {}", artifactMapFile); + artifactMap.load(artifactMapFile); + } else { + LOG.warn("artifact-map is unset"); + } + + msgBusAddress = new LinkedList<>(); + String msgBusAddressStr = props.getProperty("org.onap.ccsdk.sli.northbound.uebclient.msg-bus-address"); + if (msgBusAddressStr != null) { + String[] msgBusAddressArray = msgBusAddressStr.split(","); + for (int i = 0 ; i < msgBusAddressArray.length ; i++) { + msgBusAddress.add(msgBusAddressArray[i]); + } + } + + + } + + @Override + public String getAsdcAddress() { + return asdcAddress; + } + + @Override + public String getConsumerGroup() { + return consumerGroup; + } + + @Override + public String getConsumerID() { + return consumerID; + } + + @Override + public String getEnvironmentName() { + return environmentName; + } + + @Override + public String getPassword() { + return password; + } + + @Override + public int getPollingInterval() { + return pollingInterval; + } + + @Override + public int getPollingTimeout() { + return pollingTimeout; + } + + @Override + public List<String> getRelevantArtifactTypes() { + return relevantArtifactTypes; + } + + public int getClientStartupTimeout() { + return clientStartupTimeout; + } + + @Override + public String getUser() { + return user; + } + + + public String getSdncUser() { + return sdncUser; + } + + public String getSdncPasswd() { + return sdncPasswd; + } + + public String getAsdcApiBaseUrl() { + return asdcApiBaseUrl; + } + + @Override + public boolean activateServerTLSAuth() { + return activateServerTLSAuth; + } + + @Override + public String getKeyStorePassword() { + return keyStorePassword; + } + + @Override + public String getKeyStorePath() { + return keyStorePath; + } + + public String getIncomingDir() { + return incomingDir; + } + + public String getArchiveDir() { + return archiveDir; + } + + public int getMaxPasses() { + return artifactMap.getNumPasses(); + } + + public SdncArtifactMap.SdncArtifactType getMapping(String tag) { + return artifactMap.getMapping(tag); + } + + @Override + public boolean isFilterInEmptyResources() { + return false; + } + + @Override + public Boolean isUseHttpsWithDmaap() { + return false; + } + + @Override + public List<String> getMsgBusAddress() { + return msgBusAddress; + } + + +} diff --git a/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java new file mode 100644 index 000000000..fc288aaa9 --- /dev/null +++ b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModel.java @@ -0,0 +1,360 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.uebclient; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.tosca.parser.elements.queries.EntityQuery; +import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery; +import org.onap.sdc.tosca.parser.enums.SdcTypes; +import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; +import org.onap.sdc.toscaparser.api.Property; +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncVFCModel extends SdncBaseModel { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncVFCModel.class); + + private String vmType = null; + private String vmCount = null; + + public SdncVFCModel(ISdcCsarHelper sdcCsarHelper, IEntityDetails entityDetails, DBResourceManager jdbcDataSource, SdncUebConfiguration config) throws IOException { + + super(sdcCsarHelper, entityDetails, jdbcDataSource, config); + + // extract properties + addParameter("ecomp_generated_naming", extractBooleanValue (entityDetails, "nfc_naming", "ecomp_generated_naming")); + addParameter("naming_policy", extractValue (entityDetails, "nfc_naming", "naming_policy")); + vmCount = extractValue (entityDetails, "service_template_filter", "count"); // need path to vm_count, extracted as service_template_filter#count + if (vmCount.isEmpty()) { + vmCount = "0"; // vm_count can not be null + } + vmType = extractValue (entityDetails, SdcPropertyNames.PROPERTY_NAME_VMTYPETAG); + addParameter("vm_type", vmType); // populate vm_type with vm_type_tag value + addParameter("vm_type_tag", vmType); + addParameter("nfc_naming_code", extractValue (entityDetails, "nfc_naming_code")); + addParameter("nfc_function", extractValue (entityDetails, "nfc_function")); + addParameter("high_availability", extractValue (entityDetails, "high_availablity")); + addParameter("vm_image_name", extractValue (entityDetails, "vm_image_name")); + addParameter("vm_flavor_name", extractValue (entityDetails, "vm_flavor_name")); + addParameter("nfc_naming", extractValue (entityDetails, "nfc_naming")); + addParameter("min_instances", extractValue (entityDetails, "min_instances")); + addParameter("max_instances", extractValue (entityDetails, "max_instances")); + } + + public void insertVFCModelData () throws IOException { + try { + cleanUpExistingToscaData("VFC_MODEL", "customization_uuid", getCustomizationUUID()); + LOG.info("Call insertToscaData for VFC_MODEL where customization_uuid = " + getCustomizationUUID()); + insertToscaData(buildSql("VFC_MODEL", model_yaml), null); + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the VFC_MODEL table"); + throw new IOException (e); + } + + } + + public void insertVFCtoNetworkRoleMappingData (IEntityDetails cvfcEntity) throws IOException { + + // Get the CPs on this VFC - using getEntity + // For each VFC node, get CP properties to insert into VFC_TO_NETWORK_ROLE_MAPPING + // VFC_TO_NETWORK_ROLE_MAPPING: vfc_customization_uuid, network_role, network_role_tag, vm_type, ipv4_count, ipv6_count, + // ipv4_use_dhcp, ipv6_use_dhcp, ipv4_ip_version, ipv6_ip_version, extcp_subnetpool_id + + String vfcCustomizationUuid = getCustomizationUUID().replace("\"", ""); + EntityQuery entityQueryCP = EntityQuery.newBuilder(SdcTypes.CP).build(); + TopologyTemplateQuery topologyTemplateQueryVFC = TopologyTemplateQuery.newBuilder(SdcTypes.CVFC).customizationUUID(vfcCustomizationUuid).build(); + List<IEntityDetails> cpEntities = sdcCsarHelper.getEntity(entityQueryCP, topologyTemplateQueryVFC, true); + if (cpEntities == null || cpEntities.isEmpty()) { + LOG.debug("insertVFCtoNetworkRoleMappingData: Could not find the nested CVFCs for: " + vfcCustomizationUuid); + return; + } + + // Clean up all VFC_TO_NETWORK_ROLE_MAPPING data for this VFC node + try { + cleanUpExistingToscaData("VFC_TO_NETWORK_ROLE_MAPPING", "vfc_customization_uuid", getCustomizationUUID()); + } catch (IOException e) { + LOG.error("Could not clean up data in VFC_TO_NETWORK_ROLE_MAPPING table ", e); + } + + // There can be multiple insertions per CP: + // Insert once for each unique IP Version / Subnet Role combination per CP (network_role) + for (IEntityDetails cpEntity : cpEntities) { + + // Extract common parameters + Map<String, String> commonParams = new HashMap<String, String>(); // non-IP Version specific parameters + // Get vm_type from VFC node + addParameter("vm_type", getVmType(), commonParams); + + // Extract non-IP Version specific parameters - outside the ip_requirements block + String networkRole = extractValue(cpEntity, "network_role").isEmpty() ? "default-network-role" : extractValue(cpEntity, "network_role"); // set default-network-role? + addParameter("network_role", networkRole, commonParams); // can not be null + addParameter("network_role_tag", nullCheck(extractValue(cpEntity, "network_role_tag")), commonParams); + addParameter("extcp_subnetpool_id", nullCheck(extractValue(cpEntity, "subnetpoolid")), commonParams); + String subinterfaceIndicator = extractBooleanValue (cpEntity, "subinterface_indicator"); + addParameter("subinterface_indicator", subinterfaceIndicator, commonParams); + + // Build lists of all IPV4 and IPV6 ip_requirements elements + ArrayList<Map<String, String>> ipv4PropParamsList = new ArrayList<Map<String, String>>(); + ArrayList<Map<String, String>> ipv6PropParamsList = new ArrayList<Map<String, String>>(); + + // Extract IP Version specific parameters + if (cpEntity.getProperties().containsKey("ip_requirements")) { + + ArrayList<Map<String, Object>> ipPropsList = new ArrayList<Map<String, Object>>(); + ipPropsList = (ArrayList<Map<String, Object>>) cpEntity.getProperties().get("ip_requirements").getValue(); + + if (ipPropsList != null) { + for (Map<String, Object> ipPropMap : ipPropsList) { + //LOG.info("ip_requirements prop map = " + nullCheck(ipPropMap)); + + String ipVersion = nullCheck(ipPropMap.get("ip_version")); + if (ipVersion == null) { + LOG.error("SdncVFCModel: ipVersion not included in ip_requirements element"); + continue; + } + + String subnetRole = nullCheck(ipPropMap.get("subnet_role")); + + if (ipVersion.contains("4")) { + + // If we have already encountered this subnetRole for IPV4, skip this ip_requirements element + if (!ipPropParamsMapContainsSubnetRole (ipv4PropParamsList, subnetRole)) { + + Map<String, String> ipv4PropParams = new HashMap<String, String>(); + SdncBaseModel.addParameter("ipv4_ip_version", ipVersion, ipv4PropParams); + SdncBaseModel.addParameter("ipv4_use_dhcp", nullCheck(ipPropMap.get("dhcp_enabled")).contains("true") ? "Y" : "N", ipv4PropParams); + Map<String, Object> ipCountRequired = (Map<String, Object>)ipPropMap.get("ip_count_required"); + if (ipCountRequired != null && ipCountRequired.get("count") != null) { + SdncBaseModel.addParameter("ipv4_count", nullCheck(ipCountRequired.get("count")), ipv4PropParams); + } + Map<String, Object> floatingIpCountRequired = (Map<String, Object>)ipPropMap.get("floating_ip_count_required"); + if (floatingIpCountRequired != null && floatingIpCountRequired.get("count") != null) { + SdncBaseModel.addParameter("ipv4_floating_count", nullCheck(floatingIpCountRequired.get("count")), ipv4PropParams); + } + SdncBaseModel.addParameter("ipv4_address_plan_name", nullCheck(ipPropMap.get("ip_address_plan_name")), ipv4PropParams); + SdncBaseModel.addParameter("ipv4_vrf_name", nullCheck(ipPropMap.get("vrf_name")), ipv4PropParams); + SdncBaseModel.addParameter("subnet_role", nullCheck(ipPropMap.get("subnet_role")), ipv4PropParams); + + ipv4PropParamsList.add(ipv4PropParams); + + } else { + LOG.error("SdncVFCModel: Additional V4 ip-requirements element encountered for this subnet_role: ", subnetRole); + } + + } else if (ipVersion.contains("6")) { + + // If we have already encountered this subnetRole for IPV6, skip this ip_requirements element + if (!ipPropParamsMapContainsSubnetRole (ipv6PropParamsList, subnetRole)) { + + Map<String, String> ipv6PropParams = new HashMap<String, String>(); + SdncBaseModel.addParameter("ipv6_ip_version", ipVersion, ipv6PropParams); + SdncBaseModel.addParameter("ipv6_use_dhcp", nullCheck(ipPropMap.get("dhcp_enabled")).contains("true") ? "Y" : "N", ipv6PropParams); + Map<String, Object> ipCountRequired = (Map<String, Object>)ipPropMap.get("ip_count_required"); + if (ipCountRequired != null && ipCountRequired.get("count") != null) { + SdncBaseModel.addParameter("ipv6_count", nullCheck(ipCountRequired.get("count")), ipv6PropParams); + } + Map<String, Object> floatingIpCountRequired = (Map<String, Object>)ipPropMap.get("floating_ip_count_required"); + if (floatingIpCountRequired != null && floatingIpCountRequired.get("count") != null) { + SdncBaseModel.addParameter("ipv6_floating_count", nullCheck(floatingIpCountRequired.get("count")), ipv6PropParams); + } + SdncBaseModel.addParameter("ipv6_address_plan_name", nullCheck(ipPropMap.get("ip_address_plan_name")), ipv6PropParams); + SdncBaseModel.addParameter("ipv6_vrf_name", nullCheck(ipPropMap.get("vrf_name")), ipv6PropParams); + SdncBaseModel.addParameter("subnet_role", nullCheck(ipPropMap.get("subnet_role")), ipv6PropParams); + + ipv6PropParamsList.add(ipv6PropParams); + + } else { + LOG.error("SdncVFCModel: Additional V6 ip-requirements element encountered for this subnetRole: ", subnetRole); + } + + } else { + LOG.error("SdncVFCModel: invalid IP version encountered: ", ipVersion); + } + + } // for each ip-requirements element + + } // ipPropsList null check + + // After all Common and IP Version specific parameters are extracted, insert IPV4 and IPV6 data separately + // Insert IPV4 data + for (Map<String, String> ipv4PropParams: ipv4PropParamsList) { + + Map<String, String> mappingParams = new HashMap<String, String>(); // final list for single insertion + addParamsToMap(commonParams, mappingParams); + addParamsToMap(ipv4PropParams, mappingParams); + + // Insert ipv4PropParams into VFC_TO_NETWORK_ROLE_MAPPING + try { + LOG.info("Call insertToscaData for VFC_TO_NETWORK_ROLE_MAPPING where vfc_customization_uuid = " + getCustomizationUUID()); + addRequiredParameters(mappingParams); + insertToscaData(SdncBaseModel.getSql("VFC_TO_NETWORK_ROLE_MAPPING", "vfc_customization_uuid", getCustomizationUUID(), "", mappingParams), null); + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the VFC_TO_NETWORK_ROLE_MAPPING table"); + throw new IOException (e); + } + + } + + // Insert IPV6 data + for (Map<String, String> ipv6PropParams: ipv6PropParamsList) { + + Map<String, String> mappingParams = new HashMap<String, String>(); // final list for single insertion + addParamsToMap(commonParams, mappingParams); + addParamsToMap(ipv6PropParams, mappingParams); + + // Insert ipv6PropParams into VFC_TO_NETWORK_ROLE_MAPPING + try { + LOG.info("Call insertToscaData for VFC_TO_NETWORK_ROLE_MAPPING where vfc_customization_uuid = " + getCustomizationUUID()); + addRequiredParameters(mappingParams); + insertToscaData(SdncBaseModel.getSql("VFC_TO_NETWORK_ROLE_MAPPING", "vfc_customization_uuid", getCustomizationUUID(), "", mappingParams), null); + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the VFC_TO_NETWORK_ROLE_MAPPING table"); + throw new IOException (e); + } + } + } + } + } + + protected boolean ipPropParamsMapContainsSubnetRole (ArrayList<Map<String, String>> ipPropParamsList, String subnetRole) { + + boolean subnetRoleFound = false; + + if (subnetRole != null && !subnetRole.isEmpty()) { + for (Map<String, String> ipPropMap : ipPropParamsList) { + if (ipPropMap.get("subnet_role").contentEquals(subnetRole)) { + return true; + } + } + } + return subnetRoleFound; + } + + private void addRequiredParameters (Map<String, String> mappingParams) { + + // Add parameters which can not be null if they have not already been added - network_role, ipv4_count, ipv6_count + String ipvCountDefault = "0"; + if (!mappingParams.containsKey("ipv4_count")) { + SdncBaseModel.addParameter("ipv4_count", ipvCountDefault, mappingParams); + } + if (!mappingParams.containsKey("ipv6_count")) { + SdncBaseModel.addParameter("ipv6_count", ipvCountDefault, mappingParams); + } + } + + public void insertVFCRelatedNetworkRoleData (String vfCustomizationUUID, IEntityDetails cvfcEntity) throws IOException { + + // Get the CPs on this VFC - using getEntity + + String vfcCustomizationUuid = getCustomizationUUID().replace("\"", ""); + // Get the CPs on this VFC - ASDC suggests getNodeTemplateChildren + //List<NodeTemplate> cpNodesList = sdcCsarHelper.getNodeTemplateChildren(vfcNode); + EntityQuery entityQueryCP = EntityQuery.newBuilder(SdcTypes.CP).build(); + TopologyTemplateQuery topologyTemplateQueryVFC = TopologyTemplateQuery.newBuilder(SdcTypes.CVFC).customizationUUID(vfcCustomizationUuid).build(); + List<IEntityDetails> cpEntities = sdcCsarHelper.getEntity(entityQueryCP, topologyTemplateQueryVFC, true); + if (cpEntities == null || cpEntities.isEmpty()) { + LOG.debug("insertVFCRelatedNetworkRoleData: Could not find the nested CVFCs for: " + vfcCustomizationUuid); + return; + } + + try { + cleanUpExistingToscaData("VFC_RELATED_NETWORK_ROLE", "vfc_customization_uuid", getCustomizationUUID()); + } catch (IOException e) { + LOG.error("Could not clean up Tosca CSAR data in the VFC_RELATED_NETWORK_ROLE table"); + throw new IOException (e); + } + + for (IEntityDetails cpEntity : cpEntities){ + String networkRole = extractValue(cpEntity, "network_role"); + Map<String, String> relatedNetworkRoleParams = new HashMap<String, String>(); + addParameter("vfc_customization_uuid", getCustomizationUUID(), relatedNetworkRoleParams); + addParameter("vm_type", vmType, relatedNetworkRoleParams); + addParameter("network_role", networkRole, relatedNetworkRoleParams); + + if (cpEntity.getProperties().containsKey("related_networks")) { + + Property relatedNetworksProperty = cpEntity.getProperties().get("related_networks"); + List<String> relatedNetworkRoles = relatedNetworksProperty.getLeafPropertyValue("related_network_role"); + + for (String relatedNetworkRole : relatedNetworkRoles) { + LOG.debug("CP [" + cpEntity.getName() + "], property [" + "related_network_role" + "] property value: " + relatedNetworkRole); + + try { + // Table cleanup for VFC_RELATED_NETWORK_ROLE occurs per vfc + // If cp related_network_role, cp network_role and vm_type for this vfc already exist in VFC_RELATED_NETWORK_ROLE, + // don't attempt insertion + Map<String, String> relatedNetworkRoleParamsCheck = new HashMap<String, String>(); + addParamsToMap(relatedNetworkRoleParams, relatedNetworkRoleParamsCheck); + addParameter("related_network_role", relatedNetworkRole, relatedNetworkRoleParamsCheck); + if (checkForExistingToscaData("VFC_RELATED_NETWORK_ROLE", relatedNetworkRoleParamsCheck) == false) { + LOG.info("Call insertToscaData for VFC_RELATED_NETWORK_ROLE where vfc_customization_uuid = " + getCustomizationUUID()); + insertToscaData(buildSql("VFC_RELATED_NETWORK_ROLE", "related_network_role", "\"" + relatedNetworkRole + "\"", model_yaml, relatedNetworkRoleParams), null); + } + + // Table cleanup for VNF_RELATED_NETWORK_ROLE occurs per vf (up one level) + // Insert same related_network_role data into VNF_RELATED_NETWORK_ROLE + Map<String, String> vfRelatedNetworkRoleParamsCheck = new HashMap<String, String>(); + addParameter("vnf_customization_uuid", vfCustomizationUUID, vfRelatedNetworkRoleParamsCheck); + addParameter("network_role", networkRole, vfRelatedNetworkRoleParamsCheck); + addParameter("related_network_role", relatedNetworkRole, vfRelatedNetworkRoleParamsCheck); + if (checkForExistingToscaData("VNF_RELATED_NETWORK_ROLE", vfRelatedNetworkRoleParamsCheck) == false) { + vfRelatedNetworkRoleParamsCheck.remove("related_network_role"); + LOG.info("Call insertToscaData for VNF_RELATED_NETWORK_ROLE where vnf_customization_uuid = " + vfCustomizationUUID); + insertToscaData(buildSql("VNF_RELATED_NETWORK_ROLE", "related_network_role", "\"" + relatedNetworkRole + "\"", model_yaml, vfRelatedNetworkRoleParamsCheck), null); + } + + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the VFC_RELATED_NETWORK_ROLE table"); + throw new IOException (e); + } + } + } + } + } + + public String getVmType() { + return vmType; + } + + public void setVmType(String vmType) { + this.vmType = vmType; + } + + public String getVmCount() { + return vmCount; + } + + public void setVmCount(String vmCount) { + this.vmCount = vmCount; + } + +} diff --git a/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModel.java b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModel.java new file mode 100644 index 000000000..fa54c7c41 --- /dev/null +++ b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModel.java @@ -0,0 +1,485 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.uebclient; + +import java.io.IOException; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.tosca.parser.enums.SdcTypes; +import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.tosca.parser.elements.queries.EntityQuery; +import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery; +import org.onap.sdc.toscaparser.api.Property; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class SdncVFModel extends SdncBaseModel { + + private static final Logger LOG = LoggerFactory + .getLogger(SdncVFModel.class); + + private String vendor = null; + private String vendorModelDescription = null; + private String nfNamingCode = null; + private String serviceUUID = null; + private String serviceInvariantUUID = null; + + public SdncVFModel(ISdcCsarHelper sdcCsarHelper, IEntityDetails entityDetails, DBResourceManager jdbcDataSource, SdncUebConfiguration config) throws IOException { + + super(sdcCsarHelper, entityDetails, jdbcDataSource, config); + + // extract metadata + Metadata metadata = entityDetails.getMetadata(); + addParameter("name", extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_NAME)); + vendor = extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_RESOURCEVENDOR); + addParameter("vendor", vendor); + vendorModelDescription = extractValue (metadata, "description"); + addParameter("vendor_version", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_RESOURCEVENDORRELEASE)); + + // extract properties + addParameter("ecomp_generated_naming", extractBooleanValue(entityDetails, "nf_naming", "ecomp_generated_naming")); + addParameter("naming_policy", extractValue(entityDetails, "nf_naming", "naming_policy")); + addParameter("nf_type", extractValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFTYPE)); + addParameter("nf_role", extractValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFROLE)); + nfNamingCode = extractValue(entityDetails, "nf_naming_code"); + addParameter("nf_code", nfNamingCode); + addParameter("nf_function", extractValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); + addIntParameter("avail_zone_max_count", extractValue(entityDetails, SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONEMAXCOUNT)); + addParameter("sdnc_model_name", extractValue(entityDetails, "sdnc_model_name")); + addParameter("sdnc_model_version", extractValue(entityDetails, "sdnc_model_version")); + addParameter("sdnc_artifact_name", extractValue(entityDetails, "sdnc_artifact_name")); + + // store additional properties in ATTRIBUTE_VALUE_PAIR + // additional complex properties are extracted via VfcInstanceGroup + EntityQuery entityQuery = EntityQuery.newBuilder("org.openecomp.groups.VfcInstanceGroup").build(); + String vfCustomizationUuid = getCustomizationUUIDNoQuotes(); + TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.VF) + .customizationUUID(vfCustomizationUuid).build(); + List<IEntityDetails> vfcInstanceGroupListForVf = sdcCsarHelper.getEntity(entityQuery, topologyTemplateQuery, false); + if (vfcInstanceGroupListForVf != null) { + + for (IEntityDetails group : vfcInstanceGroupListForVf){ + + String vfcInstanceGroupFunction = extractGetInputValue(group, entityDetails, "vfc_instance_group_function"); + addParameter("vfc_instance_group_function", vfcInstanceGroupFunction, attributeValueParams); + String networkCollectionFunction = extractGetInputValue(group, entityDetails, "network_collection_function"); + addParameter("network_collection_function", networkCollectionFunction, attributeValueParams); + String initSubinterfaceQuantity = extractGetInputValue(group, entityDetails, "init_subinterface_quantity"); + addParameter("init_subinterface_quantity", initSubinterfaceQuantity, attributeValueParams); + } + } + } + + public void insertData() throws IOException { + + insertVFModelData(); + insertVFModuleData(); + insertVFtoNetworkRoleMappingData(); + insertVFCData(); + insertVFCInstanceGroupData(); + insertVFPolicyData(); + } + + private void insertVFModelData () throws IOException { + + try { + cleanUpExistingToscaData("VF_MODEL", "customization_uuid", getCustomizationUUID()) ; + //cleanUpExistingToscaData("SERVICE_MODEL_TO_VF_MODEL_MAPPING", "service_uuid", serviceUUID, "vf_uuid", getUUID()); + + // insert into VF_MODEL/ATTRIBUTE_VALUE_PAIR and SERVICE_MODEL_TO_VF_MODEL_MAPPING + LOG.info("Call insertToscaData for VF_MODEL where customization_uuid = " + getCustomizationUUID()); + insertToscaData(buildSql("VF_MODEL", model_yaml), null); + //insertRelevantAttributeData(); + + Map<String, String> mappingParams = new HashMap<String, String>(); + addParameter("service_invariant_uuid", serviceInvariantUUID, mappingParams); + addParameter("vf_uuid", getUUID(), mappingParams); + addParameter("vf_customization_uuid", getCustomizationUUIDNoQuotes(), mappingParams); + //insertToscaData(buildSql("SERVICE_MODEL_TO_VF_MODEL_MAPPING", "service_uuid", serviceUUID, model_yaml, mappingParams), null); + + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the VF_MODEL table"); + throw new IOException (e); + } + + } + + private void insertVFModuleData () throws IOException { + + // Pre-Step: Get all CVFC with VFC inside use this list to filter before insert into VF_MODULE_TO_VFC_MAPPING + // Get all VFC in all CFVC in entire model (getEntity VFC, CVFC, true) and then check resulting entity has parent that matches member + // if parent of VFC has customizationUUID that matches customizationUUID of group member, then insert into VF_MODULE_TO_VFC_MAPPING + // then get count property + EntityQuery vfcEntityQuery = EntityQuery.newBuilder(SdcTypes.VFC).build(); + TopologyTemplateQuery cvfcTopologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.CVFC).build(); + List<IEntityDetails> allVfcsInsideAllCvfcs = sdcCsarHelper.getEntity(vfcEntityQuery, cvfcTopologyTemplateQuery, true); + + // Step 1: Get all the VF Module groups (entities) in this Service + EntityQuery entityQuery = EntityQuery.newBuilder("org.openecomp.groups.VfModule").build(); + String vfCustomizationUuid = getCustomizationUUIDNoQuotes(); + TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE).build(); + List<IEntityDetails> vfModules = sdcCsarHelper.getEntity(entityQuery, topologyTemplateQuery, false); + if (vfModules == null) { + return; + } + + // Insert each VF Module group (entity) into VF_MODULE_MODEL if its name is prefixed with the VF name + for (IEntityDetails vfModule : vfModules){ + + // If this vfModule name is prefixed with the VF name of the VF being processed, insert this VF Module in VF_MODULE_MODEL + String normailizedVfName = entityDetails.getName().toLowerCase().replace(" ", "").replace("-", "").replace(".", ""); // need full set of normalization rules from ASDC + if (!vfModule.getName().startsWith(normailizedVfName)) { + continue; + } + + SdncVFModuleModel vfModuleModel = new SdncVFModuleModel(sdcCsarHelper, vfModule, this); + + try { + cleanUpExistingToscaData("VF_MODULE_MODEL", "customization_uuid", vfModuleModel.getCustomizationUUID()); + cleanUpExistingToscaData("VF_MODULE_TO_VFC_MAPPING", "vf_module_customization_uuid", vfModuleModel.getCustomizationUUID()); + LOG.info("Call insertToscaData for VF_MODULE_MODEL where customization_uuid = " + vfModuleModel.getCustomizationUUID()); + insertToscaData(vfModuleModel.buildSql("VF_MODULE_MODEL", model_yaml), null); + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the VF_MODULE_MODEL table "); + throw new IOException (e); + } + + // Step 2: Get the non-catalog VF Module in order to get the group members + String vfModuleUuid = vfModuleModel.getUUID().replace("\"", ""); + EntityQuery entityQuery2 = EntityQuery.newBuilder("org.openecomp.groups.VfModule") + .uUID(vfModuleUuid) + .build(); + TopologyTemplateQuery topologyTemplateQuery2 = TopologyTemplateQuery.newBuilder(SdcTypes.VF) + .customizationUUID(vfCustomizationUuid) // customization UUID of the VF if exists + .build(); + List<IEntityDetails> vfModulesNonCatalog = sdcCsarHelper.getEntity(entityQuery2, topologyTemplateQuery2, false); + if (vfModulesNonCatalog == null || vfModulesNonCatalog.isEmpty()) { + LOG.debug("insertVFModuleData: Could not find the non-catelog VF Module for: " + vfModuleModel.getCustomizationUUID() + ". Unable to insert members into VF_MODULE_TO_VFC_MAPPING"); + continue; + } + + List<IEntityDetails> vfModuleMembers = vfModulesNonCatalog.get(0).getMemberNodes(); // does getMemberNodes give nested CFVCs? + + // Find all members for each VF Module that are of type CVFC and insert it and any nested CFVCs into VF_MODULE_TO_VFC_MAPPING + for (IEntityDetails vfModuleMember: vfModuleMembers) { + if (vfModuleMember.getMetadata().getValue("type").equals(SdcTypes.CVFC.getValue())) { + + String cvfcCustomizationUuid = extractValue(vfModuleMember.getMetadata(), SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); + + // Additional check to see if this CVFC has a VFC in it? We only are to map CVFCs with VFC in it. + if (cvfcContainsVfc(allVfcsInsideAllCvfcs, vfModuleMember) == true) { + + // Insert this CVFC data into VF_MODULE_TO_VFC_MAPPING + String vfcVmType = extractValue (vfModuleMember, SdcPropertyNames.PROPERTY_NAME_VMTYPETAG); // extracted as vm_type_tag + String vfcVmCount = ""; + if (vfModuleMember.getProperties().containsKey("service_template_filter")) { + vfcVmCount = extractIntegerValue (vfModuleMember.getProperties().get("service_template_filter"), "count"); + } + if (vfcVmCount.isEmpty()) { + vfcVmCount = "0"; // vm_count can not be null + } + + try { + LOG.info("Call insertToscaData for VF_MODULE_TO_VFC_MAPPING where vf_module_customization_uuid = " + vfModuleModel.getCustomizationUUID()); + insertToscaData("insert into VF_MODULE_TO_VFC_MAPPING (vf_module_customization_uuid, vfc_customization_uuid, vm_type, vm_count) values (" + + vfModuleModel.getCustomizationUUID() + ", \"" + cvfcCustomizationUuid + "\", \"" + vfcVmType + "\", \"" + vfcVmCount + "\")", null); + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the VF_MODULE_TO_VFC_MAPPING table"); + throw new IOException (e); + } + } + + // Step 3: Get any nested CVFCs under this CVFC + EntityQuery entityQuery3 = EntityQuery.newBuilder(SdcTypes.CVFC).build(); + TopologyTemplateQuery topologyTemplateQuery3 = TopologyTemplateQuery.newBuilder(SdcTypes.CVFC) + .customizationUUID(cvfcCustomizationUuid) // customization UUID of the CVFC if exists + .build(); + List<IEntityDetails> nestedCvfcs = sdcCsarHelper.getEntity(entityQuery3, topologyTemplateQuery3, true); // true allows for nested search + if (nestedCvfcs == null || nestedCvfcs.isEmpty()) { + LOG.debug("insertVFModuleData: Could not find the nested CVFCs for: " + cvfcCustomizationUuid); + continue; + } + + for (IEntityDetails nestedCvfc: nestedCvfcs) { + + // Additional check to see if this CVFC has a VFC in it? We only are to map CVFCs with VFC in it. + if (cvfcContainsVfc(allVfcsInsideAllCvfcs, nestedCvfc) == false) { + continue; // continue to next CVFC + } + + // Insert this CVFC data into VF_MODULE_TO_VFC_MAPPING + String nestedCvfcCustomizationUuid = extractValue(nestedCvfc.getMetadata(), SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); + String nestedVfcVmType = extractValue (nestedCvfc, SdcPropertyNames.PROPERTY_NAME_VMTYPETAG); // extracted as vm_type_tag + String nestedVfcVmCount = ""; + if (nestedCvfc.getProperties().containsKey("service_template_filter")) { + nestedVfcVmCount = extractIntegerValue (nestedCvfc.getProperties().get("service_template_filter"), "count"); + } + if (nestedVfcVmCount.isEmpty()) { + nestedVfcVmCount = "0"; // vm_count can not be null + } + + try { + LOG.info("Call insertToscaData for VF_MODULE_TO_VFC_MAPPING where vf_module_customization_uuid = " + vfModuleModel.getCustomizationUUID()); + insertToscaData("insert into VF_MODULE_TO_VFC_MAPPING (vf_module_customization_uuid, vfc_customization_uuid, vm_type, vm_count) values (" + + vfModuleModel.getCustomizationUUID() + ", \"" + nestedCvfcCustomizationUuid + "\", \"" + nestedVfcVmType + "\", \"" + nestedVfcVmCount + "\")", null); + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the VF_MODULE_TO_VFC_MAPPING table"); + throw new IOException (e); + } + } + } + } // For each VF Module member + } // For each VF Module + } + + private boolean cvfcContainsVfc (List<IEntityDetails> allVfcsInsideAllCvfcs, IEntityDetails cvfcEntity) { + boolean containsVfc = false; + + for (IEntityDetails vfcEntity: allVfcsInsideAllCvfcs) { + IEntityDetails vfcParentEntity = vfcEntity.getParent(); + String parentCustomizationUuid = extractValue (vfcParentEntity.getMetadata(), SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); + String cvfcEntityCustomizationUuid = extractValue (cvfcEntity.getMetadata(), SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); + if (parentCustomizationUuid == cvfcEntityCustomizationUuid) { + return true; + } + } + + return containsVfc; + } + + private void insertVFtoNetworkRoleMappingData () throws IOException { + + // Cleanup existing VF_TO_NETWORK_ROLE_MAPPING for this VF + try { + cleanUpExistingToscaData("VF_TO_NETWORK_ROLE_MAPPING", "vf_customization_uuid", getCustomizationUUID()); + } catch (IOException e) { + LOG.error("Could not cleanup Tosca CSAR data into the VF_TO_NETWORK_ROLE_MAPPING table"); + throw new IOException (e); + } + + // For this VF, insert VF_TO_NETWORK_ROLE_MAPPING data. network_role is a property on the CPs for this VF. + // Use getEntity to extract all the CPs on this VF + EntityQuery entityQueryCP = EntityQuery.newBuilder(SdcTypes.CP).build(); + TopologyTemplateQuery topologyTemplateQueryVF = TopologyTemplateQuery.newBuilder(SdcTypes.VF).customizationUUID(getCustomizationUUIDNoQuotes()).build(); + List<IEntityDetails> cpEntities = sdcCsarHelper.getEntity(entityQueryCP, topologyTemplateQueryVF, true); + if (cpEntities == null || cpEntities.isEmpty()) { + LOG.debug("insertVFtoNetworkRoleMappingData: Could not find CPs for VF: " + getCustomizationUUIDNoQuotes()); + return; + } + + for (IEntityDetails entity: cpEntities ) { + + Map<String, Property> properties = entity.getProperties(); + if (properties.containsKey("network_role")) { + + Property networkRoleProperty = properties.get("network_role"); + if (networkRoleProperty != null && networkRoleProperty.getValue() != null) { + String cpNetworkRole = networkRoleProperty.getValue().toString(); + LOG.debug("insertVFtoNetworkRoleMappingData: " + "VF: " + getCustomizationUUID() + ", networkRole = " + cpNetworkRole); + + // Only insert unique network_role values for this VF + boolean networkRoleExists = false; + Map<String, String> networkRoleyKeys = new HashMap<String, String>(); + networkRoleyKeys.put("vf_customization_uuid", getCustomizationUUID()); + networkRoleyKeys.put("network_role", "\"" + cpNetworkRole + "\""); + networkRoleExists = checkForExistingToscaData("VF_TO_NETWORK_ROLE_MAPPING", networkRoleyKeys); + + if (networkRoleExists == false) { + try { + //cleanUpExistingToscaData("VF_TO_NETWORK_ROLE_MAPPING", "vf_customization_uuid", getCustomizationUUID()); + LOG.info("Call insertToscaData for VF_TO_NETWORK_ROLE_MAPPING where vf_customization_uuid = " + getCustomizationUUID()); + insertToscaData("insert into VF_TO_NETWORK_ROLE_MAPPING (vf_customization_uuid, network_role) values (" + + getCustomizationUUID() + ", \"" + cpNetworkRole + "\")", null); + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the VF_TO_NETWORK_ROLE_MAPPING table"); + throw new IOException (e); + } + } + } + } + + } // CP loop + + } + + private void insertVFCData() throws IOException { + + /* For each VF, insert VFC_MODEL, VFC_TO_NETWORK_ROLE_MAPPING, VNF_RELATED_NETWORK_ROLE and VFC_RELATED_NETWORK_ROLE data + + try { + cleanUpExistingToscaData("VNF_RELATED_NETWORK_ROLE", "vnf_customization_uuid", getCustomizationUUID()); + } catch (IOException e) { + LOG.error("Could not clean up Tosca CSAR data in the VNF_RELATED_NETWORK_ROLE table"); + throw new IOException (e); + }*/ + + // Get any CVFCs under this VF (top-level and nested) + String vfCustomizationUid = customizationUUID; + EntityQuery entityQuery = EntityQuery.newBuilder(SdcTypes.CVFC) + .build(); + TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.VF) + .customizationUUID(vfCustomizationUid) // customization UUID of the VF if exists + .build(); + List<IEntityDetails> cvfcEntities = sdcCsarHelper.getEntity(entityQuery, topologyTemplateQuery, true); // true allows for nested search + if (cvfcEntities == null || cvfcEntities.isEmpty()) { + LOG.debug("insertVFCDataEntity: Could not find the CVFCs for: " + vfCustomizationUid); + } + + for (IEntityDetails cvfcEntity: cvfcEntities) { + + // Insert this CVFC data into VFC_MODEL + try { + + SdncVFCModel vfcModel = new SdncVFCModel(sdcCsarHelper, cvfcEntity, jdbcDataSource, config); + + vfcModel.insertVFCModelData(); + vfcModel.insertVFCtoNetworkRoleMappingData(cvfcEntity); + //vfcModel.insertVFCRelatedNetworkRoleData(getCustomizationUUID(), cvfcEntity); + + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR VFC data"); + throw new IOException (e); + } + } + + } + + public void insertVFCInstanceGroupData () throws IOException { + + // Insert Group data in RESOURCE_GROUP + // Store group capabilities and capability properties in NODE_CAPABILITY and NODE_CAPABILITY_PROPERTY table + + // For each VF, insert VFC Instance Group data (convert to use getEntity in 19.08) + EntityQuery entityQuery = EntityQuery.newBuilder("org.openecomp.groups.VfcInstanceGroup").build(); + String vfCustomizationUuid = getCustomizationUUIDNoQuotes(); + TopologyTemplateQuery topologyTemplateQuery = TopologyTemplateQuery.newBuilder(SdcTypes.VF) + .customizationUUID(vfCustomizationUuid).build(); + List<IEntityDetails> vfcInstanceGroupListForVf = sdcCsarHelper.getEntity(entityQuery, topologyTemplateQuery, false); + if (vfcInstanceGroupListForVf == null) { + return; + } + + for (IEntityDetails group : vfcInstanceGroupListForVf){ + + SdncGroupModel groupModel = new SdncGroupModel (sdcCsarHelper, group, entityDetails, config, jdbcDataSource); + groupModel.insertGroupData(getUUID()); + + // For each group, populate NODE_CAPABILITY/NODE_CAPABILITY_PROPERTY + insertNodeCapabilitiesEntityData(group.getCapabilities()); + + // Store relationship between VfcInstanceGroup and node-type=VFC in RESOURCE_GROUP_TO_TARGET_NODE_MAPPING table + // target is each VFC in targets section of group + List<IEntityDetails> targetNodeList = group.getMemberNodes(); + for (IEntityDetails targetNode : targetNodeList) { + + String targetNodeUuid = extractValue(targetNode.getMetadata(), SdcPropertyNames.PROPERTY_NAME_UUID); + String targetNodeCustomizationUuid = extractValue(targetNode.getMetadata(), SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); + String targetNodeType = extractValue(targetNode.getMetadata(), SdcPropertyNames.PROPERTY_NAME_TYPE); + + // insert RESOURCE_GROUP_TO_TARGET_NODE_MAPPING + try { + Map<String, String> mappingCleanupParams = new HashMap<String, String>(); + addParameter("group_uuid", groupModel.getUUID(), mappingCleanupParams); + addParameter("parent_uuid", getUUID(), mappingCleanupParams); + addParameter("target_node_uuid", targetNodeUuid, mappingCleanupParams); + cleanupExistingToscaData("RESOURCE_GROUP_TO_TARGET_NODE_MAPPING", mappingCleanupParams); + + Map<String, String> mappingParams = new HashMap<String, String>(); + addParameter("parent_uuid", getUUID(), mappingParams); + addParameter("target_node_uuid", targetNodeUuid, mappingParams); + addParameter("target_type", targetNodeType, mappingParams); + String tableName = ""; + switch (targetNodeType) { + case "CVFC": + tableName = "VFC_MODEL"; + break; + case "VL": + tableName = "NETWORK_MODEL"; + break; + } + addParameter("table_name", tableName, mappingParams); + LOG.info("Call insertToscaData for RESOURCE_GROUP_TO_TARGET_NODE_MAPPING where group_uuid = " + groupModel.getUUID() + " and target_node_uuid = \"" + targetNodeUuid + "\""); + insertToscaData(buildSql("RESOURCE_GROUP_TO_TARGET_NODE_MAPPING", "group_uuid", groupModel.getUUID(), model_yaml, mappingParams), null); + } catch (IOException e) { + LOG.error("Could not insert Tosca CSAR data into the RESOURCE_GROUP_TO_TARGET_NODE_MAPPING"); + throw new IOException (e); + } + + // For each target node, get External policies + SdcTypes queryType = SdcTypes.valueOf(extractValue(entityDetails.getMetadata(), SdcPropertyNames.PROPERTY_NAME_TYPE)); + insertEntityPolicyData(getCustomizationUUIDNoQuotes(), getUUID().replace("\"", ""), queryType, targetNodeCustomizationUuid, targetNodeUuid, targetNodeType, "org.openecomp.policies.External"); // AFTER getEntity + } + } + } + + private void insertVFPolicyData() throws IOException { + + // For each VF node, ingest External Policy data + insertEntityPolicyData (getCustomizationUUIDNoQuotes(), getUUID(), serviceUUID.replace("\"", ""), "org.openecomp.policies.External", SdcTypes.VF); + } + + public String getVendor() { + return vendor; + } + + public void setVendor(String vendor) { + this.vendor = vendor; + } + + public String getVendorModelDescription() { + return vendorModelDescription; + } + + public void setVendorModelDescription(String vendorModelDescription) { + this.vendorModelDescription = vendorModelDescription; + } + + public String getNfNamingCode() { + return nfNamingCode; + } + + public void setNfNamingCode(String nfNamingCode) { + this.nfNamingCode = nfNamingCode; + } + + public String getServiceUUID() { + return serviceUUID; + } + public void setServiceUUID(String serviceUUID) { + this.serviceUUID = serviceUUID; + } + + public String getServiceInvariantUUID() { + return serviceInvariantUUID; + } + + public void setServiceInvariantUUID(String serviceInvariantUUID) { + this.serviceInvariantUUID = serviceInvariantUUID; + } + +} diff --git a/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModuleModel.java b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModuleModel.java new file mode 100644 index 000000000..ef815d027 --- /dev/null +++ b/northbound/ueb-listener/src/main/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModuleModel.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * openECOMP : SDN-C + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights + * reserved. + * Modifications Copyright © 2018 IBM. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.northbound.uebclient; + +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; + +public class SdncVFModuleModel extends SdncBaseModel { + + public SdncVFModuleModel(ISdcCsarHelper sdcCsarHelper, IEntityDetails vfModule, SdncVFModel vfNodeModel) { + + super(sdcCsarHelper, vfModule); + // override base implementation for setting metadata because properties are called differently for Groups + customizationUUID = extractValue (vfModule.getMetadata(), "vfModuleModelCustomizationUUID"); + invariantUUID = extractValue (vfModule.getMetadata(), "vfModuleModelInvariantUUID"); + UUID = extractValue (vfModule.getMetadata(), "vfModuleModelUUID"); + version = extractValue (vfModule.getMetadata(), "vfModuleModelVersion"); + addParameter("vf_customization_uuid", vfNodeModel.getCustomizationUUIDNoQuotes()); + addParameter("invariant_uuid", invariantUUID); + addParameter("uuid", UUID); + addParameter("version", version); + + // extract properties + addParameter("vf_module_type", extractValue(vfModule, SdcPropertyNames.PROPERTY_NAME_VFMODULETYPE)); + addParameter("vf_module_label", extractValue(vfModule, "vf_module_label")); + addIntParameter("availability_zone_count", extractValue(vfModule, SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT)); + addParameter("ecomp_generated_vm_assignments", extractBooleanValue(vfModule, SdcPropertyNames.PROPERTY_NAME_ECOMPGENERATEDVMASSIGNMENTS)); + } + +} diff --git a/northbound/ueb-listener/src/main/resources/log4j2.xml b/northbound/ueb-listener/src/main/resources/log4j2.xml new file mode 100644 index 000000000..23ab908a5 --- /dev/null +++ b/northbound/ueb-listener/src/main/resources/log4j2.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<Configuration status="debug"> + <Properties> + <Property name="logDir">$${env:LOGDIR:-logs}</Property> + </Properties> + <Appenders> + <RollingFile name="LOGFILE" fileName="${logDir}/ueb-listener.log" + filePattern="${logDir}/ueb-listener-%i.log"> + <PatternLayout pattern="%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n" /> + <Policies> + <SizeBasedTriggeringPolicy size="10 MB" /> + </Policies> + <DefaultRolloverStrategy max="10"/> + </RollingFile> + <Console name="CONSOLE" target="SYSTEM_OUT"> + <PatternLayout pattern="%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n" /> + </Console> + </Appenders> + <Loggers> + <Root level="debug"> + <AppenderRef ref="LOGFILE"/> + <AppenderRef ref="CONSOLE"/> + </Root> + </Loggers> +</Configuration>
\ No newline at end of file diff --git a/northbound/ueb-listener/src/main/resources/normalizeTagNames.xslt b/northbound/ueb-listener/src/main/resources/normalizeTagNames.xslt new file mode 100755 index 000000000..c37a5e049 --- /dev/null +++ b/northbound/ueb-listener/src/main/resources/normalizeTagNames.xslt @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/> + <xsl:template match="@*|node()"> + <xsl:copy> + <xsl:apply-templates select="@*|node()" /> + </xsl:copy> + </xsl:template> + + <xsl:template match="vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool/entitlement-metric/value/text()[.='# of software instances']">num of software instances</xsl:template> + <xsl:template match="vf-license-model/feature-group-list/feature-group/entitlement-pool-list/entitlement-pool/firstClassCitizenId"/> +</xsl:stylesheet> diff --git a/northbound/ueb-listener/src/main/resources/removeNs.xslt b/northbound/ueb-listener/src/main/resources/removeNs.xslt new file mode 100755 index 000000000..7aa927b14 --- /dev/null +++ b/northbound/ueb-listener/src/main/resources/removeNs.xslt @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version="1.0" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/> + + <xsl:template match="*"> + <xsl:element name="{local-name(.)}"> + <xsl:apply-templates select="@* | node()" /> + </xsl:element> + </xsl:template> + <xsl:template match="@*"> + <xsl:attribute name="{local-name(.)}"> + <xsl:value-of select="." /> + </xsl:attribute> + </xsl:template> +</xsl:stylesheet>
\ No newline at end of file diff --git a/northbound/ueb-listener/src/main/scripts/start-ueb-listener.sh b/northbound/ueb-listener/src/main/scripts/start-ueb-listener.sh new file mode 100644 index 000000000..80ede3c8b --- /dev/null +++ b/northbound/ueb-listener/src/main/scripts/start-ueb-listener.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +PROPERTY_DIR=${PROPERTY_DIR:-/opt/sdnc/data/properties} + + +LISTENER=ueb-listener + +PIDFILE=/tmp/.${LISTENER}-pid +UEBLISTENERROOT=${UEBLISTENERROOT:-/opt/app/ueb-listener} +JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-oracle} +JAVA_OPTS=${JAVA_OPTS:--Dhttps.protocols=TLSv1.1,TLSv1.2} +JAVA=${JAVA:-${JAVA_HOME}/bin/java} + +# Redirect output from script to $LISTENER.out +exec >> ${UEBLISTENERROOT}/logs/$LISTENER.out +exec 2>&1 + +if [ -f $PIDFILE ] +then + pid=$(cat $PIDFILE) + if [ "$pid" != "" ] + then + if kill -0 $pid + then + echo "$LISTENER already running" + exit 0 + fi + fi +fi + +if [ ! -d ${UEBLISTENERROOT}/logs ] +then + mkdir ${UEBLISTENERROOT}/logs +fi + +for file in ${UEBLISTENERROOT}/lib/*.jar +do + LISTENERCLASSPATH=$LISTENERCLASSPATH:$file +done + +${JAVA} ${JAVA_OPTS} -jar ${UEBLISTENERROOT}/lib/ueb-listener*.jar -Dlog4j.configuration=file:${UEBLISTENERROOT}/lib/log4j.properties -cp ${LISTENERCLASSPATH} & + + +echo $! > $PIDFILE + +echo "$LISTENER started!" +exit 0 diff --git a/northbound/ueb-listener/src/main/scripts/stop-ueb-listener.sh b/northbound/ueb-listener/src/main/scripts/stop-ueb-listener.sh new file mode 100644 index 000000000..cf110c5cc --- /dev/null +++ b/northbound/ueb-listener/src/main/scripts/stop-ueb-listener.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +PROPERTY_DIR=${PROPERTY_DIR:-/opt/sdnc/data/properties} + +if [ -f ${PROPERTY_DIR}/dmaap-listener.properties ] +then + LISTENER=dmaap-listener +else + LISTENER=ueb-listener +fi + +PIDFILE=/tmp/.${LISTENER}-pid +UEBLISTENERROOT=${UEBLISTENERROOT:-/opt/app/ueb-listener} + +if [ -f $PIDFILE ] +then + pid=$(cat $PIDFILE) + if [ "$pid" != "" ] + then + if kill -0 $pid + then + echo "Stopping $LISTENER" + kill $pid && rm $PIDFILE + exit 0 + else + echo "$LISTENER not running" + exit 1 + fi + else + echo "$LISTENER not running" + exit 1 + fi +fi + + diff --git a/northbound/ueb-listener/src/site/apt/index.apt b/northbound/ueb-listener/src/site/apt/index.apt new file mode 100644 index 000000000..370ddd4db --- /dev/null +++ b/northbound/ueb-listener/src/site/apt/index.apt @@ -0,0 +1,46 @@ +~~~ +~~ ============LICENSE_START======================================================= +~~ openECOMP : SDN-C +~~ ================================================================================ +~~ Copyright (C) 2017 AT&T Intellectual Property. All rights +~~ reserved. +~~ ================================================================================ +~~ Licensed under the Apache License, Version 2.0 (the "License"); +~~ you may not use this file except in compliance with the License. +~~ You may obtain a copy of the License at +~~ +~~ http://www.apache.org/licenses/LICENSE-2.0 +~~ +~~ Unless required by applicable law or agreed to in writing, software +~~ distributed under the License is distributed on an "AS IS" BASIS, +~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +~~ See the License for the specific language governing permissions and +~~ limitations under the License. +~~ ============LICENSE_END========================================================= +~~~ + + --- + UEB Listener + --- + + +UEB Listener + + The UEB Listener is a daemon that listens for notifications from SDC, posted to UEB (Universal Event Bus). + On receipt of an event, the UEB listener downloads any artifacts posted and examines them to determine if + the format (the outer XML tag) matches a supported format. If so, it posts the file to the ASDC-API REST + API in order to update the SDN-C database. + +File Locations + + * Root directory : /opt/app/ueb-listener + + * Log files : /opt/app/ueb-listener/logs + + * Incoming files to be processed : /opt/app/ueb-listener/spool/asdc/incoming + + * Files already processed : /opt/app/ueb-listener/spool/asdc/archive + + + + diff --git a/northbound/ueb-listener/src/site/site.xml b/northbound/ueb-listener/src/site/site.xml new file mode 100644 index 000000000..6b97d925e --- /dev/null +++ b/northbound/ueb-listener/src/site/site.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + ============LICENSE_START======================================================= + openECOMP : SDN-C + ================================================================================ + Copyright (C) 2017 AT&T Intellectual Property. All rights + reserved. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<project> + + <body> + <menu ref="modules"/> + + <menu ref="reports"/> + + </body> +</project> diff --git a/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModelTest.java b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModelTest.java new file mode 100644 index 000000000..11556df1b --- /dev/null +++ b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncARModelTest.java @@ -0,0 +1,50 @@ +package org.onap.ccsdk.sli.northbound.uebclient; + + import static org.junit.Assert.*; + import static org.mockito.Mockito.*; + +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; + + public class SdncARModelTest { + + SdncARModel testSdncARModel = null; + + @Before + public void setUp() throws Exception { + ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class); + Metadata mockMetadata = mock(Metadata.class); + IEntityDetails mockEntityDetails = mock(IEntityDetails.class); + DBResourceManager mockDBResourceManager = mock(DBResourceManager.class); + SdncUebConfiguration mockSdncUebConfiguration = mock(SdncUebConfiguration.class); + + when(mockEntityDetails.getMetadata()).thenReturn(mockMetadata); + + testSdncARModel = new SdncARModel(mockCsarHelper,mockEntityDetails,mockDBResourceManager,mockSdncUebConfiguration); + assertNotNull(testSdncARModel); + } + + @Test + public void testSetGetSubcategory() { + String subcategory = "test-subcategory"; + testSdncARModel.setSubcategory(subcategory); + String result = testSdncARModel.getSubcategory(); + assertEquals(subcategory, result); + } + + @Test + public void testInsertAllottedResourceModelData() { + try { + testSdncARModel.insertAllottedResourceModelData(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + } diff --git a/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModelTest.java b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModelTest.java new file mode 100644 index 000000000..0dfbf087f --- /dev/null +++ b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncGroupModelTest.java @@ -0,0 +1,39 @@ +package org.onap.ccsdk.sli.northbound.uebclient; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; + +import java.io.IOException; + +import org.junit.Test; +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; + + public class SdncGroupModelTest { + + @Test + public void testSdncGroupModelConstructor() { + ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class); + IEntityDetails group = mock(IEntityDetails.class); + IEntityDetails entityDetails = mock(IEntityDetails.class); + Metadata mockMetadata = mock(Metadata.class); + DBResourceManager mockDBResourceManager = mock(DBResourceManager.class); + SdncUebConfiguration mockSdncUebConfiguration = mock(SdncUebConfiguration.class); + + when(entityDetails.getMetadata()).thenReturn(mockMetadata); + when(group.getMetadata()).thenReturn(mockMetadata); + + SdncGroupModel testSdncGroupModel = null; + try { + testSdncGroupModel = new SdncGroupModel(mockCsarHelper,group,entityDetails,mockSdncUebConfiguration,mockDBResourceManager); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + assertNotNull(testSdncGroupModel); + } + + } + diff --git a/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java new file mode 100644 index 000000000..3f4728f07 --- /dev/null +++ b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncNodeModelTest.java @@ -0,0 +1,71 @@ +package org.onap.ccsdk.sli.northbound.uebclient; + +import static org.junit.Assert.*; + +import static org.mockito.Mockito.*; + +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; + +public class SdncNodeModelTest { + + SdncNodeModel sdncNodeModel; + + @Before + public void setUp() throws Exception { + SdncUebConfiguration config = mock(SdncUebConfiguration.class); + ISdcCsarHelper isdcCsarHelper = mock(ISdcCsarHelper.class); + IEntityDetails entityDetails = mock(IEntityDetails.class); + Metadata mockMetadata = mock(Metadata.class); + DBResourceManager mockDBResourceManager = mock(DBResourceManager.class); + + when(entityDetails.getMetadata()).thenReturn(mockMetadata); + when(mockMetadata.getValue("customizationUUID")).thenReturn("aaaa-bbbb-cccc-dddd"); + + sdncNodeModel = new SdncNodeModel(isdcCsarHelper, entityDetails, mockDBResourceManager, config); + sdncNodeModel.setServiceUUID("0e8d757f-1c80-40af-85de-31d64f1f5af8"); + sdncNodeModel.setEcompGeneratedNaming("hello-world"); + } + + @Test + public void testGetServiceUUID() { + String result = sdncNodeModel.getServiceUUID(); + assertNotNull(result != null); + } + + @Test + public void testGetEcompGeneratedNaming() { + String result = sdncNodeModel.getEcompGeneratedNaming(); + assertEquals("hello-world", result); + } + + @Test + public void testGetSqlString() { + String result = sdncNodeModel.getSql("TEST-HELLO"); + String test = "INSERT into NETWORK_MODEL (service_uuid, customization_uuid, model_yaml, ecomp_generated_naming) values (0e8d757f-1c80-40af-85de-31d64f1f5af8, \"aaaa-bbbb-cccc-dddd\", \"TEST-HELLO\", \"hello-world\");"; + assertEquals(test, result); + } + + @Test + public void testGetVpnBindingsSql() { + String result = sdncNodeModel.getVpnBindingsSql(); + assertNotNull(result); + } + + @Test + public void testInsertNetworkModelData() { + try { + sdncNodeModel.insertNetworkModelData(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + +} diff --git a/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncPNFModelTest.java b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncPNFModelTest.java new file mode 100644 index 000000000..97c3942dc --- /dev/null +++ b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncPNFModelTest.java @@ -0,0 +1,102 @@ +package org.onap.ccsdk.sli.northbound.uebclient; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.sdc.toscaparser.api.Property; + +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; + + public class SdncPNFModelTest { + + SdncPNFModel testSdncPNFModel = null; + + @Before + public void setUp() throws Exception { + ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class); + IEntityDetails mockEntityDetails = mock(IEntityDetails.class); + Metadata mockMetadata = mock(Metadata.class); + Property mockProperty = mock(Property.class); + Map<String, Property> mockProperties = new HashMap<String, Property>(); + DBResourceManager mockDBResourceManager = mock(DBResourceManager.class); + SdncUebConfiguration mockSdncUebConfiguration = mock(SdncUebConfiguration.class); + + when(mockEntityDetails.getMetadata()).thenReturn(mockMetadata); + when(mockMetadata.getValue("customizationUUID")).thenReturn("aaaa-bbbb-cccc-dddd"); + mockProperty.setValue("test-nf-naming-code"); + when(mockProperties.get("nf_naming_code")).thenReturn(mockProperty); + + try { + testSdncPNFModel = new SdncPNFModel(mockCsarHelper,mockEntityDetails,mockDBResourceManager,mockSdncUebConfiguration); + testSdncPNFModel.setServiceUUID("bbbb-cccc-dddd-eeee"); + testSdncPNFModel.setServiceInvariantUUID("cccc-dddd-eeee-ffff"); + testSdncPNFModel.setVendor("Cisco"); + testSdncPNFModel.setVendorModelDescription("Cisco Equipment Model"); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + assertNotNull(testSdncPNFModel); + } + + @Test + public void testSetGetVendor() { + String newVendorModel = "new-vendor-model"; + testSdncPNFModel.setVendor(newVendorModel); + String result = testSdncPNFModel.getVendor(); + assertEquals(result, newVendorModel); + } + + @Test + public void testSetGetVendorModelDescription() { + String newVendorModelDescription = "new-vendor-model-description"; + testSdncPNFModel.setVendorModelDescription(newVendorModelDescription); + String result = testSdncPNFModel.getVendorModelDescription(); + assertEquals(result, newVendorModelDescription); + } + + @Test + public void testSetGetNfNamingCode() { + String newNfNamingCode = "new-nf-naming-code"; + testSdncPNFModel.setNfNamingCode(newNfNamingCode); + String result = testSdncPNFModel.getNfNamingCode(); + assertEquals(result, newNfNamingCode); + } + + @Test + public void testSetGetServiceUUID() { + String newServiceUuid = "cccc-dddd-eeee-ffff"; + testSdncPNFModel.setServiceUUID(newServiceUuid); + String result = testSdncPNFModel.getServiceUUID(); + assertEquals(newServiceUuid, result); + } + + @Test + public void testSetGetServiceInvariantUUID() { + String newServiceInvariantUuid = "dddd-eeee-ffff-eeee"; + testSdncPNFModel.setServiceInvariantUUID(newServiceInvariantUuid); + String result = testSdncPNFModel.getServiceInvariantUUID(); + assertEquals(result, newServiceInvariantUuid); + } + + @Test + public void testInsertData() { + try { + testSdncPNFModel.insertData(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } diff --git a/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncServiceModelTest.java b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncServiceModelTest.java new file mode 100644 index 000000000..b86a8e131 --- /dev/null +++ b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncServiceModelTest.java @@ -0,0 +1,76 @@ +package org.onap.ccsdk.sli.northbound.uebclient; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; + +import org.junit.Before; +import org.junit.Test; +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.toscaparser.api.elements.Metadata; + + public class SdncServiceModelTest { + + SdncServiceModel testSdncServiceModel = null; + + @Before + public void setUp() throws Exception { + ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class); + DBResourceManager mockDBResourceManager = mock(DBResourceManager.class); + Metadata mockMetadata = mock(Metadata.class); + + when(mockMetadata.getValue("UUID")).thenReturn("aaaa-bbbb-cccc-dddd"); + when(mockMetadata.getValue("invariantUUID")).thenReturn("bbbb-cccc-dddd-eeee"); + when(mockMetadata.getValue("namingPolicy")).thenReturn("test-naming-policy"); + testSdncServiceModel = new SdncServiceModel(mockCsarHelper,mockMetadata,mockDBResourceManager); + + assertNotNull(testSdncServiceModel); + } + + @Test + public void testSetGetServiceUUID() { + String newServiceUuid = "cccc-dddd-eeee-ffff"; + testSdncServiceModel.setServiceUUID(newServiceUuid); + String result = testSdncServiceModel.getServiceUUID(); + assertEquals("\"" + newServiceUuid + "\"", result); + } + + @Test + public void testSetGetServiceInvariantUUID() { + String result = testSdncServiceModel.getServiceInvariantUUID(); + assertEquals(result, "\"bbbb-cccc-dddd-eeee\""); + } + + @Test + public void testSetGeServiceInstanceNamePrefix() { + String serviceInstanceNamePrefix = "test-service-instance-name-prefix"; + testSdncServiceModel.setServiceInstanceNamePrefix(serviceInstanceNamePrefix); + String result = testSdncServiceModel.getServiceInstanceNamePrefix(); + assertEquals(serviceInstanceNamePrefix, result); + } + + @Test + public void testSetGetResourceVendor() { + String resourceVendor = "Fortinet"; + testSdncServiceModel.setResourceVendor(resourceVendor); + String result = testSdncServiceModel.getResourceVendor(); + assertEquals(resourceVendor, result); + } + + @Test + public void testSetGetResourceVendorRelease() { + String resourceVendorRelease = "1.0.0"; + testSdncServiceModel.setResourceVendorRelease(resourceVendorRelease); + String result = testSdncServiceModel.getResourceVendorRelease(); + assertEquals(resourceVendorRelease, result); + } + + @Test + public void testGetSqlString() { + String result = testSdncServiceModel.getSql("TEST-HELLO"); + String test = "INSERT into SERVICE_MODEL (service_uuid, model_yaml, filename, naming_policy, invariant_uuid) values (\"aaaa-bbbb-cccc-dddd\", \"TEST-HELLO\", \"null\", \"test-naming-policy\", \"bbbb-cccc-dddd-eeee\");"; + assertEquals(test, result); + } + + + } diff --git a/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModelTest.java b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModelTest.java new file mode 100644 index 000000000..f8680522f --- /dev/null +++ b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFCModelTest.java @@ -0,0 +1,101 @@ +package org.onap.ccsdk.sli.northbound.uebclient; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; + +import org.junit.Before; +import org.junit.Test; +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; + +public class SdncVFCModelTest { + + SdncVFCModel testSdncVFCModel; + IEntityDetails mockEntityDetails = null; + + @Before + public void setup() { + ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class); + mockEntityDetails = mock(IEntityDetails.class); + Metadata mockMetadata = mock(Metadata.class); + DBResourceManager mockDBResourceManager = mock(DBResourceManager.class); + SdncUebConfiguration mockSdncUebConfiguration = mock(SdncUebConfiguration.class); + + when(mockEntityDetails.getMetadata()).thenReturn(mockMetadata); + when(mockMetadata.getValue("customizationUUID")).thenReturn("aaaa-bbbb-cccc-dddd"); + + Map<String,Map<String,Object>> cpPropertiesMap = new HashMap<String,Map<String,Object>>(); + Map<String,Object> propertiesMap = new HashMap<String,Object>(); + propertiesMap.put("network-role", "test-network-role"); + propertiesMap.put("network-role-tag", "test-network-role-tag"); + + ArrayList<Map<String, Object>> ipRequirementsList = new ArrayList<Map<String, Object>>(); + Map<String,Object> ip4Prop = new HashMap<String,Object>(); + ip4Prop.put("ip_version", "4"); + ipRequirementsList.add(ip4Prop); + Map<String,Object> ip6Prop = new HashMap<String,Object>(); + ip4Prop.put("ip_version", "6"); + ipRequirementsList.add(ip4Prop); + + propertiesMap.put("ip_requirements", ipRequirementsList); + cpPropertiesMap.put("cp-node-1", propertiesMap); + + try { + testSdncVFCModel = new SdncVFCModel(mockCsarHelper, mockEntityDetails, mockDBResourceManager, mockSdncUebConfiguration); + testSdncVFCModel.setVmType("Test-type"); + testSdncVFCModel.setVmCount("5"); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + } + + @Test + public void testSdncVFCModelSetGetVmType() { + String newVMtype = "new-vm-type"; + testSdncVFCModel.setVmType(newVMtype); + assertEquals(testSdncVFCModel.getVmType(), "new-vm-type"); + } + + @Test + public void testSdncVFCModelSetGetVmCount() { + String newVMcount = "4"; + testSdncVFCModel.setVmCount(newVMcount); + assertEquals(testSdncVFCModel.getVmCount(), "4"); + } + + @Test + public void testInsertVFCModelData() { + try { + testSdncVFCModel.insertVFCModelData(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Test + public void testInsertVFCtoNetworkRoleMappingData() { + try { + testSdncVFCModel.insertVFCtoNetworkRoleMappingData(mockEntityDetails); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + @Test + public void testIpPropParamsMapContainsSubnetRole() { + ArrayList<Map<String, String>> testList = new ArrayList<Map<String, String>>(); + testSdncVFCModel.ipPropParamsMapContainsSubnetRole(testList, "test-subnet-role"); + } + +} diff --git a/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModelTest.java b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModelTest.java new file mode 100644 index 000000000..93f7d3467 --- /dev/null +++ b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModelTest.java @@ -0,0 +1,104 @@ +package org.onap.ccsdk.sli.northbound.uebclient; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.*; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +import org.junit.Before; +import org.junit.Test; +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; +import org.onap.sdc.toscaparser.api.Property; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; + + public class SdncVFModelTest { + + SdncVFModel testSdncVFModel = null; + + @Before + public void setUp() throws Exception { + ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class); + IEntityDetails mockEntityDetails = mock(IEntityDetails.class); + Metadata mockMetadata = mock(Metadata.class); + DBResourceManager mockDBResourceManager = mock(DBResourceManager.class); + SdncUebConfiguration mockSdncUebConfiguration = mock(SdncUebConfiguration.class); + + Property mockProperty = mock(Property.class); + Map<String, Property> mockProperties = new HashMap<String, Property>(); + + when(mockEntityDetails.getMetadata()).thenReturn(mockMetadata); + when(mockEntityDetails.getProperties()).thenReturn(mockProperties); + when(mockMetadata.getValue("customizationUUID")).thenReturn("aaaa-bbbb-cccc-dddd"); + when(mockMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)).thenReturn("VF"); + mockProperty.setValue("test-nf-naming-code"); + when(mockProperties.get("nf_naming_code")).thenReturn(mockProperty); + try { + testSdncVFModel = new SdncVFModel(mockCsarHelper,mockEntityDetails,mockDBResourceManager,mockSdncUebConfiguration); + testSdncVFModel.setServiceUUID("bbbb-cccc-dddd-eeee"); + testSdncVFModel.setServiceInvariantUUID("cccc-dddd-eeee-ffff"); + testSdncVFModel.setVendor("Cisco"); + testSdncVFModel.setVendorModelDescription("Cisco Equipment Model"); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + assertNotNull(testSdncVFModel); + } + + @Test + public void testSetGetVendor() { + String newVendorModel = "new-vendor-model"; + testSdncVFModel.setVendor(newVendorModel); + String result = testSdncVFModel.getVendor(); + assertEquals(result, newVendorModel); + } + + @Test + public void testSetGetVendorModelDescription() { + String newVendorModelDescription = "new-vendor-model-description"; + testSdncVFModel.setVendorModelDescription(newVendorModelDescription); + String result = testSdncVFModel.getVendorModelDescription(); + assertEquals(result, newVendorModelDescription); + } + + @Test + public void testSetGetNfNamingCode() { + String newNfNamingCode = "new-nf-naming-code"; + testSdncVFModel.setNfNamingCode(newNfNamingCode); + String result = testSdncVFModel.getNfNamingCode(); + assertEquals(result, newNfNamingCode); + } + + @Test + public void testSetGetServiceUUID() { + String newServiceUuid = "cccc-dddd-eeee-ffff"; + testSdncVFModel.setServiceUUID(newServiceUuid); + String result = testSdncVFModel.getServiceUUID(); + assertEquals(newServiceUuid, result); + } + + @Test + public void testSetGetServiceInvariantUUID() { + String newServiceInvariantUuid = "dddd-eeee-ffff-eeee"; + testSdncVFModel.setServiceInvariantUUID(newServiceInvariantUuid); + String result = testSdncVFModel.getServiceInvariantUUID(); + assertEquals(result, newServiceInvariantUuid); + } + + @Test + public void testInsertData() { + try { + testSdncVFModel.insertData(); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + } diff --git a/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModuleModelTest.java b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModuleModelTest.java new file mode 100644 index 000000000..e19e8dfa9 --- /dev/null +++ b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/SdncVFModuleModelTest.java @@ -0,0 +1,28 @@ +package org.onap.ccsdk.sli.northbound.uebclient; + +import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import org.junit.Test; +import org.onap.sdc.tosca.parser.api.IEntityDetails; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; +import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.ccsdk.sli.northbound.uebclient.SdncVFModel; + +public class SdncVFModuleModelTest { + + @Test + public void testSdncVFModuleModelConstructor() { + IEntityDetails mockEntity = mock(IEntityDetails.class); + Metadata mockMetadata = mock(Metadata.class); + ISdcCsarHelper mockCsarHelper = mock(ISdcCsarHelper.class); + SdncVFModel mockSdncVFModel = mock(SdncVFModel.class); + + when(mockEntity.getMetadata()).thenReturn(mockMetadata); + + SdncVFModuleModel testSdncVFModel = new SdncVFModuleModel(mockCsarHelper, mockEntity, mockSdncVFModel); + assertNotNull(testSdncVFModel); + } + +} diff --git a/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncOdlConnection.java b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncOdlConnection.java new file mode 100644 index 000000000..1b4b22f42 --- /dev/null +++ b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncOdlConnection.java @@ -0,0 +1,45 @@ +package org.onap.ccsdk.sli.northbound.uebclient; + +import ch.vorburger.mariadb4j.DB; +import ch.vorburger.mariadb4j.DBConfigurationBuilder; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; +import org.onap.sdc.api.IDistributionClient; +import org.onap.sdc.api.notification.INotificationData; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.ConnectException; +import java.net.URL; +import java.nio.file.DirectoryStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.util.Properties; + +import static org.mockito.Mockito.mock; + +public class TestSdncOdlConnection { + + @Test + public void test() { + + try { + SdncOdlConnection sdncOdlConnection = SdncOdlConnection.newInstance("https://127.0.0.1:8447/aai/v11/network/pnfs/pnf/a8098c1a-f86e-11da-bd1a-00112444be1e", "", ""); + sdncOdlConnection.send("PUT", "application/json", "{\n" + + " \"input\" : { \n" + + " }\n" + + "}"); + } catch (ConnectException e) { + //Connection exception + } catch (IOException e) { + e.printStackTrace(); + } + } + +} diff --git a/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java new file mode 100644 index 000000000..24dfd36b1 --- /dev/null +++ b/northbound/ueb-listener/src/test/java/org/onap/ccsdk/sli/northbound/uebclient/TestSdncUebCallback.java @@ -0,0 +1,475 @@ +package org.onap.ccsdk.sli.northbound.uebclient; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.*; + +import java.io.File; +import java.io.InputStream; +import java.net.URL; +import java.nio.file.DirectoryStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.onap.ccsdk.sli.core.dblib.DBResourceManager; +import org.onap.sdc.api.IDistributionClient; +import org.onap.sdc.api.notification.IArtifactInfo; +import org.onap.sdc.api.notification.INotificationData; +import org.onap.sdc.api.notification.IResourceInstance; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ch.vorburger.mariadb4j.DB; +import ch.vorburger.mariadb4j.DBConfigurationBuilder; + +public class TestSdncUebCallback { + + + private static final String CRTBL_SERVICE_MODEL = "CREATE TABLE `SERVICE_MODEL` (\n" + + " `service_uuid` varchar(255) NOT NULL,\n" + + " `model_yaml` longblob,\n" + + " `invariant_uuid` varchar(255) DEFAULT NULL,\n" + + " `version` varchar(255) DEFAULT NULL,\n" + + " `name` varchar(255) DEFAULT NULL,\n" + + " `description` varchar(1024) DEFAULT NULL,\n" + + " `type` varchar(255) DEFAULT NULL,\n" + + " `category` varchar(255) DEFAULT NULL,\n" + + " `ecomp_naming` char(1) DEFAULT NULL,\n" + + " `service_instance_name_prefix` varchar(255) DEFAULT NULL,\n" + + " `filename` varchar(100) DEFAULT NULL,\n" + + " `naming_policy` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`service_uuid`)\n" + + ") "; + + private static final String CRTBL_SERVICE_MODEL_TO_VF_MODEL_MAPPING = "CREATE TABLE `SERVICE_MODEL_TO_VF_MODEL_MAPPING` (\n" + + " `service_uuid` varchar(255) NOT NULL,\n" + + " `vf_uuid` varchar(255) DEFAULT NULL,\n" + + " `vf_customization_uuid` varchar(255) DEFAULT NULL,\n" + + " `service_invariant_uuid` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`service_uuid`)\n" + + ") "; + + private static final String CRTBL_ATTRIBUTE_VALUE_PAIR = "CREATE TABLE `ATTRIBUTE_VALUE_PAIR` (\n" + + " `resource_uuid` varchar(255) NOT NULL,\n" + + " `attribute_name` varchar(255) NOT NULL,\n" + + " `resource_type` varchar(255) NOT NULL,\n" + + " `attribute_value` varchar(255) DEFAULT NULL,\n" + + " `resource_customization_uuid` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`resource_uuid`,`attribute_name`,`resource_type`)\n" + + ") "; + + private static final String CRTBL_NETWORK_MODEL = "CREATE TABLE `NETWORK_MODEL` (\n" + + " `customization_uuid` varchar(255) NOT NULL,\n" + + " `service_uuid` varchar(255) NOT NULL,\n" + + " `model_yaml` longblob,\n" + + " `invariant_uuid` varchar(255) DEFAULT NULL,\n" + + " `uuid` varchar(255) DEFAULT NULL,\n" + + " `network_type` varchar(255) DEFAULT NULL,\n" + + " `network_role` varchar(255) DEFAULT NULL,\n" + + " `network_technology` varchar(255) DEFAULT NULL,\n" + + " `network_scope` varchar(255) DEFAULT NULL,\n" + + " `naming_policy` varchar(255) DEFAULT NULL,\n" + + " `ecomp_generated_naming` char(1) DEFAULT NULL,\n" + + " `is_shared_network` char(1) DEFAULT NULL,\n" + + " `is_external_network` char(1) DEFAULT NULL,\n" + + " `is_provider_network` char(1) DEFAULT NULL,\n" + + " `physical_network_name` varchar(255) DEFAULT NULL,\n" + + " `is_bound_to_vpn` char(1) DEFAULT NULL,\n" + + " `vpn_binding` varchar(255) DEFAULT NULL,\n" + + " `use_ipv4` char(1) DEFAULT NULL,\n" + + " `ipv4_dhcp_enabled` char(1) DEFAULT NULL,\n" + + " `ipv4_ip_version` char(1) DEFAULT NULL,\n" + + " `ipv4_cidr_mask` varchar(255) DEFAULT NULL,\n" + + " `eipam_v4_address_plan` varchar(255) DEFAULT NULL,\n" + + " `use_ipv6` char(1) DEFAULT NULL,\n" + + " `ipv6_dhcp_enabled` char(1) DEFAULT NULL,\n" + + " `ipv6_ip_version` char(1) DEFAULT NULL,\n" + + " `ipv6_cidr_mask` varchar(255) DEFAULT NULL,\n" + + " `eipam_v6_address_plan` varchar(255) DEFAULT NULL,\n" + + " `version` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`customization_uuid`),\n" + + " KEY `FK_NETWORK_MODEL` (`service_uuid`),\n" + + " CONSTRAINT `FK_NETWORK_MODEL` FOREIGN KEY (`service_uuid`) REFERENCES `SERVICE_MODEL` (`service_uuid`) ON DELETE NO ACTION ON UPDATE NO ACTION\n" + + ")"; + + private static final String CRTBL_ALLOTTED_RESOURCE_MODEL = "CREATE TABLE `ALLOTTED_RESOURCE_MODEL` (\n" + + " `customization_uuid` varchar(255) NOT NULL,\n" + + " `model_yaml` longblob,\n" + + " `invariant_uuid` varchar(255) DEFAULT NULL,\n" + + " `uuid` varchar(255) DEFAULT NULL,\n" + + " `version` varchar(255) DEFAULT NULL,\n" + + " `naming_policy` varchar(255) DEFAULT NULL,\n" + + " `ecomp_generated_naming` char(1) DEFAULT NULL,\n" + + " `depending_service` varchar(255) DEFAULT NULL,\n" + + " `role` varchar(255) DEFAULT NULL,\n" + + " `type` varchar(255) DEFAULT NULL,\n" + + " `service_dependency` varchar(255) DEFAULT NULL,\n" + + " `allotted_resource_type` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`customization_uuid`)\n" + + ") "; + + private static final String CRTBL_VFC_MODEL = "CREATE TABLE `VFC_MODEL` (\n" + + " `customization_uuid` varchar(255) NOT NULL,\n" + + " `model_yaml` longblob,\n" + + " `invariant_uuid` varchar(255) DEFAULT NULL,\n" + + " `uuid` varchar(255) DEFAULT NULL,\n" + + " `version` varchar(255) DEFAULT NULL,\n" + + " `naming_policy` varchar(255) DEFAULT NULL,\n" + + " `ecomp_generated_naming` char(1) DEFAULT NULL,\n" + + " `nfc_function` varchar(255) DEFAULT NULL,\n" + + " `nfc_naming_code` varchar(255) DEFAULT NULL,\n" + + " `vm_type` varchar(255) DEFAULT NULL,\n" + + " `vm_type_tag` varchar(255) DEFAULT NULL,\n" + + " `vm_image_name` varchar(255) DEFAULT NULL,\n" + + " `vm_flavor_name` varchar(255) DEFAULT NULL,\n" + + " `high_availability` varchar(255) DEFAULT NULL,\n" + + " `nfc_naming` varchar(255) DEFAULT NULL,\n" + + " `min_instances` int(11) DEFAULT NULL,\n" + + " `max_instances` int(11) DEFAULT NULL,\n" + + " PRIMARY KEY (`customization_uuid`)\n" + + ") "; + + private static final String CRTBL_VFC_RELATED_NETWORK_ROLE = "CREATE TABLE `VFC_RELATED_NETWORK_ROLE` (\n" + + " `vfc_customization_uuid` varchar(255) NOT NULL,\n" + + " `vm_type` varchar(255) NOT NULL,\n" + + " `network_role` varchar(255) NOT NULL,\n" + + " `related_network_role` varchar(255) NOT NULL,\n" + + " PRIMARY KEY (`vfc_customization_uuid`,`vm_type`,`network_role`,`related_network_role`)\n" + + ") "; + + private static final String CRTBL_VFC_TO_NETWORK_ROLE_MAPPING = "CREATE TABLE `VFC_TO_NETWORK_ROLE_MAPPING` (\n" + + " `seq` int(11) NOT NULL AUTO_INCREMENT,\n" + + " `vfc_customization_uuid` varchar(255) NOT NULL,\n" + + " `network_role` varchar(255) NOT NULL,\n" + + " `vm_type` varchar(255) DEFAULT NULL,\n" + + " `network_role_tag` varchar(255) DEFAULT NULL,\n" + + " `ipv4_count` int(11) NOT NULL,\n" + + " `ipv6_count` int(11) NOT NULL,\n" + + " `ipv4_use_dhcp` char(1) DEFAULT NULL,\n" + + " `ipv6_use_dhcp` char(1) DEFAULT NULL,\n" + + " `ipv4_ip_version` char(1) DEFAULT NULL,\n" + + " `ipv6_ip_version` char(1) DEFAULT NULL,\n" + + " `extcp_subnetpool_id` varchar(512) DEFAULT NULL,\n" + + " `ipv4_floating_count` int(11) DEFAULT NULL,\n" + + " `ipv6_floating_count` int(11) DEFAULT NULL,\n" + + " `ipv4_address_plan_name` varchar(512) DEFAULT NULL,\n" + + " `ipv6_address_plan_name` varchar(512) DEFAULT NULL,\n" + + " `ipv4_vrf_name` varchar(512) DEFAULT NULL,\n" + + " `ipv6_vrf_name` varchar(512) DEFAULT NULL,\n" + + " `subnet_role` varchar(255) DEFAULT NULL,\n" + + " `subinterface_indicator` char(1) DEFAULT NULL,\n" + + " PRIMARY KEY (`seq`),\n" + + " KEY `IX1_VFC_TO_NETWORK_ROLE_MAPPING` (`vfc_customization_uuid`)\n" + + ") "; + + private static final String CRTBL_VF_MODEL = "CREATE TABLE `VF_MODEL` (\n" + + " `customization_uuid` varchar(255) NOT NULL,\n" + + " `model_yaml` longblob,\n" + + " `invariant_uuid` varchar(255) DEFAULT NULL,\n" + + " `uuid` varchar(255) DEFAULT NULL,\n" + + " `version` varchar(255) DEFAULT NULL,\n" + + " `name` varchar(255) DEFAULT NULL,\n" + + " `naming_policy` varchar(255) DEFAULT NULL,\n" + + " `ecomp_generated_naming` char(1) DEFAULT NULL,\n" + + " `avail_zone_max_count` int(11) DEFAULT NULL,\n" + + " `nf_function` varchar(255) DEFAULT NULL,\n" + + " `nf_code` varchar(255) DEFAULT NULL,\n" + + " `nf_type` varchar(255) DEFAULT NULL,\n" + + " `nf_role` varchar(255) DEFAULT NULL,\n" + + " `vendor` varchar(255) DEFAULT NULL,\n" + + " `vendor_version` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`customization_uuid`)\n" + + ")"; + + private static final String CRTBL_VNF_RELATED_NETWORK_ROLE = "CREATE TABLE `VNF_RELATED_NETWORK_ROLE` (\n" + + " `vnf_customization_uuid` varchar(255) NOT NULL,\n" + + " `network_role` varchar(255) NOT NULL,\n" + + " `related_network_role` varchar(255) NOT NULL,\n" + + " PRIMARY KEY (`vnf_customization_uuid`,`network_role`,`related_network_role`)\n" + + ")"; + + private static final String CRTBL_VF_TO_NETWORK_ROLE_MAPPING = "CREATE TABLE `VF_TO_NETWORK_ROLE_MAPPING` (\n" + + " `seq` int(11) NOT NULL AUTO_INCREMENT,\n" + + " `vf_customization_uuid` varchar(255) NOT NULL,\n" + + " `network_role` varchar(255) NOT NULL,\n" + + " PRIMARY KEY (`seq`),\n" + + " KEY `IX1_VF_TO_NETWORK_ROLE_MAPPING` (`vf_customization_uuid`)\n" + + ")"; + + private static final String CRTBL_VF_MODULE_MODEL = "CREATE TABLE `VF_MODULE_MODEL` (\n" + + " `customization_uuid` varchar(255) NOT NULL,\n" + + " `model_yaml` longblob,\n" + + " `invariant_uuid` varchar(255) DEFAULT NULL,\n" + + " `uuid` varchar(255) DEFAULT NULL,\n" + + " `version` varchar(255) DEFAULT NULL,\n" + + " `vf_module_type` varchar(255) DEFAULT NULL,\n" + + " `availability_zone_count` int(11) DEFAULT NULL,\n" + + " `ecomp_generated_vm_assignments` char(1) DEFAULT NULL,\n" + + " `vf_customization_uuid` char(255) DEFAULT NULL,\n" + + " `vf_module_label` char(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`customization_uuid`)\n" + + ")"; + + private static final String CRTBL_VF_MODULE_TO_VFC_MAPPING = "CREATE TABLE `VF_MODULE_TO_VFC_MAPPING` (\n" + + " `seq` int(11) NOT NULL AUTO_INCREMENT,\n" + + " `vf_module_customization_uuid` varchar(255) NOT NULL,\n" + + " `vfc_customization_uuid` varchar(255) NOT NULL,\n" + + " `vm_type` varchar(255) NOT NULL,\n" + + " `vm_count` int(11) NOT NULL,\n" + + " PRIMARY KEY (`seq`),\n" + + " KEY `IX1_VF_MODULE_TO_VFC_MAPPING` (`vf_module_customization_uuid`)\n" + + ")"; + + private static final String CRTBL_RESOURCE_GROUP = "CREATE TABLE `RESOURCE_GROUP` (\n" + + " `resource_uuid` varchar(255) NOT NULL,\n" + + " `group_uuid` varchar(255) NOT NULL,\n" + + " `group_customization_uuid` varchar(255) DEFAULT NULL,\n" + + " `group_invariant_uuid` varchar(255) DEFAULT NULL,\n" + + " `group_name` varchar(255) DEFAULT NULL,\n" + + " `version` varchar(255) DEFAULT NULL,\n" + + " `group_type` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`resource_uuid`,`group_uuid`)\n" + + ")"; + + private static final String CRTBL_RESOURCE_GROUP_TO_TARGET_NODE_MAPPING = "CREATE TABLE `RESOURCE_GROUP_TO_TARGET_NODE_MAPPING` (\n" + + " `group_uuid` varchar(255) NOT NULL,\n" + + " `parent_uuid` varchar(255) NOT NULL,\n" + + " `target_node_uuid` varchar(255) NOT NULL,\n" + + " `target_type` varchar(255) DEFAULT NULL,\n" + + " `table_name` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`group_uuid`,`parent_uuid`,`target_node_uuid`)\n" + + ")"; + + private static final String CRTBL_RESOURCE_POLICY = "CREATE TABLE `RESOURCE_POLICY` (\n" + + " `resource_uuid` varchar(255) NOT NULL,\n" + + " `policy_uuid` varchar(255) NOT NULL,\n" + + " `policy_invariant_uuid` varchar(255) NOT NULL,\n" + + " `policy_name` varchar(255) DEFAULT NULL,\n" + + " `version` varchar(255) DEFAULT NULL,\n" + + " `policy_type` varchar(255) DEFAULT NULL,\n" + + " `property_type` varchar(255) DEFAULT NULL,\n" + + " `property_source` varchar(255) DEFAULT NULL,\n" + + " `property_name` varchar(255) DEFAULT NULL,\n" + + " `policy_customization_uuid` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`resource_uuid`,`policy_uuid`)\n" + + ")"; + + private static final String CRTBL_RESOURCE_POLICY_TO_TARGET_NODE_MAPPING = "CREATE TABLE `RESOURCE_POLICY_TO_TARGET_NODE_MAPPING` (\n" + + " `policy_uuid` varchar(255) NOT NULL,\n" + + " `parent_uuid` varchar(255) NOT NULL,\n" + + " `target_node_uuid` varchar(255) NOT NULL,\n" + + " `target_type` varchar(255) DEFAULT NULL,\n" + + " `target_node_customization_uuid` varchar(255) DEFAULT NULL,\n" + + " `policy_customization_uuid` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`policy_uuid`,`parent_uuid`,`target_node_uuid`)\n" + + ")"; + + private static final String CRTBL_NODE_CAPABILITY = "CREATE TABLE `NODE_CAPABILITY` (\n" + + " `capability_id` int(11) NOT NULL AUTO_INCREMENT,\n" + + " `capability_provider_uuid` varchar(255) NOT NULL,\n" + + " `capability_provider_customization_uuid` varchar(255) NOT NULL,\n" + + " `capability_name` varchar(255) DEFAULT NULL,\n" + + " `capability_type` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`capability_id`)\n" + + ")"; + + private static final String CRTBL_NODE_CAPABILITY_PROPERTY = "CREATE TABLE `NODE_CAPABILITY_PROPERTY` (\n" + + " `capability_id` int(11) NOT NULL AUTO_INCREMENT,\n" + + " `capability_property_name` varchar(255) NOT NULL,\n" + + " `capability_property_type` varchar(255) DEFAULT NULL,\n" + + " PRIMARY KEY (`capability_id`,`capability_property_name`),\n" + + " CONSTRAINT `NODE_CAPABILITY_PROPERTY_TO_NODE_CAPABILITY` FOREIGN KEY (`capability_id`) REFERENCES `NODE_CAPABILITY` (`capability_id`) ON DELETE CASCADE\n" + + ")"; + + + private static final Logger LOG = LoggerFactory + .getLogger(TestSdncUebCallback.class); + SdncUebConfiguration config; + DBResourceManager dblibSvc; + DB db; + List<IArtifactInfo > processLevelArtifactList; + List<IArtifactInfo > serviceLevelArtifactList; + ArrayList<IResourceInstance> resourceList; + IArtifactInfo mockProcessArtifact1; + IArtifactInfo mockProcessArtifact2; + IArtifactInfo mockProcessArtifact3; + IArtifactInfo mockServiceArtifact1; + IResourceInstance resource; + + + @Before + public void setUp() throws Exception { + config = new SdncUebConfiguration("src/test/resources"); + + + URL propUrl = getClass().getResource("/dblib.properties"); + + InputStream propStr = getClass().getResourceAsStream("/dblib.properties"); + + Properties props = new Properties(); + + props.load(propStr); + + + // Start MariaDB4j database + DBConfigurationBuilder config = DBConfigurationBuilder.newBuilder(); + config.setPort(0); // 0 => autom. detect free port + db = DB.newEmbeddedDB(config.build()); + db.start(); + + + // Override jdbc URL and database name + props.setProperty("org.onap.ccsdk.sli.jdbc.database", "test"); + props.setProperty("org.onap.ccsdk.sli.jdbc.url", config.getURL("test")); + + + // Create dblib connection + dblibSvc = new DBResourceManager(props); + + // Create TOSCA tables + dblibSvc.writeData(CRTBL_SERVICE_MODEL, null, null); + dblibSvc.writeData(CRTBL_SERVICE_MODEL_TO_VF_MODEL_MAPPING, null, null); + dblibSvc.writeData(CRTBL_ATTRIBUTE_VALUE_PAIR, null, null); + dblibSvc.writeData(CRTBL_NETWORK_MODEL, null, null); + dblibSvc.writeData(CRTBL_VFC_MODEL, null, null); + dblibSvc.writeData(CRTBL_VFC_RELATED_NETWORK_ROLE, null, null); + dblibSvc.writeData(CRTBL_VFC_TO_NETWORK_ROLE_MAPPING, null, null); + dblibSvc.writeData(CRTBL_VF_MODEL, null, null); + dblibSvc.writeData(CRTBL_VNF_RELATED_NETWORK_ROLE, null, null); + dblibSvc.writeData(CRTBL_VF_TO_NETWORK_ROLE_MAPPING, null, null); + dblibSvc.writeData(CRTBL_VF_MODULE_MODEL, null, null); + dblibSvc.writeData(CRTBL_VF_MODULE_TO_VFC_MAPPING, null, null); + dblibSvc.writeData(CRTBL_ALLOTTED_RESOURCE_MODEL, null, null); + dblibSvc.writeData(CRTBL_RESOURCE_GROUP, null, null); + dblibSvc.writeData(CRTBL_RESOURCE_GROUP_TO_TARGET_NODE_MAPPING, null, null); + dblibSvc.writeData(CRTBL_RESOURCE_POLICY, null, null); + dblibSvc.writeData(CRTBL_RESOURCE_POLICY_TO_TARGET_NODE_MAPPING, null, null); + dblibSvc.writeData(CRTBL_NODE_CAPABILITY, null, null); + dblibSvc.writeData(CRTBL_NODE_CAPABILITY_PROPERTY, null, null); + + processLevelArtifactList = new ArrayList<>(); + serviceLevelArtifactList = new ArrayList<>(); + resourceList = new ArrayList<>(); + + + mockProcessArtifact1 = mock(IArtifactInfo.class); + when(mockProcessArtifact1.getArtifactName()).thenReturn("mockProcessArtifact1"); + when(mockProcessArtifact1.getArtifactType()).thenReturn("HEAT"); + when(mockProcessArtifact1.getArtifactURL()).thenReturn("https://asdc.sdc.com/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml"); + when(mockProcessArtifact1.getArtifactChecksum()).thenReturn("123tfg123 1234ftg"); + when(mockProcessArtifact1.getArtifactTimeout()).thenReturn(110); + + mockProcessArtifact2 = mock(IArtifactInfo.class); + when(mockProcessArtifact2.getArtifactName()).thenReturn("mockProcessArtifact2"); + when(mockProcessArtifact2.getArtifactType()).thenReturn("DG_XML"); + when(mockProcessArtifact2.getArtifactURL()).thenReturn("https://asdc.sdc.com/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml"); + when(mockProcessArtifact2.getArtifactChecksum()).thenReturn("456jhgt 1234ftg"); + when(mockProcessArtifact2.getArtifactTimeout()).thenReturn(110); + + mockProcessArtifact3 = mock(IArtifactInfo.class); + when(mockProcessArtifact3.getArtifactName()).thenReturn("mockProcessArtifact3"); + when(mockProcessArtifact3.getArtifactType()).thenReturn("HEAT"); + when(mockProcessArtifact3.getArtifactURL()).thenReturn("https://asdc.sdc.com/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml"); + when(mockProcessArtifact3.getArtifactChecksum()).thenReturn("123tfg123 543gtd"); + when(mockProcessArtifact3.getArtifactTimeout()).thenReturn(110); + + + mockServiceArtifact1 = mock(IArtifactInfo.class); + when(mockServiceArtifact1.getArtifactName()).thenReturn("mockProcessArtifact4"); + when(mockServiceArtifact1.getArtifactType()).thenReturn("HEAT"); + when(mockServiceArtifact1.getArtifactURL()).thenReturn("https://asdc.sdc.com/v1/catalog/services/srv1/2.0/resources/aaa/1.0/artifacts/aaa.yml"); + when(mockServiceArtifact1.getArtifactChecksum()).thenReturn("123t3455 543gtd"); + when(mockServiceArtifact1.getArtifactTimeout()).thenReturn(110); + + resource = mock(IResourceInstance.class); + } + + @After + public void tearDown() throws Exception { + // Move anything in archive back to incoming + String curFileName = ""; + + Path incomingPath = new File(config.getIncomingDir()).toPath(); + File archiveDir = new File(config.getArchiveDir()); + try (DirectoryStream<Path> stream = Files.newDirectoryStream(archiveDir.toPath())) { + for (Path file: stream) { + Files.move(file, incomingPath.resolve(file.getFileName()), StandardCopyOption.REPLACE_EXISTING); + } + } catch (Exception x) { + // IOException can never be thrown by the iteration. + // In this snippet, it can only be thrown by newDirectoryStream. + LOG.warn("Cannot replace spool file {}", curFileName, x); + } + + db.stop(); + + } + + @Test + public void test() { + + IDistributionClient iDistClient = mock(IDistributionClient.class); + SdncUebCallback cb = new SdncUebCallback(iDistClient, config); + SdncUebCallback.setJdbcDataSource(dblibSvc); + + INotificationData iData = mock(INotificationData.class); + /*IArtifactInfo iArtifactInfo = mock(IArtifactInfo.class); + when(iArtifactInfo.getArtifactName()).thenReturn("testArtifact1"); + when(iArtifactInfo.getArtifactType()).thenReturn("TOSCA_CSAR"); + List artifactInfoList = new ArrayList(); + artifactInfoList.add(iArtifactInfo);*/ + + when(iData.getServiceName()).thenReturn("testServiceName"); + //when(iData.getServiceArtifacts()).thenReturn(artifactInfoList); + cb.deployDownloadedFiles(null, null, null); + cb.activateCallback(iData); + + } + + + + @Test + public void testServiceAndProcessArtifactsactivateCallback() { + + try { + processLevelArtifactList.add(mockProcessArtifact1); + processLevelArtifactList.add(mockProcessArtifact2); + processLevelArtifactList.add(mockProcessArtifact3); + + resourceList.add(resource); + serviceLevelArtifactList.add(mockServiceArtifact1); + when(resource.getArtifacts()).thenReturn(serviceLevelArtifactList); + when(resource.getResourceName()).thenReturn("Resource_service_name"); + + + IDistributionClient iDistClient1 = mock(IDistributionClient.class); + INotificationData mockData = mock(INotificationData.class); + when(mockData.getResources()).thenReturn(resourceList); + when(mockData.getServiceName()).thenReturn("Test_service_name"); + when(mockData.getServiceArtifacts()).thenReturn(processLevelArtifactList); + + /*IArtifactInfo iArtifactInfo = mock(IArtifactInfo.class); + when(iArtifactInfo.getArtifactName()).thenReturn("testArtifact1"); + when(iArtifactInfo.getArtifactType()).thenReturn("TOSCA_CSAR"); + List artifactInfoList = new ArrayList(); + artifactInfoList.add(iArtifactInfo); + + //when(mockData.getServiceName()).thenReturn("testServiceName"); + when(mockData.getServiceArtifacts()).thenReturn(artifactInfoList);*/ + + + SdncUebCallback cb1 = new SdncUebCallback(iDistClient1, config); + cb1.activateCallback(mockData); + assertTrue(true); + } catch (Exception e) { + assertTrue(false); + } + } + +} diff --git a/northbound/ueb-listener/src/test/resources/artifact.map b/northbound/ueb-listener/src/test/resources/artifact.map new file mode 100644 index 000000000..0256515f0 --- /dev/null +++ b/northbound/ueb-listener/src/test/resources/artifact.map @@ -0,0 +1,2 @@ +vf-license-model,ASDC-API:vf-license-model-update,0 +bad-entry,0 diff --git a/northbound/ueb-listener/src/test/resources/dblib.properties b/northbound/ueb-listener/src/test/resources/dblib.properties new file mode 100644 index 000000000..9506ac8d1 --- /dev/null +++ b/northbound/ueb-listener/src/test/resources/dblib.properties @@ -0,0 +1,38 @@ +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +# dblib.properrties +org.onap.ccsdk.sli.dbtype=jdbc + +org.onap.ccsdk.sli.jdbc.hosts=sdnctldb01 +org.onap.ccsdk.sli.jdbc.url=jdbc:mysql://dbhost:3306/sdnctl +org.onap.ccsdk.sli.jdbc.driver=org.mariadb.jdbc.Driver +org.onap.ccsdk.sli.jdbc.database=sdnctl +org.onap.ccsdk.sli.jdbc.user=sdnctl +org.onap.ccsdk.sli.jdbc.password=gamma +org.onap.ccsdk.sli.jdbc.connection.name=sdnctldb01 +org.onap.ccsdk.sli.jdbc.connection.timeout=50 +org.onap.ccsdk.sli.jdbc.request.timeout=100 +org.onap.ccsdk.sli.jdbc.limit.init=10 +org.onap.ccsdk.sli.jdbc.limit.min=10 +org.onap.ccsdk.sli.jdbc.limit.max=20 +org.onap.dblib.connection.recovery=false + diff --git a/northbound/ueb-listener/src/test/resources/incoming/src_test_resources_csars_nsepc.csar b/northbound/ueb-listener/src/test/resources/incoming/src_test_resources_csars_nsepc.csar Binary files differnew file mode 100644 index 000000000..bb09f1c2f --- /dev/null +++ b/northbound/ueb-listener/src/test/resources/incoming/src_test_resources_csars_nsepc.csar diff --git a/northbound/ueb-listener/src/test/resources/incoming/src_test_resources_csars_service-NfodService-csar.csar b/northbound/ueb-listener/src/test/resources/incoming/src_test_resources_csars_service-NfodService-csar.csar Binary files differnew file mode 100644 index 000000000..329076a15 --- /dev/null +++ b/northbound/ueb-listener/src/test/resources/incoming/src_test_resources_csars_service-NfodService-csar.csar diff --git a/northbound/ueb-listener/src/test/resources/incoming/vf-license-model.xml b/northbound/ueb-listener/src/test/resources/incoming/vf-license-model.xml new file mode 100644 index 000000000..c5e33eeb5 --- /dev/null +++ b/northbound/ueb-listener/src/test/resources/incoming/vf-license-model.xml @@ -0,0 +1 @@ +<vf-license-model xmlns="http://xmlns.openecomp.org/asdc/license-model/1.0"><vendor-name>Broadsoft</vendor-name><vf-id>E5A18BC3D2454091B02EA3F69EB1DB46</vf-id><feature-group-list><feature-group><entitlement-pool-list><entitlement-pool><name>Broadsoft EP</name><description>tbp</description><increments>200</increments><entitlement-pool-uuid>728ad6b0-912e-432b-853e-373845d410ad</entitlement-pool-uuid><manufacturer-reference-number>tbp</manufacturer-reference-number><sp-limits/><vendor-limits/><operational-scope><value>VM</value></operational-scope><start-date/><expiry-date/><threshold-value><unit>Absolute</unit><value>100</value></threshold-value></entitlement-pool></entitlement-pool-list><license-key-group-list><license-key-group><name>Placeholder BS LPK</name><description>tbp</description><type>Universal</type><increments/><license-key-group-uuid>3be519b2-abf3-449f-9851-0ac70ccb5632</license-key-group-uuid><manufacturer-reference-number>tbp</manufacturer-reference-number><sp-limits/><vendor-limits/><operational-scope><value>VM</value></operational-scope><start-date/><expiry-date/><threshold-value><unit/><value/></threshold-value></license-key-group></license-key-group-list><description>tbp</description><part-number>asdfasfdsdf</part-number><name>Placeholder LPK</name><feature-group-uuid>4ACF252A84FA4FEC9C98AA0DFCFFFBCE</feature-group-uuid></feature-group></feature-group-list></vf-license-model>
\ No newline at end of file diff --git a/northbound/ueb-listener/src/test/resources/log4j.properties b/northbound/ueb-listener/src/test/resources/log4j.properties new file mode 100644 index 000000000..71849c3db --- /dev/null +++ b/northbound/ueb-listener/src/test/resources/log4j.properties @@ -0,0 +1,30 @@ +### +# ============LICENSE_START======================================================= +# openECOMP : SDN-C +# ================================================================================ +# Copyright (C) 2017 AT&T Intellectual Property. All rights +# reserved. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============LICENSE_END========================================================= +### + +log4j.rootLogger=DEBUG,CONSOLE + +# CONSOLE is set to be a ConsoleAppender using a PatternLayout. +log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender +log4j.appender.CONSOLE.Threshold=DEBUG +log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout +log4j.appender.CONSOLE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n + + diff --git a/northbound/ueb-listener/src/test/resources/ueb-listener.properties b/northbound/ueb-listener/src/test/resources/ueb-listener.properties new file mode 100755 index 000000000..c017cbd7b --- /dev/null +++ b/northbound/ueb-listener/src/test/resources/ueb-listener.properties @@ -0,0 +1,22 @@ +org.onap.ccsdk.sli.northbound.uebclient.asdc-address=localhost:1234 +org.onap.ccsdk.sli.northbound.uebclient.consumer-group=ccsdk1 +org.onap.ccsdk.sli.northbound.uebclient.consumer-id=localhost_ccsdk1 +org.onap.ccsdk.sli.northbound.uebclient.environment-name=UNITTEST +org.onap.ccsdk.sli.northbound.uebclient.password=123456 +org.onap.ccsdk.sli.northbound.uebclient.user=test +org.onap.ccsdk.sli.northbound.uebclient.sdnc-user=test +org.onap.ccsdk.sli.northbound.uebclient.sdnc-passwd=test +org.onap.ccsdk.sli.northbound.uebclient.asdc-api-base-url=http://localhost:8282/restconf/operations/ +org.onap.ccsdk.sli.northbound.uebclient.asdc-api-namespace=org:onap:ccsdk +org.onap.ccsdk.sli.northbound.uebclient.spool.incoming=src/test/resources/incoming +org.onap.ccsdk.sli.northbound.uebclient.spool.archive=src/test/resources/archive +org.onap.ccsdk.sli.northbound.uebclient.polling-interval=30 +org.onap.ccsdk.sli.northbound.uebclient.polling-timeout=15 +org.onap.ccsdk.sli.northbound.uebclient.client-startup-timeout=60 +org.onap.ccsdk.sli.northbound.uebclient.relevant-artifact-types=YANG_XML,VF_LICENSE,TOSCA_TEMPLATE,TOSCA_CSAR,UCPE_LAYER_2_CONFIGURATION +org.onap.ccsdk.sli.northbound.uebclient.relevant-capability-names=RoutingConfiguration,routing_configuration,VLANAssignment,vlan_assignment +org.onap.ccsdk.sli.northbound.uebclient.activate-server-tls-auth=false +org.onap.ccsdk.sli.northbound.uebclient.keystore-path= +org.onap.ccsdk.sli.northbound.uebclient.keystore-password= +org.onap.ccsdk.sli.northbound.uebclient.xslt-path-list= +org.onap.ccsdk.sli.northbound.uebclient.artifact-map=src/test/resources/artifact.map |