summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2017-02-15 15:09:44 -0500
committerDan Timoney <dtimoney@att.com>2017-02-15 15:11:54 -0500
commit1b47683183e05c39e55d14c904caf073b65825ef (patch)
tree30d6ed61324f59b014ab2e935979c6aaef6d7fba
parent66fe1714388c1d1f82097de468ef3789b178743d (diff)
Initial commit for OpenECOMP SDN-C northbound
Change-Id: Iffe4d4fbcfd21ecbc1000238354094cc064298ce Signed-off-by: Dan Timoney <dtimoney@att.com>
-rwxr-xr-x.gitignore38
-rw-r--r--.gitreview4
-rw-r--r--LICENSE.txt22
-rw-r--r--README.md8
-rwxr-xr-xasdcApi/.gitignore34
-rwxr-xr-xasdcApi/features/pom.xml137
-rw-r--r--asdcApi/features/src/main/resources/features.xml41
-rwxr-xr-xasdcApi/installer/pom.xml137
-rw-r--r--asdcApi/installer/src/assembly/assemble_installer_zip.xml58
-rw-r--r--asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml54
-rw-r--r--asdcApi/installer/src/main/resources/scripts/install-feature.sh40
-rwxr-xr-xasdcApi/model/pom.xml81
-rwxr-xr-xasdcApi/model/src/main/yang/ASDC-API.yang63
-rwxr-xr-xasdcApi/model/src/main/yang/asdc-api-common.yang53
-rwxr-xr-xasdcApi/model/src/main/yang/asdc-license-model.yang369
-rwxr-xr-xasdcApi/pom.xml63
-rwxr-xr-xasdcApi/provider/pom.xml129
-rw-r--r--asdcApi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/asdcapi/provider/impl/rev140523/AsdcApiProviderModule.java57
-rw-r--r--asdcApi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/asdcapi/provider/impl/rev140523/AsdcApiProviderModuleFactory.java34
-rw-r--r--asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiProvider.java413
-rw-r--r--asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiSliClient.java111
-rw-r--r--asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiUtil.java48
-rw-r--r--asdcApi/provider/src/main/resources/initial/asdcApi-provider.xml72
-rwxr-xr-xasdcApi/provider/src/main/yang/asdcApi-provider-impl.yang61
-rwxr-xr-xdataChange/.gitignore34
-rwxr-xr-xdataChange/.sonar/checkstyle.xml1
-rwxr-xr-xdataChange/.sonar/pmd.xml67
-rwxr-xr-xdataChange/README.txt35
-rwxr-xr-xdataChange/features/pom.xml135
-rw-r--r--dataChange/features/src/main/resources/features.xml39
-rwxr-xr-xdataChange/installer/pom.xml137
-rw-r--r--dataChange/installer/src/assembly/assemble_installer_zip.xml58
-rw-r--r--dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml54
-rw-r--r--dataChange/installer/src/main/resources/scripts/install-feature.sh40
-rwxr-xr-xdataChange/model/pom.xml82
-rwxr-xr-xdataChange/model/src/main/yang/DataChange.yang73
-rwxr-xr-xdataChange/pom.xml59
-rwxr-xr-xdataChange/provider/pom.xml137
-rw-r--r--dataChange/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/datachange/provider/impl/rev140523/DataChangeProviderModule.java55
-rw-r--r--dataChange/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/datachange/provider/impl/rev140523/DataChangeProviderModuleFactory.java34
-rw-r--r--dataChange/provider/src/main/java/org/openecomp/sdnc/datachange/DataChangeClient.java115
-rw-r--r--dataChange/provider/src/main/java/org/openecomp/sdnc/datachange/DataChangeProvider.java181
-rw-r--r--dataChange/provider/src/main/resources/initial/dataChange-provider.xml72
-rwxr-xr-xdataChange/provider/src/main/yang/DataChange-provider-impl.yang61
-rw-r--r--example-settings.xml163
-rw-r--r--jenkins-settings.xml168
-rw-r--r--pom.xml84
-rwxr-xr-xueb-listener/.gitignore12
-rwxr-xr-xueb-listener/.sonar/checkstyle.xml1
-rwxr-xr-xueb-listener/.sonar/pmd.xml67
-rwxr-xr-xueb-listener/pom.xml110
-rw-r--r--ueb-listener/src/assembly/assemble_zip.xml61
-rw-r--r--ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebCallback.java840
-rw-r--r--ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebClient.java65
-rw-r--r--ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebConfiguration.java260
-rw-r--r--ueb-listener/src/main/resources/log4j.properties37
-rwxr-xr-xueb-listener/src/main/resources/normalizeTagNames.xslt14
-rwxr-xr-xueb-listener/src/main/resources/removeNs.xslt16
-rw-r--r--ueb-listener/src/site/apt/index.apt46
-rw-r--r--ueb-listener/src/site/site.xml31
-rw-r--r--version.properties14
-rw-r--r--vnfapi/.gitignore34
-rw-r--r--vnfapi/.sonar/checkstyle.xml1
-rw-r--r--vnfapi/.sonar/pmd.xml67
-rw-r--r--vnfapi/README.txt35
-rw-r--r--vnfapi/features/pom.xml135
-rw-r--r--vnfapi/features/src/main/resources/features.xml39
-rwxr-xr-xvnfapi/installer/pom.xml137
-rw-r--r--vnfapi/installer/src/assembly/assemble_installer_zip.xml55
-rw-r--r--vnfapi/installer/src/assembly/assemble_mvnrepo_zip.xml56
-rw-r--r--vnfapi/installer/src/main/resources/scripts/install-feature.sh40
-rw-r--r--vnfapi/model/pom.xml124
-rwxr-xr-xvnfapi/model/scripts/python/yang2props.py57
-rwxr-xr-xvnfapi/model/src/main/yang/VNF-API.yang815
-rwxr-xr-xvnfapi/model/src/main/yang/vnfsubmodule.yang356
-rw-r--r--vnfapi/pom.xml58
-rw-r--r--vnfapi/provider/pom.xml133
-rw-r--r--vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModule.java56
-rw-r--r--vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModuleFactory.java34
-rw-r--r--vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java379
-rw-r--r--vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VnfSdnUtil.java232
-rw-r--r--vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/vnfapiProvider.java2617
-rw-r--r--vnfapi/provider/src/main/resources/initial/vnfapi-provider.xml72
-rw-r--r--vnfapi/provider/src/main/yang/vnfapi-provider-impl.yang61
-rw-r--r--vnfapi/provider/src/test/java/org/openecomp/sdnc/vnfapi/TestPropertyList.java102
-rw-r--r--vnfapi/provider/src/test/resources/proplist.properties22
-rw-r--r--vnfapi/provider/src/test/resources/simplelogger.properties22
-rw-r--r--vnftools/.gitignore34
-rw-r--r--vnftools/features/pom.xml133
-rw-r--r--vnftools/features/src/main/resources/features.xml38
-rwxr-xr-xvnftools/installer/pom.xml137
-rw-r--r--vnftools/installer/src/assembly/assemble_installer_zip.xml58
-rw-r--r--vnftools/installer/src/assembly/assemble_mvnrepo_zip.xml48
-rw-r--r--vnftools/installer/src/main/resources/scripts/install-feature.sh40
-rw-r--r--vnftools/pom.xml49
-rw-r--r--vnftools/provider/pom.xml83
-rw-r--r--vnftools/provider/src/main/java/org/openecomp/sdnc/vnftools/VnfTools.java205
-rw-r--r--vnftools/provider/src/main/java/org/openecomp/sdnc/vnftools/VnfToolsActivator.java87
-rw-r--r--vnftools/provider/src/main/resources/l3ucpetools.properties23
99 files changed, 12259 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100755
index 00000000..8b49fb2a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,38 @@
+#####standard .git ignore entries#####
+
+## IDE Specific Files ##
+org.eclipse.core.resources.prefs
+.classpath
+.project
+.settings
+.idea
+.externalToolBuilders
+.checkstyle
+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
+provider/src/main/java/META-INF/
+provider/src/main/java/inventory/
+
+## BlackDuck generated file
+sdnc-northbound_bdio.jsonld
+blackDuckHubProjectName.txt
+blackDuckHubProjectVersionName.txt
diff --git a/.gitreview b/.gitreview
new file mode 100644
index 00000000..ac3bf486
--- /dev/null
+++ b/.gitreview
@@ -0,0 +1,4 @@
+[gerrit]
+host=gerrit.openecomp.org
+port=29418
+project=sdnc/northbound.git
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 00000000..3ea5081a
--- /dev/null
+++ b/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/README.md b/README.md
new file mode 100644
index 00000000..64be1de0
--- /dev/null
+++ b/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/asdcApi/.gitignore b/asdcApi/.gitignore
new file mode 100755
index 00000000..b73caf31
--- /dev/null
+++ b/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/asdcApi/features/pom.xml b/asdcApi/features/pom.xml
new file mode 100755
index 00000000..41970e2b
--- /dev/null
+++ b/asdcApi/features/pom.xml
@@ -0,0 +1,137 @@
+<?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>
+ <artifactId>asdcApi</artifactId>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>asdcApi-features</artifactId>
+
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>asdcApi-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>asdcApi-provider</artifactId>
+ <version>${project.version}</version>
+ <classifier>config</classifier>
+ <type>xml</type>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>asdcApi-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>features-mdsal</artifactId>
+ <version>${odl.mdsal.features.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+
+
+ <scope>runtime</scope>
+ </dependency>
+
+
+
+ <!-- dependency for opendaylight-karaf-empty for use by testing -->
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>opendaylight-karaf-empty</artifactId>
+ <type>zip</type>
+ </dependency>
+
+
+ <dependency>
+ <!-- Required for launching the feature tests-->
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>features-test</artifactId>
+ <scope>test</scope>
+ <version>${odl.commons.opendaylight.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>features-yangtools</artifactId>
+ <version>${odl.yangtools.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <filtering>true</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>filter</id>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- launches the feature test, which validates that your karaf feature can
+ be installed inside of a karaf container. It doesn't validate that your
+ functionality works correctly, just that you have all of the dependent
+ bundles defined correctly.
+ <plugin>
+
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.16</version>
+ <configuration>
+ <systemPropertyVariables>
+ <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId>
+ <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
+ <karaf.distro.version>${odl.karaf.empty.distro.version}</karaf.distro.version>
+ </systemPropertyVariables>
+ <dependenciesToScan>
+ <dependency>org.opendaylight.yangtools:features-test</dependency>
+ </dependenciesToScan>
+ </configuration>
+ </plugin>
+ -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/${features.file}</file>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/asdcApi/features/src/main/resources/features.xml b/asdcApi/features/src/main/resources/features.xml
new file mode 100644
index 00000000..54b2c809
--- /dev/null
+++ b/asdcApi/features/src/main/resources/features.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============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=========================================================
+ -->
+
+
+<features name="sdnc-asdcApi-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+
+ <repository>mvn:org.opendaylight.mdsal/features-mdsal/${odl.mdsal.features.version}/xml/features</repository>
+
+ <feature name='sdnc-asdcApi' description="sdnc-asdcApi" version='${project.version}'>
+ <!-- Most applications will have a dependency on the ODL MD-SAL Broker -->
+ <feature version="${odl.mdsal.version}">odl-mdsal-broker</feature>
+
+ <bundle>mvn:org.openecomp.sdnc.northbound/asdcApi-model/${project.version}</bundle>
+ <bundle>mvn:org.openecomp.sdnc.northbound/asdcApi-provider/${project.version}</bundle>
+
+ <feature version="${sdnctl.sli.version}">sdnc-sli</feature>
+ <configfile finalname="etc/opendaylight/karaf/200-asdcApi-provider.xml">mvn:org.openecomp.sdnc.northbound/asdcApi-provider/${project.version}/xml/config</configfile>
+ </feature>
+
+</features>
diff --git a/asdcApi/installer/pom.xml b/asdcApi/installer/pom.xml
new file mode 100755
index 00000000..23ea77d1
--- /dev/null
+++ b/asdcApi/installer/pom.xml
@@ -0,0 +1,137 @@
+<?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>
+ <artifactId>asdcApi</artifactId>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>asdcApi-installer</artifactId>
+ <name>asdcApi - Karaf Installer</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <application.name>sdnc-asdcApi</application.name>
+ <features.boot>sdnc-asdcApi</features.boot>
+ <features.repositories>mvn:org.openecomp.sdnc.northbound/asdcApi-features/${project.version}/xml/features</features.repositories>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>asdcApi-features</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>asdcApi-provider</artifactId>
+ <version>${project.version}</version>
+ </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>false</attach>
+ <finalName>stage/${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+ </descriptors>
+ </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>
+ </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.openecomp.sdnc</includeGroupIds>
+ <excludeArtifactIds>sli-common,sli-provider,dblib-provider</excludeArtifactIds>
+ <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/asdcApi/installer/src/assembly/assemble_installer_zip.xml b/asdcApi/installer/src/assembly/assemble_installer_zip.xml
new file mode 100644
index 00000000..0ce9b1ac
--- /dev/null
+++ b/asdcApi/installer/src/assembly/assemble_installer_zip.xml
@@ -0,0 +1,58 @@
+<!--
+ ============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">
+ <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/asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml b/asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100644
index 00000000..c64ca699
--- /dev/null
+++ b/asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml
@@ -0,0 +1,54 @@
+<!--
+ ============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">
+ <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>
+
+ <files>
+ <file>
+ <source>../provider/src/main/resources/initial/${feature-name}-provider.xml</source>
+ <destName>./etc/opendaylight/karaf/200-${feature-name}-provider.xml</destName>
+ </file>
+
+ </files>
+
+</assembly>
diff --git a/asdcApi/installer/src/main/resources/scripts/install-feature.sh b/asdcApi/installer/src/main/resources/scripts/install-feature.sh
new file mode 100644
index 00000000..33e9b036
--- /dev/null
+++ b/asdcApi/installer/src/main/resources/scripts/install-feature.sh
@@ -0,0 +1,40 @@
+#!/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}
+ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"}
+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} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories}
+${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot}
diff --git a/asdcApi/model/pom.xml b/asdcApi/model/pom.xml
new file mode 100755
index 00000000..04198e04
--- /dev/null
+++ b/asdcApi/model/pom.xml
@@ -0,0 +1,81 @@
+<?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>
+ <artifactId>asdcApi</artifactId>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>asdcApi-model</artifactId>
+ <version>1.0.0</version>
+ <packaging>bundle</packaging>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Import-Package>*</Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-maven-plugin</artifactId>
+ <version>${odl.yangtools.yang.maven.plugin.version}</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>maven-sal-api-gen-plugin</artifactId>
+ <version>${odl.yangtools.version}</version>
+ <type>jar</type>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <yangFilesRootDir>${yang.file.directory}</yangFilesRootDir>
+ <codeGenerators>
+ <generator>
+ <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
+ <outputBaseDir>${salGeneratorPath}</outputBaseDir>
+ </generator>
+ </codeGenerators>
+ <inspectDependencies>true</inspectDependencies>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>yang-binding</artifactId>
+ <version>${odl.yangtools.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-common</artifactId>
+ <version>${odl.yangtools.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-inet-types</artifactId>
+ <version>${odl.ietf-inet-types.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-yang-types</artifactId>
+ <version>${odl.ietf-yang-types.version}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/asdcApi/model/src/main/yang/ASDC-API.yang b/asdcApi/model/src/main/yang/ASDC-API.yang
new file mode 100755
index 00000000..401ec7da
--- /dev/null
+++ b/asdcApi/model/src/main/yang/ASDC-API.yang
@@ -0,0 +1,63 @@
+
+module ASDC-API {
+ yang-version "1";
+
+ namespace "org:openecomp:sdnc";
+
+ 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 "2010-09-24";
+ }
+
+ organization
+ "OpenECOMP";
+
+ 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/asdcApi/model/src/main/yang/asdc-api-common.yang b/asdcApi/model/src/main/yang/asdc-api-common.yang
new file mode 100755
index 00000000..126368d4
--- /dev/null
+++ b/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:openecomp:sdnc:asdcapi:common";
+
+ prefix asdcapi;
+
+ organization
+ "OpenECOMP";
+
+ 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/asdcApi/model/src/main/yang/asdc-license-model.yang b/asdcApi/model/src/main/yang/asdc-license-model.yang
new file mode 100755
index 00000000..37ae869b
--- /dev/null
+++ b/asdcApi/model/src/main/yang/asdc-license-model.yang
@@ -0,0 +1,369 @@
+module asdc-license-model {
+
+ namespace "http://xmlns.openecomp.org/asdc/license-model/1.0";
+ prefix le;
+ organization "openecomp";
+ 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/asdcApi/pom.xml b/asdcApi/pom.xml
new file mode 100755
index 00000000..aaea307e
--- /dev/null
+++ b/asdcApi/pom.xml
@@ -0,0 +1,63 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>sdnc-northbound</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <packaging>pom</packaging>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>asdcApi</artifactId>
+ <version>1.0.0</version>
+
+ <properties>
+ <feature-name>asdcApi</feature-name>
+ </properties>
+
+ <dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>asdcApi-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>asdcApi-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>asdcApi-provider</artifactId>
+ <version>${project.version}</version>
+ <classifier>config</classifier>
+ <type>xml</type>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>asdcApi-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+
+ </dependencyManagement>
+
+
+
+
+ <modules>
+ <module>model</module>
+ <module>features</module>
+ <module>provider</module>
+ <module>installer</module>
+ </modules>
+
+</project>
diff --git a/asdcApi/provider/pom.xml b/asdcApi/provider/pom.xml
new file mode 100755
index 00000000..033cd29c
--- /dev/null
+++ b/asdcApi/provider/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>
+ <artifactId>asdcApi</artifactId>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>asdcApi-provider</artifactId>
+ <packaging>bundle</packaging>
+
+ <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.asdcApi_provider.impl</Export-Package>
+ <Import-Package>*</Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-maven-plugin</artifactId>
+ <version>${odl.yangtools.yang.maven.plugin.version}</version>
+ <executions>
+ <execution>
+ <id>config</id>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <codeGenerators>
+ <generator>
+ <codeGeneratorClass>org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator</codeGeneratorClass>
+ <outputBaseDir>${jmxGeneratorPath}</outputBaseDir>
+ <additionalConfiguration>
+ <namespaceToPackage1>urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang</namespaceToPackage1>
+ </additionalConfiguration>
+ </generator>
+ <generator>
+ <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
+ <outputBaseDir>${salGeneratorPath}</outputBaseDir>
+ </generator>
+ </codeGenerators>
+ <inspectDependencies>true</inspectDependencies>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>maven-sal-api-gen-plugin</artifactId>
+ <version>${odl.yangtools.version}</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>yang-jmx-generator-plugin</artifactId>
+ <version>${odl.yang.jmx.generator.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/initial/asdcApi-provider.xml</file>
+ <type>xml</type>
+ <classifier>config</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>asdcApi-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-api</artifactId>
+ <version>${odl.controller.config.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-config</artifactId>
+ <version>${odl.mdsal.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
+ <version>${odl.mdsal.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-common-util</artifactId>
+ <version>${odl.mdsal.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-common</artifactId>
+ <version>${sdnctl.sli.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ <version>${sdnctl.sli.version}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/asdcApi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/asdcapi/provider/impl/rev140523/AsdcApiProviderModule.java b/asdcApi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/asdcapi/provider/impl/rev140523/AsdcApiProviderModule.java
new file mode 100644
index 00000000..a20c510d
--- /dev/null
+++ b/asdcApi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/asdcapi/provider/impl/rev140523/AsdcApiProviderModule.java
@@ -0,0 +1,57 @@
+/*-
+ * ============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.opendaylight.yang.gen.v1.org.openecomp.sdnc.asdcapi.provider.impl.rev140523;
+
+import org.openecomp.sdnc.asdcapi.AsdcApiProvider;
+
+public class AsdcApiProviderModule extends org.opendaylight.yang.gen.v1.org.openecomp.sdnc.asdcapi.provider.impl.rev140523.AbstractAsdcApiProviderModule {
+ public AsdcApiProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public AsdcApiProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.org.openecomp.sdnc.asdcapi.provider.impl.rev140523.AsdcApiProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+
+ final AsdcApiProvider provider = new AsdcApiProvider(getDataBrokerDependency()
+ , getNotificationServiceDependency()
+ , getRpcRegistryDependency());
+
+ return new AutoCloseable() {
+
+ @Override
+ public void close() throws Exception {
+
+ provider.close();
+ }
+ };
+ }
+
+}
diff --git a/asdcApi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/asdcapi/provider/impl/rev140523/AsdcApiProviderModuleFactory.java b/asdcApi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/asdcapi/provider/impl/rev140523/AsdcApiProviderModuleFactory.java
new file mode 100644
index 00000000..f59edcc1
--- /dev/null
+++ b/asdcApi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/asdcapi/provider/impl/rev140523/AsdcApiProviderModuleFactory.java
@@ -0,0 +1,34 @@
+/*-
+ * ============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=========================================================
+ */
+
+/*
+* Generated file
+*
+* Generated from: yang module name: asdcApi-provider-impl yang module local name: asdcApi-provider-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Wed Nov 02 03:46:08 EDT 2016
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.org.openecomp.sdnc.asdcapi.provider.impl.rev140523;
+public class AsdcApiProviderModuleFactory extends org.opendaylight.yang.gen.v1.org.openecomp.sdnc.asdcapi.provider.impl.rev140523.AbstractAsdcApiProviderModuleFactory {
+
+}
diff --git a/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiProvider.java b/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiProvider.java
new file mode 100644
index 00000000..43344cda
--- /dev/null
+++ b/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiProvider.java
@@ -0,0 +1,413 @@
+/*-
+ * ============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.openecomp.sdnc.asdcapi;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.Futures;
+import java.util.Properties;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+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.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.http.xmlns.openecomp.org.asdc.license.model._1._0.rev160427.vf.license.model.grouping.VfLicenseModel;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.ASDCAPIService;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.Artifacts;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.ArtifactsBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelUpdateInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelUpdateInputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelUpdateOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelUpdateOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelVersions;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelVersionsBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.artifacts.Artifact;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.artifacts.ArtifactBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.artifacts.ArtifactKey;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.vf.license.model.versions.VfLicenseModelVersion;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.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;
+
+/**
+ * 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 String ACTIVE_VERSION = "active";
+
+ private final Logger log = LoggerFactory.getLogger( AsdcApiProvider.class );
+ private final String appName = "asdcApi";
+
+ private final ExecutorService executor;
+ protected DataBroker dataBroker;
+ protected NotificationProviderService notificationService;
+ protected RpcProviderRegistry rpcRegistry;
+
+ protected BindingAwareBroker.RpcRegistration<ASDCAPIService> rpcRegistration;
+
+ public AsdcApiProvider(DataBroker dataBroker2,
+ NotificationProviderService notificationProviderService,
+ RpcProviderRegistry rpcProviderRegistry) {
+ this.log.info( "Creating provider for " + appName );
+ executor = Executors.newFixedThreadPool(1);
+ dataBroker = dataBroker2;
+ notificationService = notificationProviderService;
+ rpcRegistry = rpcProviderRegistry;
+ initialize();
+ }
+
+ public void initialize(){
+ log.info( "Initializing provider for " + appName );
+
+
+ createContainers();
+
+ if (rpcRegistration == null) {
+ if (rpcRegistry != null) {
+ rpcRegistration = rpcRegistry.addRpcImplementation(
+ ASDCAPIService.class, this);
+ log.info("Initialization complete for " + appName);
+ } else {
+ log.warn("Error initializing " + appName
+ + " : rpcRegistry unset");
+ }
+ }
+ }
+
+ 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);
+ e.printStackTrace();
+ }
+ } 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 " + appName );
+ executor.shutdown();
+ rpcRegistration.close();
+ log.info( "Successfully closed provider for " + appName );
+ }
+
+ public void setDataBroker(DataBroker dataBroker) {
+ this.dataBroker = dataBroker;
+ if( log.isDebugEnabled() ){
+ log.debug( "DataBroker set to " + (dataBroker==null?"null":"non-null") + "." );
+ }
+ }
+
+ public void setNotificationService(
+ NotificationProviderService notificationService) {
+ this.notificationService = notificationService;
+ if( log.isDebugEnabled() ){
+ log.debug( "Notification Service set to " + (notificationService==null?"null":"non-null") + "." );
+ }
+ }
+
+ public void setRpcRegistry(RpcProviderRegistry rpcRegistry) {
+ this.rpcRegistry = rpcRegistry;
+
+ rpcRegistration = rpcRegistry.addRpcImplementation(ASDCAPIService.class, this);
+
+ if( log.isDebugEnabled() ){
+ log.debug( "RpcRegistry set to " + (rpcRegistry==null?"null":"non-null") + "." );
+ }
+ }
+
+
+ private boolean artifactVersionExists(String aName, String aVersion) {
+ InstanceIdentifier artifactInstanceId =
+ InstanceIdentifier.<Artifacts>builder(Artifacts.class)
+ .child(Artifact.class, new ArtifactKey(aName, aVersion)).toInstance();
+ ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction();
+ Optional<Artifact> data = null;
+ try {
+ 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;
+
+ }
+
+ if (data.isPresent()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private 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.getKey());
+
+ InstanceIdentifier<Artifact> path = aIdBuilder
+ .toInstance();
+
+ 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.getKey());
+
+ InstanceIdentifier<VfLicenseModelVersion> path = versionIdBuilder
+ .toInstance();
+
+ 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.getKey());
+
+ InstanceIdentifier<VfLicenseModelVersion> path = versionIdBuilder
+ .toInstance();
+
+ 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 Future<RpcResult<VfLicenseModelUpdateOutput>> vfLicenseModelUpdate(VfLicenseModelUpdateInput input) {
+ final String SVC_OPERATION = "vf-license-model-update";
+
+ Properties parms = new Properties();
+
+ log.info( SVC_OPERATION +" called." );
+
+ if(input == null ) {
+ log.debug("exiting " +SVC_OPERATION+ " because of invalid input");
+ return null;
+ }
+
+ VfLicenseModelUpdateInputBuilder inputBuilder = new VfLicenseModelUpdateInputBuilder(input);
+ input = inputBuilder.build();
+
+ String errorMessage = "Success";
+ String errorCode = "200";
+
+ // If this artifact already exists, reject this update
+ if (artifactVersionExists(input.getArtifactName(), input.getArtifactVersion())) {
+ errorCode = "409";
+ errorMessage = "Artifact version already exists";
+ } else {
+ // Translate input object into SLI-consumable properties
+ log.info("Adding INPUT data for "+SVC_OPERATION+" input: " + input);
+ AsdcApiUtil.toProperties(parms, input);
+
+
+ // Call directed graph
+
+ Properties respProps = null;
+
+
+ AsdcApiSliClient sliClient = new AsdcApiSliClient();
+ try
+ {
+ if (sliClient.hasGraph("ASDC-API", SVC_OPERATION , null, "sync"))
+ {
+
+ try
+ {
+ respProps = sliClient.execute("ASDC-API", SVC_OPERATION, null, "sync", parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic for "+ SVC_OPERATION, e);
+ }
+ } else {
+ errorMessage = "No service logic active for ASDC-API: '" + SVC_OPERATION + "'";
+ 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(input);
+ addArtifactVersion(input.getArtifactName(), input.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/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiSliClient.java b/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiSliClient.java
new file mode 100644
index 00000000..98d79d59
--- /dev/null
+++ b/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiSliClient.java
@@ -0,0 +1,111 @@
+/*-
+ * ============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.openecomp.sdnc.asdcapi;
+
+import java.util.Properties;
+
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.provider.SvcLogicService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AsdcApiSliClient {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(AsdcApiSliClient.class);
+
+ private SvcLogicService svcLogic = null;
+
+ public AsdcApiSliClient()
+ {
+ BundleContext bctx = FrameworkUtil.getBundle(SvcLogicService.class).getBundleContext();
+
+ // Get SvcLogicService reference
+ ServiceReference sref = bctx.getServiceReference(SvcLogicService.NAME);
+ if (sref != null)
+ {
+ svcLogic = (SvcLogicService) bctx.getService(sref);
+ }
+ else
+ {
+ LOG.warn("Cannot find service reference for "+SvcLogicService.NAME);
+
+ }
+ }
+
+ public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException
+ {
+ return(svcLogic.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 = svcLogic.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("error-code")) {
+ respProps.setProperty("error-code", "500");
+ }
+ } else {
+ if (!respProps.containsKey("error-code")) {
+ respProps.setProperty("error-code", "200");
+ }
+ }
+
+
+ return (respProps);
+ }
+
+}
diff --git a/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiUtil.java b/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiUtil.java
new file mode 100644
index 00000000..02ce4e19
--- /dev/null
+++ b/asdcApi/provider/src/main/java/org/openecomp/sdnc/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.openecomp.sdnc.asdcapi;
+
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.ArtifactsBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelUpdateInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelUpdateInputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.VfLicenseModelVersionsBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.rev170201.vf.license.model.versions.VfLicenseModelVersionBuilder;
+import org.openecomp.sdnc.sli.provider.MdsalHelper;
+
+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/asdcApi/provider/src/main/resources/initial/asdcApi-provider.xml b/asdcApi/provider/src/main/resources/initial/asdcApi-provider.xml
new file mode 100644
index 00000000..1e33f0d6
--- /dev/null
+++ b/asdcApi/provider/src/main/resources/initial/asdcApi-provider.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============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=========================================================
+ -->
+
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<snapshot>
+ <configuration>
+ <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+ <module>
+
+ <!-- This xmlns:prefix should match the namespace in the *-provider-impl.yang file
+ The prefix: inside type should match the prefix of the yang file. -->
+ <type xmlns:prefix="org:openecomp:sdnc:asdcapi:provider:impl">
+ prefix:asdcApi-provider-impl
+ </type>
+ <name>asdcApi-provider-impl</name>
+
+ <!-- The following sections contain bindings to services defined in the
+ *-provider-impl yang file. For example the rpc-registry is required
+ because we have a dependency (or augmentation) named "rpc-registry"
+ and which binds to the md-sa-binding-registry. If you remove those
+ dependencies from the yang file then you can remove them from here. -->
+ <rpc-registry>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
+ <name>binding-rpc-broker</name>
+ </rpc-registry>
+
+ <data-broker>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
+ <name>binding-data-broker</name>
+ </data-broker>
+
+ <notification-service>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
+ binding:binding-notification-service
+ </type>
+ <name>binding-notification-broker</name>
+ </notification-service>
+ </module>
+
+ </modules>
+ </data>
+
+ </configuration>
+
+ <!-- Required capabilities are basically a listing of all modules that need to be imported before
+ our service can be resolved. Capabilities for dependencies defined above are implied which is
+ why we do not have define a required capability for the data broker, for example. -->
+ <required-capabilities>
+ <capability>org:openecomp:sdnc:asdcapi:provider:impl?module=asdcApi-provider-impl&amp;revision=2014-05-23</capability>
+ </required-capabilities>
+
+</snapshot>
diff --git a/asdcApi/provider/src/main/yang/asdcApi-provider-impl.yang b/asdcApi/provider/src/main/yang/asdcApi-provider-impl.yang
new file mode 100755
index 00000000..94ee8836
--- /dev/null
+++ b/asdcApi/provider/src/main/yang/asdcApi-provider-impl.yang
@@ -0,0 +1,61 @@
+module asdcApi-provider-impl {
+
+ yang-version 1;
+ namespace "org:openecomp:sdnc:asdcapi:provider:impl";
+ prefix "asdcApi-provider-impl";
+
+ import config { prefix config; revision-date 2013-04-05; }
+ import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+
+ description
+ "This module contains the base YANG definitions for
+ asdcApi-provider impl implementation.";
+
+ revision "2014-05-23" {
+ description
+ "Initial revision.";
+ }
+
+ // This is the definition of the service implementation as a module identity.
+ identity asdcApi-provider-impl {
+ base config:module-type;
+
+ // Specifies the prefix for generated java classes.
+ config:java-name-prefix AsdcApiProvider;
+ }
+
+ // Augments the 'configuration' choice node under modules/module.
+ // We consume the three main services, RPCs, DataStore, and Notifications
+ augment "/config:modules/config:module/config:configuration" {
+ case asdcApi-provider-impl {
+ when "/config:modules/config:module/config:type = 'asdcApi-provider-impl'";
+
+ container rpc-registry {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity mdsal:binding-rpc-registry;
+ }
+ }
+ }
+
+ container notification-service {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity mdsal:binding-notification-service;
+ }
+ }
+ }
+
+ container data-broker {
+ uses config:service-ref {
+ refine type {
+ mandatory false;
+ config:required-identity mdsal:binding-async-data-broker;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/dataChange/.gitignore b/dataChange/.gitignore
new file mode 100755
index 00000000..b73caf31
--- /dev/null
+++ b/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/dataChange/.sonar/checkstyle.xml b/dataChange/.sonar/checkstyle.xml
new file mode 100755
index 00000000..3fa23153
--- /dev/null
+++ b/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/dataChange/.sonar/pmd.xml b/dataChange/.sonar/pmd.xml
new file mode 100755
index 00000000..80343b3b
--- /dev/null
+++ b/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/dataChange/README.txt b/dataChange/README.txt
new file mode 100755
index 00000000..f9f4a2ab
--- /dev/null
+++ b/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/dataChange/features/pom.xml b/dataChange/features/pom.xml
new file mode 100755
index 00000000..6f993f8b
--- /dev/null
+++ b/dataChange/features/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>
+ <artifactId>dataChange</artifactId>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>dataChange-features</artifactId>
+ <version>1.0.0</version>
+
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>dataChange-model</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>dataChange-provider</artifactId>
+ <classifier>config</classifier>
+ <type>xml</type>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>dataChange-provider</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>features-mdsal</artifactId>
+ <classifier>features</classifier>
+ <version>${odl.mdsal.features.version}</version>
+ <type>xml</type>
+
+ <scope>runtime</scope>
+ </dependency>
+
+
+
+ <!-- dependency for opendaylight-karaf-empty for use by testing -->
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>opendaylight-karaf-empty</artifactId>
+ <type>zip</type>
+ </dependency>
+
+
+ <dependency>
+ <!-- Required for launching the feature tests-->
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>features-test</artifactId>
+ <scope>test</scope>
+ <version>${odl.commons.opendaylight.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>features-yangtools</artifactId>
+ <version>${odl.yangtools.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <filtering>true</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>filter</id>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <!--
+ <plugin>
+ launches the feature test, which validates that your karaf feature can
+ be installed inside of a karaf container. It doesn't validate that your
+ functionality works correctly, just that you have all of the dependent
+ bundles defined correctly.
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.16</version>
+ <configuration>
+ <systemPropertyVariables>
+ <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId>
+ <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
+ <karaf.distro.version>${odl.karaf.empty.distro.version}</karaf.distro.version>
+ </systemPropertyVariables>
+ <dependenciesToScan>
+ <dependency>org.opendaylight.yangtools:features-test</dependency>
+ </dependenciesToScan>
+ </configuration>
+ </plugin>
+ -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/${features.file}</file>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/dataChange/features/src/main/resources/features.xml b/dataChange/features/src/main/resources/features.xml
new file mode 100644
index 00000000..98ed8d51
--- /dev/null
+++ b/dataChange/features/src/main/resources/features.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============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=========================================================
+ -->
+
+
+<features name="sdnc-dataChange-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+
+ <repository>mvn:org.opendaylight.mdsal/features-mdsal/${odl.mdsal.features.version}/xml/features</repository>
+
+ <feature name='sdnc-dataChange' description="sdnc-dataChange" version='${project.version}'>
+ <!-- Most applications will have a dependency on the ODL MD-SAL Broker -->
+ <feature version="${odl.mdsal.version}">odl-mdsal-broker</feature>
+ <feature version="${sdnctl.sli.version}">sdnc-sli</feature>
+ <bundle>mvn:org.openecomp.sdnc.northbound/dataChange-model/${project.version}</bundle>
+ <bundle>mvn:org.openecomp.sdnc.northbound/dataChange-provider/${project.version}</bundle>
+ <configfile finalname="etc/opendaylight/karaf/200-dataChange-provider.xml">mvn:org.openecomp.sdnc.northbound/dataChange-provider/${project.version}/xml/config</configfile>
+ </feature>
+
+</features>
diff --git a/dataChange/installer/pom.xml b/dataChange/installer/pom.xml
new file mode 100755
index 00000000..3a5fa50a
--- /dev/null
+++ b/dataChange/installer/pom.xml
@@ -0,0 +1,137 @@
+<?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>
+ <artifactId>dataChange</artifactId>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>dataChange-installer</artifactId>
+ <name>dataChange - Karaf Installer</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <application.name>sdnc-dataChange</application.name>
+ <features.boot>sdnc-dataChange</features.boot>
+ <features.repositories>mvn:org.openecomp.sdnc.northbound/dataChange-features/${project.version}/xml/features</features.repositories>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>dataChange-features</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>dataChange-provider</artifactId>
+ <version>${project.version}</version>
+ </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>false</attach>
+ <finalName>stage/${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+ </descriptors>
+ </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>
+ </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.openecomp.sdnc</includeGroupIds>
+ <excludeArtifactIds>sli-common,sli-provider,dblib-provider</excludeArtifactIds>
+ <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/dataChange/installer/src/assembly/assemble_installer_zip.xml b/dataChange/installer/src/assembly/assemble_installer_zip.xml
new file mode 100644
index 00000000..0ce9b1ac
--- /dev/null
+++ b/dataChange/installer/src/assembly/assemble_installer_zip.xml
@@ -0,0 +1,58 @@
+<!--
+ ============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">
+ <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/dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml b/dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100644
index 00000000..c64ca699
--- /dev/null
+++ b/dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml
@@ -0,0 +1,54 @@
+<!--
+ ============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">
+ <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>
+
+ <files>
+ <file>
+ <source>../provider/src/main/resources/initial/${feature-name}-provider.xml</source>
+ <destName>./etc/opendaylight/karaf/200-${feature-name}-provider.xml</destName>
+ </file>
+
+ </files>
+
+</assembly>
diff --git a/dataChange/installer/src/main/resources/scripts/install-feature.sh b/dataChange/installer/src/main/resources/scripts/install-feature.sh
new file mode 100644
index 00000000..33e9b036
--- /dev/null
+++ b/dataChange/installer/src/main/resources/scripts/install-feature.sh
@@ -0,0 +1,40 @@
+#!/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}
+ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"}
+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} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories}
+${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot}
diff --git a/dataChange/model/pom.xml b/dataChange/model/pom.xml
new file mode 100755
index 00000000..e5772f4d
--- /dev/null
+++ b/dataChange/model/pom.xml
@@ -0,0 +1,82 @@
+<?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>
+ <artifactId>dataChange</artifactId>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>dataChange-model</artifactId>
+ <version>1.0.0</version>
+ <packaging>bundle</packaging>
+
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Import-Package>*</Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-maven-plugin</artifactId>
+ <version>${odl.yangtools.yang.maven.plugin.version}</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>maven-sal-api-gen-plugin</artifactId>
+ <version>${odl.yangtools.version}</version>
+ <type>jar</type>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <yangFilesRootDir>${yang.file.directory}</yangFilesRootDir>
+ <codeGenerators>
+ <generator>
+ <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
+ <outputBaseDir>${salGeneratorPath}</outputBaseDir>
+ </generator>
+ </codeGenerators>
+ <inspectDependencies>true</inspectDependencies>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>yang-binding</artifactId>
+ <version>${odl.yangtools.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-common</artifactId>
+ <version>${odl.yangtools.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-inet-types</artifactId>
+ <version>${odl.ietf-inet-types.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-yang-types</artifactId>
+ <version>${odl.ietf-yang-types.version}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/dataChange/model/src/main/yang/DataChange.yang b/dataChange/model/src/main/yang/DataChange.yang
new file mode 100755
index 00000000..3d326f7b
--- /dev/null
+++ b/dataChange/model/src/main/yang/DataChange.yang
@@ -0,0 +1,73 @@
+module DataChange {
+
+ yang-version 1;
+
+ namespace "org:openecomp:sdnc: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/dataChange/pom.xml b/dataChange/pom.xml
new file mode 100755
index 00000000..90d3311d
--- /dev/null
+++ b/dataChange/pom.xml
@@ -0,0 +1,59 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>sdnc-northbound</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <packaging>pom</packaging>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>dataChange</artifactId>
+ <version>1.0.0</version>
+
+ <properties>
+ <feature-name>dataChange</feature-name>
+ </properties>
+
+ <dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>dataChange-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>dataChange-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>dataChange-provider</artifactId>
+ <version>${project.version}</version>
+ <classifier>config</classifier>
+ <type>xml</type>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>dataChange-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+
+ </dependencyManagement>
+
+ <modules>
+ <module>model</module>
+ <module>features</module>
+ <module>provider</module>
+ <module>installer</module>
+ </modules>
+</project>
diff --git a/dataChange/provider/pom.xml b/dataChange/provider/pom.xml
new file mode 100755
index 00000000..f2cd725d
--- /dev/null
+++ b/dataChange/provider/pom.xml
@@ -0,0 +1,137 @@
+<?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>
+ <artifactId>dataChange</artifactId>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>dataChange-provider</artifactId>
+ <packaging>bundle</packaging>
+
+ <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.DataChange_provider.impl</Export-Package>
+ <Import-Package>*</Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-maven-plugin</artifactId>
+ <version>${odl.yangtools.yang.maven.plugin.version}</version>
+
+ <executions>
+ <execution>
+ <id>config</id>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <codeGenerators>
+ <generator>
+ <codeGeneratorClass>org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator</codeGeneratorClass>
+ <outputBaseDir>${jmxGeneratorPath}</outputBaseDir>
+ <additionalConfiguration>
+ <namespaceToPackage1>urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang</namespaceToPackage1>
+ </additionalConfiguration>
+ </generator>
+ <generator>
+ <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
+ <outputBaseDir>${salGeneratorPath}</outputBaseDir>
+ </generator>
+ </codeGenerators>
+ <inspectDependencies>true</inspectDependencies>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>maven-sal-api-gen-plugin</artifactId>
+ <version>${odl.yangtools.version}</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>yang-jmx-generator-plugin</artifactId>
+ <version>${odl.yang.jmx.generator.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/initial/${feature-name}-provider.xml</file>
+ <type>xml</type>
+ <classifier>config</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>dataChange-model</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-api</artifactId>
+
+ <version>${odl.controller.config.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-config</artifactId>
+ <version>${odl.mdsal.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
+ <version>${odl.mdsal.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-common-util</artifactId>
+ <version>${odl.mdsal.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-common</artifactId>
+ <version>${sdnctl.sli.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ <version>${sdnctl.sli.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/dataChange/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/datachange/provider/impl/rev140523/DataChangeProviderModule.java b/dataChange/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/datachange/provider/impl/rev140523/DataChangeProviderModule.java
new file mode 100644
index 00000000..43a3710d
--- /dev/null
+++ b/dataChange/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/datachange/provider/impl/rev140523/DataChangeProviderModule.java
@@ -0,0 +1,55 @@
+/*-
+ * ============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.opendaylight.yang.gen.v1.org.openecomp.sdnc.datachange.provider.impl.rev140523;
+
+import org.openecomp.sdnc.datachange.DataChangeProvider;
+
+public class DataChangeProviderModule extends org.opendaylight.yang.gen.v1.org.openecomp.sdnc.datachange.provider.impl.rev140523.AbstractDataChangeProviderModule {
+ public DataChangeProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public DataChangeProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.org.openecomp.sdnc.datachange.provider.impl.rev140523.DataChangeProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ final DataChangeProvider provider = new DataChangeProvider(getDataBrokerDependency()
+ , getNotificationServiceDependency()
+ , getRpcRegistryDependency());
+
+ return new AutoCloseable() {
+
+ @Override
+ public void close() throws Exception {
+ provider.close();
+ }
+ };
+ }
+
+}
diff --git a/dataChange/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/datachange/provider/impl/rev140523/DataChangeProviderModuleFactory.java b/dataChange/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/datachange/provider/impl/rev140523/DataChangeProviderModuleFactory.java
new file mode 100644
index 00000000..157a9e33
--- /dev/null
+++ b/dataChange/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/datachange/provider/impl/rev140523/DataChangeProviderModuleFactory.java
@@ -0,0 +1,34 @@
+/*-
+ * ============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=========================================================
+ */
+
+/*
+* Generated file
+*
+* Generated from: yang module name: DataChange-provider-impl yang module local name: DataChange-provider-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Wed Nov 02 06:00:03 EDT 2016
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.org.openecomp.sdnc.datachange.provider.impl.rev140523;
+public class DataChangeProviderModuleFactory extends org.opendaylight.yang.gen.v1.org.openecomp.sdnc.datachange.provider.impl.rev140523.AbstractDataChangeProviderModuleFactory {
+
+}
diff --git a/dataChange/provider/src/main/java/org/openecomp/sdnc/datachange/DataChangeClient.java b/dataChange/provider/src/main/java/org/openecomp/sdnc/datachange/DataChangeClient.java
new file mode 100644
index 00000000..ff6c484b
--- /dev/null
+++ b/dataChange/provider/src/main/java/org/openecomp/sdnc/datachange/DataChangeClient.java
@@ -0,0 +1,115 @@
+/*-
+ * ============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.openecomp.sdnc.datachange;
+
+import java.util.Properties;
+
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.datachange.rev150519.DataChangeNotificationOutputBuilder;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.provider.MdsalHelper;
+import org.openecomp.sdnc.sli.provider.SvcLogicService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DataChangeClient {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(DataChangeClient.class);
+
+ private SvcLogicService svcLogic = null;
+
+ public DataChangeClient()
+ {
+ BundleContext bctx = FrameworkUtil.getBundle(SvcLogicService.class).getBundleContext();
+
+ // Get SvcLogicService reference
+ ServiceReference sref = bctx.getServiceReference(SvcLogicService.NAME);
+ if (sref != null)
+ {
+ svcLogic = (SvcLogicService) bctx.getService(sref);
+
+ }
+ else
+ {
+ LOG.warn("Cannot find service reference for "+SvcLogicService.NAME);
+
+ }
+ }
+
+ public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException
+ {
+ return(svcLogic.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 {
+
+ parms = MdsalHelper.toProperties(parms, serviceData);
+
+ 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 = svcLogic.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"))) {
+ return (respProps);
+ }
+
+ MdsalHelper.toBuilder(respProps, serviceData);
+
+ return (respProps);
+ }
+
+}
diff --git a/dataChange/provider/src/main/java/org/openecomp/sdnc/datachange/DataChangeProvider.java b/dataChange/provider/src/main/java/org/openecomp/sdnc/datachange/DataChangeProvider.java
new file mode 100644
index 00000000..092dac2c
--- /dev/null
+++ b/dataChange/provider/src/main/java/org/openecomp/sdnc/datachange/DataChangeProvider.java
@@ -0,0 +1,181 @@
+/*-
+ * ============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.openecomp.sdnc.datachange;
+
+import java.util.Properties;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
+import org.opendaylight.controller.sal.binding.api.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.datachange.rev150519.DataChangeNotificationInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.datachange.rev150519.DataChangeNotificationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.datachange.rev150519.DataChangeNotificationOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.datachange.rev150519.DataChangeNotificationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.datachange.rev150519.DataChangeService;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.openecomp.sdnc.sli.provider.MdsalHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.util.concurrent.Futures;
+
+/**
+ * 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 final Logger log = LoggerFactory.getLogger( DataChangeProvider.class );
+ private final String appName = "DataChange";
+ private final ExecutorService executor;
+
+ protected DataBroker dataBroker;
+ protected NotificationProviderService notificationService;
+ protected RpcProviderRegistry rpcRegistry;
+ protected BindingAwareBroker.RpcRegistration<DataChangeService> rpcRegistration;
+
+
+ public DataChangeProvider(DataBroker dataBroker2,
+ NotificationProviderService notificationProviderService,
+ RpcProviderRegistry rpcProviderRegistry) {
+ this.log.info( "Creating provider for " + appName );
+ executor = Executors.newFixedThreadPool(1);
+ dataBroker = dataBroker2;
+ notificationService = notificationProviderService;
+ rpcRegistry = rpcProviderRegistry;
+ initialize();
+ }
+
+ public void initialize(){
+ log.info( "Initializing provider for " + appName );
+ rpcRegistration = rpcRegistry.addRpcImplementation(DataChangeService.class, this);
+ log.info( "Initialization complete for " + appName );
+ }
+
+ protected void initializeChild() {
+ //Override if you have custom initialization intelligence
+ }
+
+ @Override
+ public void close() throws Exception {
+ log.info( "Closing provider for " + appName );
+ executor.shutdown();
+ rpcRegistration.close();
+ log.info( "Successfully closed provider for " + appName );
+ }
+
+ public void setDataBroker(DataBroker dataBroker) {
+ this.dataBroker = dataBroker;
+ if( log.isDebugEnabled() ){
+ log.debug( "DataBroker set to " + (dataBroker==null?"null":"non-null") + "." );
+ }
+ }
+
+ public void setNotificationService(
+ NotificationProviderService notificationService) {
+ this.notificationService = notificationService;
+ if( log.isDebugEnabled() ){
+ log.debug( "Notification Service set to " + (notificationService==null?"null":"non-null") + "." );
+ }
+ }
+
+ public void setRpcRegistry(RpcProviderRegistry rpcRegistry) {
+ this.rpcRegistry = rpcRegistry;
+ if( log.isDebugEnabled() ){
+ log.debug( "RpcRegistry set to " + (rpcRegistry==null?"null":"non-null") + "." );
+ }
+ }
+
+ @Override
+ public Future<RpcResult<DataChangeNotificationOutput>> dataChangeNotification(
+ DataChangeNotificationInput input) {
+ final String SVC_OPERATION = "data-change-notification";
+
+ Properties parms = new Properties();
+ DataChangeNotificationOutputBuilder serviceDataBuilder = new DataChangeNotificationOutputBuilder();
+
+ log.info( SVC_OPERATION +" called." );
+
+ if(input == null || input.getAaiEventId() == null) {
+ log.debug("exiting " +SVC_OPERATION+ " 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 "+SVC_OPERATION+" input: " + input);
+ DataChangeNotificationInputBuilder inputBuilder = new DataChangeNotificationInputBuilder(input);
+ MdsalHelper.toProperties(parms, inputBuilder.build());
+
+ // Call SLI sync method
+ // Get SvcLogicService reference
+
+ DataChangeClient svcLogicClient = new DataChangeClient();
+ Properties respProps = null;
+
+ try
+ {
+ if (svcLogicClient.hasGraph("DataChange", SVC_OPERATION , null, "sync"))
+ {
+ try
+ {
+ respProps = svcLogicClient.execute("DataChange", SVC_OPERATION, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic for "+ SVC_OPERATION, e);
+ serviceDataBuilder.setDataChangeResponseCode("500");
+ }
+ } else {
+ log.error("No service logic active for DataChange: '" + SVC_OPERATION + "'");
+ serviceDataBuilder.setDataChangeResponseCode("503");
+ }
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception looking for service logic", e);
+ serviceDataBuilder.setDataChangeResponseCode("500");
+ }
+
+ String errorCode = serviceDataBuilder.getDataChangeResponseCode();
+
+ if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) {
+ log.error("Returned FAILED for "+SVC_OPERATION+" error code: '" + errorCode + "'");
+ } else {
+ log.info("Returned SUCCESS for "+SVC_OPERATION+" ");
+ }
+
+ RpcResult<DataChangeNotificationOutput> rpcResult =
+ RpcResultBuilder.<DataChangeNotificationOutput> status(true).withResult(serviceDataBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+}
diff --git a/dataChange/provider/src/main/resources/initial/dataChange-provider.xml b/dataChange/provider/src/main/resources/initial/dataChange-provider.xml
new file mode 100644
index 00000000..80a0ad39
--- /dev/null
+++ b/dataChange/provider/src/main/resources/initial/dataChange-provider.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============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=========================================================
+ -->
+
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<snapshot>
+ <configuration>
+ <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+ <module>
+
+ <!-- This xmlns:prefix should match the namespace in the *-provider-impl.yang file
+ The prefix: inside type should match the prefix of the yang file. -->
+ <type xmlns:prefix="org:openecomp:sdnc:datachange:provider:impl">
+ prefix:DataChange-provider-impl
+ </type>
+ <name>DataChange-provider-impl</name>
+
+ <!-- The following sections contain bindings to services defined in the
+ *-provider-impl yang file. For example the rpc-registry is required
+ because we have a dependency (or augmentation) named "rpc-registry"
+ and which binds to the md-sa-binding-registry. If you remove those
+ dependencies from the yang file then you can remove them from here. -->
+ <rpc-registry>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
+ <name>binding-rpc-broker</name>
+ </rpc-registry>
+
+ <data-broker>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
+ <name>binding-data-broker</name>
+ </data-broker>
+
+ <notification-service>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
+ binding:binding-notification-service
+ </type>
+ <name>binding-notification-broker</name>
+ </notification-service>
+ </module>
+
+ </modules>
+ </data>
+
+ </configuration>
+
+ <!-- Required capabilities are basically a listing of all modules that need to be imported before
+ our service can be resolved. Capabilities for dependencies defined above are implied which is
+ why we do not have define a required capability for the data broker, for example. -->
+ <required-capabilities>
+ <capability>org:openecomp:sdnc:datachange:provider:impl?module=DataChange-provider-impl&amp;revision=2014-05-23</capability>
+ </required-capabilities>
+
+</snapshot>
diff --git a/dataChange/provider/src/main/yang/DataChange-provider-impl.yang b/dataChange/provider/src/main/yang/DataChange-provider-impl.yang
new file mode 100755
index 00000000..fe1dab23
--- /dev/null
+++ b/dataChange/provider/src/main/yang/DataChange-provider-impl.yang
@@ -0,0 +1,61 @@
+module DataChange-provider-impl {
+
+ yang-version 1;
+ namespace "org:openecomp:sdnc:datachange:provider:impl";
+ prefix "DataChange-provider-impl";
+
+ import config { prefix config; revision-date 2013-04-05; }
+ import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+
+ description
+ "This module contains the base YANG definitions for
+ DataChange-provider impl implementation.";
+
+ revision "2014-05-23" {
+ description
+ "Initial revision.";
+ }
+
+ // This is the definition of the service implementation as a module identity.
+ identity DataChange-provider-impl {
+ base config:module-type;
+
+ // Specifies the prefix for generated java classes.
+ config:java-name-prefix DataChangeProvider;
+ }
+
+ // Augments the 'configuration' choice node under modules/module.
+ // We consume the three main services, RPCs, DataStore, and Notifications
+ augment "/config:modules/config:module/config:configuration" {
+ case DataChange-provider-impl {
+ when "/config:modules/config:module/config:type = 'DataChange-provider-impl'";
+
+ container rpc-registry {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity mdsal:binding-rpc-registry;
+ }
+ }
+ }
+
+ container notification-service {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity mdsal:binding-notification-service;
+ }
+ }
+ }
+
+ container data-broker {
+ uses config:service-ref {
+ refine type {
+ mandatory false;
+ config:required-identity mdsal:binding-async-data-broker;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/example-settings.xml b/example-settings.xml
new file mode 100644
index 00000000..2e7ce644
--- /dev/null
+++ b/example-settings.xml
@@ -0,0 +1,163 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=2 tabstop=2: -->
+<!--
+ Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
+
+ <profiles>
+ <profile>
+ <id>openecomp-release</id>
+ <repositories>
+ <repository>
+ <id>openecomp-release</id>
+ <name>openecomp-release</name>
+ <url>https://ecomp-nexus:8443/repository/maven-releases/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>openecomp-release</id>
+ <name>openecomp-release</name>
+ <url>https://ecomp-nexus:8443/repository/maven-releases/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+
+ <profile>
+ <id>openecomp-snapshots</id>
+ <repositories>
+ <repository>
+ <id>openecomp-snapshot</id>
+ <name>openecomp-snapshot</name>
+ <url>https://ecomp-nexus:8443/repository/maven-snapshots/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>openecomp-snapshot</id>
+ <name>openecomp-snapshot</name>
+ <url>https://ecomp-nexus:8443/repository/maven-snapshots/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ <profile>
+ <id>opendaylight-release</id>
+ <repositories>
+ <repository>
+ <id>opendaylight-mirror</id>
+ <name>opendaylight-mirror</name>
+ <url>https://nexus.opendaylight.org/content/repositories/public/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>opendaylight-mirror</id>
+ <name>opendaylight-mirror</name>
+ <url>https://nexus.opendaylight.org/content/repositories/public/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+
+ <profile>
+ <id>opendaylight-snapshots</id>
+ <repositories>
+ <repository>
+ <id>opendaylight-snapshot</id>
+ <name>opendaylight-snapshot</name>
+ <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>opendaylight-snapshot</id>
+ <name>opendaylight-snapshot</name>
+ <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
+
+ <activeProfiles>
+ <activeProfile>openecomp-release</activeProfile>
+ <activeProfile>openecomp-snapshots</activeProfile>
+ <activeProfile>opendaylight-release</activeProfile>
+ <activeProfile>opendaylight-snapshots</activeProfile>
+ </activeProfiles>
+
+ <servers>
+ <server>
+ <id>nexus</id>
+ <username>USERNAME</username>
+ <password>PASSWORD</password>
+ </server>
+ <server>
+ <id>openecomp-release</id>
+ <username>USERNAME</username>
+ <password>PASSWORD</password>
+ </server>
+ <server>
+ <id>openecomp-snapshot</id>
+ <username>USERNAME</username>
+ <password>PASSWORD</password>
+ </server>
+ </servers>
+</settings>
diff --git a/jenkins-settings.xml b/jenkins-settings.xml
new file mode 100644
index 00000000..344994f8
--- /dev/null
+++ b/jenkins-settings.xml
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=2 tabstop=2: -->
+<!--
+ Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved.
+
+ This program and the accompanying materials are made available under the
+ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
+
+ <profiles>
+ <profile>
+ <id>openecomp-release</id>
+ <repositories>
+ <repository>
+ <id>openecomp-release</id>
+ <name>openecomp-release</name>
+ <url>https://ecomp-nexus:8443/repository/maven-releases/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>openecomp-release</id>
+ <name>openecomp-release</name>
+ <url>https://ecomp-nexus:8443/repository/maven-releases/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+
+ <profile>
+ <id>openecomp-snapshots</id>
+ <repositories>
+ <repository>
+ <id>openecomp-snapshot</id>
+ <name>openecomp-snapshot</name>
+ <url>https://ecomp-nexus:8443/repository/maven-snapshots/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>openecomp-snapshot</id>
+ <name>openecomp-snapshot</name>
+ <url>https://ecomp-nexus:8443/repository/maven-snapshots/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ <profile>
+ <id>opendaylight-release</id>
+ <repositories>
+ <repository>
+ <id>opendaylight-mirror</id>
+ <name>opendaylight-mirror</name>
+ <url>https://nexus.opendaylight.org/content/repositories/public/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>opendaylight-mirror</id>
+ <name>opendaylight-mirror</name>
+ <url>https://nexus.opendaylight.org/content/repositories/public/</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+
+ <profile>
+ <id>opendaylight-snapshots</id>
+ <repositories>
+ <repository>
+ <id>opendaylight-snapshot</id>
+ <name>opendaylight-snapshot</name>
+ <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>opendaylight-snapshot</id>
+ <name>opendaylight-snapshot</name>
+ <url>https://nexus.opendaylight.org/content/repositories/opendaylight.snapshot/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+ </profile>
+ </profiles>
+
+ <activeProfiles>
+ <activeProfile>openecomp-release</activeProfile>
+ <activeProfile>openecomp-snapshots</activeProfile>
+ <activeProfile>opendaylight-release</activeProfile>
+ <activeProfile>opendaylight-snapshots</activeProfile>
+ </activeProfiles>
+
+ <servers>
+ <server>
+ <id>nexus</id>
+ <username>${ecomp.nexus.user}</username>
+ <password>${ecomp.nexus.password}</password>
+ </server>
+ <server>
+ <id>openecomp-release</id>
+ <username>${ecomp.nexus.user}</username>
+ <password>${ecomp.nexus.password}</password>
+ </server>
+ <server>
+ <id>openecomp-snapshot</id>
+ <username>${ecomp.nexus.user}</username>
+ <password>${ecomp.nexus.password}</password>
+ </server>
+ <server>
+ <id>sdnc-javadoc</id>
+ <username>${ecomp.nexus.user}</username>
+ <password>${ecomp.nexus.password}</password>
+ </server>
+ </servers>
+</settings>
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 00000000..be03e932
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,84 @@
+<?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/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>root</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>pom</packaging>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>sdnc-northbound</artifactId>
+
+ <name>SDN-C Northbound APIs</name>
+ <url>https://wiki.openecomp.org</url>
+ <description>The SDN-C Northbound APIs repo contains code for northbound API adaptors, typically MD-SAL applications</description>
+
+
+ <issueManagement>
+ <system>JIRA</system>
+ <url>https://jira.openecomp.org/</url>
+ </issueManagement>
+
+
+ <scm>
+ <connection>scm:git:ssh://git@${openecomp.git.host}/sdnc-northbound.git</connection>
+
+ <developerConnection>scm:git:ssh://${openecomp.git.host}:${openecomp.git.port}/${openecomp.git.project}/sdnc-northbound.git</developerConnection>
+ <url>${openecomp.git.protocol}://${openecomp.git.host}/projects/${openecomp.git.project}/repos/sdnc-northbound/browse</url>
+ </scm>
+
+ <ciManagement>
+ <system>Jenkins</system>
+ <url>https://jenkins.openecomp.org/</url>
+ </ciManagement>
+
+ <distributionManagement>
+ <site>
+ <id>sdnc-javadoc</id>
+ <url>dav:https://${openecomp.nexus.host}:${openecomp.nexus.port}/repository/sdn-c-javadoc/${project.artifactId}/${project.version}</url>
+ </site>
+ </distributionManagement>
+
+ <build>
+ <plugins>
+ <!-- Blackduck plugin breaks release build
+ <plugin>
+ <groupId>com.blackducksoftware.integration</groupId>
+ <artifactId>hub-maven-plugin</artifactId>
+ <version>1.4.0</version>
+ <inherited>false</inherited>
+ <configuration>
+ <hubProjectName>${project.name}</hubProjectName>
+ <outputDirectory>${project.basedir}</outputDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>create-bdio-file</id>
+ <phase>package</phase>
+ <goals>
+ <goal>createHubOutput</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ -->
+ </plugins>
+
+ </build>
+ <modules>
+ <module>asdcApi</module>
+ <module>dataChange</module>
+ <module>ueb-listener</module>
+ <module>vnfapi</module>
+ <module>vnftools</module>
+ </modules>
+ <organization>
+ <name>AT&amp;T</name>
+ </organization>
+ <version>1.0.0</version>
+
+
+</project>
diff --git a/ueb-listener/.gitignore b/ueb-listener/.gitignore
new file mode 100755
index 00000000..1b8a6ba9
--- /dev/null
+++ b/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/ueb-listener/.sonar/checkstyle.xml b/ueb-listener/.sonar/checkstyle.xml
new file mode 100755
index 00000000..3fa23153
--- /dev/null
+++ b/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/ueb-listener/.sonar/pmd.xml b/ueb-listener/.sonar/pmd.xml
new file mode 100755
index 00000000..80343b3b
--- /dev/null
+++ b/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/ueb-listener/pom.xml b/ueb-listener/pom.xml
new file mode 100755
index 00000000..ae740bb9
--- /dev/null
+++ b/ueb-listener/pom.xml
@@ -0,0 +1,110 @@
+<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>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <packaging>jar</packaging>
+ <artifactId>ueb-listener</artifactId>
+ <version>1.0.0</version>
+
+ <name>UEB Listener</name>
+ <description>UEB Listener</description>
+ <parent>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>sdnc-northbound</artifactId>
+ <version>1.0.0</version>
+ </parent>
+ <properties>
+ <sdc.client.version>1.1.0</sdc.client.version>
+ <skip.SWM>true</skip.SWM>
+ <ueb.listener.base>/opt/app/ueb-listener</ueb.listener.base>
+ <maven.build.timestamp.format>yyMMdd-HHmmss</maven.build.timestamp.format>
+ <build.number>${maven.build.timestamp}</build.number>
+ <SWM_VERSION>${project.version}-${build.number}</SWM_VERSION>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>sdc-distribution-client</artifactId>
+ <version>${sdc.client.version}</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>1.7.10</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>1.6.1</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.17</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>${commons.codec.version}</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.7</source>
+ <target>1.7</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.openecomp.sdnc.uebclient.SdncUebClient</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <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>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+</project>
diff --git a/ueb-listener/src/assembly/assemble_zip.xml b/ueb-listener/src/assembly/assemble_zip.xml
new file mode 100644
index 00000000..f87a6488
--- /dev/null
+++ b/ueb-listener/src/assembly/assemble_zip.xml
@@ -0,0 +1,61 @@
+<!--
+ ============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">
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>src/main/bin</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>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ <useProjectArtifact>true</useProjectArtifact>
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+</assembly>
diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebCallback.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebCallback.java
new file mode 100644
index 00000000..3fa752bc
--- /dev/null
+++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebCallback.java
@@ -0,0 +1,840 @@
+/*-
+ * ============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.openecomp.sdnc.uebclient;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
+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 java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLSession;
+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 org.apache.commons.codec.binary.Base64;
+import org.openecomp.sdc.api.IDistributionClient;
+import org.openecomp.sdc.api.consumer.IDistributionStatusMessage;
+import org.openecomp.sdc.api.consumer.INotificationCallback;
+import org.openecomp.sdc.api.notification.IArtifactInfo;
+import org.openecomp.sdc.api.notification.INotificationData;
+import org.openecomp.sdc.api.notification.IResourceInstance;
+import org.openecomp.sdc.api.results.IDistributionClientDownloadResult;
+import org.openecomp.sdc.api.results.IDistributionClientResult;
+import org.openecomp.sdc.utils.ArtifactTypeEnum;
+import org.openecomp.sdc.utils.DistributionActionResultEnum;
+import org.openecomp.sdc.utils.DistributionStatusEnum;
+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);
+
+ private static final int NUM_PASSES = 2;
+
+ private enum SdncArtifactType {
+ VF_LICENSE_MODEL("vf-license-model", "vf-license-model-update",0),
+ UNKNOWN("","",0);
+
+
+ private String tag;
+ private String rpcName;
+ private int pass;
+
+ public int getPass() {
+ return pass;
+ }
+
+ private SdncArtifactType(String tag, String rpcName, int pass) {
+ this.tag = tag;
+ this.rpcName = rpcName;
+ this.pass = pass;
+ }
+
+ public String getTag() {
+ return tag;
+ }
+
+ public String getRpcUrl(String base) {
+ return base+rpcName;
+ }
+
+ public static SdncArtifactType fromTag(String tag) {
+ if (tag != null) {
+ for (SdncArtifactType artifact: SdncArtifactType.values()) {
+ if (artifact.getTag().equalsIgnoreCase(tag)) {
+ return artifact;
+ }
+ }
+ }
+
+ return UNKNOWN;
+ }
+ }
+
+ 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.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.artifactName = artifactName;
+ this.artifactVersion = artifactVersion;
+ this.file = file;
+ }
+
+
+
+ public String getSvcName() {
+ return svcName;
+ }
+
+
+
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ }
+
+ private final IDistributionClient client;
+ private final SdncUebConfiguration config;
+
+ private final LinkedList<DeployableArtifact> deployList[];
+
+
+ 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<>();
+ }
+ }
+
+ @Override
+ public void activateCallback(INotificationData data) {
+
+ LOG.info("Received notification : ("+data.getDistributionID()+","+data.getServiceName()+","+data.getServiceVersion()+
+ ","+data.getServiceDescription());
+
+ String incomingDirName = config.getIncomingDir();
+ String archiveDirName = config.getArchiveDir();
+
+ File incomingDir = null;
+ File archiveDir = null;
+
+ 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());
+
+ handleArtifact(data, data.getServiceName(), null, curArtifact, 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(), curArtifact, incomingDir, archiveDir);
+ }
+ }
+ }
+
+ deployDownloadedFiles(incomingDir, archiveDir, data);
+
+
+ }
+
+
+ public void deployDownloadedFiles(File incomingDir, File archiveDir, INotificationData data) {
+
+ if (incomingDir == null) {
+ incomingDir = new File(config.getIncomingDir());
+
+ if (!incomingDir.exists()) {
+ incomingDir.mkdirs();
+ }
+
+ }
+
+ 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();
+ handleSuccessfulDownload(null,null, null, null, file.toFile(), archiveDir);
+ }
+ } 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
+
+ for (int pass = 0 ; pass < NUM_PASSES ; 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));
+ }
+
+ }
+ }
+ }
+ }
+
+ private void handleArtifact(INotificationData data, String svcName, String resourceName, IArtifactInfo artifact, File incomingDir, File archiveDir) {
+
+ // Download Artifact
+ IDistributionClientDownloadResult downloadResult = client
+ .download(artifact);
+
+ String payload = new String(downloadResult.getArtifactPayload());
+
+
+ File spoolFile = new File(incomingDir.getAbsolutePath() + "/" + artifact.getArtifactName());
+
+ boolean writeSucceeded = false;
+
+ try {
+ FileWriter spoolFileWriter = new FileWriter(spoolFile);
+ spoolFileWriter.write(payload);
+ spoolFileWriter.close();
+ 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
+ IDistributionClientResult sendDownloadStatus = client
+ .sendDownloadStatus(buildStatusMessage(client, data,
+ relevantArtifact, DistributionStatusEnum.DOWNLOAD_ERROR));
+ }
+
+ 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;
+
+ if (artifact != null) {
+ artifact.getArtifactType();
+ }
+ String overrideFileName = config.getOverrideFile();
+ if (overrideFileName != null && overrideFileName.length() > 0) {
+ File overrideFile = new File(overrideFileName);
+
+ if (overrideFile.exists()) {
+ artifactEnum = ArtifactTypeEnum.YANG_XML;
+ spoolFile = overrideFile;
+ }
+
+ }
+
+ // Process spool file
+ Document spoolDoc = null;
+ File transformedFile = null;
+
+ // Apply XSLTs and get Doc object
+ try {
+ 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();
+ 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);
+ }
+ }
+
+
+ if (spoolDoc != null) {
+ // Analyze file type
+ SdncArtifactType artifactType = analyzeFileType(artifactEnum,
+ spoolFile, spoolDoc);
+
+ if (artifactType != SdncArtifactType.UNKNOWN) {
+
+ 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 SdncArtifactType analyzeFileType(ArtifactTypeEnum artifactType, File spoolFile, Document spoolDoc) {
+
+ if (artifactType != ArtifactTypeEnum.YANG_XML) {
+ LOG.error("Unexpected artifact type - expecting YANG_XML, got "+artifactType);
+ return SdncArtifactType.UNKNOWN;
+ }
+
+ // 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 retValue = SdncArtifactType.fromTag(rootName);
+
+ if (retValue == SdncArtifactType.UNKNOWN) {
+
+ LOG.error("Unexpected file contents - root tag is "+rootName);
+ }
+ return retValue;
+ } else {
+ LOG.error("Cannot get root tag from file");
+ return SdncArtifactType.UNKNOWN;
+ }
+
+ } catch (Exception e) {
+ LOG.error("Could not parse YANG_XML file "+spoolFile.getName(), e);
+ return SdncArtifactType.UNKNOWN;
+ }
+ }
+
+ 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();
+ if (namespace == null || namespace.length() == 0) {
+ namespace="com:att:sdnctl:asdcapi";
+ }
+
+ 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;
+ }
+ }
+
+ 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("<?")) {
+ msgBuffer.append(curLine+"\n");
+ }
+ curLine = rdr.readLine();
+ }
+ rdr.close();
+
+ } 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;
+
+ }
+
+ 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;
+
+ LOG.info("Sending REST POST to "+urlString);
+ LOG.info("Message body:\n"+new String(msgBytes));
+
+ try {
+ HttpURLConnection conn = getRestXmlConnection(urlString, "POST");
+
+ if (conn instanceof HttpsURLConnection) {
+ HostnameVerifier hostnameVerifier = new HostnameVerifier() {
+ @Override
+ public boolean verify(String hostname, SSLSession session) {
+ return true;
+ }
+ };
+ ((HttpsURLConnection)conn).setHostnameVerifier(hostnameVerifier);
+ }
+
+ // Write message
+ conn.setRequestProperty("Content-Length", ""+msgBytes.length);
+ DataOutputStream outStr = new DataOutputStream(conn.getOutputStream());
+ outStr.write(msgBytes);
+ outStr.close();
+
+
+ // Read response
+ BufferedReader respRdr;
+
+ LOG.info("Response: "+conn.getResponseCode()+" "+conn.getResponseMessage());
+
+
+ if (conn.getResponseCode() < 300) {
+
+ respRdr = new BufferedReader(new InputStreamReader(conn.getInputStream()));
+ } else {
+ respRdr = new BufferedReader(new InputStreamReader(conn.getErrorStream()));
+ }
+
+ StringBuffer respBuff = new StringBuffer();
+
+ String respLn;
+
+ while ((respLn = respRdr.readLine()) != null) {
+ respBuff.append(respLn+"\n");
+ }
+ respRdr.close();
+
+ String respString = respBuff.toString();
+
+ LOG.info("Response body :\n"+respString);
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+
+
+ response = db.parse(new ByteArrayInputStream(respString.getBytes()));
+
+ } catch (Exception e) {
+
+ LOG.error("Caught exception in postRestXml", 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();
+ 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) {
+ 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();
+
+ }
+
+}
diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebClient.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebClient.java
new file mode 100644
index 00000000..dd6c5148
--- /dev/null
+++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebClient.java
@@ -0,0 +1,65 @@
+/*-
+ * ============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.openecomp.sdnc.uebclient;
+
+import org.openecomp.sdc.api.IDistributionClient;
+import org.openecomp.sdc.api.results.IDistributionClientResult;
+import org.openecomp.sdc.impl.DistributionClientFactory;
+import org.openecomp.sdc.utils.DistributionActionResultEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SdncUebClient {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(SdncUebConfiguration.class);
+
+ public static void main(String[] args) {
+ IDistributionClient client = DistributionClientFactory
+ .createDistributionClient();
+
+ SdncUebConfiguration config = new SdncUebConfiguration();
+
+ SdncUebCallback cb = new SdncUebCallback(client, config);
+
+ LOG.info("Scanning for local distribution artifacts before starting client");
+ cb.deployDownloadedFiles(null, null, null);
+
+ LOG.info("Initializing ASDC distribution client");
+
+ IDistributionClientResult result = client.init(
+ config, cb);
+
+ LOG.info("Initialized ASDC distribution client - results = "
+ + result.getDistributionMessageResult());
+
+ if (result.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS) {
+ LOG.info("Starting client...");
+ IDistributionClientResult start = client.start();
+ LOG.info("Client startup result = "
+ + start.getDistributionMessageResult());
+ }
+
+
+ }
+
+}
diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebConfiguration.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebConfiguration.java
new file mode 100644
index 00000000..b7d9b983
--- /dev/null
+++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebConfiguration.java
@@ -0,0 +1,260 @@
+/*-
+ * ============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.openecomp.sdnc.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.openecomp.sdc.api.consumer.IConfiguration;
+import org.openecomp.sdc.utils.ArtifactTypeEnum;
+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 List<String> relevantArtifactTypes = null;
+ private String user = null;
+
+ private String sdncUser = null;
+ private String sdncPasswd = null;
+ private String asdcApiBaseUrl = null;
+ private String asdcApiNamespace = null;
+
+ public String getAsdcApiNamespace() {
+ return asdcApiNamespace;
+ }
+
+ 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 String getXsltPathList() {
+ return xsltPathList;
+ }
+
+ public String getOverrideFile() {
+ return overrideFile;
+ }
+
+ public SdncUebConfiguration() {
+
+ try {
+ init();
+ } catch (Exception e) {
+ LOG.error("Cannot initialize SdncUebConfiguration", e);
+ }
+ }
+
+ public void init() throws IOException {
+ String propPath = null;
+ String propDir = System.getenv(SDNC_CONFIG_DIR);
+ if (propDir == null) {
+
+ propDir = "/opt/sdnc/data/properties";
+ }
+ 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.openecomp.sdnc.uebclient.asdc-address");
+ consumerGroup = props.getProperty("org.openecomp.sdnc.uebclient.consumer-group");
+ consumerID = props.getProperty("org.openecomp.sdnc.uebclient.consumer-id");
+ environmentName = props.getProperty("org.openecomp.sdnc.uebclient.environment-name");
+ password = props.getProperty("org.openecomp.sdnc.uebclient.password");
+ user = props.getProperty("org.openecomp.sdnc.uebclient.user");
+
+ sdncUser = props.getProperty("org.openecomp.sdnc.uebclient.sdnc-user");
+ sdncPasswd = props.getProperty("org.openecomp.sdnc.uebclient.sdnc-passwd");
+ asdcApiBaseUrl = props.getProperty("org.openecomp.sdnc.uebclient.asdc-api-base-url");
+ asdcApiNamespace = props.getProperty("org.openecomp.sdnc.uebclient.asdc-api-namespace");
+
+ incomingDir = props.getProperty("org.openecomp.sdnc.uebclient.spool.incoming");
+ archiveDir = props.getProperty("org.openecomp.sdnc.uebclient.spool.archive");
+ overrideFile = props.getProperty("org.openecomp.sdnc.uebclient.override-file");
+
+ String curval = props.getProperty("org.openecomp.sdnc.uebclient.polling-interval");
+ if ((curval != null) && (curval.length() > 0)) {
+ try {
+ pollingInterval = Integer.parseInt(curval);
+ } catch (Exception e) {
+ LOG.warn("Illegal value for org.openecomp.sdnc.uebclient.polling-interval ("+curval+")");
+ }
+ }
+
+ curval = props.getProperty("org.openecomp.sdnc.uebclient.polling-timeout");
+ if ((curval != null) && (curval.length() > 0)) {
+ try {
+ pollingTimeout = Integer.parseInt(curval);
+ } catch (Exception e) {
+ LOG.warn("Illegal value for org.openecomp.sdnc.uebclient.polling-timeout ("+curval+")");
+ }
+ }
+
+ curval = props.getProperty("org.openecomp.sdnc.uebclient.relevant-artifact-types");
+ if ((curval != null) && (curval.length() > 0)) {
+ String[] artifactTypes = curval.split(",");
+
+ relevantArtifactTypes = new LinkedList<String>();
+
+ for (int i = 0 ; i < artifactTypes.length ; i++) {
+ try {
+ if (ArtifactTypeEnum.valueOf(artifactTypes[i]) != null) {
+ relevantArtifactTypes.add(artifactTypes[i]);
+ } else {
+ LOG.warn("Skipping unrecognized artifact type "+artifactTypes[i]);
+ }
+ } catch (Exception e) {
+
+ LOG.warn("Caught exception validating artifact type "+artifactTypes[i], e);
+ }
+
+ }
+
+ }
+
+ curval = props.getProperty("org.openecomp.sdnc.uebclient.activate-server-tls-auth", "false");
+ activateServerTLSAuth = "true".equalsIgnoreCase(curval);
+ keyStorePath = props.getProperty("org.openecomp.sdnc.uebclient.keystore-path");
+ keyStorePassword = props.getProperty("org.openecomp.sdnc.uebclient.keystore-password");
+ xsltPathList = props.getProperty("org.openecomp.sdnc.uebclient.xslt-path-list");
+
+
+
+ }
+
+ @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;
+ }
+
+ @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;
+ }
+
+
+}
diff --git a/ueb-listener/src/main/resources/log4j.properties b/ueb-listener/src/main/resources/log4j.properties
new file mode 100644
index 00000000..274f2d45
--- /dev/null
+++ b/ueb-listener/src/main/resources/log4j.properties
@@ -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=========================================================
+###
+
+log4j.rootCategory=INFO,CONSOLE,LOGFILE
+
+# CONSOLE is set to be a ConsoleAppender using a PatternLayout.
+log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
+log4j.appender.CONSOLE.Threshold=ERROR
+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
+
+# LOGFILE is set to be a File appender using a PatternLayout.
+log4j.appender.LOGFILE=org.apache.log4j.RollingFileAppender
+log4j.appender.LOGFILE.File=/opt/app/ueb-listener/logs/ueb-listener.log
+log4j.appender.LOGFILE.Append=true
+log4j.appender.LOGFILE.layout=org.apache.log4j.PatternLayout
+log4j.appender.LOGFILE.layout.ConversionPattern=%p %d{yyyy-MM-dd HH:mm:ss.SSS Z} %c{1} - %m%n
+log4j.appender.LOGFILE.MaxFileSize=10MB
+log4j.appender.LOGFILE.MaxBackupIndex=10
diff --git a/ueb-listener/src/main/resources/normalizeTagNames.xslt b/ueb-listener/src/main/resources/normalizeTagNames.xslt
new file mode 100755
index 00000000..6594ccfa
--- /dev/null
+++ b/ueb-listener/src/main/resources/normalizeTagNames.xslt
@@ -0,0 +1,14 @@
+<?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/ueb-listener/src/main/resources/removeNs.xslt b/ueb-listener/src/main/resources/removeNs.xslt
new file mode 100755
index 00000000..7aa927b1
--- /dev/null
+++ b/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/ueb-listener/src/site/apt/index.apt b/ueb-listener/src/site/apt/index.apt
new file mode 100644
index 00000000..fb2cb293
--- /dev/null
+++ b/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/ueb-listener/src/site/site.xml b/ueb-listener/src/site/site.xml
new file mode 100644
index 00000000..1d4e73ff
--- /dev/null
+++ b/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/version.properties b/version.properties
new file mode 100644
index 00000000..494186b5
--- /dev/null
+++ b/version.properties
@@ -0,0 +1,14 @@
+###########################################################
+# Versioning variables
+# Note that these variables cannot be structured (e.g. : version.release or version.snapshot etc... )
+# because they are used in Jenkins, whose plug-in doesn't support
+
+release_name=0
+sprint_number=1
+feature_revision=2
+
+base_version=${release_name}.${sprint_number}.${feature_revision}
+
+release_version=${base_version}
+snapshot_version=${base_version}-SNAPSHOT
+
diff --git a/vnfapi/.gitignore b/vnfapi/.gitignore
new file mode 100644
index 00000000..b73caf31
--- /dev/null
+++ b/vnfapi/.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/vnfapi/.sonar/checkstyle.xml b/vnfapi/.sonar/checkstyle.xml
new file mode 100644
index 00000000..3fa23153
--- /dev/null
+++ b/vnfapi/.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/vnfapi/.sonar/pmd.xml b/vnfapi/.sonar/pmd.xml
new file mode 100644
index 00000000..80343b3b
--- /dev/null
+++ b/vnfapi/.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/vnfapi/README.txt b/vnfapi/README.txt
new file mode 100644
index 00000000..f9f4a2ab
--- /dev/null
+++ b/vnfapi/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/vnfapi/features/pom.xml b/vnfapi/features/pom.xml
new file mode 100644
index 00000000..e4c3214c
--- /dev/null
+++ b/vnfapi/features/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>
+ <artifactId>vnfapi</artifactId>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>vnfapi-features</artifactId>
+
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnfapi-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnfapi-provider</artifactId>
+ <classifier>config</classifier>
+ <type>xml</type>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnfapi-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>features-mdsal</artifactId>
+ <version>${odl.mdsal.features.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+
+ <scope>runtime</scope>
+ </dependency>
+
+
+
+ <!-- dependency for opendaylight-karaf-empty for use by testing -->
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>opendaylight-karaf-empty</artifactId>
+ <type>zip</type>
+ </dependency>
+
+
+ <dependency>
+ <!-- Required for launching the feature tests-->
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>features-test</artifactId>
+ <scope>test</scope>
+ <version>${odl.commons.opendaylight.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>features-yangtools</artifactId>
+ <version>${odl.yangtools.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <filtering>true</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>filter</id>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <!--
+ <plugin>
+ launches the feature test, which validates that your karaf feature can
+ be installed inside of a karaf container. It doesn't validate that your
+ functionality works correctly, just that you have all of the dependent
+ bundles defined correctly.
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.16</version>
+ <configuration>
+ <systemPropertyVariables>
+ <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId>
+ <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
+ <karaf.distro.version>${odl.karaf.empty.distro.version}</karaf.distro.version>
+ </systemPropertyVariables>
+ <dependenciesToScan>
+ <dependency>org.opendaylight.yangtools:features-test</dependency>
+ </dependenciesToScan>
+ </configuration>
+ </plugin>
+ -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/${features.file}</file>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/vnfapi/features/src/main/resources/features.xml b/vnfapi/features/src/main/resources/features.xml
new file mode 100644
index 00000000..6d0bab2d
--- /dev/null
+++ b/vnfapi/features/src/main/resources/features.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============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=========================================================
+ -->
+
+
+<features name="sdnc-vnfapi-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+
+ <repository>mvn:org.opendaylight.mdsal/features-mdsal/${odl.mdsal.features.version}/xml/features</repository>
+
+ <feature name='sdnc-vnfapi' description="sdnc-vnfapi" version='${project.version}'>
+ <!-- Most applications will have a dependency on the ODL MD-SAL Broker -->
+ <feature version="${odl.mdsal.version}">odl-mdsal-broker</feature>
+ <feature version="${sdnctl.sli.version}">sdnc-sli</feature>
+ <bundle>mvn:org.openecomp.sdnc.northbound/vnfapi-model/${project.version}</bundle>
+ <bundle>mvn:org.openecomp.sdnc.northbound/vnfapi-provider/${project.version}</bundle>
+ <configfile finalname="etc/opendaylight/karaf/200-vnfapi-provider.xml">mvn:org.openecomp.sdnc.northbound/vnfapi-provider/${project.version}/xml/config</configfile>
+ </feature>
+
+</features>
diff --git a/vnfapi/installer/pom.xml b/vnfapi/installer/pom.xml
new file mode 100755
index 00000000..9553b52c
--- /dev/null
+++ b/vnfapi/installer/pom.xml
@@ -0,0 +1,137 @@
+<?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>
+ <artifactId>vnfapi</artifactId>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>vnfapi-installer</artifactId>
+ <name>VNF API - Karaf Installer</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <application.name>sdnc-vnfapi</application.name>
+ <features.boot>sdnc-vnfapi</features.boot>
+ <features.repositories>mvn:org.openecomp.sdnc.northbound/vnfapi-features/${project.version}/xml/features</features.repositories>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnfapi-features</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnfapi-provider</artifactId>
+ <version>${project.version}</version>
+ </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>false</attach>
+ <finalName>stage/${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+ </descriptors>
+ </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>
+ </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.openecomp.sdnc</includeGroupIds>
+ <excludeArtifactIds>sli-common,sli-provider,dblib-common,dblib-provider</excludeArtifactIds>
+ <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/vnfapi/installer/src/assembly/assemble_installer_zip.xml b/vnfapi/installer/src/assembly/assemble_installer_zip.xml
new file mode 100644
index 00000000..37357aa8
--- /dev/null
+++ b/vnfapi/installer/src/assembly/assemble_installer_zip.xml
@@ -0,0 +1,55 @@
+<!--
+ ============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">
+ <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/vnfapi/installer/src/assembly/assemble_mvnrepo_zip.xml b/vnfapi/installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100644
index 00000000..777da028
--- /dev/null
+++ b/vnfapi/installer/src/assembly/assemble_mvnrepo_zip.xml
@@ -0,0 +1,56 @@
+<!--
+ ============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">
+ <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>
+
+ <files>
+ <file>
+ <source>../provider/src/main/resources/initial/${feature-name}-provider.xml</source>
+ <destName>./etc/opendaylight/karaf/200-${feature-name}-provider.xml</destName>
+ </file>
+ <file>
+ <source>../model/target/vnfapi.properties</source>
+ <destName>./configuration/vnfapi.properties</destName>
+
+ </file>
+ </files>
+
+</assembly>
diff --git a/vnfapi/installer/src/main/resources/scripts/install-feature.sh b/vnfapi/installer/src/main/resources/scripts/install-feature.sh
new file mode 100644
index 00000000..33e9b036
--- /dev/null
+++ b/vnfapi/installer/src/main/resources/scripts/install-feature.sh
@@ -0,0 +1,40 @@
+#!/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}
+ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"}
+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} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories}
+${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot}
diff --git a/vnfapi/model/pom.xml b/vnfapi/model/pom.xml
new file mode 100644
index 00000000..cf354ed1
--- /dev/null
+++ b/vnfapi/model/pom.xml
@@ -0,0 +1,124 @@
+<?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>
+ <artifactId>vnfapi</artifactId>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>vnfapi-model</artifactId>
+ <packaging>bundle</packaging>
+
+ <build>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Import-Package>*</Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-maven-plugin</artifactId>
+ <version>${odl.yangtools.yang.maven.plugin.version}</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>maven-sal-api-gen-plugin</artifactId>
+ <version>${odl.yangtools.version}</version>
+ <type>jar</type>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <yangFilesRootDir>${yang.file.directory}</yangFilesRootDir>
+ <codeGenerators>
+ <generator>
+ <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
+ <outputBaseDir>${salGeneratorPath}</outputBaseDir>
+ </generator>
+ </codeGenerators>
+ <inspectDependencies>true</inspectDependencies>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.2.1</version>
+ <executions>
+ <execution>
+ <configuration>
+ <executable>python</executable>
+ <arguments>
+ <argument>scripts/python/yang2props.py</argument>
+ <argument>src/main/yang/VNF-API.yang</argument>
+ <argument>target/vnfapi.properties</argument>
+ </arguments>
+ </configuration>
+ <id>generation</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>exec</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/vnfapi.properties</file>
+ <type>properties</type>
+ <classifier>vnfapi</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>yang-binding</artifactId>
+ <version>${odl.yangtools.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-common</artifactId>
+ <version>${odl.yangtools.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-inet-types</artifactId>
+ <version>${odl.ietf-inet-types.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>ietf-yang-types</artifactId>
+ <version>${odl.ietf-yang-types.version}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/vnfapi/model/scripts/python/yang2props.py b/vnfapi/model/scripts/python/yang2props.py
new file mode 100755
index 00000000..559d31b8
--- /dev/null
+++ b/vnfapi/model/scripts/python/yang2props.py
@@ -0,0 +1,57 @@
+#!/usr/bin/python
+
+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)
+
+
+# Open output file
+fo = open(sys.argv[2], "wb")
+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")
+
+# Close opend file
+fo.close()
+
+
diff --git a/vnfapi/model/src/main/yang/VNF-API.yang b/vnfapi/model/src/main/yang/VNF-API.yang
new file mode 100755
index 00000000..a786757f
--- /dev/null
+++ b/vnfapi/model/src/main/yang/VNF-API.yang
@@ -0,0 +1,815 @@
+module VNF-API {
+
+ yang-version 1;
+
+ namespace "org:openecomp:sdnctl:vnf";
+
+ prefix vnfapi;
+
+ import ietf-inet-types { prefix "ietf"; revision-date "2010-09-24"; }
+
+ include "vnfsubmodule";
+
+ organization "OpenECOMP";
+
+ contact
+ "Network Controller <sdnc@lists.openecomp.org>";
+
+ description
+ "Defines API interface for VNF Orchestration";
+
+ revision "2015-07-20" {
+ description
+ "Initial draft";
+ }
+ // Last updated on 8-17-2016
+ grouping sdnc-request-header {
+ container sdnc-request-header {
+ leaf svc-request-id {
+ type string;
+ }
+ leaf svc-action {
+ type enumeration {
+ enum "reserve";
+ enum "assign";
+ enum "activate"; // equal to commit
+ enum "delete"; // equal to commit
+ enum "changeassign";
+ enum "changedelete";
+ enum "rollback";
+ }
+ }
+ leaf svc-notification-url {
+ type string;
+ }
+ }
+ }
+
+ grouping request-information {
+ container request-information {
+ leaf request-id {
+ type string;
+ }
+ leaf request-action {
+ type enumeration {
+ enum "PreloadNetworkRequest";
+ enum "DeletePreloadNetworkRequest";
+ enum "NetworkActivateRequest";
+ enum "DisconnectNetworkRequest";
+ enum "PreloadVNFRequest";
+ enum "DeletePreloadVNFRequest";
+ enum "VNFActivateRequest";
+ enum "ChangeVNFActivateRequest";
+ enum "DisconnectVNFRequest";
+ enum "PreloadVnfInstanceRequest";
+ enum "DeletePreloadVnfInstanceRequest";
+ enum "VnfInstanceActivateRequest";
+ enum "ChangeVnfInstanceActivateRequest";
+ enum "DisconnectVnfInstanceRequest";
+ enum "PreloadVfModuleRequest";
+ enum "DeletePreloadVfModuleRequest";
+ enum "VfModuleActivateRequest";
+ enum "ChangeVfModuleActivateRequest";
+ enum "DisconnectVfModuleRequest";
+ }
+ }
+ leaf request-sub-action {
+ type enumeration {
+ enum "SUPP";
+ enum "CANCEL";
+ }
+ }
+ leaf source {
+ type string;
+ }
+ leaf notification-url {
+ type string;
+ }
+ leaf order-number {
+ type string;
+ }
+ leaf order-version {
+ type string;
+ }
+ }
+ }
+
+ grouping service-information {
+ container service-information {
+ // 1610 use for AnAI subscription-service-type
+ leaf service-type {
+ type string;
+ description "AnAI subscription-service-type";
+ }
+ leaf service-id {
+ type string;
+ }
+ leaf service-instance-id {
+ type string;
+ description "A service instance that a VNF or a l3-network is associated with";
+ }
+ // 1610 use for global-customer-id
+ leaf subscriber-name {
+ type string;
+ description "AnAI global-customer-id";
+ }
+ }
+ }
+
+
+ grouping vnf-request-information {
+ container vnf-request-information {
+ leaf vnf-request-version {
+ type string;
+ }
+ leaf vnf-id {
+ type string;
+ description "vf-module-id";
+ }
+ leaf vnf-type {
+ type string;
+ description "vf-module-type";
+ }
+ leaf vnf-name {
+ type string;
+ description "vf-module-name";
+ }
+ leaf generic-vnf-id {
+ type string;
+ description "generic vnf-id";
+ }
+ leaf generic-vnf-type {
+ type string;
+ description "generic vnf type";
+ }
+ leaf generic-vnf-name {
+ type string;
+ description "generic vnf name";
+ }
+ leaf tenant {
+ type string;
+ }
+ leaf aic-clli {
+ type string;
+ }
+ leaf aic-cloud-region {
+ type string;
+ description "The AIC cloud region which maps to contrail versions";
+ }
+ list vnf-networks {
+ key network-role;
+ uses vnf-network;
+ description "Network List";
+ }
+ }
+ }
+
+ grouping network-request-information {
+ container network-request-information {
+ leaf network-id {
+ type string;
+ }
+ leaf network-type {
+ type string;
+ }
+ leaf network-name {
+ type string;
+ }
+ leaf tenant {
+ type string;
+ }
+ leaf aic-clli {
+ type string;
+ }
+ leaf aic-cloud-region {
+ type string;
+ description "The AIC cloud region which maps to contrail versions";
+ }
+ }
+ }
+
+ /***********************************************************/
+ /* PRELOAD DATA */
+ /***********************************************************/
+
+ container preload-vnfs {
+ uses preload-model-information;
+ }
+ grouping preload-model-information {
+ list vnf-preload-list {
+ key "vnf-name vnf-type";
+ leaf vnf-name {
+ type string;
+ description "vf-module-name";
+ }
+ leaf vnf-type {
+ type string;
+ description "vf-module-type";
+ }
+ uses preload-data;
+ }
+ }
+
+ // For preload networks it will have network-topology-information
+ // For preload vnfs, it will have vnf-topology-information
+ grouping preload-data {
+ container preload-data {
+ uses vnf-topology-information;
+ uses network-topology-information;
+ uses oper-status;
+ }
+ }
+
+
+ grouping vnf-topology-information {
+ container vnf-topology-information {
+ uses vnf-topology-identifier;
+ uses vnf-assignments;
+ uses vnf-parameters;
+ }
+ }
+
+ grouping vnf-topology-identifier {
+ container vnf-topology-identifier {
+ leaf service-type {
+ type string;
+ }
+ leaf service-id {
+ type string;
+ }
+ leaf vnf-name {
+ type string;
+ description "vf-module-name";
+ }
+ leaf vnf-type {
+ type string;
+ description "vf-module-type";
+ }
+ leaf generic-vnf-name {
+ type string;
+ }
+ leaf generic-vnf-type {
+ type string;
+ }
+ leaf generic-vnf-id {
+ type string;
+ }
+ }
+ }
+
+ grouping vnf-assignments {
+ container vnf-assignments {
+ leaf vnf-status {
+ type string;
+ description "Orchestration Status from AAI - to be set by SDNC";
+ }
+ list availability-zones {
+ ordered-by user;
+ leaf availability-zone {
+ type string;
+ description "Openstack availability zone name or UUID";
+ }
+ }
+ list vnf-networks {
+ key network-role;
+ uses vnf-network;
+ // 1610
+ uses sriov-vlan-filter-list;
+ description "Network List";
+ }
+ uses vm-topology;
+ }
+ }
+
+ grouping vm-topology {
+ list vnf-vms {
+ key vm-type;
+ leaf vm-type {
+ type string;
+ }
+ leaf vm-count {
+ type uint8;
+ }
+ list vm-names {
+ ordered-by user;
+ leaf vm-name{
+ type string;
+ }
+ }
+ //leaf-list vm-names {
+ // type string;
+ // ordered-by user;
+ //}
+ list vm-networks {
+ key network-role;
+ uses vm-network;
+ description "Network List";
+ }
+ }
+ }
+
+ grouping vnf-network {
+ leaf network-role {
+ type string;
+ description "A Network Role to which a VNF must connect";
+ }
+ leaf network-name {
+ type string;
+ description "Unique Neutron UUID of an instance of the network role ";
+ }
+ leaf neutron-id {
+ type string;
+ description "Unique Neutron UUID of an instance of the network role ";
+ }
+ leaf network-id {
+ type string;
+ description "Unique Neutron UUID of an instance of the network role ";
+ }
+ leaf subnet-id {
+ type string;
+ description "ipv4 subnet UUID to be passed into the HEAT template for DHCP assignment";
+ }
+ leaf contrail-network-fqdn {
+ type string;
+ description "contrail network policy object";
+ }
+ // 1610
+ leaf ipv6-subnet-id {
+ type string;
+ description "ipv6 subnet UUID to be passed into the HEAT template for DHCP assignment";
+ }
+ leaf ipv6-subnet-name {
+ type string;
+ description "ipv6 subnet-name that corresponds to the ipv6 subnet-id";
+ }
+ leaf subnet-name {
+ type string;
+ description "ipv4 subnet-name that corresponds to the ipv4 subnet-id";
+ }
+ }
+
+ // 1610
+ grouping sriov-vlan-filter-list {
+ list sriov-vlan-filter-list {
+ leaf sriov-vlan-filter {
+ type string;
+ }
+ }
+ }
+
+ grouping vm-network {
+ leaf network-role {
+ type string;
+ description "network (identified by role) that this VM connects to. Should also be included in the vnf-networks for the containing VNF";
+
+ }
+ leaf use-dhcp {
+ type enumeration {
+ enum "Y";
+ enum "N";
+ }
+ description "Indicator to use DHCP on this network for this VM";
+ }
+ leaf ip-count {
+ type uint8;
+ description "The number of ip addresses to be assigned per vm for this network role";
+ }
+ list network-ips {
+ ordered-by user;
+ leaf ip-address {
+ //type string;
+ type ietf:ip-address;
+ description "List of assigned ipv4 addresses on a network";
+ }
+ }
+ list network-ips-v6 {
+ ordered-by user;
+ leaf ip-address-ipv6 {
+ //type string;
+ type ietf:ipv6-address;
+ description "List of assigned ipv6 addresses on a network";
+ }
+ }
+ list network-macs {
+ ordered-by user;
+ leaf mac-address {
+ type string;
+ description "List of network assignments for this VM (one per network)";
+ }
+ }
+ leaf floating-ip {
+ //type string;
+ type ietf:ip-address;
+ description "Floating ipv4 for VMs of a given type on this network";
+ }
+ leaf floating-ip-v6 {
+ //type string;
+ type ietf:ipv6-address;
+ description "Floating ipv6 for VMs of a given type on this network";
+ }
+ list interface-route-prefixes {
+ ordered-by user;
+ leaf interface-route-prefix {
+ type ietf:ip-address;
+ description "route prefixes (CIDRs) to be provided to MSO in vnf-topology as a list of static routes";
+ }
+ }
+ }
+
+ grouping vnf-parameters {
+ list vnf-parameters {
+ key vnf-parameter-name;
+ leaf vnf-parameter-name {
+ type string;
+ description "The name of an arbitrary instance-specific vnf-parameters";
+ }
+ leaf vnf-parameter-value {
+ type string;
+ description "The value of an arbitrary instance-specific vnf-parameters ";
+ }
+ }
+ }
+
+ grouping network-topology-information {
+ container network-topology-information {
+ uses network-topology-identifier;
+ uses subnets;
+ uses vpn-bindings;
+ uses network-policy;
+ uses route-table-reference;
+ uses provider-network-information;
+ }
+ }
+
+ grouping network-topology-identifier {
+ container network-topology-identifier {
+ leaf service-type {
+ type string;
+ }
+ leaf network-name {
+ type string;
+ }
+ leaf network-role {
+ type string;
+ }
+ leaf network-type {
+ type string;
+ }
+ leaf network-technology{
+ type string;
+ }
+ }
+ }
+ grouping subnets {
+ list subnets {
+ key start-address;
+ leaf start-address{
+ type ietf:ip-address;
+ //type string;
+ }
+ leaf gateway-address{
+ //type string;
+ type ietf:ip-address;
+ }
+ leaf cidr-mask{
+ type string;
+ }
+ leaf ip-version {
+ type string;
+ }
+ leaf dhcp-enabled {
+ type enumeration {
+ enum "Y";
+ enum "N";
+ }
+ }
+ leaf dhcp-start-address {
+ type string;
+ }
+ leaf dhcp-end-address {
+ type string;
+ }
+ // 1610
+ leaf subnet-name {
+ type string;
+ }
+
+ }
+ }
+
+ grouping vpn-bindings {
+ list vpn-bindings {
+ key vpn-binding-id;
+ leaf vpn-binding-id {
+ type string;
+ }
+ leaf global-route-target {
+ type string;
+ }
+ }
+ }
+
+ grouping network-policy {
+ list network-policy {
+ key network-policy-fqdn;
+ leaf network-policy-fqdn {
+ type string;
+ }
+ leaf network-policy-id {
+ type string;
+ }
+ }
+ }
+
+ //1610
+ grouping route-table-reference {
+ list route-table-reference {
+ leaf route-table-reference-id {
+ type string;
+ }
+ leaf route-table-reference-fqdn {
+ type string;
+ }
+ }
+ }
+
+ // 1610
+ grouping provider-network-information {
+ container provider-network-information {
+ leaf physical-network-name {
+ type string;
+ }
+ leaf is-provider-network {
+ type boolean;
+ }
+ leaf is-shared-network {
+ type boolean;
+ }
+ leaf is-external-network {
+ type boolean;
+ }
+ }
+ }
+
+ /***********************************************************/
+ /* SERVICE_DATA */
+ /***********************************************************/
+ container vnfs {
+ uses vnf-model-infrastructure;
+ }
+ grouping vnf-model-infrastructure {
+ list vnf-list {
+ key vnf-id;
+ leaf vnf-id {
+ type string;
+ mandatory true;
+ description "vf-module-id";
+ }
+ uses service-data;
+ uses service-status;
+ }
+ }
+ grouping service-data {
+ container service-data {
+ uses vnf-configuration-information;
+ uses oper-status;
+ }
+ }
+ grouping service-status {
+ container service-status {
+ leaf response-code {
+ type string;
+ }
+ leaf response-message {
+ type string;
+ }
+ leaf final-indicator {
+ type string;
+ }
+ leaf request-status {
+ type enumeration {
+ enum "synccomplete";
+ enum "asynccomplete";
+ enum "notifycomplete";
+ }
+ }
+ leaf vnfsdn-action {
+ type enumeration {
+ enum "PreloadNetworkRequest";
+ enum "DeletePreloadNetworkRequest";
+ enum "NetworkActivateRequest";
+ enum "DisconnectNetworkRequest";
+ enum "PreloadVNFRequest";
+ enum "DeletePreloadVNFRequest";
+ enum "VNFActivateRequest";
+ enum "ChangeVNFActivateRequest";
+ enum "DisconnectVNFRequest";
+ enum "PreloadVnfInstanceRequest";
+ enum "DeletePreloadVnfInstanceRequest";
+ enum "VnfInstanceActivateRequest";
+ enum "ChangeVnfInstanceActivateRequest";
+ enum "DisconnectVnfInstanceRequest";
+ enum "PreloadVfModuleRequest";
+ enum "DeletePreloadVfModuleRequest";
+ enum "VfModuleActivateRequest";
+ enum "ChangeVfModuleActivateRequest";
+ enum "DisconnectVfModuleRequest";
+ }
+ }
+ leaf vnfsdn-subaction {
+ type enumeration {
+ enum "SUPP";
+ enum "CANCEL";
+ }
+ }
+ leaf rpc-name {
+ type enumeration {
+ enum "vnf-topology-operation";
+ enum "preload-vnf-topology-operation";
+ enum "vnf-instance-topology-operation";
+ enum "preload-vnf-instance-topology-operation";
+ enum "vf-module-topology-operation";
+ enum "preload-vf-module-topology-operation";
+ }
+ }
+ leaf rpc-action {
+ type enumeration {
+ enum "reserve";
+ enum "assign";
+ enum "activate"; // equal to commit
+ enum "delete"; // equal to commit
+ enum "changeassign";
+ enum "changedelete";
+ enum "rollback";
+ }
+ }
+ leaf response-timestamp {
+ type string;
+ }
+ }
+ }
+ grouping vnf-configuration-information {
+ uses sdnc-request-header;
+ uses request-information;
+ uses service-information;
+ uses vnf-request-information;
+ uses vnf-topology;
+ }
+ grouping vnf-topology-response-body {
+ leaf svc-request-id {
+ type string;
+ }
+ leaf response-code {
+ type string;
+ }
+ leaf response-message {
+ type string;
+ }
+ leaf ack-final-indicator {
+ type string;
+ }
+ }
+
+ grouping vnf-information {
+ container vnf-information {
+ leaf vnf-service-type {
+ type string;
+ }
+ leaf vnf-id {
+ type string;
+ description "vf-module-id";
+ }
+ }
+ }
+
+ grouping network-information {
+ container network-information {
+ leaf network-service-type {
+ type string;
+ }
+ leaf network-id {
+ type string;
+ }
+ }
+ }
+
+
+ // Carried over from l3sdn and potentially not needed
+ grouping oper-status {
+ container oper-status {
+ leaf order-status {
+ type enumeration {
+ enum "Active";
+ enum "PendingAssignment";
+ enum "PendingCreate";
+ enum "PendingUpdate";
+ enum "PendingDelete";
+ enum "Deleted";
+
+ }
+ }
+ leaf last-action {
+ type enumeration {
+ enum "VNFActivateRequest";
+ enum "ChangeVNFActivateRequest";
+ enum "VnfInstanceActivateRequest";
+ enum "ChangeVnfInstanceActivateRequest";
+ enum "VfModuleActivateRequest";
+ enum "ChangeVfModuleActivateRequest";
+ enum "DisconnectVNFRequest";
+ enum "DisconnectVnfInstanceRequest";
+ enum "DisconnectVfModuleRequest";
+ enum "PreloadVNFRequest";
+ enum "DeletePreloadVNFRequest";
+ enum "PreloadVnfInstanceRequest";
+ enum "DeletePreloadVnfInstanceRequest";
+ enum "PreloadVfModuleRequest";
+ enum "DeletePreloadVfModuleRequest";
+ }
+ }
+ leaf last-svc-request-id {
+ type string;
+ }
+ leaf last-order-status {
+ type enumeration {
+ enum "Active";
+ enum "PendingAssignment";
+ enum "PendingCreate";
+ enum "PendingUpdate";
+ enum "PendingDelete";
+ enum "Deleted";
+ }
+ }
+ leaf create-timestamp {
+ type string;
+ }
+ leaf modify-timestamp {
+ type string;
+ }
+ leaf maintenance-indicator {
+ type enumeration {
+ enum "Y";
+ enum "N";
+ }
+ }
+ }
+ }
+ grouping vnf-topology {
+ leaf vnf-id {
+ type string;
+ description "vf-module-id";
+ }
+ uses vnf-topology-information;
+ }
+
+
+ rpc vnf-topology-operation {
+ input {
+ uses sdnc-request-header;
+ uses request-information;
+ uses service-information;
+ uses vnf-request-information;
+ }
+ output {
+ uses vnf-topology-response-body;
+ uses vnf-information;
+ uses service-information;
+ }
+ }
+
+ rpc network-topology-operation {
+ input {
+ uses sdnc-request-header;
+ uses request-information;
+ uses service-information;
+ uses network-request-information;
+ }
+ output {
+ uses vnf-topology-response-body;
+ uses network-information;
+ uses service-information;
+ }
+ }
+
+ rpc preload-vnf-topology-operation {
+ input {
+ uses sdnc-request-header;
+ uses request-information;
+ uses vnf-topology-information;
+ }
+ output {
+ uses vnf-topology-response-body;
+ }
+ }
+
+ rpc preload-network-topology-operation {
+ input {
+ uses sdnc-request-header;
+ uses request-information;
+ uses network-topology-information;
+ }
+ output {
+ uses vnf-topology-response-body;
+ }
+ }
+}
diff --git a/vnfapi/model/src/main/yang/vnfsubmodule.yang b/vnfapi/model/src/main/yang/vnfsubmodule.yang
new file mode 100755
index 00000000..1c573d21
--- /dev/null
+++ b/vnfapi/model/src/main/yang/vnfsubmodule.yang
@@ -0,0 +1,356 @@
+submodule vnfsubmodule {
+
+ belongs-to VNF-API { prefix "vnfapi"; }
+
+ // Last updated on 8-17-2016
+ /********************************************/
+ /* vnf-instance */
+ /********************************************/
+ grouping vnf-instance-request-information {
+ container vnf-instance-request-information {
+ leaf request-version {
+ type string;
+ }
+ uses vnf-instance-topology-identifier;
+ uses region-identifier;
+ list vnf-networks {
+ key network-role;
+ uses vnfapi:vnf-network;
+ description "List of vnf networks to override preload";
+ }
+ }
+ }
+
+ grouping region-identifier {
+ leaf tenant {
+ type string;
+ }
+ leaf aic-cloud-region {
+ type string;
+ description "The AIC cloud region which maps to contrail versions";
+ }
+ }
+
+
+ /***********************************************************/
+ /* PRELOAD DATA - vnf-instance */
+ /***********************************************************/
+
+ container preload-vnf-instances {
+ uses preload-vnf-instance-model-information;
+ }
+ grouping preload-vnf-instance-model-information {
+ list vnf-instance-preload-list {
+ key "vnf-instance-name vnf-model-id";
+ leaf vnf-instance-name {
+ type string;
+ description "vnf-instance-name, aka generic-vnf-name";
+ }
+ leaf vnf-model-id {
+ type string;
+ description "vnf-model-id, aka generic-vnf-type";
+ }
+ uses vnf-instance-preload-data;
+ }
+ }
+
+ grouping vnf-instance-preload-data {
+ container vnf-instance-preload-data {
+ uses vnf-instance-topology-information;
+ uses vnfapi:oper-status;
+ }
+ }
+
+ grouping vnf-instance-topology-information {
+ container vnf-instance-topology-information {
+ uses vnf-instance-identifiers;
+ uses vnfapi:service-information;
+ uses vnfapi:vnf-assignments;
+ uses vnfapi:vnf-parameters;
+ }
+ }
+
+ // This is used by MSO request for assign,rollback,activate,delete, etc
+ grouping vnf-instance-topology-identifier {
+ leaf vnf-instance-name {
+ type string;
+ }
+ leaf vnf-model-id {
+ type string;
+ }
+ leaf vnf-instance-id {
+ type string;
+ }
+ }
+
+ // container used in preload identifiers
+ grouping vnf-instance-identifiers {
+ container vnf-instance-identifiers {
+ uses vnf-instance-topology-identifier;
+ }
+ }
+
+ /***********************************************************/
+ /* SERVICE_DATA - vnf-instance */
+ /***********************************************************/
+ container vnf-instances {
+ uses vnf-instance-model-infrastructure;
+ }
+ grouping vnf-instance-model-infrastructure {
+ list vnf-instance-list {
+ key vnf-instance-id;
+ leaf vnf-instance-id {
+ type string;
+ mandatory true;
+ description "generic-vnf-id";
+ }
+ uses vnf-instance-service-data;
+ uses vnfapi:service-status;
+ }
+ }
+
+ grouping vnf-instance-service-data {
+ container vnf-instance-service-data {
+ uses vnf-instance-configuration-information;
+ uses vf-module-relationship-list;
+ uses vnfapi:oper-status;
+ }
+ }
+
+ grouping vnf-instance-configuration-information {
+ uses vnfapi:sdnc-request-header;
+ uses vnfapi:request-information;
+ uses vnfapi:service-information;
+ uses vnf-instance-request-information;
+ uses vnf-instance-topology;
+ }
+
+ grouping vf-module-relationship-list {
+ list vf-module-relationship-list {
+ leaf vf-module-id {
+ type string;
+ description "vf-module-id";
+ }
+ }
+ }
+
+ grouping vnf-instance-topology-response-body {
+ leaf svc-request-id {
+ type string;
+ }
+ leaf response-code {
+ type string;
+ }
+ leaf response-message {
+ type string;
+ }
+ leaf ack-final-indicator {
+ type string;
+ }
+ }
+
+ grouping vnf-instance-information {
+ container vnf-instance-information {
+ leaf vnf-instance-id {
+ type string;
+ description "vnf-instance-id";
+ }
+ }
+ }
+
+ grouping vnf-instance-topology {
+ leaf vnf-instance-id {
+ type string;
+ description "vnf-instance-id";
+ }
+ uses vnf-instance-topology-information;
+ }
+
+
+ rpc vnf-instance-topology-operation {
+ input {
+ uses sdnc-request-header;
+ uses request-information;
+ uses service-information;
+ uses vnf-instance-request-information;
+ }
+ output {
+ uses vnf-instance-topology-response-body;
+ uses vnf-instance-information;
+ uses service-information;
+ }
+ }
+
+ rpc preload-vnf-instance-topology-operation {
+ input {
+ uses sdnc-request-header;
+ uses request-information;
+ uses vnf-instance-topology-information;
+ }
+ output {
+ uses vnf-instance-topology-response-body;
+ }
+ }
+
+ /********************************************/
+ /* vf-module */
+ /********************************************/
+ grouping vf-module-request-information {
+ container vf-module-request-information {
+ uses vnf-instance-topology-identifier;
+ uses region-identifier;
+ uses vf-module-topology-identifier;
+ }
+ }
+
+ grouping vf-module-identifiers {
+ container vf-module-identifiers {
+ uses vf-module-topology-identifier;
+ }
+ }
+
+ grouping vf-module-topology-identifier {
+ leaf vf-module-id {
+ type string;
+ description "vf-module id";
+ }
+ leaf vf-module-name {
+ type string;
+ description "vf-module-name";
+ }
+ leaf vf-module-model-id {
+ type string;
+ description "vf-module-type";
+ }
+ }
+
+ /***********************************************************/
+ /* PRELOAD DATA - vfmodule */
+ /***********************************************************/
+ container preload-vf-modules {
+ uses preload-vf-module-model-information;
+ }
+
+ grouping preload-vf-module-model-information {
+ list vf-module-preload-list {
+ key "vf-module-name vf-module-model-id";
+ leaf vf-module-name {
+ type string;
+ description "vf-module-name";
+ }
+ leaf vf-module-model-id {
+ type string;
+ description "vf-module-type";
+ }
+ uses vf-module-preload-data;
+ }
+ }
+
+ grouping vf-module-preload-data {
+ container vf-module-preload-data {
+ uses vf-module-topology-information;
+ uses vnfapi:oper-status;
+ }
+ }
+
+ grouping vf-module-topology-information {
+ container vf-module-topology-information {
+ uses vf-module-identifiers;
+ uses vnfapi:vnf-assignments;
+ uses vnfapi:vnf-parameters;
+ }
+ }
+
+
+ /***********************************************************/
+ /* SERVICE_DATA - vfmodule */
+ /***********************************************************/
+ container vf-modules {
+ uses vf-module-model-infrastructure;
+ }
+ grouping vf-module-model-infrastructure {
+ list vf-module-list {
+ key vf-module-id;
+ leaf vf-module-id {
+ type string;
+ mandatory true;
+ description "vf-module-id";
+ }
+ uses vf-module-service-data;
+ uses vnfapi:service-status;
+ }
+ }
+
+ grouping vf-module-service-data {
+ container vf-module-service-data {
+ uses vf-module-configuration-information;
+ uses vnfapi:oper-status;
+ }
+ }
+
+ grouping vf-module-configuration-information {
+ uses vnfapi:sdnc-request-header;
+ uses vnfapi:request-information;
+ uses vnfapi:service-information;
+ uses vf-module-request-information;
+ uses vf-module-topology;
+ }
+
+ grouping vf-module-topology-response-body {
+ leaf svc-request-id {
+ type string;
+ }
+ leaf response-code {
+ type string;
+ }
+ leaf response-message {
+ type string;
+ }
+ leaf ack-final-indicator {
+ type string;
+ }
+ }
+
+ grouping vf-module-information {
+ container vf-module-information {
+ leaf vf-module-id {
+ type string;
+ description "vf-module-id";
+ }
+ }
+ }
+
+ grouping vf-module-topology {
+ leaf vf-module-id {
+ type string;
+ description "vf-module-id";
+ }
+ uses vf-module-topology-information;
+ }
+
+
+ rpc vf-module-topology-operation {
+ input {
+ uses sdnc-request-header;
+ uses request-information;
+ uses service-information;
+ uses vf-module-request-information;
+ }
+ output {
+ uses vf-module-topology-response-body;
+ uses vf-module-information;
+ uses service-information;
+ }
+ }
+
+ rpc preload-vf-module-topology-operation {
+ input {
+ uses sdnc-request-header;
+ uses request-information;
+ uses vf-module-topology-information;
+ }
+ output {
+ uses vf-module-topology-response-body;
+ }
+ }
+}
diff --git a/vnfapi/pom.xml b/vnfapi/pom.xml
new file mode 100644
index 00000000..8e92a9a2
--- /dev/null
+++ b/vnfapi/pom.xml
@@ -0,0 +1,58 @@
+<?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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>sdnc-northbound</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <packaging>pom</packaging>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnfapi</artifactId>
+ <version>1.0.0</version>
+
+ <properties>
+ <feature-name>vnfapi</feature-name>
+ </properties>
+
+ <dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnfapi-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnfapi-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnfapi-provider</artifactId>
+ <version>${project.version}</version>
+ <classifier>config</classifier>
+ <type>xml</type>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnfapi-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ </dependencyManagement>
+
+ <modules>
+ <module>model</module>
+ <module>features</module>
+ <module>provider</module>
+ <module>installer</module>
+ </modules>
+</project>
diff --git a/vnfapi/provider/pom.xml b/vnfapi/provider/pom.xml
new file mode 100644
index 00000000..6841ac49
--- /dev/null
+++ b/vnfapi/provider/pom.xml
@@ -0,0 +1,133 @@
+<?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>
+ <artifactId>vnfapi</artifactId>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>vnfapi-provider</artifactId>
+ <packaging>bundle</packaging>
+ <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.vnfapi_provider.impl</Export-Package>
+ <Import-Package>*</Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-maven-plugin</artifactId>
+ <version>${odl.yangtools.yang.maven.plugin.version}</version>
+ <executions>
+ <execution>
+ <id>config</id>
+ <goals>
+ <goal>generate-sources</goal>
+ </goals>
+ <configuration>
+ <codeGenerators>
+ <generator>
+ <codeGeneratorClass>org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator</codeGeneratorClass>
+ <outputBaseDir>${jmxGeneratorPath}</outputBaseDir>
+ <additionalConfiguration>
+ <namespaceToPackage1>urn:opendaylight:params:xml:ns:yang:controller==org.opendaylight.controller.config.yang</namespaceToPackage1>
+ </additionalConfiguration>
+ </generator>
+ <generator>
+ <codeGeneratorClass>org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl</codeGeneratorClass>
+ <outputBaseDir>${salGeneratorPath}</outputBaseDir>
+ </generator>
+ </codeGenerators>
+ <inspectDependencies>true</inspectDependencies>
+ </configuration>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>maven-sal-api-gen-plugin</artifactId>
+ <version>${odl.yangtools.version}</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>yang-jmx-generator-plugin</artifactId>
+ <version>${odl.yang.jmx.generator.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/initial/vnfapi-provider.xml</file>
+ <type>xml</type>
+ <classifier>config</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnfapi-model</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>config-api</artifactId>
+ <version>${odl.controller.config.api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-config</artifactId>
+ <version>${odl.mdsal.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
+ <version>${odl.mdsal.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-common-util</artifactId>
+ <version>${odl.mdsal.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-common</artifactId>
+ <version>${sdnctl.sli.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ <version>${sdnctl.sli.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModule.java b/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModule.java
new file mode 100644
index 00000000..88d3e2ea
--- /dev/null
+++ b/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModule.java
@@ -0,0 +1,56 @@
+/*-
+ * ============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.opendaylight.yang.gen.v1.org.openecomp.sdnc.vnfapi.provider.impl.rev140523;
+
+import org.openecomp.sdnc.vnfapi.vnfapiProvider;
+
+public class VnfapiProviderModule extends org.opendaylight.yang.gen.v1.org.openecomp.sdnc.vnfapi.provider.impl.rev140523.AbstractVnfapiProviderModule {
+ public VnfapiProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public VnfapiProviderModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.org.openecomp.sdnc.vnfapi.provider.impl.rev140523.VnfapiProviderModule oldModule, java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ final vnfapiProvider provider = new vnfapiProvider(getDataBrokerDependency()
+ , getNotificationServiceDependency()
+ , getRpcRegistryDependency());
+
+ return new AutoCloseable() {
+
+ @Override
+ public void close() throws Exception {
+ provider.close();
+ }
+ };
+
+ }
+
+}
diff --git a/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModuleFactory.java b/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModuleFactory.java
new file mode 100644
index 00000000..c696a4e6
--- /dev/null
+++ b/vnfapi/provider/src/main/java/org/opendaylight/yang/gen/v1/org/openecomp/sdnc/vnfapi/provider/impl/rev140523/VnfapiProviderModuleFactory.java
@@ -0,0 +1,34 @@
+/*-
+ * ============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=========================================================
+ */
+
+/*
+* Generated file
+*
+* Generated from: yang module name: vnfapi-provider-impl yang module local name: vnfapi-provider-impl
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Tue Nov 08 09:03:40 EST 2016
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.org.openecomp.sdnc.vnfapi.provider.impl.rev140523;
+public class VnfapiProviderModuleFactory extends org.opendaylight.yang.gen.v1.org.openecomp.sdnc.vnfapi.provider.impl.rev140523.AbstractVnfapiProviderModuleFactory {
+
+}
diff --git a/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.java
new file mode 100644
index 00000000..56bac4e6
--- /dev/null
+++ b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VNFSDNSvcLogicServiceClient.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.openecomp.sdnc.vnfapi;
+
+import java.util.Properties;
+
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadDataBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceDataBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadDataBuilder;
+//1610
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceDataBuilder;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.provider.SvcLogicService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class VNFSDNSvcLogicServiceClient {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(VNFSDNSvcLogicServiceClient.class);
+
+ private SvcLogicService svcLogic = null;
+
+ public VNFSDNSvcLogicServiceClient()
+ {
+ BundleContext bctx = FrameworkUtil.getBundle(SvcLogicService.class).getBundleContext();
+
+ // Get SvcLogicService reference
+ ServiceReference sref = bctx.getServiceReference(SvcLogicService.NAME);
+ if (sref != null)
+ {
+ svcLogic = (SvcLogicService) bctx.getService(sref);
+
+ }
+ else
+ {
+ LOG.warn("Cannot find service reference for "+SvcLogicService.NAME);
+
+ }
+ }
+
+ public boolean hasGraph(String module, String rpc, String version, String mode) throws SvcLogicException
+ {
+ return(svcLogic.hasGraph(module, rpc, version, mode));
+ }
+
+ public Properties execute(String module, String rpc, String version, String mode, ServiceDataBuilder 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, PreloadDataBuilder 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, ServiceDataBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+
+ parms = VnfSdnUtil.toProperties(parms, serviceData);
+
+ 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 = svcLogic.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"))) {
+ return (respProps);
+ }
+
+ VnfSdnUtil.toBuilder(respProps, serviceData);
+
+ return (respProps);
+ }
+
+
+ public Properties execute(String module, String rpc, String version, String mode, PreloadDataBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+
+ parms = VnfSdnUtil.toProperties(parms, serviceData);
+
+ 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 = svcLogic.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"))) {
+ return (respProps);
+ }
+
+ VnfSdnUtil.toBuilder(respProps, serviceData);
+
+ return (respProps);
+ }
+
+
+ //1610 vnf-instance
+ public Properties execute(String module, String rpc, String version, String mode, VnfInstanceServiceDataBuilder serviceData)
+ throws SvcLogicException {
+
+ Properties parms = new Properties();
+
+ return execute(module,rpc,version, mode,serviceData,parms);
+ }
+
+ //1610 vnf-instance
+ public Properties execute(String module, String rpc, String version, String mode, VnfInstanceServiceDataBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+
+ parms = VnfSdnUtil.toProperties(parms, serviceData);
+
+ 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 = svcLogic.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"))) {
+ return (respProps);
+ }
+
+ VnfSdnUtil.toBuilder(respProps, serviceData);
+
+ return (respProps);
+ }
+
+ //1610 vf-module
+ public Properties execute(String module, String rpc, String version, String mode, VfModuleServiceDataBuilder serviceData)
+ throws SvcLogicException {
+
+ Properties parms = new Properties();
+
+ return execute(module,rpc,version, mode,serviceData,parms);
+ }
+
+ //1610 vf-module
+ public Properties execute(String module, String rpc, String version, String mode, VfModuleServiceDataBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+
+ parms = VnfSdnUtil.toProperties(parms, serviceData);
+
+ 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 = svcLogic.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"))) {
+ return (respProps);
+ }
+
+ VnfSdnUtil.toBuilder(respProps, serviceData);
+
+ return (respProps);
+ }
+
+ //1610 vnf-instance-preload
+ public Properties execute(String module, String rpc, String version, String mode, VnfInstancePreloadDataBuilder serviceData)
+ throws SvcLogicException {
+
+ Properties parms = new Properties();
+
+ return execute(module,rpc,version, mode,serviceData,parms);
+ }
+
+
+ //1610 vnf-instance-preload
+ public Properties execute(String module, String rpc, String version, String mode, VnfInstancePreloadDataBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+
+ parms = VnfSdnUtil.toProperties(parms, serviceData);
+
+ 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 = svcLogic.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"))) {
+ return (respProps);
+ }
+
+ VnfSdnUtil.toBuilder(respProps, serviceData);
+
+ return (respProps);
+ }
+
+ //1610 vf-module-preload
+ public Properties execute(String module, String rpc, String version, String mode, VfModulePreloadDataBuilder serviceData)
+ throws SvcLogicException {
+
+ Properties parms = new Properties();
+
+ return execute(module,rpc,version, mode,serviceData,parms);
+ }
+
+
+ //1610 vf-module-preload
+ public Properties execute(String module, String rpc, String version, String mode, VfModulePreloadDataBuilder serviceData, Properties parms)
+ throws SvcLogicException {
+
+ parms = VnfSdnUtil.toProperties(parms, serviceData);
+
+ 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 = svcLogic.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"))) {
+ return (respProps);
+ }
+
+ VnfSdnUtil.toBuilder(respProps, serviceData);
+
+ return (respProps);
+ }
+
+
+}
diff --git a/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VnfSdnUtil.java b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VnfSdnUtil.java
new file mode 100644
index 00000000..8c7fc7ab
--- /dev/null
+++ b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/VnfSdnUtil.java
@@ -0,0 +1,232 @@
+/*-
+ * ============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.openecomp.sdnc.vnfapi;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+import org.openecomp.sdnc.sli.provider.MdsalHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class VnfSdnUtil extends MdsalHelper {
+
+ private static final Logger LOG = LoggerFactory.getLogger(VnfSdnUtil.class);
+
+ public static File ODLHOME = null;
+ private static Properties properties;
+
+
+ public static void loadProperties() {
+
+ if (ODLHOME == null) {
+ ODLHOME = new File("/opt/opendaylight/current");
+
+ if (!ODLHOME.isDirectory()) {
+ ODLHOME = new File("/opt/bvc/controller");
+ }
+
+ }
+
+ File file = new File(ODLHOME.getAbsoluteFile()+"/configuration/vnfapi.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.
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.network.information.NetworkInformationBuilder u1 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.network.information.NetworkInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.network.policy.NetworkPolicyBuilder u2 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.network.policy.NetworkPolicyBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.network.request.information.NetworkRequestInformationBuilder u3 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.network.request.information.NetworkRequestInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.network.topology.identifier.NetworkTopologyIdentifierBuilder u4 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.network.topology.identifier.NetworkTopologyIdentifierBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.network.topology.information.NetworkTopologyInformationBuilder u5 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.network.topology.information.NetworkTopologyInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.NetworkTopologyOperationInputBuilder u6 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.NetworkTopologyOperationInputBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.NetworkTopologyOperationOutputBuilder u7 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.NetworkTopologyOperationOutputBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.oper.status.OperStatusBuilder u8 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.oper.status.OperStatusBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder u9 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.model.information.VnfPreloadListBuilder u10 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.model.information.VnfPreloadListBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationInputBuilder u11 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationInputBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationOutputBuilder u12 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationOutputBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.vf.module.model.information.VfModulePreloadListBuilder u13 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.vf.module.model.information.VfModulePreloadListBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVfModulesBuilder u14 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVfModulesBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationInputBuilder u15 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationInputBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationOutputBuilder u16 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationOutputBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.vnf.instance.model.information.VnfInstancePreloadListBuilder u17 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.vnf.instance.model.information.VnfInstancePreloadListBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfInstancesBuilder u18 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfInstancesBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationInputBuilder u19 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationInputBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationOutputBuilder u20 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationOutputBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfsBuilder u21 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfsBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInputBuilder u22 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInputBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationOutputBuilder u23 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationOutputBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.provider.network.information.ProviderNetworkInformationBuilder u24 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.provider.network.information.ProviderNetworkInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.request.information.RequestInformationBuilder u25 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.request.information.RequestInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.route.table.reference.RouteTableReferenceBuilder u26 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.route.table.reference.RouteTableReferenceBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.sdnc.request.header.SdncRequestHeaderBuilder u27 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.sdnc.request.header.SdncRequestHeaderBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder u28 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.service.information.ServiceInformationBuilder u29 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.service.information.ServiceInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.service.status.ServiceStatusBuilder u30 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.service.status.ServiceStatusBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.sriov.vlan.filter.list.SriovVlanFilterListBuilder u31 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.sriov.vlan.filter.list.SriovVlanFilterListBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.subnets.SubnetsBuilder u32 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.subnets.SubnetsBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.identifiers.VfModuleIdentifiersBuilder u33 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.identifiers.VfModuleIdentifiersBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.information.VfModuleInformationBuilder u34 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.information.VfModuleInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.model.infrastructure.VfModuleListBuilder u35 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.model.infrastructure.VfModuleListBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadDataBuilder u36 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadDataBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.relationship.list.VfModuleRelationshipListBuilder u37 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.relationship.list.VfModuleRelationshipListBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.request.information.VfModuleRequestInformationBuilder u38 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.request.information.VfModuleRequestInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VfModulesBuilder u39 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VfModulesBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceDataBuilder u40 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceDataBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.topology.information.VfModuleTopologyInformationBuilder u41 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.topology.information.VfModuleTopologyInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VfModuleTopologyOperationInputBuilder u42 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VfModuleTopologyOperationInputBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VfModuleTopologyOperationOutputBuilder u43 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VfModuleTopologyOperationOutputBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vm.network.InterfaceRoutePrefixesBuilder u44 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vm.network.InterfaceRoutePrefixesBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vm.network.NetworkIpsBuilder u45 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vm.network.NetworkIpsBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vm.network.NetworkIpsV6Builder u46 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vm.network.NetworkIpsV6Builder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vm.network.NetworkMacsBuilder u47 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vm.network.NetworkMacsBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vm.topology.VnfVmsBuilder u48 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vm.topology.VnfVmsBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vm.topology.vnf.vms.VmNamesBuilder u49 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vm.topology.vnf.vms.VmNamesBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vm.topology.vnf.vms.VmNetworksBuilder u50 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vm.topology.vnf.vms.VmNetworksBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.assignments.vnf.assignments.AvailabilityZonesBuilder u51 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.assignments.vnf.assignments.AvailabilityZonesBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.assignments.VnfAssignmentsBuilder u52 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.assignments.VnfAssignmentsBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.assignments.vnf.assignments.VnfNetworksBuilder u53 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.assignments.vnf.assignments.VnfNetworksBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.information.VnfInformationBuilder u54 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.information.VnfInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.identifiers.VnfInstanceIdentifiersBuilder u55 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.identifiers.VnfInstanceIdentifiersBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.information.VnfInstanceInformationBuilder u56 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.information.VnfInstanceInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.model.infrastructure.VnfInstanceListBuilder u57 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.model.infrastructure.VnfInstanceListBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadDataBuilder u58 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadDataBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.request.information.VnfInstanceRequestInformationBuilder u59 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.request.information.VnfInstanceRequestInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.request.information.vnf.instance.request.information.VnfNetworksBuilder u60 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.request.information.vnf.instance.request.information.VnfNetworksBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfInstancesBuilder u61 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfInstancesBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceDataBuilder u62 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceDataBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.topology.information.VnfInstanceTopologyInformationBuilder u63 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.topology.information.VnfInstanceTopologyInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInputBuilder u64 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInputBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationOutputBuilder u65 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationOutputBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfListBuilder u66 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfListBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.parameters.VnfParametersBuilder u67 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.parameters.VnfParametersBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.request.information.VnfRequestInformationBuilder u68 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.request.information.VnfRequestInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.request.information.vnf.request.information.VnfNetworksBuilder u69 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.request.information.vnf.request.information.VnfNetworksBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfsBuilder u70 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfsBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.topology.identifier.VnfTopologyIdentifierBuilder u71 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.topology.identifier.VnfTopologyIdentifierBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.topology.information.VnfTopologyInformationBuilder u72 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.topology.information.VnfTopologyInformationBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfTopologyOperationInputBuilder u73 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfTopologyOperationInputBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfTopologyOperationOutputBuilder u74 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfTopologyOperationOutputBuilder();
+ org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vpn.bindings.VpnBindingsBuilder u75 =
+ new org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vpn.bindings.VpnBindingsBuilder();
+ }
+}
diff --git a/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/vnfapiProvider.java b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/vnfapiProvider.java
new file mode 100644
index 00000000..31aeed26
--- /dev/null
+++ b/vnfapi/provider/src/main/java/org/openecomp/sdnc/vnfapi/vnfapiProvider.java
@@ -0,0 +1,2617 @@
+/*-
+ * ============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.openecomp.sdnc.vnfapi;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Properties;
+import java.util.TimeZone;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.controller.md.sal.binding.api.DataChangeListener;
+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.AsyncDataChangeEvent;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.common.api.data.OptimisticLockFailedException;
+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.NotificationProviderService;
+import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.NetworkTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.NetworkTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.NetworkTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.NetworkTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadNetworkTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVfModuleTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVfModules;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVfModulesBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfInstanceTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfInstances;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfInstancesBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfs;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfsBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VNFAPIService;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VfModuleTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VfModuleTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VfModuleTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VfModuleTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VfModules;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VfModulesBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfInstanceTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfInstances;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfInstancesBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfTopologyOperationOutput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfTopologyOperationOutputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.Vnfs;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfsBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.network.information.NetworkInformationBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.data.PreloadData;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.model.information.VnfPreloadList;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.model.information.VnfPreloadListBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.model.information.VnfPreloadListKey;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.vf.module.model.information.VfModulePreloadList;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.vf.module.model.information.VfModulePreloadListBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.vf.module.model.information.VfModulePreloadListKey;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.vnf.instance.model.information.VnfInstancePreloadList;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.vnf.instance.model.information.VnfInstancePreloadListBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.vnf.instance.model.information.VnfInstancePreloadListKey;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.request.information.RequestInformation;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.sdnc.request.header.SdncRequestHeader;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.sdnc.request.header.SdncRequestHeader.SvcAction;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.service.data.ServiceData;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.service.status.ServiceStatus;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.service.status.ServiceStatus.RequestStatus;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.service.status.ServiceStatus.RpcAction;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.service.status.ServiceStatus.RpcName;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.service.status.ServiceStatus.VnfsdnAction;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.service.status.ServiceStatus.VnfsdnSubaction;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.service.status.ServiceStatusBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.information.VfModuleInformationBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.model.infrastructure.VfModuleList;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.model.infrastructure.VfModuleListBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.model.infrastructure.VfModuleListKey;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadData;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.preload.data.VfModulePreloadDataBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceData;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vf.module.service.data.VfModuleServiceDataBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.information.VnfInformationBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.information.VnfInstanceInformationBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.model.infrastructure.VnfInstanceList;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.model.infrastructure.VnfInstanceListBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.model.infrastructure.VnfInstanceListKey;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadData;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.preload.data.VnfInstancePreloadDataBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceData;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.instance.service.data.VnfInstanceServiceDataBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfList;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfListBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.vnf.model.infrastructure.VnfListKey;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+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.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.SettableFuture;
+
+
+/**
+ * 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 vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeListener{
+
+ private final Logger log = LoggerFactory.getLogger( vnfapiProvider.class );
+ private final String appName = "vnfapi";
+ private final ExecutorService executor;
+
+
+ private ListenerRegistration<DataChangeListener> dclServices;
+
+ protected DataBroker dataBroker;
+ protected NotificationProviderService notificationService;
+ protected RpcProviderRegistry rpcRegistry;
+ protected BindingAwareBroker.RpcRegistration<VNFAPIService> rpcRegistration;
+
+
+
+ public vnfapiProvider(DataBroker dataBroker2,
+ NotificationProviderService notificationProviderService,
+ RpcProviderRegistry rpcProviderRegistry) {
+ this.log.info( "Creating provider for " + appName );
+ executor = Executors.newFixedThreadPool(1);
+ dataBroker = dataBroker2;
+ notificationService = notificationProviderService;
+ rpcRegistry = rpcProviderRegistry;
+ initialize();
+
+ }
+
+ public void initialize(){
+ log.info( "Initializing provider for " + appName );
+ // Create the top level containers
+ createContainers();
+ try {
+ VnfSdnUtil.loadProperties();
+ } catch (Exception e) {
+ log.error("Caught Exception while trying to load properties file");
+ }
+ rpcRegistration = rpcRegistry.addRpcImplementation(VNFAPIService.class, this);
+
+ log.info( "Initialization complete for " + appName );
+ }
+
+ private void createContainers() {
+ final WriteTransaction t = dataBroker.newReadWriteTransaction();
+
+ // Create the Vnfs container
+ t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(Vnfs.class),
+ new VnfsBuilder().build());
+ t.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Vnfs.class),
+ new VnfsBuilder().build());
+
+ // Create the PreloadVnfs container
+ t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(PreloadVnfs.class),
+ new PreloadVnfsBuilder().build());
+ t.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(PreloadVnfs.class),
+ new PreloadVnfsBuilder().build());
+
+ // 1610 Create the PreloadVnfInstances container
+ t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(PreloadVnfInstances.class),
+ new PreloadVnfInstancesBuilder().build());
+ t.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(PreloadVnfInstances.class),
+ new PreloadVnfInstancesBuilder().build());
+
+ // 1610 Create the VnfInstances container
+ t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(VnfInstances.class),
+ new VnfInstancesBuilder().build());
+ t.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(VnfInstances.class),
+ new VnfInstancesBuilder().build());
+
+ // 1610 Create the PreloadVfModules container
+ t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(PreloadVfModules.class),
+ new PreloadVfModulesBuilder().build());
+ t.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(PreloadVfModules.class),
+ new PreloadVfModulesBuilder().build());
+
+ // 1610 Create the VfModules container
+ t.merge(LogicalDatastoreType.CONFIGURATION, InstanceIdentifier.create(VfModules.class),
+ new VfModulesBuilder().build());
+ t.merge(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(VfModules.class),
+ new VfModulesBuilder().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);
+ e.printStackTrace();
+ }
+ }
+
+
+
+ protected void initializeChild() {
+ //Override if you have custom initialization intelligence
+ }
+
+ @Override
+ public void close() throws Exception {
+ log.info( "Closing provider for " + appName );
+ executor.shutdown();
+ rpcRegistration.close();
+ // dclServices.close();
+ log.info( "Successfully closed provider for " + appName );
+ }
+
+ // On data change not used
+ @Override
+ public void onDataChanged(
+ AsyncDataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
+ boolean changed = false;
+ log.info(" IN ON DATA CHANGE: ");
+ WriteTransaction writeTransaction = dataBroker
+ .newWriteOnlyTransaction();
+
+ DataObject updatedSubTree = change.getUpdatedSubtree();
+
+ if (updatedSubTree != null) {
+ if (log.isDebugEnabled())
+ {
+ log.debug("updatedSubTree was non-null:" + updatedSubTree);
+ }
+ if ( updatedSubTree instanceof Vnfs ) {
+ ArrayList<VnfList> vnfList = (ArrayList<VnfList>) ((Vnfs) updatedSubTree).getVnfList();
+ if (vnfList != null) {
+ for (VnfList entry : vnfList) {
+ ServiceData serviceData = entry.getServiceData();
+ ServiceStatus serviceStatus = entry.getServiceStatus();
+ if (serviceData != null && serviceStatus != null) {
+ //
+ // ServiceData change detected, check the AckFinal indicator and request-status to see if we need to proceed.
+ //
+ if ((! "Y".equals(serviceStatus.getFinalIndicator())) && (RequestStatus.Synccomplete.equals(serviceStatus.getRequestStatus()))) {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Final Indicator is not Y, calling handleServiceDataUpdated");
+ }
+ //handleServiceDataUpdated(serviceData, serviceStatus, writeTransaction);
+ changed = true;
+ }
+ }
+ }
+ }
+ }
+ if ( updatedSubTree instanceof PreloadVnfs ) {
+ ArrayList<VnfPreloadList> vnfList = (ArrayList<VnfPreloadList>) ((PreloadVnfs) updatedSubTree).getVnfPreloadList();
+ if (vnfList != null) {
+ for (VnfPreloadList entry : vnfList) {
+ PreloadData preloadData = entry.getPreloadData();
+ if (preloadData != null ) {
+ //
+ // PreloadData change detected
+ //
+ // handlePreloadDataUpdated(preloadData, writeTransaction);
+ changed = true;
+ }
+ }
+ }
+ }
+ //1610
+ if ( updatedSubTree instanceof PreloadVnfInstances ) {
+ ArrayList<VnfInstancePreloadList> vnfInstanceList = (ArrayList<VnfInstancePreloadList>) ((PreloadVnfInstances) updatedSubTree).getVnfInstancePreloadList();
+ if (vnfInstanceList != null) {
+ for (VnfInstancePreloadList entry : vnfInstanceList) {
+ VnfInstancePreloadData vnfInstancePreloadData = entry.getVnfInstancePreloadData();
+ if (vnfInstancePreloadData != null ) {
+ //
+ // PreloadData change detected
+ //
+ // handlePreloadDataUpdated(preloadData, writeTransaction);
+ changed = true;
+ }
+ }
+ }
+ }
+ //1610
+ if ( updatedSubTree instanceof VnfInstances ) {
+ ArrayList<VnfInstanceList> vnfInstanceList = (ArrayList<VnfInstanceList>) ((VnfInstances) updatedSubTree).getVnfInstanceList();
+ if (vnfInstanceList != null) {
+ for (VnfInstanceList entry : vnfInstanceList) {
+ VnfInstanceServiceData vnfInstanceServiceData = entry.getVnfInstanceServiceData();
+ ServiceStatus serviceStatus = entry.getServiceStatus();
+ if (vnfInstanceServiceData != null && serviceStatus != null) {
+ //
+ // VnfInstanceServiceData change detected, check the AckFinal indicator and request-status to see if we need to proceed.
+ //
+ if ((! "Y".equals(serviceStatus.getFinalIndicator())) && (RequestStatus.Synccomplete.equals(serviceStatus.getRequestStatus()))) {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Final Indicator is not Y, calling handleServiceDataUpdated");
+ }
+ //handleServiceDataUpdated(serviceData, serviceStatus, writeTransaction);
+ changed = true;
+ }
+ }
+ }
+ }
+ }
+ //1610
+ if ( updatedSubTree instanceof PreloadVfModules ) {
+ ArrayList<VfModulePreloadList> vnfInstanceList = (ArrayList<VfModulePreloadList>) ((PreloadVfModules) updatedSubTree).getVfModulePreloadList();
+ if (vnfInstanceList != null) {
+ for (VfModulePreloadList entry : vnfInstanceList) {
+ VfModulePreloadData vnfInstancePreloadData = entry.getVfModulePreloadData();
+ if (vnfInstancePreloadData != null ) {
+ //
+ // PreloadData change detected
+ //
+ // handlePreloadDataUpdated(preloadData, writeTransaction);
+ changed = true;
+ }
+ }
+ }
+ }
+ //1610
+ if ( updatedSubTree instanceof VfModules ) {
+ ArrayList<VfModuleList> vfModuleList = (ArrayList<VfModuleList>) ((VfModules) updatedSubTree).getVfModuleList();
+ if (vfModuleList != null) {
+ for (VfModuleList entry : vfModuleList) {
+ VfModuleServiceData vfModuleServiceData = entry.getVfModuleServiceData();
+ ServiceStatus serviceStatus = entry.getServiceStatus();
+ if (vfModuleServiceData != null && serviceStatus != null) {
+ //
+ // VfModuleServiceData change detected, check the AckFinal indicator and request-status to see if we need to proceed.
+ //
+ if ((! "Y".equals(serviceStatus.getFinalIndicator())) && (RequestStatus.Synccomplete.equals(serviceStatus.getRequestStatus()))) {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Final Indicator is not Y, calling handleServiceDataUpdated");
+ }
+ //handleServiceDataUpdated(serviceData, serviceStatus, writeTransaction);
+ changed = true;
+ }
+ }
+ }
+ }
+ }
+ }
+ // Do the write transaction only if something changed.
+ if (changed) {
+ CheckedFuture<Void, TransactionCommitFailedException> checkedFuture = writeTransaction
+ .submit();
+ Futures.addCallback(checkedFuture, new FutureCallback<Void>() {
+
+ @Override
+ public void onSuccess(Void arg0) {
+ log.debug("Successfully updated Service Status");
+ }
+
+ @Override
+ public void onFailure(Throwable ex) {
+ log.debug(
+ "Failed updating Service Status",
+ ex);
+ }
+ }, executor);
+ }
+ }
+
+ private static class Iso8601Util
+ {
+ private static TimeZone tz = TimeZone.getTimeZone("UTC");
+ private static DateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
+
+ static
+ {
+ df.setTimeZone(tz);
+ }
+
+ private static String now()
+ {
+ return df.format(new Date());
+ }
+ }
+
+ private void setServiceStatus(ServiceStatusBuilder serviceStatusBuilder, String errorCode, String errorMessage, String ackFinal)
+ {
+ serviceStatusBuilder.setResponseCode(errorCode);
+ serviceStatusBuilder.setResponseMessage(errorMessage);
+ serviceStatusBuilder.setFinalIndicator(ackFinal);
+ serviceStatusBuilder.setResponseTimestamp(Iso8601Util.now());
+ }
+
+ private void setServiceStatus(ServiceStatusBuilder serviceStatusBuilder, RequestInformation requestInformation)
+ {
+ if (requestInformation != null && requestInformation.getRequestAction() != null) {
+ switch (requestInformation.getRequestAction())
+ {
+ case VNFActivateRequest:
+ serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.VNFActivateRequest);
+ break;
+ case ChangeVNFActivateRequest:
+ serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.ChangeVNFActivateRequest);
+ break;
+ case DisconnectVNFRequest:
+ serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.DisconnectVNFRequest);
+ break;
+ case PreloadVNFRequest:
+ serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.PreloadVNFRequest);
+ break;
+ case DeletePreloadVNFRequest:
+ serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.DeletePreloadVNFRequest);
+ break;
+ // 1610 vnf-instance Requests
+ case VnfInstanceActivateRequest:
+ serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.VnfInstanceActivateRequest);
+ break;
+ case ChangeVnfInstanceActivateRequest:
+ serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.ChangeVnfInstanceActivateRequest);
+ break;
+ case DisconnectVnfInstanceRequest:
+ serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.DisconnectVnfInstanceRequest);
+ break;
+ case PreloadVnfInstanceRequest:
+ serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.PreloadVnfInstanceRequest);
+ break;
+ // 1610 vf-module Requests
+ case VfModuleActivateRequest:
+ serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.VfModuleActivateRequest);
+ break;
+ case ChangeVfModuleActivateRequest:
+ serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.ChangeVfModuleActivateRequest);
+ break;
+ case DisconnectVfModuleRequest:
+ serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.DisconnectVfModuleRequest);
+ break;
+ case PreloadVfModuleRequest:
+ serviceStatusBuilder.setVnfsdnAction(VnfsdnAction.PreloadVfModuleRequest);
+ break;
+ default:
+ log.error("Unknown RequestAction: " + requestInformation.getRequestAction() );
+ break;
+ };
+ }
+ if (requestInformation != null && requestInformation.getRequestSubAction() != null) {
+ switch (requestInformation.getRequestSubAction())
+ {
+ case SUPP:
+ serviceStatusBuilder.setVnfsdnSubaction(VnfsdnSubaction.SUPP);
+ break;
+ case CANCEL:
+ serviceStatusBuilder.setVnfsdnSubaction(VnfsdnSubaction.CANCEL);
+ break;
+ default:
+ log.error("Unknown RequestSubAction: " + requestInformation.getRequestSubAction() );
+ break;
+ };
+ }
+ }
+
+ private void setServiceStatus(ServiceStatusBuilder serviceStatusBuilder, SdncRequestHeader requestHeader)
+ {
+ if (requestHeader != null && requestHeader.getSvcAction() != null) {
+ switch (requestHeader.getSvcAction())
+ {
+ case Reserve:
+ serviceStatusBuilder.setRpcAction(RpcAction.Reserve);
+ break;
+ case Activate:
+ serviceStatusBuilder.setRpcAction(RpcAction.Activate);
+ break;
+ case Assign:
+ serviceStatusBuilder.setRpcAction(RpcAction.Assign);
+ break;
+ case Delete:
+ serviceStatusBuilder.setRpcAction(RpcAction.Delete);
+ break;
+ case Changeassign:
+ serviceStatusBuilder.setRpcAction(RpcAction.Changeassign);
+ break;
+ case Changedelete:
+ serviceStatusBuilder.setRpcAction(RpcAction.Changedelete);
+ break;
+ case Rollback:
+ serviceStatusBuilder.setRpcAction(RpcAction.Rollback);
+ break;
+ default:
+ log.error("Unknown SvcAction: " + requestHeader.getSvcAction() );
+ break;
+ };
+ }
+ }
+
+ private void getServiceData(String siid, ServiceDataBuilder serviceDataBuilder)
+ {
+ // default to config
+ getServiceData(siid,serviceDataBuilder,LogicalDatastoreType.CONFIGURATION);
+ }
+
+
+ private void getServiceData(String siid, ServiceDataBuilder serviceDataBuilder, LogicalDatastoreType type)
+ {
+ // See if any data exists yet for this siid, if so grab it.
+ InstanceIdentifier serviceInstanceIdentifier =
+ InstanceIdentifier.<Vnfs>builder(Vnfs.class)
+ .child(VnfList.class, new VnfListKey(siid)).toInstance();
+ ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction();
+ Optional<VnfList> data = null;
+ try {
+ data = (Optional<VnfList>) readTx.read(type, serviceInstanceIdentifier).get();
+ } catch (InterruptedException | ExecutionException e) {
+ log.error("Caught Exception reading MD-SAL ("+type+") for ["+siid+"] " ,e);
+ }
+
+ if ( data.isPresent()) {
+ ServiceData serviceData = (ServiceData) data.get().getServiceData();
+ if (serviceData != null) {
+ log.info("Read MD-SAL ("+type+") data for ["+siid+"] ServiceData: " + serviceData);
+ serviceDataBuilder.setSdncRequestHeader(serviceData.getSdncRequestHeader());
+ serviceDataBuilder.setRequestInformation(serviceData.getRequestInformation());
+ serviceDataBuilder.setServiceInformation(serviceData.getServiceInformation());
+ serviceDataBuilder.setVnfRequestInformation(serviceData.getVnfRequestInformation());
+ serviceDataBuilder.setVnfId(serviceData.getVnfId());
+ serviceDataBuilder.setVnfTopologyInformation(serviceData.getVnfTopologyInformation());
+ serviceDataBuilder.setOperStatus(serviceData.getOperStatus());
+ } else {
+ log.info("No service-data found in MD-SAL ("+type+") for ["+siid+"] ");
+ }
+ } else {
+ log.info("No data found in MD-SAL ("+type+") for ["+siid+"] ");
+ }
+ }
+
+ //1610 vnf-instance
+ private void getVnfInstanceServiceData(String siid, VnfInstanceServiceDataBuilder vnfInstanceServiceDataBuilder)
+ {
+ // default to config
+ getVnfInstanceServiceData(siid,vnfInstanceServiceDataBuilder,LogicalDatastoreType.CONFIGURATION);
+ }
+ //1610 vnf-instance
+ private void getVnfInstanceServiceData(String siid, VnfInstanceServiceDataBuilder vnfInstanceServiceDataBuilder, LogicalDatastoreType type)
+ {
+ // See if any data exists yet for this siid, if so grab it.
+ InstanceIdentifier vnfInstanceIdentifier =
+ InstanceIdentifier.<VnfInstances>builder(VnfInstances.class)
+ .child(VnfInstanceList.class, new VnfInstanceListKey(siid)).toInstance();
+ ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction();
+ Optional<VnfInstanceList> data = null;
+ try {
+ data = (Optional<VnfInstanceList>) readTx.read(type, vnfInstanceIdentifier).get();
+ } catch (InterruptedException | ExecutionException e) {
+ log.error("Caught Exception reading MD-SAL ("+type+") for ["+siid+"] " ,e);
+ }
+
+ if ( data.isPresent()) {
+ VnfInstanceServiceData vnfInstanceServiceData = (VnfInstanceServiceData) data.get().getVnfInstanceServiceData();
+ if (vnfInstanceServiceData != null) {
+ log.info("Read MD-SAL ("+type+") data for ["+siid+"] VnfInstanceServiceData: " + vnfInstanceServiceData);
+ vnfInstanceServiceDataBuilder.setSdncRequestHeader(vnfInstanceServiceData.getSdncRequestHeader());
+ vnfInstanceServiceDataBuilder.setRequestInformation(vnfInstanceServiceData.getRequestInformation());
+ vnfInstanceServiceDataBuilder.setServiceInformation(vnfInstanceServiceData.getServiceInformation());
+ vnfInstanceServiceDataBuilder.setVnfInstanceRequestInformation(vnfInstanceServiceData.getVnfInstanceRequestInformation());
+ vnfInstanceServiceDataBuilder.setVnfInstanceId(vnfInstanceServiceData.getVnfInstanceId());
+ vnfInstanceServiceDataBuilder.setVnfInstanceTopologyInformation(vnfInstanceServiceData.getVnfInstanceTopologyInformation());
+ vnfInstanceServiceDataBuilder.setOperStatus(vnfInstanceServiceData.getOperStatus());
+ } else {
+ log.info("No vnf-instance-service-data found in MD-SAL ("+type+") for ["+siid+"] ");
+ }
+ } else {
+ log.info("No data found in MD-SAL ("+type+") for ["+siid+"] ");
+ }
+ }
+
+ //1610 vf-module
+ private void getVfModuleServiceData(String siid, VfModuleServiceDataBuilder vfModuleServiceDataBuilder)
+ {
+ // default to config
+ getVfModuleServiceData(siid,vfModuleServiceDataBuilder,LogicalDatastoreType.CONFIGURATION);
+ }
+ //1610 vf-module
+ private void getVfModuleServiceData(String siid, VfModuleServiceDataBuilder vfModuleServiceDataBuilder, LogicalDatastoreType type)
+ {
+ // See if any data exists yet for this siid, if so grab it.
+ InstanceIdentifier vfModuleIdentifier =
+ InstanceIdentifier.<VfModules>builder(VfModules.class)
+ .child(VfModuleList.class, new VfModuleListKey(siid)).toInstance();
+ ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction();
+ Optional<VfModuleList> data = null;
+ try {
+ data = (Optional<VfModuleList>) readTx.read(type, vfModuleIdentifier).get();
+ } catch (InterruptedException | ExecutionException e) {
+ log.error("Caught Exception reading MD-SAL ("+type+") for ["+siid+"] " ,e);
+ }
+
+ if ( data.isPresent()) {
+ VfModuleServiceData vfModuleServiceData = (VfModuleServiceData) data.get().getVfModuleServiceData();
+ if (vfModuleServiceData != null) {
+ log.info("Read MD-SAL ("+type+") data for ["+siid+"] VfModuleServiceData: " + vfModuleServiceData);
+ vfModuleServiceDataBuilder.setSdncRequestHeader(vfModuleServiceData.getSdncRequestHeader());
+ vfModuleServiceDataBuilder.setRequestInformation(vfModuleServiceData.getRequestInformation());
+ vfModuleServiceDataBuilder.setServiceInformation(vfModuleServiceData.getServiceInformation());
+ vfModuleServiceDataBuilder.setVfModuleRequestInformation(vfModuleServiceData.getVfModuleRequestInformation());
+ vfModuleServiceDataBuilder.setVfModuleId(vfModuleServiceData.getVfModuleId());
+ vfModuleServiceDataBuilder.setVfModuleTopologyInformation(vfModuleServiceData.getVfModuleTopologyInformation());
+ vfModuleServiceDataBuilder.setOperStatus(vfModuleServiceData.getOperStatus());
+ } else {
+ log.info("No vf-module-service-data found in MD-SAL ("+type+") for ["+siid+"] ");
+ }
+ } else {
+ log.info("No data found in MD-SAL ("+type+") for ["+siid+"] ");
+ }
+ }
+
+
+ private void getPreloadData(String vnf_name, String vnf_type, PreloadDataBuilder preloadDataBuilder)
+ {
+ // default to config
+ getPreloadData(vnf_name, vnf_type ,preloadDataBuilder,LogicalDatastoreType.CONFIGURATION);
+ }
+
+ private void getPreloadData(String preload_name, String preload_type, PreloadDataBuilder preloadDataBuilder, LogicalDatastoreType type)
+ {
+ // See if any data exists yet for this name/type, if so grab it.
+ InstanceIdentifier preloadInstanceIdentifier =
+ InstanceIdentifier.<PreloadVnfs>builder(PreloadVnfs.class)
+ .child(VnfPreloadList.class, new VnfPreloadListKey(preload_name, preload_type)).toInstance();
+ ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction();
+ Optional<VnfPreloadList> data = null;
+ try {
+ data = (Optional<VnfPreloadList>) readTx.read(type, preloadInstanceIdentifier).get();
+ } catch (InterruptedException | ExecutionException e) {
+ log.error("Caught Exception reading MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] " ,e);
+ }
+
+ if ( data.isPresent()) {
+ PreloadData preloadData = (PreloadData) data.get().getPreloadData();
+ if (preloadData != null) {
+ log.info("Read MD-SAL ("+type+") data for ["+preload_name+","+preload_type+"] PreloadData: " + preloadData);
+ preloadDataBuilder.setVnfTopologyInformation(preloadData.getVnfTopologyInformation());
+ preloadDataBuilder.setNetworkTopologyInformation(preloadData.getNetworkTopologyInformation());
+ preloadDataBuilder.setOperStatus(preloadData.getOperStatus());
+ } else {
+ log.info("No preload-data found in MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] ");
+ }
+ } else {
+ log.info("No data found in MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] ");
+ }
+ }
+
+ //1610 preload-vnf-instance
+ private void getVnfInstancePreloadData(String vnf_name, String vnf_type, VnfInstancePreloadDataBuilder preloadDataBuilder)
+ {
+ // default to config
+ getVnfInstancePreloadData(vnf_name, vnf_type ,preloadDataBuilder,LogicalDatastoreType.CONFIGURATION);
+ }
+
+ //1610 preload-vnf-instance
+ private void getVnfInstancePreloadData(String preload_name, String preload_type, VnfInstancePreloadDataBuilder preloadDataBuilder, LogicalDatastoreType type)
+ {
+ // See if any data exists yet for this name/type, if so grab it.
+ InstanceIdentifier preloadInstanceIdentifier =
+ InstanceIdentifier.<PreloadVnfInstances>builder(PreloadVnfInstances.class)
+ .child(VnfInstancePreloadList.class, new VnfInstancePreloadListKey(preload_name, preload_type)).toInstance();
+ ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction();
+ Optional<VnfInstancePreloadList> data = null;
+ try {
+ data = (Optional<VnfInstancePreloadList>) readTx.read(type, preloadInstanceIdentifier).get();
+ } catch (InterruptedException | ExecutionException e) {
+ log.error("Caught Exception reading MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] " ,e);
+ }
+
+ if ( data.isPresent()) {
+ VnfInstancePreloadData preloadData = (VnfInstancePreloadData) data.get().getVnfInstancePreloadData();
+ if (preloadData != null) {
+ log.info("Read MD-SAL ("+type+") data for ["+preload_name+","+preload_type+"] VnfInstancePreloadData: " + preloadData);
+ preloadDataBuilder.setVnfInstanceTopologyInformation(preloadData.getVnfInstanceTopologyInformation());
+ preloadDataBuilder.setOperStatus(preloadData.getOperStatus());
+ } else {
+ log.info("No vnf-instance-preload-data found in MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] ");
+ }
+ } else {
+ log.info("No data found in MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] ");
+ }
+ }
+
+ // 1610 preload-vf-module
+ private void getVfModulePreloadData(String vnf_name, String vnf_type, VfModulePreloadDataBuilder preloadDataBuilder)
+ {
+ // default to config
+ getVfModulePreloadData(vnf_name, vnf_type ,preloadDataBuilder,LogicalDatastoreType.CONFIGURATION);
+ }
+
+ private void getVfModulePreloadData(String preload_name, String preload_type, VfModulePreloadDataBuilder preloadDataBuilder, LogicalDatastoreType type)
+ {
+ // See if any data exists yet for this name/type, if so grab it.
+ InstanceIdentifier preloadInstanceIdentifier =
+ InstanceIdentifier.<PreloadVfModules>builder(PreloadVfModules.class)
+ .child(VfModulePreloadList.class, new VfModulePreloadListKey(preload_name, preload_type)).toInstance();
+ ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction();
+ Optional<VfModulePreloadList> data = null;
+ try {
+ data = (Optional<VfModulePreloadList>) readTx.read(type, preloadInstanceIdentifier).get();
+ } catch (InterruptedException | ExecutionException e) {
+ log.error("Caught Exception reading MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] " ,e);
+ }
+
+ if ( data.isPresent()) {
+ VfModulePreloadData preloadData = (VfModulePreloadData) data.get().getVfModulePreloadData();
+ if (preloadData != null) {
+ log.info("Read MD-SAL ("+type+") data for ["+preload_name+","+preload_type+"] VfModulePreloadData: " + preloadData);
+ preloadDataBuilder.setVfModuleTopologyInformation(preloadData.getVfModuleTopologyInformation());
+ preloadDataBuilder.setOperStatus(preloadData.getOperStatus());
+ } else {
+ log.info("No preload-data found in MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] ");
+ }
+ } else {
+ log.info("No data found in MD-SAL ("+type+") for ["+preload_name+","+preload_type+"] ");
+ }
+ }
+
+ private void SaveVnfList (final VnfList entry, boolean merge, LogicalDatastoreType storeType) throws IllegalStateException {
+ // Each entry will be identifiable by a unique key, we have to create that identifier
+ InstanceIdentifier.InstanceIdentifierBuilder<VnfList> vnfListIdBuilder =
+ InstanceIdentifier.<Vnfs>builder(Vnfs.class)
+ .child(VnfList.class, entry.getKey());
+ InstanceIdentifier<VnfList> path = vnfListIdBuilder.toInstance();
+
+ int tries = 2;
+ while(true) {
+ try {
+ WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
+ if (merge) {
+ tx.merge(storeType, path, entry);
+ } else {
+ tx.put(storeType, path, entry);
+ }
+ tx.submit().checkedGet();
+ log.debug("Update DataStore succeeded");
+ break;
+ } catch (final TransactionCommitFailedException e) {
+ if(e instanceof OptimisticLockFailedException) {
+ if(--tries <= 0) {
+ log.debug("Got OptimisticLockFailedException on last try - failing ");
+ throw new IllegalStateException(e);
+ }
+ log.debug("Got OptimisticLockFailedException - trying again ");
+ } else {
+ log.debug("Update DataStore failed");
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+ }
+
+ //1610 vnf-instance
+ private void SaveVnfInstanceList (final VnfInstanceList entry, boolean merge, LogicalDatastoreType storeType) throws IllegalStateException {
+ // Each entry will be identifiable by a unique key, we have to create that identifier
+ InstanceIdentifier.InstanceIdentifierBuilder<VnfInstanceList> vnfInstanceListIdBuilder =
+ InstanceIdentifier.<VnfInstances>builder(VnfInstances.class)
+ .child(VnfInstanceList.class, entry.getKey());
+ InstanceIdentifier<VnfInstanceList> path = vnfInstanceListIdBuilder.toInstance();
+
+ int tries = 2;
+ while(true) {
+ try {
+ WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
+ if (merge) {
+ tx.merge(storeType, path, entry);
+ } else {
+ tx.put(storeType, path, entry);
+ }
+ tx.submit().checkedGet();
+ log.debug("Update DataStore succeeded");
+ break;
+ } catch (final TransactionCommitFailedException e) {
+ if(e instanceof OptimisticLockFailedException) {
+ if(--tries <= 0) {
+ log.debug("Got OptimisticLockFailedException on last try - failing ");
+ throw new IllegalStateException(e);
+ }
+ log.debug("Got OptimisticLockFailedException - trying again ");
+ } else {
+ log.debug("Update DataStore failed");
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+ }
+
+ //1610 vf-module
+ private void SaveVfModuleList (final VfModuleList entry, boolean merge, LogicalDatastoreType storeType) throws IllegalStateException {
+ // Each entry will be identifiable by a unique key, we have to create that identifier
+ InstanceIdentifier.InstanceIdentifierBuilder<VfModuleList> vfModuleListIdBuilder =
+ InstanceIdentifier.<VfModules>builder(VfModules.class)
+ .child(VfModuleList.class, entry.getKey());
+ InstanceIdentifier<VfModuleList> path = vfModuleListIdBuilder.toInstance();
+
+ int tries = 2;
+ while(true) {
+ try {
+ WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
+ if (merge) {
+ tx.merge(storeType, path, entry);
+ } else {
+ tx.put(storeType, path, entry);
+ }
+ tx.submit().checkedGet();
+ log.debug("Update DataStore succeeded");
+ break;
+ } catch (final TransactionCommitFailedException e) {
+ if(e instanceof OptimisticLockFailedException) {
+ if(--tries <= 0) {
+ log.debug("Got OptimisticLockFailedException on last try - failing ");
+ throw new IllegalStateException(e);
+ }
+ log.debug("Got OptimisticLockFailedException - trying again ");
+ } else {
+ log.debug("Update DataStore failed");
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+ }
+
+ private void SavePreloadList(final VnfPreloadList entry, boolean merge, LogicalDatastoreType storeType) throws IllegalStateException{
+
+ // Each entry will be identifiable by a unique key, we have to create that identifier
+ InstanceIdentifier.InstanceIdentifierBuilder<VnfPreloadList> vnfListIdBuilder =
+ InstanceIdentifier.<PreloadVnfs>builder(PreloadVnfs.class)
+ .child(VnfPreloadList.class, entry.getKey());
+ InstanceIdentifier<VnfPreloadList> path = vnfListIdBuilder.toInstance();
+ int tries = 2;
+ while(true) {
+ try {
+ WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
+ if (merge) {
+ tx.merge(storeType, path, entry);
+ } else {
+ tx.put(storeType, path, entry);
+ }
+ tx.submit().checkedGet();
+ log.debug("Update DataStore succeeded");
+ break;
+ } catch (final TransactionCommitFailedException e) {
+ if(e instanceof OptimisticLockFailedException) {
+ if(--tries <= 0) {
+ log.debug("Got OptimisticLockFailedException on last try - failing ");
+ throw new IllegalStateException(e);
+ }
+ log.debug("Got OptimisticLockFailedException - trying again ");
+ } else {
+ log.debug("Update DataStore failed");
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+ }
+
+ //1610 preload vnf-instance
+ private void SaveVnfInstancePreloadList(final VnfInstancePreloadList entry, boolean merge, LogicalDatastoreType storeType) throws IllegalStateException{
+
+ // Each entry will be identifiable by a unique key, we have to create that identifier
+ InstanceIdentifier.InstanceIdentifierBuilder<VnfInstancePreloadList> vnfInstanceListIdBuilder =
+ InstanceIdentifier.<PreloadVnfInstances>builder(PreloadVnfInstances.class)
+ .child(VnfInstancePreloadList.class, entry.getKey());
+ InstanceIdentifier<VnfInstancePreloadList> path = vnfInstanceListIdBuilder.toInstance();
+ int tries = 2;
+ while(true) {
+ try {
+ WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
+ if (merge) {
+ tx.merge(storeType, path, entry);
+ } else {
+ tx.put(storeType, path, entry);
+ }
+ tx.submit().checkedGet();
+ log.debug("Update DataStore succeeded");
+ break;
+ } catch (final TransactionCommitFailedException e) {
+ if(e instanceof OptimisticLockFailedException) {
+ if(--tries <= 0) {
+ log.debug("Got OptimisticLockFailedException on last try - failing ");
+ throw new IllegalStateException(e);
+ }
+ log.debug("Got OptimisticLockFailedException - trying again ");
+ } else {
+ log.debug("Update DataStore failed");
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+ }
+
+ //1610 preload vf-module
+ private void SaveVfModulePreloadList(final VfModulePreloadList entry, boolean merge, LogicalDatastoreType storeType) throws IllegalStateException{
+
+ // Each entry will be identifiable by a unique key, we have to create that identifier
+ InstanceIdentifier.InstanceIdentifierBuilder<VfModulePreloadList> vfModuleListIdBuilder =
+ InstanceIdentifier.<PreloadVfModules>builder(PreloadVfModules.class)
+ .child(VfModulePreloadList.class, entry.getKey());
+ InstanceIdentifier<VfModulePreloadList> path = vfModuleListIdBuilder.toInstance();
+ int tries = 2;
+ while(true) {
+ try {
+ WriteTransaction tx = dataBroker.newWriteOnlyTransaction();
+ if (merge) {
+ tx.merge(storeType, path, entry);
+ } else {
+ tx.put(storeType, path, entry);
+ }
+ tx.submit().checkedGet();
+ log.debug("Update DataStore succeeded");
+ break;
+ } catch (final TransactionCommitFailedException e) {
+ if(e instanceof OptimisticLockFailedException) {
+ if(--tries <= 0) {
+ log.debug("Got OptimisticLockFailedException on last try - failing ");
+ throw new IllegalStateException(e);
+ }
+ log.debug("Got OptimisticLockFailedException - trying again ");
+ } else {
+ log.debug("Update DataStore failed");
+ throw new IllegalStateException(e);
+ }
+ }
+ }
+ }
+
+ //1610 vnf-instance-topology-operation
+ @Override
+ public Future<RpcResult<VnfInstanceTopologyOperationOutput>> vnfInstanceTopologyOperation(
+ VnfInstanceTopologyOperationInput input) {
+
+ final String SVC_OPERATION = "vnf-instance-topology-operation";
+ VnfInstanceServiceData vnfInstanceServiceData = null;
+ ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
+ Properties parms = new Properties();
+
+ log.info( SVC_OPERATION +" called." );
+ // create a new response object
+ VnfInstanceTopologyOperationOutputBuilder responseBuilder = new VnfInstanceTopologyOperationOutputBuilder();
+
+ //if(input == null || input.getVnfInstanceRequestInformation().getVnfInstanceTopologyIdentifier().getVnfInstanceId() == null )
+ if(input == null ||
+ input.getVnfInstanceRequestInformation() == null ||
+ input.getVnfInstanceRequestInformation().getVnfInstanceId() == null )
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because of invalid input, null or empty vnf-instance-id");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, null or empty vnf-instance-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<VnfInstanceTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VnfInstanceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Grab the service instance ID from the input buffer
+ String viid = input.getVnfInstanceRequestInformation().getVnfInstanceId();
+ String preload_name = input.getVnfInstanceRequestInformation().getVnfInstanceName();
+ String preload_type = input.getVnfInstanceRequestInformation().getVnfModelId();
+
+ // Make sure we have a valid viid
+ if(viid == null || viid.length() == 0 ) {
+ log.debug("exiting "+SVC_OPERATION+" because of invalid vnf-instance-id");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, null or empty vnf-instance-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<VnfInstanceTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VnfInstanceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ if (input.getSdncRequestHeader() != null) {
+ responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ }
+
+ // Get vnf-instance-preload-data
+ VnfInstancePreloadDataBuilder vnfInstancePreloadDataBuilder = new VnfInstancePreloadDataBuilder();
+ getVnfInstancePreloadData(preload_name, preload_type, vnfInstancePreloadDataBuilder);
+
+ // Get service-data
+ VnfInstanceServiceDataBuilder vnfInstanceServiceDataBuilder = new VnfInstanceServiceDataBuilder();
+ getVnfInstanceServiceData(viid,vnfInstanceServiceDataBuilder);
+
+ // Get operational-data
+ VnfInstanceServiceDataBuilder operDataBuilder = new VnfInstanceServiceDataBuilder();
+ getVnfInstanceServiceData(viid,operDataBuilder, LogicalDatastoreType.OPERATIONAL );
+
+ // Set the serviceStatus based on input
+ setServiceStatus(serviceStatusBuilder, input.getSdncRequestHeader());
+ setServiceStatus(serviceStatusBuilder, input.getRequestInformation());
+
+ //
+ // setup a service-data object builder
+ // ACTION vnf-topology-operation
+ // INPUT:
+ // USES sdnc-request-header;
+ // USES request-information;
+ // USES service-information;
+ // USES vnf-request-information
+ // OUTPUT:
+ // USES vnf-topology-response-body;
+ // USES vnf-information
+ // USES service-information
+ //
+ // container service-data
+ // uses vnf-configuration-information;
+ // uses oper-status;
+
+ log.info("Adding INPUT data for "+SVC_OPERATION+" ["+viid+"] input: " + input);
+ VnfInstanceTopologyOperationInputBuilder inputBuilder = new VnfInstanceTopologyOperationInputBuilder(input);
+ VnfSdnUtil.toProperties(parms, inputBuilder.build());
+
+ log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+viid+"] operational-data: " + operDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder);
+
+ log.info("Adding CONFIG data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] preload-data: " + vnfInstancePreloadDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, "vnf-instance-preload-data", vnfInstancePreloadDataBuilder);
+
+ // Call SLI sync method
+ // Get SvcLogicService reference
+
+ VNFSDNSvcLogicServiceClient svcLogicClient = new VNFSDNSvcLogicServiceClient();
+ Properties respProps = null;
+
+ String errorCode = "200";
+ String errorMessage = null;
+ String ackFinal = "Y";
+
+
+ try
+ {
+ if (svcLogicClient.hasGraph("VNF-API", SVC_OPERATION , null, "sync"))
+ {
+
+ try
+ {
+ respProps = svcLogicClient.execute("VNF-API", SVC_OPERATION, null, "sync", vnfInstanceServiceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic for "+ SVC_OPERATION, e);
+ errorMessage = e.getMessage();
+ errorCode = "500";
+ }
+ } else {
+ errorMessage = "No service logic active for VNF-API: '" + SVC_OPERATION + "'";
+ 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");
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ }
+
+ setServiceStatus(serviceStatusBuilder,errorCode, errorMessage, ackFinal);
+ serviceStatusBuilder.setRequestStatus(RequestStatus.Synccomplete);
+ serviceStatusBuilder.setRpcName(RpcName.VnfInstanceTopologyOperation);
+
+ if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) {
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setResponseMessage(errorMessage);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ VnfInstanceListBuilder vnfInstanceListBuilder = new VnfInstanceListBuilder();
+ vnfInstanceListBuilder.setVnfInstanceId(viid);
+ vnfInstanceListBuilder.setServiceStatus(serviceStatusBuilder.build());
+ try {
+ SaveVnfInstanceList (vnfInstanceListBuilder.build(), true,LogicalDatastoreType.CONFIGURATION);
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+viid+"] \n",e);
+ }
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+viid+"] " + responseBuilder.build());
+ RpcResult<VnfInstanceTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VnfInstanceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ try {
+ vnfInstanceServiceData = vnfInstanceServiceDataBuilder.build();
+ log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+viid+"] VnfInstanceServiceData: " + vnfInstanceServiceData);
+ // svc-configuration-list
+ VnfInstanceListBuilder vnfInstanceListBuilder = new VnfInstanceListBuilder();
+ vnfInstanceListBuilder.setVnfInstanceServiceData(vnfInstanceServiceData);
+ vnfInstanceListBuilder.setVnfInstanceId(vnfInstanceServiceData.getVnfInstanceId());
+ //siid = vnfInstanceServiceData.getVnfInstanceId();
+ vnfInstanceListBuilder.setServiceStatus(serviceStatusBuilder.build());
+ SaveVnfInstanceList (vnfInstanceListBuilder.build(), false,LogicalDatastoreType.CONFIGURATION);
+ if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null)
+ {
+ // Only update operational tree on Delete or Activate
+ if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Delete) ||
+ input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate))
+ {
+ log.info("Updating OPERATIONAL tree.");
+ SaveVnfInstanceList (vnfInstanceListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
+ }
+ }
+ VnfInstanceInformationBuilder vnfInstanceInformationBuilder = new VnfInstanceInformationBuilder();
+ vnfInstanceInformationBuilder.setVnfInstanceId(viid);
+ responseBuilder.setVnfInstanceInformation(vnfInstanceInformationBuilder.build());
+ responseBuilder.setServiceInformation(vnfInstanceServiceData.getServiceInformation());
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+viid+"] \n",e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+viid+"] " + responseBuilder.build());
+ RpcResult<VnfInstanceTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VnfInstanceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Update succeeded
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ if (errorMessage != null)
+ {
+ responseBuilder.setResponseMessage(errorMessage);
+ }
+ log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+viid+"] ");
+ log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+viid+"] " + responseBuilder.build());
+
+ RpcResult<VnfInstanceTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VnfInstanceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return success
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ //1610 vf-module-topology-operation
+ @Override
+ public Future<RpcResult<VfModuleTopologyOperationOutput>> vfModuleTopologyOperation(
+ VfModuleTopologyOperationInput input) {
+
+ final String SVC_OPERATION = "vf-module-topology-operation";
+ VfModuleServiceData vfModuleServiceData = null;
+ VnfInstanceServiceData vnfInstanceServiceData = null;
+ ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
+ Properties parms = new Properties();
+
+ log.info( SVC_OPERATION +" called." );
+ // create a new response object
+ VfModuleTopologyOperationOutputBuilder responseBuilder = new VfModuleTopologyOperationOutputBuilder();
+
+ // Validate vf-module-id from vf-module-request-information
+ if(input == null ||
+ input.getVfModuleRequestInformation() == null ||
+ input.getVfModuleRequestInformation().getVfModuleId() == null)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because of invalid input, null or empty vf-module-id");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, null or empty vf-module-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<VfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Grab the vf-module-request-information.vf-module-id from the input buffer
+ String vfid = input.getVfModuleRequestInformation().getVfModuleId();
+ String preload_name = input.getVfModuleRequestInformation().getVfModuleName();
+ String preload_type = input.getVfModuleRequestInformation().getVfModuleModelId();
+
+ // Make sure we have a valid siid
+ if(vfid == null || vfid.length() == 0 ) {
+ log.debug("exiting "+SVC_OPERATION+" because of invalid vf-module-id");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, null or empty vf-module-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<VfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // 1610 add vf-module-id to vnf-instance-list.vf-module-relationship-list
+ String viid = input.getVfModuleRequestInformation().getVnfInstanceId();
+
+ if(viid == null || viid.length() == 0 ) {
+ log.debug("exiting "+SVC_OPERATION+" because of invalid vnf-instance-id");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, null or empty vnf-instance-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<VfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ if (input.getSdncRequestHeader() != null) {
+ responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ }
+
+ // Get vf-module-preload-data
+ VfModulePreloadDataBuilder vfModulePreloadDataBuilder = new VfModulePreloadDataBuilder();
+ getVfModulePreloadData(preload_name, preload_type, vfModulePreloadDataBuilder);
+
+ // Get vf-module-service-data
+ VfModuleServiceDataBuilder vfModuleServiceDataBuilder = new VfModuleServiceDataBuilder();
+ getVfModuleServiceData(vfid,vfModuleServiceDataBuilder);
+
+ // Get vf-module operation-data
+ VfModuleServiceDataBuilder operDataBuilder = new VfModuleServiceDataBuilder();
+ getVfModuleServiceData(vfid,operDataBuilder, LogicalDatastoreType.OPERATIONAL );
+
+ // save service-data builder object for rollback
+ VfModuleServiceDataBuilder rb_vfModuleServiceDataBuilder = vfModuleServiceDataBuilder;
+ VfModuleServiceDataBuilder rb_operDataBuilder = operDataBuilder;
+
+ // 1610 Need to pull vnf-instance-list.vf-module-relationship-list from MD-SAL
+ VnfInstanceServiceDataBuilder vnfInstanceServiceDataBuilder = new VnfInstanceServiceDataBuilder();
+ getVnfInstanceServiceData(viid, vnfInstanceServiceDataBuilder);
+
+ // vnf-instance operational-data
+ VnfInstanceServiceDataBuilder vnfInstanceOperDataBuilder = new VnfInstanceServiceDataBuilder();
+ getVnfInstanceServiceData(viid, vnfInstanceOperDataBuilder, LogicalDatastoreType.OPERATIONAL );
+
+ // save operational builder object for rollback
+ VnfInstanceServiceDataBuilder rb_vnfInstanceServiceDataBuilder = vnfInstanceServiceDataBuilder;
+ VnfInstanceServiceDataBuilder rb_vnfInstanceOperDataBuilder = vnfInstanceOperDataBuilder;
+
+ // Set the serviceStatus based on input
+ setServiceStatus(serviceStatusBuilder, input.getSdncRequestHeader());
+ setServiceStatus(serviceStatusBuilder, input.getRequestInformation());
+
+ //
+ // setup a service-data object builder
+ // ACTION vnf-topology-operation
+ // INPUT:
+ // USES sdnc-request-header;
+ // USES request-information;
+ // USES service-information;
+ // USES vnf-request-information
+ // OUTPUT:
+ // USES vnf-topology-response-body;
+ // USES vnf-information
+ // USES service-information
+ //
+ // container service-data
+ // uses vnf-configuration-information;
+ // uses oper-status;
+
+ log.info("Adding INPUT data for "+SVC_OPERATION+" ["+vfid+"] input: " + input);
+ VfModuleTopologyOperationInputBuilder inputBuilder = new VfModuleTopologyOperationInputBuilder(input);
+ VnfSdnUtil.toProperties(parms, inputBuilder.build());
+
+ log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+vfid+"] vf-module operational-data: " + operDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder);
+
+ log.info("Adding CONFIG data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] vf-module-preload-data: " + vfModulePreloadDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, "vf-module-preload-data", vfModulePreloadDataBuilder);
+
+ log.info("Adding vnf-instance CONFIG data for "+SVC_OPERATION+" ["+viid+"] vnf-instance-service-data: " + vnfInstanceServiceDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, "vnf-instance-service-data", vnfInstanceServiceDataBuilder);
+
+ log.info("Adding vnf-instance OPERATIONAL data for "+SVC_OPERATION+" ["+viid+"] vnf-instance operational-data: " + vnfInstanceOperDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, "vnf-instance-operational-data", vnfInstanceOperDataBuilder);
+
+ // Call SLI sync method
+ // Get SvcLogicService reference
+
+ VNFSDNSvcLogicServiceClient svcLogicClient = new VNFSDNSvcLogicServiceClient();
+ Properties respProps = null;
+
+ String errorCode = "200";
+ String errorMessage = null;
+ String ackFinal = "Y";
+
+
+ try
+ {
+ if (svcLogicClient.hasGraph("VNF-API", SVC_OPERATION , null, "sync"))
+ {
+
+ try
+ {
+ respProps = svcLogicClient.execute("VNF-API", SVC_OPERATION, null, "sync", vfModuleServiceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic on vf-module for "+ SVC_OPERATION, e);
+ errorMessage = e.getMessage();
+ errorCode = "500";
+ }
+
+ } else {
+ errorMessage = "No service logic active for VNF-API: '" + SVC_OPERATION + "'";
+ 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");
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ }
+
+ setServiceStatus(serviceStatusBuilder,errorCode, errorMessage, ackFinal);
+ serviceStatusBuilder.setRequestStatus(RequestStatus.Synccomplete);
+ serviceStatusBuilder.setRpcName(RpcName.VfModuleTopologyOperation);
+
+ if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) {
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setResponseMessage(errorMessage);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ VfModuleListBuilder vfModuleListBuilder = new VfModuleListBuilder();
+ vfModuleListBuilder.setVfModuleId(vfid);
+ vfModuleListBuilder.setServiceStatus(serviceStatusBuilder.build());
+ try {
+ SaveVfModuleList (vfModuleListBuilder.build(), true,LogicalDatastoreType.CONFIGURATION);
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+vfid+"] \n",e);
+ }
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+vfid+"] " + responseBuilder.build());
+ RpcResult<VfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ // save vf-module-service-data in MD-SAL
+ try {
+ vfModuleServiceData = vfModuleServiceDataBuilder.build();
+ log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+vfid+"] VfModuleServiceData: " + vfModuleServiceData);
+ // vf-module-list
+ VfModuleListBuilder vfModuleListBuilder = new VfModuleListBuilder();
+ vfModuleListBuilder.setVfModuleServiceData(vfModuleServiceData);
+ vfModuleListBuilder.setVfModuleId(vfModuleServiceData.getVfModuleId());
+ //vfid = vfModuleServiceData.getVfModuleId();
+ vfModuleListBuilder.setServiceStatus(serviceStatusBuilder.build());
+ SaveVfModuleList (vfModuleListBuilder.build(), false,LogicalDatastoreType.CONFIGURATION);
+ if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null)
+ {
+ // Only update operational tree on Delete or Activate
+ if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Delete) ||
+ input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate))
+ {
+ log.info("Updating OPERATIONAL tree.");
+ SaveVfModuleList (vfModuleListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
+ }
+ }
+ VfModuleInformationBuilder vfModuleInformationBuilder = new VfModuleInformationBuilder();
+ vfModuleInformationBuilder.setVfModuleId(vfid);
+ responseBuilder.setVfModuleInformation(vfModuleInformationBuilder.build());
+ responseBuilder.setServiceInformation(vfModuleServiceData.getServiceInformation());
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+vfid+"] \n",e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+vfid+"] " + responseBuilder.build());
+ RpcResult<VfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Update succeeded
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ if (errorMessage != null)
+ {
+ responseBuilder.setResponseMessage(errorMessage);
+ }
+ log.info("Updated vf-module in MD-SAL for "+SVC_OPERATION+" ["+vfid+"] ");
+ log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+vfid+"] " + responseBuilder.build());
+
+ RpcResult<VfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return success
+ return Futures.immediateFuture(rpcResult);
+ }
+
+
+ @Override
+ public Future<RpcResult<VnfTopologyOperationOutput>> vnfTopologyOperation(
+ VnfTopologyOperationInput input) {
+
+ final String SVC_OPERATION = "vnf-topology-operation";
+ ServiceData serviceData = null;
+ ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
+ Properties parms = new Properties();
+
+ log.info( SVC_OPERATION +" called." );
+ // create a new response object
+ VnfTopologyOperationOutputBuilder responseBuilder = new VnfTopologyOperationOutputBuilder();
+
+ if(input == null ||
+ input.getServiceInformation() == null ||
+ input.getServiceInformation().getServiceInstanceId() == null ||
+ input.getServiceInformation().getServiceInstanceId().length() == 0)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because of invalid input, null or empty service-instance-id");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<VnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ if(input.getVnfRequestInformation() == null ||
+ input.getVnfRequestInformation().getVnfId() == null ||
+ input.getVnfRequestInformation().getVnfId().length() == 0)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because of invalid input, null or empty vf-module-id");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, null or empty vf-module-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<VnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Grab the service instance ID from the input buffer
+ String siid = input.getVnfRequestInformation().getVnfId();
+ String preload_name = input.getVnfRequestInformation().getVnfName();
+ String preload_type = input.getVnfRequestInformation().getVnfType();
+
+ /*
+ // Make sure we have a valid siid
+ if(siid == null || siid.length() == 0 ) {
+ log.debug("exiting "+SVC_OPERATION+" because of invalid siid");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<VnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+ */
+
+ if (input.getSdncRequestHeader() != null) {
+ responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ }
+
+ PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
+ getPreloadData(preload_name, preload_type, preloadDataBuilder);
+
+ ServiceDataBuilder serviceDataBuilder = new ServiceDataBuilder();
+ getServiceData(siid,serviceDataBuilder);
+
+ ServiceDataBuilder operDataBuilder = new ServiceDataBuilder();
+ getServiceData(siid,operDataBuilder, LogicalDatastoreType.OPERATIONAL );
+
+ // Set the serviceStatus based on input
+ setServiceStatus(serviceStatusBuilder, input.getSdncRequestHeader());
+ setServiceStatus(serviceStatusBuilder, input.getRequestInformation());
+
+ //
+ // setup a service-data object builder
+ // ACTION vnf-topology-operation
+ // INPUT:
+ // USES sdnc-request-header;
+ // USES request-information;
+ // USES service-information;
+ // USES vnf-request-information
+ // OUTPUT:
+ // USES vnf-topology-response-body;
+ // USES vnf-information
+ // USES service-information
+ //
+ // container service-data
+ // uses vnf-configuration-information;
+ // uses oper-status;
+
+ log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input);
+ VnfTopologyOperationInputBuilder inputBuilder = new VnfTopologyOperationInputBuilder(input);
+ VnfSdnUtil.toProperties(parms, inputBuilder.build());
+
+ log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+siid+"] operational-data: " + operDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder);
+
+ log.info("Adding CONFIG data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] preload-data: " + preloadDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, "preload-data", preloadDataBuilder);
+
+ // Call SLI sync method
+ // Get SvcLogicService reference
+
+ VNFSDNSvcLogicServiceClient svcLogicClient = new VNFSDNSvcLogicServiceClient();
+ Properties respProps = null;
+
+ String errorCode = "200";
+ String errorMessage = null;
+ String ackFinal = "Y";
+
+
+ try
+ {
+ if (svcLogicClient.hasGraph("VNF-API", SVC_OPERATION , null, "sync"))
+ {
+
+ try
+ {
+ respProps = svcLogicClient.execute("VNF-API", SVC_OPERATION, null, "sync", serviceDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic for "+ SVC_OPERATION, e);
+ errorMessage = e.getMessage();
+ errorCode = "500";
+ }
+ } else {
+ errorMessage = "No service logic active for VNF-API: '" + SVC_OPERATION + "'";
+ 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");
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ }
+
+ setServiceStatus(serviceStatusBuilder,errorCode, errorMessage, ackFinal);
+ serviceStatusBuilder.setRequestStatus(RequestStatus.Synccomplete);
+ serviceStatusBuilder.setRpcName(RpcName.VnfTopologyOperation);
+
+ if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) {
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setResponseMessage(errorMessage);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ VnfListBuilder vnfListBuilder = new VnfListBuilder();
+ vnfListBuilder.setVnfId(siid);
+ vnfListBuilder.setServiceStatus(serviceStatusBuilder.build());
+ try {
+ SaveVnfList (vnfListBuilder.build(), true,LogicalDatastoreType.CONFIGURATION);
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e);
+ }
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+ RpcResult<VnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ try {
+ serviceData = serviceDataBuilder.build();
+ log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] ServiceData: " + serviceData);
+ // svc-configuration-list
+ VnfListBuilder vnfListBuilder = new VnfListBuilder();
+ vnfListBuilder.setServiceData(serviceData);
+ vnfListBuilder.setVnfId(serviceData.getVnfId());
+ siid = serviceData.getVnfId();
+ vnfListBuilder.setServiceStatus(serviceStatusBuilder.build());
+ SaveVnfList (vnfListBuilder.build(), false,LogicalDatastoreType.CONFIGURATION);
+ if (input.getSdncRequestHeader() != null && input.getSdncRequestHeader().getSvcAction() != null)
+ {
+ // Only update operational tree on Delete or Activate
+ if (input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Delete) ||
+ input.getSdncRequestHeader().getSvcAction().equals(SvcAction.Activate))
+ {
+ log.info("Updating OPERATIONAL tree.");
+ SaveVnfList (vnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
+ }
+ }
+ VnfInformationBuilder vnfInformationBuilder = new VnfInformationBuilder();
+ vnfInformationBuilder.setVnfId(siid);
+ responseBuilder.setVnfInformation(vnfInformationBuilder.build());
+ responseBuilder.setServiceInformation(serviceData.getServiceInformation());
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+ RpcResult<VnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Update succeeded
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ if (errorMessage != null)
+ {
+ responseBuilder.setResponseMessage(errorMessage);
+ }
+ log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] ");
+ log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+
+ RpcResult<VnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<VnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return success
+ return Futures.immediateFuture(rpcResult);
+ }
+
+
+ @Override
+ public Future<RpcResult<NetworkTopologyOperationOutput>> networkTopologyOperation(
+ NetworkTopologyOperationInput input) {
+
+ final String SVC_OPERATION = "network-topology-operation";
+ ServiceData serviceData = null;
+ ServiceStatusBuilder serviceStatusBuilder = new ServiceStatusBuilder();
+ Properties parms = new Properties();
+
+ log.info( SVC_OPERATION +" called." );
+ // create a new response object
+ NetworkTopologyOperationOutputBuilder responseBuilder = new NetworkTopologyOperationOutputBuilder();
+
+ if(input == null ||
+ input.getServiceInformation() == null ||
+ input.getServiceInformation().getServiceInstanceId() == null ||
+ input.getServiceInformation().getServiceInstanceId().length() == 0)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because of invalid input, null or empty service-instance-id");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<NetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ if(input.getNetworkRequestInformation() == null || input.getNetworkRequestInformation().getNetworkName() == null) {
+ log.debug("exiting " +SVC_OPERATION+ " because of invalid input, null or empty service-instance-id");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<NetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Grab the service instance ID from the input buffer
+ String siid = null;
+ if (input.getSdncRequestHeader().getSvcAction().equals("assign")) {
+ siid = input.getNetworkRequestInformation().getNetworkName();
+ }
+ else {
+ siid = input.getNetworkRequestInformation().getNetworkId();
+ }
+ String preload_name = input.getNetworkRequestInformation().getNetworkName();
+ String preload_type = input.getNetworkRequestInformation().getNetworkType();
+
+ /*
+ if(siid == null || siid.length() == 0 ) {
+ log.debug("exiting "+SVC_OPERATION+" because of invalid siid");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, null or empty service-instance-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<NetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+ */
+
+ if (input.getSdncRequestHeader() != null) {
+ responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ }
+
+ PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
+ getPreloadData(preload_name, preload_type, preloadDataBuilder);
+
+ log.info("Adding INPUT data for "+SVC_OPERATION+" ["+siid+"] input: " + input);
+ NetworkTopologyOperationInputBuilder inputBuilder = new NetworkTopologyOperationInputBuilder(input);
+ VnfSdnUtil.toProperties(parms, inputBuilder.build());
+
+/*
+ log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+siid+"] operational-data: " + operDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder);
+
+ log.info("Adding CONFIG data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] preload-data: " + preloadDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, "preload-data", preloadDataBuilder);
+*/
+
+ // Call SLI sync method
+ // Get SvcLogicService reference
+
+ VNFSDNSvcLogicServiceClient svcLogicClient = new VNFSDNSvcLogicServiceClient();
+ Properties respProps = null;
+
+ String errorCode = "200";
+ String errorMessage = null;
+ String ackFinal = "Y";
+ String networkId = "error";
+
+
+ try
+ {
+ if (svcLogicClient.hasGraph("VNF-API", SVC_OPERATION , null, "sync"))
+ {
+
+ try
+ {
+ respProps = svcLogicClient.execute("VNF-API", SVC_OPERATION, null, "sync", preloadDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic for "+ SVC_OPERATION, e);
+ errorMessage = e.getMessage();
+ errorCode = "500";
+ }
+ } else {
+ errorMessage = "No service logic active for VNF-API: '" + SVC_OPERATION + "'";
+ 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");
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ networkId = respProps.getProperty("networkId","0");
+ }
+
+ if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) {
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setResponseMessage(errorMessage);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+
+ RpcResult<NetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ try {
+ NetworkInformationBuilder networkInformationBuilder = new NetworkInformationBuilder();
+ networkInformationBuilder.setNetworkId(networkId);
+ responseBuilder.setNetworkInformation(networkInformationBuilder.build());
+ responseBuilder.setServiceInformation(input.getServiceInformation());
+ } catch (IllegalStateException e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+siid+"] \n",e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+ RpcResult<NetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return error
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Update succeeded
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ if (errorMessage != null)
+ {
+ responseBuilder.setResponseMessage(errorMessage);
+ }
+ log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+siid+"] ");
+ log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+siid+"] " + responseBuilder.build());
+
+ RpcResult<NetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<NetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ // return success
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ @Override
+ public Future<RpcResult<PreloadVnfTopologyOperationOutput>> preloadVnfTopologyOperation(
+ PreloadVnfTopologyOperationInput input) {
+
+ final String SVC_OPERATION = "preload-vnf-topology-operation";
+ PreloadData preloadData = null;
+ Properties parms = new Properties();
+
+ log.info( SVC_OPERATION +" called." );
+ // create a new response object
+ PreloadVnfTopologyOperationOutputBuilder responseBuilder = new PreloadVnfTopologyOperationOutputBuilder();
+
+ // Result from savePreloadData
+ final SettableFuture<RpcResult<Void>> futureResult = SettableFuture.create();
+
+ if(input == null || input.getVnfTopologyInformation() == null || input.getVnfTopologyInformation().getVnfTopologyIdentifier() == null || input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfName() == null || input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfType() == null) {
+ log.debug("exiting " +SVC_OPERATION+ " because of invalid input, null or empty vnf-name and vnf-type");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, null or empty vnf-name and vnf-type");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Grab the name and type from the input buffer
+ String preload_name = input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfName();
+ String preload_type = input.getVnfTopologyInformation().getVnfTopologyIdentifier().getVnfType();
+
+ // Make sure we have a preload_name and preload_type
+ if(preload_name == null || preload_name.length() == 0 ) {
+ log.debug("exiting "+SVC_OPERATION+" because of invalid preload-name");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, invalid preload-name");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+ if(preload_type == null || preload_type.length() == 0 ) {
+ log.debug("exiting "+SVC_OPERATION+" because of invalid preload-type");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, invalid preload-type");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ if (input.getSdncRequestHeader() != null) {
+ responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ }
+
+ PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
+ getPreloadData(preload_name, preload_type, preloadDataBuilder);
+ //preloadData = preloadDataBuilder.build();
+
+ PreloadDataBuilder operDataBuilder = new PreloadDataBuilder();
+ getPreloadData(preload_name, preload_type, operDataBuilder, LogicalDatastoreType.OPERATIONAL );
+
+ //
+ // setup a preload-data object builder
+ // ACTION vnf-topology-operation
+ // INPUT:
+ // USES sdnc-request-header;
+ // USES request-information;
+ // uses vnf-topology-information;
+ // OUTPUT:
+ // USES vnf-topology-response-body;
+ //
+ // container preload-data
+ // uses vnf-configuration-information;
+
+
+ log.info("Adding INPUT data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] input: " + input);
+ PreloadVnfTopologyOperationInputBuilder inputBuilder = new PreloadVnfTopologyOperationInputBuilder(input);
+ VnfSdnUtil.toProperties(parms, inputBuilder.build());
+ log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+preload_name+","+preload_type +"] operational-data: " + operDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder);
+
+ // Call SLI sync method
+ // Get SvcLogicService reference
+
+ VNFSDNSvcLogicServiceClient svcLogicClient = new VNFSDNSvcLogicServiceClient();
+ Properties respProps = null;
+
+ String errorCode = "200";
+ String errorMessage = null;
+ String ackFinal = "Y";
+
+
+ try
+ {
+ if (svcLogicClient.hasGraph("VNF-API", SVC_OPERATION , null, "sync"))
+ {
+
+ try
+ {
+ respProps = svcLogicClient.execute("VNF-API", SVC_OPERATION, null, "sync", preloadDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic for "+ SVC_OPERATION, e);
+ errorMessage = e.getMessage();
+ errorCode = "500";
+ }
+ } else {
+ errorMessage = "No service logic active for VNF-API: '" + SVC_OPERATION + "'";
+ 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");
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ // internalError = respProps.getProperty("internal-error", "false");
+ }
+
+ if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) {
+
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setResponseMessage(errorMessage);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+
+ VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder();
+ preloadVnfListBuilder.setVnfName(preload_name);
+ preloadVnfListBuilder.setVnfType(preload_type);
+ preloadVnfListBuilder.setPreloadData(preloadDataBuilder.build());
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] error code: '" + errorCode + "', Reason: '" + errorMessage + "'");
+ try {
+ SavePreloadList (preloadVnfListBuilder.build(), true,LogicalDatastoreType.CONFIGURATION);
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e);
+ }
+ log.debug("Sending Success rpc result due to external error");
+ RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ try {
+ preloadData = preloadDataBuilder.build();
+ log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] preloadData: " + preloadData);
+ // svc-configuration-list
+ VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder();
+ preloadVnfListBuilder.setVnfName(preload_name);
+ preloadVnfListBuilder.setVnfType(preload_type);
+ preloadVnfListBuilder.setPreloadData(preloadData);
+
+ // SDNGC-989 set merge flag to false
+ SavePreloadList (preloadVnfListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION);
+ log.info("Updating OPERATIONAL tree.");
+ SavePreloadList (preloadVnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build());
+ RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(false).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Update succeeded
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ if (errorMessage != null)
+ {
+ responseBuilder.setResponseMessage(errorMessage);
+ }
+ log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] ");
+ log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build());
+
+ RpcResult<PreloadVnfTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVnfTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ //1610 preload-vnf-instance-topology-operation
+ @Override
+ public Future<RpcResult<PreloadVnfInstanceTopologyOperationOutput>> preloadVnfInstanceTopologyOperation(
+ PreloadVnfInstanceTopologyOperationInput input) {
+
+ final String SVC_OPERATION = "preload-vnf-instance-topology-operation";
+ VnfInstancePreloadData vnfInstancePreloadData = null;
+ Properties parms = new Properties();
+
+ log.info( SVC_OPERATION +" called." );
+ // create a new response object
+ PreloadVnfInstanceTopologyOperationOutputBuilder responseBuilder = new PreloadVnfInstanceTopologyOperationOutputBuilder();
+
+ // Result from savePreloadData
+ final SettableFuture<RpcResult<Void>> futureResult = SettableFuture.create();
+
+ if(input == null ||
+ input.getVnfInstanceTopologyInformation() == null ||
+ input.getVnfInstanceTopologyInformation().getVnfInstanceIdentifiers().getVnfInstanceName() == null ||
+ input.getVnfInstanceTopologyInformation().getVnfInstanceIdentifiers().getVnfModelId() == null)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because of invalid input, null or empty vnf-instance-name and vnf-model-id");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, null or empty vnf-instance-name and vnf-model-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<PreloadVnfInstanceTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVnfInstanceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Grab the name and type from the input buffer
+ String preload_name = input.getVnfInstanceTopologyInformation().getVnfInstanceIdentifiers().getVnfInstanceName();
+ String preload_type = input.getVnfInstanceTopologyInformation().getVnfInstanceIdentifiers().getVnfModelId();
+
+ // Make sure we have a preload_name and preload_type
+ if(preload_name == null || preload_name.length() == 0 ) {
+ log.debug("exiting "+SVC_OPERATION+" because of invalid preload-name");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, invalid preload-name");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<PreloadVnfInstanceTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVnfInstanceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+ if(preload_type == null || preload_type.length() == 0 ) {
+ log.debug("exiting "+SVC_OPERATION+" because of invalid preload-type");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, invalid preload-type");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<PreloadVnfInstanceTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVnfInstanceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ if (input.getSdncRequestHeader() != null) {
+ responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ }
+
+ VnfInstancePreloadDataBuilder vnfInstancePreloadDataBuilder = new VnfInstancePreloadDataBuilder();
+ getVnfInstancePreloadData(preload_name, preload_type, vnfInstancePreloadDataBuilder);
+ //preloadData = preloadDataBuilder.build();
+
+ VnfInstancePreloadDataBuilder operDataBuilder = new VnfInstancePreloadDataBuilder();
+ getVnfInstancePreloadData(preload_name, preload_type, operDataBuilder, LogicalDatastoreType.OPERATIONAL );
+
+ //
+ // setup a preload-data object builder
+ // ACTION vnf-topology-operation
+ // INPUT:
+ // USES sdnc-request-header;
+ // USES request-information;
+ // uses vnf-topology-information;
+ // OUTPUT:
+ // USES vnf-topology-response-body;
+ //
+ // container preload-data
+ // uses vnf-configuration-information;
+
+
+ log.info("Adding INPUT data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] input: " + input);
+ PreloadVnfInstanceTopologyOperationInputBuilder inputBuilder = new PreloadVnfInstanceTopologyOperationInputBuilder(input);
+ VnfSdnUtil.toProperties(parms, inputBuilder.build());
+ log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+preload_name+","+preload_type +"] operational-data: " + operDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder);
+
+ // Call SLI sync method
+ // Get SvcLogicService reference
+
+ VNFSDNSvcLogicServiceClient svcLogicClient = new VNFSDNSvcLogicServiceClient();
+ Properties respProps = null;
+
+ String errorCode = "200";
+ String errorMessage = null;
+ String ackFinal = "Y";
+
+
+ try
+ {
+ if (svcLogicClient.hasGraph("VNF-API", SVC_OPERATION , null, "sync"))
+ {
+
+ try
+ {
+ respProps = svcLogicClient.execute("VNF-API", SVC_OPERATION, null, "sync", vnfInstancePreloadDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic for "+ SVC_OPERATION, e);
+ errorMessage = e.getMessage();
+ errorCode = "500";
+ }
+ } else {
+ errorMessage = "No service logic active for VNF-API: '" + SVC_OPERATION + "'";
+ 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");
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ // internalError = respProps.getProperty("internal-error", "false");
+ }
+
+ if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) {
+
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setResponseMessage(errorMessage);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+
+ VnfInstancePreloadListBuilder vnfInstancePreloadListBuilder = new VnfInstancePreloadListBuilder();
+ vnfInstancePreloadListBuilder.setVnfInstanceName(preload_name);
+ vnfInstancePreloadListBuilder.setVnfModelId(preload_type);
+ vnfInstancePreloadListBuilder.setVnfInstancePreloadData(vnfInstancePreloadDataBuilder.build());
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] error code: '" + errorCode + "', Reason: '" + errorMessage + "'");
+ try {
+ SaveVnfInstancePreloadList (vnfInstancePreloadListBuilder.build(), true,LogicalDatastoreType.CONFIGURATION);
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e);
+ }
+ log.debug("Sending Success rpc result due to external error");
+ RpcResult<PreloadVnfInstanceTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVnfInstanceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ try {
+ vnfInstancePreloadData = vnfInstancePreloadDataBuilder.build();
+ log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] preloadData: " + vnfInstancePreloadData);
+ // svc-configuration-list
+ VnfInstancePreloadListBuilder vnfInstancePreloadListBuilder = new VnfInstancePreloadListBuilder();
+ vnfInstancePreloadListBuilder.setVnfInstanceName(preload_name);
+ vnfInstancePreloadListBuilder.setVnfModelId(preload_type);
+ vnfInstancePreloadListBuilder.setVnfInstancePreloadData(vnfInstancePreloadData);
+
+ // SDNGC-989 set merge flag to false
+ SaveVnfInstancePreloadList (vnfInstancePreloadListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION);
+ log.info("Updating OPERATIONAL tree.");
+ SaveVnfInstancePreloadList (vnfInstancePreloadListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build());
+ RpcResult<PreloadVnfInstanceTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVnfInstanceTopologyOperationOutput> status(false).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Update succeeded
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ if (errorMessage != null)
+ {
+ responseBuilder.setResponseMessage(errorMessage);
+ }
+ log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] ");
+ log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build());
+
+ RpcResult<PreloadVnfInstanceTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVnfInstanceTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+
+ //1610 preload-vf-module-topology-operation
+ @Override
+ public Future<RpcResult<PreloadVfModuleTopologyOperationOutput>> preloadVfModuleTopologyOperation(
+ PreloadVfModuleTopologyOperationInput input) {
+
+ final String SVC_OPERATION = "preload-vf-module-topology-operation";
+ VfModulePreloadData vfModulePreloadData = null;
+ Properties parms = new Properties();
+
+ log.info( SVC_OPERATION +" called." );
+ // create a new response object
+ PreloadVfModuleTopologyOperationOutputBuilder responseBuilder = new PreloadVfModuleTopologyOperationOutputBuilder();
+
+ // Result from savePreloadData
+ final SettableFuture<RpcResult<Void>> futureResult = SettableFuture.create();
+
+ if(input == null ||
+ input.getVfModuleTopologyInformation() == null ||
+ input.getVfModuleTopologyInformation().getVfModuleIdentifiers().getVfModuleName() == null ||
+ input.getVfModuleTopologyInformation().getVfModuleIdentifiers().getVfModuleModelId() == null)
+ {
+ log.debug("exiting " +SVC_OPERATION+ " because of invalid input, null or empty vnf-instance-name and vnf-model-id");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, null or empty vnf-instance-name and vnf-model-id");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<PreloadVfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Grab the name and type from the input buffer
+ String preload_name = input.getVfModuleTopologyInformation().getVfModuleIdentifiers().getVfModuleName();
+ String preload_type = input.getVfModuleTopologyInformation().getVfModuleIdentifiers().getVfModuleModelId();
+
+ // Make sure we have a preload_name and preload_type
+ if(preload_name == null || preload_name.length() == 0 ) {
+ log.debug("exiting "+SVC_OPERATION+" because of invalid preload-name");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, invalid preload-name");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<PreloadVfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+ if(preload_type == null || preload_type.length() == 0 ) {
+ log.debug("exiting "+SVC_OPERATION+" because of invalid preload-type");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("invalid input, invalid preload-type");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<PreloadVfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ if (input.getSdncRequestHeader() != null) {
+ responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ }
+
+ VfModulePreloadDataBuilder vfModulePreloadDataBuilder = new VfModulePreloadDataBuilder();
+ getVfModulePreloadData(preload_name, preload_type, vfModulePreloadDataBuilder);
+ //preloadData = preloadDataBuilder.build();
+
+ VfModulePreloadDataBuilder operDataBuilder = new VfModulePreloadDataBuilder();
+ getVfModulePreloadData(preload_name, preload_type, operDataBuilder, LogicalDatastoreType.OPERATIONAL );
+
+ //
+ // setup a preload-data object builder
+ // ACTION vnf-topology-operation
+ // INPUT:
+ // USES sdnc-request-header;
+ // USES request-information;
+ // uses vnf-topology-information;
+ // OUTPUT:
+ // USES vnf-topology-response-body;
+ //
+ // container preload-data
+ // uses vnf-configuration-information;
+
+
+ log.info("Adding INPUT data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] input: " + input);
+ PreloadVfModuleTopologyOperationInputBuilder inputBuilder = new PreloadVfModuleTopologyOperationInputBuilder(input);
+ VnfSdnUtil.toProperties(parms, inputBuilder.build());
+ log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+preload_name+","+preload_type +"] operational-data: " + operDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder);
+
+ // Call SLI sync method
+ // Get SvcLogicService reference
+
+ VNFSDNSvcLogicServiceClient svcLogicClient = new VNFSDNSvcLogicServiceClient();
+ Properties respProps = null;
+
+ String errorCode = "200";
+ String errorMessage = null;
+ String ackFinal = "Y";
+
+
+ try
+ {
+ if (svcLogicClient.hasGraph("VNF-API", SVC_OPERATION , null, "sync"))
+ {
+
+ try
+ {
+ respProps = svcLogicClient.execute("VNF-API", SVC_OPERATION, null, "sync", vfModulePreloadDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic for "+ SVC_OPERATION, e);
+ errorMessage = e.getMessage();
+ errorCode = "500";
+ }
+ } else {
+ errorMessage = "No service logic active for VNF-API: '" + SVC_OPERATION + "'";
+ 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");
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ // internalError = respProps.getProperty("internal-error", "false");
+ }
+
+ if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) {
+
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setResponseMessage(errorMessage);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+
+ VfModulePreloadListBuilder vfModulePreloadListBuilder = new VfModulePreloadListBuilder();
+ vfModulePreloadListBuilder.setVfModuleName(preload_name);
+ vfModulePreloadListBuilder.setVfModuleModelId(preload_type);
+ vfModulePreloadListBuilder.setVfModulePreloadData(vfModulePreloadDataBuilder.build());
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] error code: '" + errorCode + "', Reason: '" + errorMessage + "'");
+ try {
+ SaveVfModulePreloadList (vfModulePreloadListBuilder.build(), true,LogicalDatastoreType.CONFIGURATION);
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e);
+ }
+ log.debug("Sending Success rpc result due to external error");
+ RpcResult<PreloadVfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ try {
+ vfModulePreloadData = vfModulePreloadDataBuilder.build();
+ log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] preloadData: " + vfModulePreloadData);
+ // svc-configuration-list
+ VfModulePreloadListBuilder vfModulePreloadListBuilder = new VfModulePreloadListBuilder();
+ vfModulePreloadListBuilder.setVfModuleName(preload_name);
+ vfModulePreloadListBuilder.setVfModuleModelId(preload_type);
+ vfModulePreloadListBuilder.setVfModulePreloadData(vfModulePreloadData);
+
+ // SDNGC-989 set merge flag to false
+ SaveVfModulePreloadList (vfModulePreloadListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION);
+ log.info("Updating OPERATIONAL tree.");
+ SaveVfModulePreloadList (vfModulePreloadListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build());
+ RpcResult<PreloadVfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVfModuleTopologyOperationOutput> status(false).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Update succeeded
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ if (errorMessage != null)
+ {
+ responseBuilder.setResponseMessage(errorMessage);
+ }
+ log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] ");
+ log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build());
+
+ RpcResult<PreloadVfModuleTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadVfModuleTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+
+ @Override
+ public Future<RpcResult<PreloadNetworkTopologyOperationOutput>> preloadNetworkTopologyOperation(
+ PreloadNetworkTopologyOperationInput input) {
+
+ final String SVC_OPERATION = "preload-network-topology-operation";
+ PreloadData preloadData = null;
+ Properties parms = new Properties();
+
+ log.info( SVC_OPERATION +" called." );
+ // create a new response object
+ PreloadNetworkTopologyOperationOutputBuilder responseBuilder = new PreloadNetworkTopologyOperationOutputBuilder();
+
+ // Result from savePreloadData
+ final SettableFuture<RpcResult<Void>> futureResult = SettableFuture.create();
+
+ if(input == null || input.getNetworkTopologyInformation() == null || input.getNetworkTopologyInformation().getNetworkTopologyIdentifier() == null || input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkName() == null || input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkType() == null) {
+ log.debug("exiting " +SVC_OPERATION+ " because of invalid input, null or empty vnf-name and vnf-type");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("input, null or empty vnf-name and vnf-type");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Grab the name and type from the input buffer
+ String preload_name = input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkName();
+ String preload_type = input.getNetworkTopologyInformation().getNetworkTopologyIdentifier().getNetworkType();
+
+ // Make sure we have a preload_name and preload_type
+ if(preload_name == null || preload_name.length() == 0 ) {
+ log.debug("exiting "+SVC_OPERATION+" because of invalid preload-name");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("input, invalid preload-name");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+ if(preload_type == null || preload_type.length() == 0 ) {
+ log.debug("exiting "+SVC_OPERATION+" because of invalid preload-type");
+ responseBuilder.setResponseCode("403");
+ responseBuilder.setResponseMessage("input, invalid preload-type");
+ responseBuilder.setAckFinalIndicator("Y");
+ RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ if (input.getSdncRequestHeader() != null) {
+ responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ }
+
+ PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
+ getPreloadData(preload_name, preload_type, preloadDataBuilder);
+
+ PreloadDataBuilder operDataBuilder = new PreloadDataBuilder();
+ getPreloadData(preload_name, preload_type, operDataBuilder, LogicalDatastoreType.OPERATIONAL );
+
+ //
+ // setup a preload-data object builder
+ // ACTION vnf-topology-operation
+ // INPUT:
+ // USES sdnc-request-header;
+ // USES request-information;
+ // uses vnf-topology-information;
+ // OUTPUT:
+ // USES vnf-topology-response-body;
+ //
+ // container preload-data
+ // uses vnf-configuration-information;
+
+
+ log.info("Adding INPUT data for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] input: " + input);
+ PreloadNetworkTopologyOperationInputBuilder inputBuilder = new PreloadNetworkTopologyOperationInputBuilder(input);
+ VnfSdnUtil.toProperties(parms, inputBuilder.build());
+ log.info("Adding OPERATIONAL data for "+SVC_OPERATION+" ["+preload_name+","+preload_type +"] operational-data: " + operDataBuilder.build());
+ VnfSdnUtil.toProperties(parms, "operational-data", operDataBuilder);
+
+ // Call SLI sync method
+ // Get SvcLogicService reference
+
+ VNFSDNSvcLogicServiceClient svcLogicClient = new VNFSDNSvcLogicServiceClient();
+ Properties respProps = null;
+
+ String errorCode = "200";
+ String errorMessage = null;
+ String ackFinal = "Y";
+
+
+ try
+ {
+ if (svcLogicClient.hasGraph("VNF-API", SVC_OPERATION , null, "sync"))
+ {
+
+ try
+ {
+ respProps = svcLogicClient.execute("VNF-API", SVC_OPERATION, null, "sync", preloadDataBuilder, parms);
+ }
+ catch (Exception e)
+ {
+ log.error("Caught exception executing service logic for "+ SVC_OPERATION, e);
+ errorMessage = e.getMessage();
+ errorCode = "500";
+ }
+ } else {
+ errorMessage = "No service logic active for VNF-API: '" + SVC_OPERATION + "'";
+ 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");
+ ackFinal = respProps.getProperty("ack-final", "Y");
+ // internalError = respProps.getProperty("internal-error", "false");
+ }
+
+ if ( errorCode != null && errorCode.length() != 0 && !( errorCode.equals("0")|| errorCode.equals("200"))) {
+
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setResponseMessage(errorMessage);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+
+ VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder();
+ preloadVnfListBuilder.setVnfName(preload_name);
+ preloadVnfListBuilder.setVnfType(preload_type);
+ preloadVnfListBuilder.setPreloadData(preloadDataBuilder.build());
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] error code: '" + errorCode + "', Reason: '" + errorMessage + "'");
+ try {
+ SavePreloadList (preloadVnfListBuilder.build(),true,LogicalDatastoreType.CONFIGURATION);
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e);
+
+ }
+ log.debug("Sending Success rpc result due to external error");
+ RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Got success from SLI
+ try {
+ preloadData = preloadDataBuilder.build();
+ log.info("Updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] preloadData: " + preloadData);
+ // svc-configuration-list
+ VnfPreloadListBuilder preloadVnfListBuilder = new VnfPreloadListBuilder();
+ preloadVnfListBuilder.setVnfName(preload_name);
+ preloadVnfListBuilder.setVnfType(preload_type);
+ preloadVnfListBuilder.setPreloadData(preloadData);
+
+ // SDNGC-989 set merge flag to false
+ SavePreloadList (preloadVnfListBuilder.build(), false, LogicalDatastoreType.CONFIGURATION);
+ log.info("Updating OPERATIONAL tree.");
+ SavePreloadList (preloadVnfListBuilder.build(), false, LogicalDatastoreType.OPERATIONAL);
+ } catch (Exception e) {
+ log.error("Caught Exception updating MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] \n",e);
+ responseBuilder.setResponseCode("500");
+ responseBuilder.setResponseMessage(e.toString());
+ responseBuilder.setAckFinalIndicator("Y");
+ log.error("Returned FAILED for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build());
+ RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(false).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+
+ // Update succeeded
+ responseBuilder.setResponseCode(errorCode);
+ responseBuilder.setAckFinalIndicator(ackFinal);
+ if (errorMessage != null)
+ {
+ responseBuilder.setResponseMessage(errorMessage);
+ }
+ log.info("Updated MD-SAL for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] ");
+ log.info("Returned SUCCESS for "+SVC_OPERATION+" ["+preload_name+","+preload_type+"] " + responseBuilder.build());
+
+ RpcResult<PreloadNetworkTopologyOperationOutput> rpcResult =
+ RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
+ return Futures.immediateFuture(rpcResult);
+ }
+}
diff --git a/vnfapi/provider/src/main/resources/initial/vnfapi-provider.xml b/vnfapi/provider/src/main/resources/initial/vnfapi-provider.xml
new file mode 100644
index 00000000..4db02193
--- /dev/null
+++ b/vnfapi/provider/src/main/resources/initial/vnfapi-provider.xml
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============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=========================================================
+ -->
+
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<snapshot>
+ <configuration>
+ <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+ <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
+ <module>
+
+ <!-- This xmlns:prefix should match the namespace in the *-provider-impl.yang file
+ The prefix: inside type should match the prefix of the yang file. -->
+ <type xmlns:prefix="org:openecomp:sdnc:vnfapi:provider:impl">
+ prefix:vnfapi-provider-impl
+ </type>
+ <name>vnfapi-provider-impl</name>
+
+ <!-- The following sections contain bindings to services defined in the
+ *-provider-impl yang file. For example the rpc-registry is required
+ because we have a dependency (or augmentation) named "rpc-registry"
+ and which binds to the md-sa-binding-registry. If you remove those
+ dependencies from the yang file then you can remove them from here. -->
+ <rpc-registry>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-rpc-registry</type>
+ <name>binding-rpc-broker</name>
+ </rpc-registry>
+
+ <data-broker>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">binding:binding-async-data-broker</type>
+ <name>binding-data-broker</name>
+ </data-broker>
+
+ <notification-service>
+ <type xmlns:binding="urn:opendaylight:params:xml:ns:yang:controller:md:sal:binding">
+ binding:binding-notification-service
+ </type>
+ <name>binding-notification-broker</name>
+ </notification-service>
+ </module>
+
+ </modules>
+ </data>
+
+ </configuration>
+
+ <!-- Required capabilities are basically a listing of all modules that need to be imported before
+ our service can be resolved. Capabilities for dependencies defined above are implied which is
+ why we do not have define a required capability for the data broker, for example. -->
+ <required-capabilities>
+ <capability>org:openecomp:sdnc:vnfapi:provider:impl?module=vnfapi-provider-impl&amp;revision=2014-05-23</capability>
+ </required-capabilities>
+
+</snapshot>
diff --git a/vnfapi/provider/src/main/yang/vnfapi-provider-impl.yang b/vnfapi/provider/src/main/yang/vnfapi-provider-impl.yang
new file mode 100644
index 00000000..3749d83d
--- /dev/null
+++ b/vnfapi/provider/src/main/yang/vnfapi-provider-impl.yang
@@ -0,0 +1,61 @@
+module vnfapi-provider-impl {
+
+ yang-version 1;
+ namespace "org:openecomp:sdnc:vnfapi:provider:impl";
+ prefix "vnfapi-provider-impl";
+
+ import config { prefix config; revision-date 2013-04-05; }
+ import opendaylight-md-sal-binding { prefix mdsal; revision-date 2013-10-28; }
+
+ description
+ "This module contains the base YANG definitions for
+ vnfapi-provider impl implementation.";
+
+ revision "2014-05-23" {
+ description
+ "Initial revision.";
+ }
+
+ // This is the definition of the service implementation as a module identity.
+ identity vnfapi-provider-impl {
+ base config:module-type;
+
+ // Specifies the prefix for generated java classes.
+ config:java-name-prefix vnfapiProvider;
+ }
+
+ // Augments the 'configuration' choice node under modules/module.
+ // We consume the three main services, RPCs, DataStore, and Notifications
+ augment "/config:modules/config:module/config:configuration" {
+ case vnfapi-provider-impl {
+ when "/config:modules/config:module/config:type = 'vnfapi-provider-impl'";
+
+ container rpc-registry {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity mdsal:binding-rpc-registry;
+ }
+ }
+ }
+
+ container notification-service {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity mdsal:binding-notification-service;
+ }
+ }
+ }
+
+ container data-broker {
+ uses config:service-ref {
+ refine type {
+ mandatory false;
+ config:required-identity mdsal:binding-async-data-broker;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/vnfapi/provider/src/test/java/org/openecomp/sdnc/vnfapi/TestPropertyList.java b/vnfapi/provider/src/test/java/org/openecomp/sdnc/vnfapi/TestPropertyList.java
new file mode 100644
index 00000000..e8836d7a
--- /dev/null
+++ b/vnfapi/provider/src/test/java/org/openecomp/sdnc/vnfapi/TestPropertyList.java
@@ -0,0 +1,102 @@
+/*-
+ * ============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.openecomp.sdnc.vnfapi;
+
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.util.Date;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.VnfTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.service.data.ServiceDataBuilder;
+import org.openecomp.sdnc.vnfapi.VnfSdnUtil;
+import org.openecomp.sdnc.vnfapi.vnfapiProvider;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInput;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.PreloadVnfTopologyOperationInputBuilder;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnctl.vnf.rev150720.preload.data.PreloadDataBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class TestPropertyList extends TestCase {
+
+
+ private final Logger log = LoggerFactory.getLogger( vnfapiProvider.class );
+ public void testPrintPropertyList() {
+ InputStream propStr = getClass().getResourceAsStream("/proplist.properties");
+
+ Properties props = new Properties();
+
+ try
+ {
+ props.load(propStr);
+ } catch (Exception e)
+ {
+ fail("Could not load proplist.properties");
+ }
+
+ String aptFile = props.getProperty("proplist.aptFile");
+
+ if ((aptFile == null) || (aptFile.length() == 0))
+ {
+ fail("proplist.aptFile unset");
+ }
+
+ PrintStream outStr = null;
+
+ try {
+ outStr = new PrintStream(new FileOutputStream(aptFile));
+ } catch (FileNotFoundException e) {
+ fail("Cannot open apt file "+aptFile);
+ }
+
+ Date now = new Date();
+
+ outStr.print(" ---");
+ outStr.print("\n Service Logic Variables");
+ outStr.print("\n ---");
+ outStr.print("\n System generated");
+ outStr.print("\n ---");
+ outStr.print("\n "+now.toString());
+ outStr.print("\n\nSupported service logic variables");
+ outStr.print("\n\n Config/operational tree data for VNF SDN service is passed to the service logic in the following variables");
+ outStr.print("\n");
+ VnfSdnUtil.printPropertyList(outStr, "", ServiceDataBuilder.class);
+ VnfSdnUtil.printPropertyList(outStr, "", PreloadDataBuilder.class);
+ outStr.print("\n");
+ outStr.print("\n\n Input parameters to the vnf-topology-operation RPC are passed to the service logic in the following variables");
+ outStr.print("\n");
+ VnfSdnUtil.printPropertyList(outStr, "", VnfTopologyOperationInputBuilder.class);
+ outStr.print("\n");
+ outStr.print("\n\n Input parameters to the preload-vnf-topology-operation -operation RPC are passed to the service logic in the following variables");
+ outStr.print("\n");
+ VnfSdnUtil.printPropertyList(outStr, "", PreloadVnfTopologyOperationInputBuilder.class);
+ outStr.print("\n");
+ outStr.flush();
+ outStr.close();
+ }
+
+}
diff --git a/vnfapi/provider/src/test/resources/proplist.properties b/vnfapi/provider/src/test/resources/proplist.properties
new file mode 100644
index 00000000..ac8c13a3
--- /dev/null
+++ b/vnfapi/provider/src/test/resources/proplist.properties
@@ -0,0 +1,22 @@
+###
+# ============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=========================================================
+###
+
+proplist.aptFile = target/properties.apt
diff --git a/vnfapi/provider/src/test/resources/simplelogger.properties b/vnfapi/provider/src/test/resources/simplelogger.properties
new file mode 100644
index 00000000..68ced844
--- /dev/null
+++ b/vnfapi/provider/src/test/resources/simplelogger.properties
@@ -0,0 +1,22 @@
+###
+# ============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=========================================================
+###
+
+org.slf4j.simpleLogger.defaultLogLevel=debug
diff --git a/vnftools/.gitignore b/vnftools/.gitignore
new file mode 100644
index 00000000..b73caf31
--- /dev/null
+++ b/vnftools/.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/vnftools/features/pom.xml b/vnftools/features/pom.xml
new file mode 100644
index 00000000..7f0797f3
--- /dev/null
+++ b/vnftools/features/pom.xml
@@ -0,0 +1,133 @@
+<?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>
+ <artifactId>vnftools</artifactId>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>vnftools-features</artifactId>
+ <name>VNF tools Plugin - Features</name>
+
+ <packaging>jar</packaging>
+
+ <dependencies>
+
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnftools-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>features-mdsal</artifactId>
+ <version>${odl.mdsal.features.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+
+ <scope>runtime</scope>
+ </dependency>
+
+
+ <!-- dependency for opendaylight-karaf-empty for use by testing -->
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>opendaylight-karaf-empty</artifactId>
+ <type>zip</type>
+ </dependency>
+
+
+ <dependency>
+ <!-- Required for launching the feature tests -->
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>features-test</artifactId>
+ <scope>test</scope>
+ <version>${odl.commons.opendaylight.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>features-yangtools</artifactId>
+ <version>${odl.yangtools.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <filtering>true</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>filter</id>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- launches the feature test, which validates that your karaf feature
+ can be installed inside of a karaf container. It doesn't validate that your
+ functionality works correctly, just that you have all of the dependent bundles
+ defined correctly.
+ <plugin>
+
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.16</version>
+ <configuration>
+ <systemPropertyVariables>
+ <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId>
+ <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
+ <karaf.distro.version>${odl.karaf.empty.distro.version}</karaf.distro.version>
+ </systemPropertyVariables>
+ <dependenciesToScan>
+ <dependency>org.opendaylight.yangtools:features-test</dependency>
+ </dependenciesToScan>
+ </configuration>
+ </plugin>
+ -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/${features.file}</file>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/vnftools/features/src/main/resources/features.xml b/vnftools/features/src/main/resources/features.xml
new file mode 100644
index 00000000..8cd1ca27
--- /dev/null
+++ b/vnftools/features/src/main/resources/features.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============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=========================================================
+ -->
+
+
+<features name="sdnc-vnftools-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+
+ <repository>mvn:org.opendaylight.controller/features-mdsal/${odl.mdsal.version}/xml/features</repository>
+
+
+ <feature name='sdnc-vnftools' description="sdnc-vnftools" version='${project.version}'>
+ <!-- Most applications will have a dependency on the ODL MD-SAL Broker -->
+ <feature version="${odl.mdsal.version}">odl-mdsal-broker</feature>
+ <feature>sdnc-sli</feature>
+ <bundle>mvn:org.openecomp.sdnc.northbound/vnftools-provider/${project.version}</bundle>
+ </feature>
+
+</features>
diff --git a/vnftools/installer/pom.xml b/vnftools/installer/pom.xml
new file mode 100755
index 00000000..acf7dccd
--- /dev/null
+++ b/vnftools/installer/pom.xml
@@ -0,0 +1,137 @@
+<?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>
+ <artifactId>vnftools</artifactId>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>vnftools-installer</artifactId>
+ <name>VNF Tools Plugin - Karaf Installer</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <application.name>sdnc-vnftools</application.name>
+ <features.boot>sdnc-vnftools</features.boot>
+ <features.repositories>mvn:org.openecomp.sdnc.northbound/vnftools-features/${project.version}/xml/features</features.repositories>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnftools-features</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnftools-provider</artifactId>
+ <version>${project.version}</version>
+ </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>false</attach>
+ <finalName>stage/${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+ </descriptors>
+ </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>
+ </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.openecomp.sdnc</includeGroupIds>
+ <excludeArtifactIds>sli-common,sli-provider,dblib-common,dblib-provider,sliPluginUtils-provider</excludeArtifactIds>
+ <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/vnftools/installer/src/assembly/assemble_installer_zip.xml b/vnftools/installer/src/assembly/assemble_installer_zip.xml
new file mode 100644
index 00000000..0ce9b1ac
--- /dev/null
+++ b/vnftools/installer/src/assembly/assemble_installer_zip.xml
@@ -0,0 +1,58 @@
+<!--
+ ============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">
+ <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/vnftools/installer/src/assembly/assemble_mvnrepo_zip.xml b/vnftools/installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100644
index 00000000..ba21ddac
--- /dev/null
+++ b/vnftools/installer/src/assembly/assemble_mvnrepo_zip.xml
@@ -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=========================================================
+ -->
+
+<!-- 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">
+ <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/vnftools/installer/src/main/resources/scripts/install-feature.sh b/vnftools/installer/src/main/resources/scripts/install-feature.sh
new file mode 100644
index 00000000..33e9b036
--- /dev/null
+++ b/vnftools/installer/src/main/resources/scripts/install-feature.sh
@@ -0,0 +1,40 @@
+#!/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}
+ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"}
+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} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories}
+${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot}
diff --git a/vnftools/pom.xml b/vnftools/pom.xml
new file mode 100644
index 00000000..59a876f3
--- /dev/null
+++ b/vnftools/pom.xml
@@ -0,0 +1,49 @@
+<?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/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>sdnc-northbound</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>pom</packaging>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnftools</artifactId>
+
+ <properties>
+ <feature-name>vnftools</feature-name>
+ </properties>
+
+ <name>VNF Tools Plugin</name>
+ <description>Provides execute nodes to Directed Graphs that use the VNF Module.</description>
+
+ <version>1.0.0</version>
+
+ <dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnftools-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnftools-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+
+ </dependencyManagement>
+
+ <modules>
+ <module>provider</module>
+ <module>features</module>
+ <module>installer</module>
+ </modules>
+</project>
diff --git a/vnftools/provider/pom.xml b/vnftools/provider/pom.xml
new file mode 100644
index 00000000..cce9e246
--- /dev/null
+++ b/vnftools/provider/pom.xml
@@ -0,0 +1,83 @@
+<?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.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnftools</artifactId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>vnftools-provider</artifactId>
+ <packaging>bundle</packaging>
+ <name>VNF Tools Plugin - Provider</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-common</artifactId>
+ <version>${sdnctl.sli.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ <version>${sdnctl.sli.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>equinoxSDK381</groupId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ <version>${equinox.osgi.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sliPluginUtils-provider</artifactId>
+ <version>${sdnctl.slipluginutils.version}</version>
+ <type>jar</type>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>${bundle.plugin.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>org.openecomp.sdnc.vnftools</Bundle-SymbolicName>
+ <Bundle-Activator>org.openecomp.sdnc.vnftools.VnfToolsActivator</Bundle-Activator>
+ <Export-Package>org.openecomp.sdnc.vnftools</Export-Package>
+ <Import-Package>org.openecomp.sdnc.*,org.osgi.framework.*,org.slf4j.*,java.net.*,org.apache.commons.*</Import-Package>
+ <Embed-Dependency>*;scope=compile|runtime;artifactId=!sli-common|org.eclipse.osgi|mysql-connector-java|slf4j-api|jcl-over-slf4j|xml-apis|InetAddress|commons-lang3</Embed-Dependency>
+ <Embed-Transitive>true</Embed-Transitive>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </build>
+</project>
diff --git a/vnftools/provider/src/main/java/org/openecomp/sdnc/vnftools/VnfTools.java b/vnftools/provider/src/main/java/org/openecomp/sdnc/vnftools/VnfTools.java
new file mode 100644
index 00000000..52864961
--- /dev/null
+++ b/vnftools/provider/src/main/java/org/openecomp/sdnc/vnftools/VnfTools.java
@@ -0,0 +1,205 @@
+/*-
+ * ============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.openecomp.sdnc.vnftools;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.SvcLogicJavaPlugin;
+import org.openecomp.sdnc.sli.SliPluginUtils.SliPluginUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class VnfTools implements SvcLogicJavaPlugin {
+ // ========== FIELDS ==========
+
+ private static final Logger LOG = LoggerFactory.getLogger(VnfTools.class);
+
+ // ========== CONSTRUCTORS ==========
+
+ public VnfTools(Properties props) {
+ if (props != null) {
+ LOG.debug("props is not null.");
+ }
+ }
+
+
+ public void checkIfActivateReady( Map<String, String> parameters, SvcLogicContext ctx ) throws SvcLogicException {
+ LOG.debug("Checking if enough data is available to send the NCS Activate request...");
+
+ SliPluginUtils.checkParameters(parameters, new String[]{"return-key"}, LOG);
+ final String returnKey = parameters.get("return-key");
+ ctx.setAttribute(returnKey, "true");
+
+ }
+
+ /**
+ * DG node performs a java String.contains(String) and writes true or false
+ * to a key in context memory.
+ * @param parameters Hashmap in context memory must contain the following:
+ * <table border='1'>
+ * <thead>
+ * <th>Key</th>
+ * <th>Description</th>
+ * </thead>
+ * <tbody>
+ * <tr>
+ * <td>string_to_search</td>
+ * <td>String to perform java String.contains(String) on</td>
+ * </tr>
+ * <tr>
+ * <td>string_to_find</td>
+ * <td>String to find in the string_to_search</td>
+ * </tr>
+ * <tr>
+ * <td>result_ctx_string</td>
+ * <td>Context memory key to write the result ("true" or "false") to</td>
+ * </tr>
+ * </tbody>
+ * </table>
+ * @param ctx Reference to context memory
+ * @throws SvcLogicException
+ */
+ public void stringContains( Map<String, String> parameters, SvcLogicContext ctx ) throws SvcLogicException {
+ SliPluginUtils.checkParameters(parameters, new String[]{"string_to_search","string_to_find","result_ctx_string"}, LOG);
+ ctx.setAttribute(parameters.get("result_ctx_string"), Boolean.toString(parameters.get("string_to_search").contains(parameters.get("string_to_find"))));
+ }
+
+
+ public void generateName( Map<String, String> parameters, SvcLogicContext ctx ) throws SvcLogicException {
+ LOG.debug("generateName");
+
+ SliPluginUtils.checkParameters(parameters, new String[]{"base","suffix","return-path"}, LOG);
+
+ String base = parameters.get("base");
+ ctx.setAttribute( parameters.get("return-path"), base.substring(0, base.length() - 4) + parameters.get("suffix") + base.substring(base.length() - 2) );
+ }
+
+
+ private boolean matches(String str1, String str2) {
+ if (str1 == null) {
+ if (str2 == null) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ if (str2 == null) {
+ return false;
+ } else {
+ return str1.equals(str2);
+ }
+ }
+ }
+
+ private void setIfNotNull(String property, String value, SvcLogicContext ctx) {
+ if (value != null) {
+ LOG.debug("Setting " + property + " to " + value);
+ ctx.setAttribute(property, value);
+ }
+ }
+
+ /*
+ * Moves an array element from one index to another
+ */
+ private void copyArrayEntry(String srcRoot, String destRoot, SvcLogicContext ctx) {
+ LOG.debug("copyArrayEntry called: srcRoot=" + srcRoot + ", destRoot=" + destRoot);
+
+ // Record all of the source keys
+ List<String> keysToMove = new ArrayList<String>();
+ for (String key : ctx.getAttributeKeySet()) {
+ if (key.startsWith(srcRoot)) {
+ keysToMove.add(key);
+ }
+ }
+
+ // Now loop through and copy those keys to the destination, and then delete the source
+ for (String key : keysToMove) {
+ String suffix = key.substring(srcRoot.length());
+ LOG.debug("Move " + key + " to " + destRoot + suffix);
+ ctx.setAttribute(destRoot + suffix, ctx.getAttribute(key));
+ ctx.setAttribute(key, null);
+ }
+
+ }
+
+ public void printContext(Map<String, String> parameters, SvcLogicContext ctx) throws SvcLogicException {
+ if (parameters == null) {
+ throw new SvcLogicException("no parameters passed");
+ }
+
+ String fileName = parameters.get("filename");
+
+ if ((fileName == null) || (fileName.length() == 0)) {
+ throw new SvcLogicException("printContext requires 'filename' parameter");
+ }
+
+ PrintStream pstr = null;
+
+ try {
+ pstr = new PrintStream(new FileOutputStream(new File(fileName), true));
+ } catch (Exception e) {
+ throw new SvcLogicException("Cannot open file " + fileName, e);
+ }
+ pstr.println("#######################################");
+ for (String attr : ctx.getAttributeKeySet()) {
+ pstr.println(attr + " = " + ctx.getAttribute(attr));
+ }
+ pstr.flush();
+ pstr.close();
+ }
+
+ static int getArrayLength( SvcLogicContext ctx, String key ) {
+ try {
+ return Integer.parseInt(ctx.getAttribute(key));
+ } catch( NumberFormatException e ) {}
+
+ return 0;
+ }
+
+ static int getArrayLength( SvcLogicContext ctx, String key, String debug ) {
+ try {
+ return Integer.parseInt(ctx.getAttribute(key));
+ } catch( NumberFormatException e ) {
+ LOG.debug(debug);
+ }
+
+ return 0;
+ }
+
+ /**
+ * Returns true if string is null or empty.
+ * @param str
+ * @return
+ */
+ private static boolean stringIsBlank( String str ) {
+ return str == null || str.isEmpty();
+ }
+
+}
diff --git a/vnftools/provider/src/main/java/org/openecomp/sdnc/vnftools/VnfToolsActivator.java b/vnftools/provider/src/main/java/org/openecomp/sdnc/vnftools/VnfToolsActivator.java
new file mode 100644
index 00000000..7e8e615a
--- /dev/null
+++ b/vnftools/provider/src/main/java/org/openecomp/sdnc/vnftools/VnfToolsActivator.java
@@ -0,0 +1,87 @@
+/*-
+ * ============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.openecomp.sdnc.vnftools;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+
+import org.openecomp.sdnc.sli.ConfigurationException;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class VnfToolsActivator implements BundleActivator {
+
+ private static final String VNFTOOLS_PROP_VAR = "/vnftools.properties";
+ private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR";
+
+ @SuppressWarnings("rawtypes")
+ private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>();
+
+ private static final Logger LOG = LoggerFactory.getLogger(VnfToolsActivator.class);
+
+ @Override
+ public void start(BundleContext ctx) throws Exception {
+ // Read properties
+ Properties props = new Properties();
+
+ String propDir = System.getenv(SDNC_CONFIG_DIR);
+ if (propDir == null) {
+ propDir = "/opt/sdnc/data/properties";
+ }
+
+ String propPath = propDir + VNFTOOLS_PROP_VAR;
+
+ File propFile = new File(propPath);
+
+ if (!propFile.exists()) {
+ props = null;
+ } else {
+
+ try {
+ props.load(new FileInputStream(propFile));
+ } catch (Exception e) {
+ throw new ConfigurationException("Could not load properties file " + propPath, e);
+ }
+ }
+ VnfTools plugin = new VnfTools(props);
+
+ LOG.info("Registering service " + plugin.getClass().getName());
+ registrations.add(ctx.registerService(plugin.getClass().getName(), plugin, null));
+ }
+
+ @Override
+ public void stop(BundleContext ctx) throws Exception {
+
+ for (@SuppressWarnings("rawtypes")
+ ServiceRegistration registration : registrations) {
+ registration.unregister();
+ registration = null;
+ }
+ }
+
+}
diff --git a/vnftools/provider/src/main/resources/l3ucpetools.properties b/vnftools/provider/src/main/resources/l3ucpetools.properties
new file mode 100644
index 00000000..1abb05a0
--- /dev/null
+++ b/vnftools/provider/src/main/resources/l3ucpetools.properties
@@ -0,0 +1,23 @@
+###
+# ============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=========================================================
+###
+
+changeorder.timeout=86400
+breakfix.timeout=7200