summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x.gitignore38
-rw-r--r--LICENSE.txt22
-rw-r--r--README.md8
-rwxr-xr-xasdcApi/.gitignore34
-rwxr-xr-xasdcApi/features/pom.xml138
-rw-r--r--asdcApi/features/src/main/resources/features.xml41
-rwxr-xr-xasdcApi/installer/pom.xml140
-rw-r--r--asdcApi/installer/src/assembly/assemble_installer_zip.xml59
-rw-r--r--asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml55
-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.java415
-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.xml136
-rw-r--r--dataChange/features/src/main/resources/features.xml39
-rwxr-xr-xdataChange/installer/pom.xml140
-rw-r--r--dataChange/installer/src/assembly/assemble_installer_zip.xml59
-rw-r--r--dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml55
-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
-rwxr-xr-xdmaap-listener/.gitignore12
-rwxr-xr-xdmaap-listener/.sonar/checkstyle.xml1
-rwxr-xr-xdmaap-listener/.sonar/pmd.xml67
-rwxr-xr-xdmaap-listener/pom.xml115
-rw-r--r--dmaap-listener/src/assembly/assemble_zip.xml61
-rw-r--r--dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DmaapListener.java165
-rw-r--r--dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DummyDmaapConsumer.java37
-rw-r--r--dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/InvalidMessageException.java37
-rw-r--r--dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncDmaapConsumer.java146
-rw-r--r--dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncFlatJsonDmaapConsumer.java196
-rw-r--r--dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncOdlConnection.java159
-rw-r--r--dmaap-listener/src/main/resources/edgeRouterStatusChange.map23
-rw-r--r--dmaap-listener/src/main/resources/log4j.properties37
-rw-r--r--dmaap-listener/src/main/resources/preferredRoute.txt1
-rw-r--r--dmaap-listener/src/main/scripts/start-dmaap-listener.sh69
-rw-r--r--dmaap-listener/src/main/scripts/stop-dmaap-listener.sh52
-rw-r--r--dmaap-listener/src/site/apt/index.apt46
-rw-r--r--dmaap-listener/src/site/site.xml31
-rw-r--r--example-settings.xml163
-rw-r--r--jenkins-settings.xml168
-rw-r--r--pom.xml119
-rwxr-xr-xueb-listener/.gitignore12
-rwxr-xr-xueb-listener/.sonar/checkstyle.xml1
-rwxr-xr-xueb-listener/.sonar/pmd.xml67
-rwxr-xr-xueb-listener/pom.xml128
-rw-r--r--ueb-listener/src/assembly/assemble_zip.xml63
-rw-r--r--ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncARModel.java53
-rw-r--r--ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncArtifactMap.java134
-rw-r--r--ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncBaseModel.java297
-rw-r--r--ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncNodeModel.java145
-rw-r--r--ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncOdlConnection.java158
-rw-r--r--ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncServiceModel.java98
-rw-r--r--ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebCallback.java1125
-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.java280
-rw-r--r--ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFCModel.java69
-rw-r--r--ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFModel.java56
-rw-r--r--ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFModuleModel.java45
-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/main/scripts/start-ueb-listener.sh68
-rw-r--r--ueb-listener/src/main/scripts/stop-ueb-listener.sh56
-rw-r--r--ueb-listener/src/site/apt/index.apt46
-rw-r--r--ueb-listener/src/site/site.xml31
-rw-r--r--version.properties14
89 files changed, 8389 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/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..774d9e52
--- /dev/null
+++ b/asdcApi/features/pom.xml
@@ -0,0 +1,138 @@
+<?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.onap.ccsdk.sli.northbound</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>asdcApi-features</artifactId>
+
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>asdcApi-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>asdcApi-provider</artifactId>
+ <version>${project.version}</version>
+ <classifier>config</classifier>
+ <type>xml</type>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.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>
+ <version>${odl.karaf.empty.distro.version}</version>
+ <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..e72e0f65
--- /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 ONAP 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..94008aaa
--- /dev/null
+++ b/asdcApi/installer/pom.xml
@@ -0,0 +1,140 @@
+<?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.onap.ccsdk.sli.northbound</groupId>
+ <version>0.0.1-SNAPSHOT</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.onap.ccsdk.sli.northbound/asdcApi-features/${project.version}/xml/features</features.repositories>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>asdcApi-features</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>asdcApi-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>maven-repo-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <attach>false</attach>
+ <finalName>stage/${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+ </descriptors>
+ <appendAssemblyId>false</appendAssemblyId>
+ </configuration>
+ </execution>
+ <execution>
+ <id>installer-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <attach>true</attach>
+ <finalName>${application.name}-${project.version}-installer</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_installer_zip.xml</descriptor>
+ </descriptors>
+ <appendAssemblyId>false</appendAssemblyId>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <transitive>false</transitive>
+ <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <useRepositoryLayout>true</useRepositoryLayout>
+ <addParentPoms>false</addParentPoms>
+ <copyPom>false</copyPom>
+ <includeGroupIds>org.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..e278872a
--- /dev/null
+++ b/asdcApi/installer/src/assembly/assemble_installer_zip.xml
@@ -0,0 +1,59 @@
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : SDN-C
+ ================================================================================
+ Copyright (C) 2017 ONAP Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>installer_zip</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level
+ as this file is suppose to be unzip on top of a karaf
+ distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target/stage/</directory>
+ <outputDirectory>${application.name}</outputDirectory>
+ <fileMode>755</fileMode>
+ <includes>
+ <include>*.sh</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/stage/</directory>
+ <outputDirectory>${application.name}</outputDirectory>
+ <fileMode>644</fileMode>
+ <excludes>
+ <exclude>*.sh</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+
+
+</assembly>
diff --git a/asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml b/asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100644
index 00000000..608200da
--- /dev/null
+++ b/asdcApi/installer/src/assembly/assemble_mvnrepo_zip.xml
@@ -0,0 +1,55 @@
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : SDN-C
+ ================================================================================
+ Copyright (C) 2017 ONAP Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>mvnrepo_zip</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level
+ as this file is suppose to be unzip on top of a karaf
+ distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target/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..9a47d222
--- /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 ONAP 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..b9f48326
--- /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.onap.ccsdk.sli.northbound</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>asdcApi-model</artifactId>
+ <version>0.0.1-SNAPSHOT</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.sal.api.gen.plugin.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.mdsal.yang.binding.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..b4d538ab
--- /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.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>sdnc-northbound</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+
+ <packaging>pom</packaging>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>asdcApi</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <properties>
+ <feature-name>asdcApi</feature-name>
+ </properties>
+
+ <dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>asdcApi-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>asdcApi-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>asdcApi-provider</artifactId>
+ <version>${project.version}</version>
+ <classifier>config</classifier>
+ <type>xml</type>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.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..e8769fd7
--- /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.onap.ccsdk.sli.northbound</groupId>
+ <version>0.0.1-SNAPSHOT</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.sal.api.gen.plugin.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.onap.ccsdk.sli.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.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-common</artifactId>
+ <version>${sdnctl.sli.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ <version>${sdnctl.sli.version}</version>
+ </dependency>
+ </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..c9223a15
--- /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 ONAP 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..6a1d8068
--- /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 ONAP 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..28e59c8d
--- /dev/null
+++ b/asdcApi/provider/src/main/java/org/openecomp/sdnc/asdcapi/AsdcApiProvider.java
@@ -0,0 +1,415 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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 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;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.CheckedFuture;
+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.
+ *
+ * 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") + "." );
+ }
+ }
+
+
+ protected 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;
+ }
+ }
+
+ protected void addArtifactVersion(String aName, String aVersion) {
+
+
+ try {
+ ArtifactBuilder aBuilder = new ArtifactBuilder();
+
+ aBuilder.setArtifactName(aName);
+ aBuilder.setArtifactVersion(aVersion);
+
+ Artifact artifact = aBuilder.build();
+
+ InstanceIdentifier.InstanceIdentifierBuilder<Artifact> aIdBuilder = InstanceIdentifier
+ .<Artifacts> builder(Artifacts.class)
+ .child(Artifact.class, artifact.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..2f3a783b
--- /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 ONAP 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.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.onap.ccsdk.sli.core.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..240c939b
--- /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 ONAP 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.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
+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;
+
+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..ab2da905
--- /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 ONAP 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..12340447
--- /dev/null
+++ b/dataChange/features/pom.xml
@@ -0,0 +1,136 @@
+<?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.onap.ccsdk.sli.northbound</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>dataChange-features</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>dataChange-model</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>dataChange-provider</artifactId>
+ <classifier>config</classifier>
+ <type>xml</type>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.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>
+ <version>${odl.karaf.empty.distro.version}</version>
+ <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..2b4ac946
--- /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 ONAP 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..414719e1
--- /dev/null
+++ b/dataChange/installer/pom.xml
@@ -0,0 +1,140 @@
+<?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.onap.ccsdk.sli.northbound</groupId>
+ <version>0.0.1-SNAPSHOT</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.onap.ccsdk.sli.northbound/dataChange-features/${project.version}/xml/features</features.repositories>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>dataChange-features</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>dataChange-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>maven-repo-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <attach>false</attach>
+ <finalName>stage/${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+ </descriptors>
+ <appendAssemblyId>false</appendAssemblyId>
+ </configuration>
+ </execution>
+ <execution>
+ <id>installer-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <attach>true</attach>
+ <finalName>${application.name}-${project.version}-installer</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_installer_zip.xml</descriptor>
+ </descriptors>
+ <appendAssemblyId>false</appendAssemblyId>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <transitive>false</transitive>
+ <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <useRepositoryLayout>true</useRepositoryLayout>
+ <addParentPoms>false</addParentPoms>
+ <copyPom>false</copyPom>
+ <includeGroupIds>org.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..e278872a
--- /dev/null
+++ b/dataChange/installer/src/assembly/assemble_installer_zip.xml
@@ -0,0 +1,59 @@
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : SDN-C
+ ================================================================================
+ Copyright (C) 2017 ONAP Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>installer_zip</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level
+ as this file is suppose to be unzip on top of a karaf
+ distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target/stage/</directory>
+ <outputDirectory>${application.name}</outputDirectory>
+ <fileMode>755</fileMode>
+ <includes>
+ <include>*.sh</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/stage/</directory>
+ <outputDirectory>${application.name}</outputDirectory>
+ <fileMode>644</fileMode>
+ <excludes>
+ <exclude>*.sh</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+
+
+</assembly>
diff --git a/dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml b/dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100644
index 00000000..608200da
--- /dev/null
+++ b/dataChange/installer/src/assembly/assemble_mvnrepo_zip.xml
@@ -0,0 +1,55 @@
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : SDN-C
+ ================================================================================
+ Copyright (C) 2017 ONAP Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>mvnrepo_zip</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level
+ as this file is suppose to be unzip on top of a karaf
+ distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target/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..9a47d222
--- /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 ONAP 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..0d16ebfc
--- /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.onap.ccsdk.sli.northbound</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>dataChange-model</artifactId>
+ <version>0.0.1-SNAPSHOT</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.sal.api.gen.plugin.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.mdsal.yang.binding.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..2e3d8749
--- /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.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>sdnc-northbound</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+
+ <packaging>pom</packaging>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>dataChange</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <properties>
+ <feature-name>dataChange</feature-name>
+ </properties>
+
+ <dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>dataChange-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>dataChange-model</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>dataChange-provider</artifactId>
+ <version>${project.version}</version>
+ <classifier>config</classifier>
+ <type>xml</type>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.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..5a7c7003
--- /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.onap.ccsdk.sli.northbound</groupId>
+ <version>0.0.1-SNAPSHOT</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.sal.api.gen.plugin.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.onap.ccsdk.sli.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.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-common</artifactId>
+ <version>${sdnctl.sli.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ <version>${sdnctl.sli.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>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..c3dd110a
--- /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 ONAP 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..2f472496
--- /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 ONAP 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..5db3eff6
--- /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 ONAP 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.onap.ccsdk.sli.core.sli.SvcLogicException;
+import org.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
+import org.onap.ccsdk.sli.core.sli.provider.SvcLogicService;
+import org.opendaylight.yang.gen.v1.org.openecomp.sdnc.datachange.rev150519.DataChangeNotificationOutputBuilder;
+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..791da5c0
--- /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 ONAP 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.onap.ccsdk.sli.core.sli.provider.MdsalHelper;
+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.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..2812ca4d
--- /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 ONAP 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/dmaap-listener/.gitignore b/dmaap-listener/.gitignore
new file mode 100755
index 00000000..1b8a6ba9
--- /dev/null
+++ b/dmaap-listener/.gitignore
@@ -0,0 +1,12 @@
+org.eclipse.core.resources.prefs
+.classpath
+.project
+.settings
+.idea
+.externalToolBuilders
+maven-eclipse.xml
+*.class
+target/
+MANIFEST.MF
+.DS_STORE
+.metadata
diff --git a/dmaap-listener/.sonar/checkstyle.xml b/dmaap-listener/.sonar/checkstyle.xml
new file mode 100755
index 00000000..3fa23153
--- /dev/null
+++ b/dmaap-listener/.sonar/checkstyle.xml
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.2//EN" "http://www.puppycrawl.com/dtds/configuration_1_2.dtd"><!-- Generated by Sonar --><module name="Checker"><module name="SuppressionCommentFilter"/><module name="TreeWalker"><module name="FileContentsHolder"/> <module name="ClassFanOutComplexity"><property name="severity" value="warning"/></module><module name="NestedForDepth"><property name="severity" value="warning"/><property name="max" value="1"/></module><module name="ClassDataAbstractionCoupling"><property name="severity" value="warning"/></module></module></module> \ No newline at end of file
diff --git a/dmaap-listener/.sonar/pmd.xml b/dmaap-listener/.sonar/pmd.xml
new file mode 100755
index 00000000..80343b3b
--- /dev/null
+++ b/dmaap-listener/.sonar/pmd.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ruleset>
+ <rule ref="rulesets/java/naming.xml/BooleanGetMethodName">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/j2ee.xml/StaticEJBFieldShouldBeFinal">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/coupling.xml/CouplingBetweenObjects">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/codesize.xml/TooManyMethods">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/naming.xml/AvoidFieldNameMatchingTypeName">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/basic.xml/DoubleCheckedLocking">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/naming.xml/AvoidFieldNameMatchingMethodName">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/coupling.xml/ExcessiveImports">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/basic.xml/OverrideBothEqualsAndHashcode">
+ <priority>2</priority>
+ </rule>
+ <rule ref="rulesets/java/naming.xml/ShortMethodName">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/basic.xml/BooleanInstantiation">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/codesize.xml/TooManyFields">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/controversial.xml/AvoidUsingNativeCode">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/optimizations.xml/UseStringBufferForStringAppends">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/coupling.xml/LooseCoupling">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/design.xml/NonThreadSafeSingleton">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/j2ee.xml/DoNotUseThreads">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/sunsecure.xml/ArrayIsStoredDirectly">
+ <priority>5</priority>
+ </rule>
+ <rule ref="rulesets/java/sunsecure.xml/MethodReturnsInternalArray">
+ <priority>2</priority>
+ </rule>
+ <rule ref="rulesets/java/design.xml/AssignmentToNonFinalStatic">
+ <priority>3</priority>
+ </rule>
+ <rule ref="rulesets/java/strictexception.xml/AvoidCatchingGenericException">
+ <priority>3</priority>
+ </rule>
+</ruleset>
+
diff --git a/dmaap-listener/pom.xml b/dmaap-listener/pom.xml
new file mode 100755
index 00000000..9ab23cde
--- /dev/null
+++ b/dmaap-listener/pom.xml
@@ -0,0 +1,115 @@
+<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.onap.ccsdk.sli.northbound</groupId>
+ <packaging>jar</packaging>
+ <artifactId>dmaap-listener</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <name>DMAAP Listener</name>
+ <description>DMAAP Listener</description>
+ <parent>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>sdnc-northbound</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <properties>
+ <sdc.client.version>1.1.7-SNAPSHOT</sdc.client.version>
+ <fasterxml.jackson.version>2.9.0.pr1</fasterxml.jackson.version>
+ <skip.SWM>true</skip.SWM>
+ <dmaap.listener.base>/opt/app/dmaap-listener</dmaap.listener.base>
+ <dmaap.listener.version>0.2.12</dmaap.listener.version>
+ <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>com.att.nsa</groupId>
+ <artifactId>dmaapClient</artifactId>
+ <version>${dmaap.listener.version}</version>
+ </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>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>${fasterxml.jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>${fasterxml.jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>dblib-provider</artifactId>
+ <version>${sdnctl.dblib.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>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>create-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <attach>true</attach>
+ <finalName>${project.artifactId}.${project.version}</finalName>
+ <attach>true</attach>
+ <descriptors>
+ <descriptor>src/assembly/assemble_zip.xml</descriptor>
+ </descriptors>
+ <appendAssemblyId>false</appendAssemblyId>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+</project>
diff --git a/dmaap-listener/src/assembly/assemble_zip.xml b/dmaap-listener/src/assembly/assemble_zip.xml
new file mode 100644
index 00000000..15f6bf4d
--- /dev/null
+++ b/dmaap-listener/src/assembly/assemble_zip.xml
@@ -0,0 +1,61 @@
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : SDN-C
+ ================================================================================
+ Copyright (C) 2017 ONAP Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+ http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>assemble_zip</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>src/main/scripts</directory>
+ <outputDirectory>bin</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>lib</outputDirectory>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src/main/resources</directory>
+ <outputDirectory>lib</outputDirectory>
+ <includes>
+ <include>*.properties</include>
+ <include>*.map</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>lib</outputDirectory>
+ <useProjectArtifact>true</useProjectArtifact>
+ <scope>runtime</scope>
+ </dependencySet>
+ </dependencySets>
+</assembly>
diff --git a/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DmaapListener.java b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DmaapListener.java
new file mode 100644
index 00000000..7096d83b
--- /dev/null
+++ b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DmaapListener.java
@@ -0,0 +1,165 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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.dmaapclient;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DmaapListener {
+
+ private static final String DMAAP_LISTENER_PROPERTIES = "dmaap-listener.properties";
+ private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR";
+ private static final Logger LOG = LoggerFactory
+ .getLogger(DmaapListener.class);
+
+ public static void main(String[] args) {
+
+ Properties properties = new Properties();
+
+
+ String propFileName = DMAAP_LISTENER_PROPERTIES;
+
+ if (args.length > 0) {
+ propFileName = args[0];
+ }
+
+ String propPath = null;
+ String propDir = System.getenv(SDNC_CONFIG_DIR);
+
+ List<SdncDmaapConsumer> consumers = new LinkedList();
+
+ if (propDir == null) {
+
+ propDir = "/opt/sdnc/data/properties";
+ }
+
+ if (!propFileName.startsWith("/")) {
+ propPath = propDir + "/" + propFileName;
+ }
+
+ File propFile = new File(propPath);
+
+ if (!propFile.canRead()) {
+ LOG.error("Cannot read properties file "+propPath);
+ System.exit(1);
+ }
+
+ try {
+ properties.load(new FileInputStream(propFile));
+ } catch (Exception e) {
+ LOG.error("Caught exception loading properties from "+propPath, e);
+ System.exit(1);
+ }
+
+ String subscriptionStr = properties.getProperty("subscriptions");
+
+ boolean threadsRunning = false;
+
+ LOG.debug("Dmaap subscriptions : "+subscriptionStr);
+
+ if (subscriptionStr != null) {
+ String[] subscriptions = subscriptionStr.split(";");
+
+ for (int i = 0; i < subscriptions.length; i++) {
+ String[] subscription = subscriptions[i].split(":");
+ String consumerClassName = subscription[0];
+ String propertyPath = subscription[1];
+
+ LOG.debug("Handling subscription [" + consumerClassName + "," + propertyPath + "]");
+
+ if (propertyPath == null) {
+ LOG.error("Invalid subscription (" + subscriptions[i] + ") property file missing");
+ continue;
+ }
+
+ if (!propertyPath.startsWith("/")) {
+ propertyPath = propDir + "/" + propertyPath;
+ }
+
+ Class<?> consumerClass = null;
+
+ try {
+ consumerClass = Class.forName(consumerClassName);
+ } catch (Exception e) {
+ LOG.error("Could not find DMaap consumer class " + consumerClassName);
+ }
+
+ if (consumerClass != null) {
+
+ SdncDmaapConsumer consumer = null;
+
+ try {
+ consumer = (SdncDmaapConsumer) consumerClass.newInstance();
+ } catch (Exception e) {
+ LOG.error("Could not create consumer from class " + consumerClassName, e);
+ }
+
+ if (consumer != null) {
+ LOG.debug("Initializing consumer " + consumerClassName + "(" + propertyPath + ")");
+ consumer.init(properties, propertyPath);
+
+ if (consumer.isReady()) {
+ Thread consumerThread = new Thread(consumer);
+ consumerThread.start();
+ consumers.add(consumer);
+ threadsRunning = true;
+ LOG.info("Started consumer thread (" + consumerClassName + " : " + propertyPath + ")");
+ } else {
+ LOG.debug("Consumer " + consumerClassName + " is not ready");
+ }
+ }
+
+ }
+
+ }
+ }
+
+ while (threadsRunning) {
+
+ threadsRunning = false;
+ for (SdncDmaapConsumer consumer : consumers) {
+ if (consumer.isRunning()) {
+ threadsRunning = true;
+ }
+ }
+
+ if (!threadsRunning) {
+ break;
+ }
+
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+
+ }
+ }
+
+ LOG.info("No listener threads running - exitting");
+
+ }
+}
diff --git a/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DummyDmaapConsumer.java b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DummyDmaapConsumer.java
new file mode 100644
index 00000000..5edc1c90
--- /dev/null
+++ b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/DummyDmaapConsumer.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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.dmaapclient;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class DummyDmaapConsumer extends SdncDmaapConsumer {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(DummyDmaapConsumer.class);
+
+ @Override
+ public void processMsg(String msg) {
+ LOG.info("Consumed message: \n"+msg);
+ }
+
+}
diff --git a/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/InvalidMessageException.java b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/InvalidMessageException.java
new file mode 100644
index 00000000..3de5df6c
--- /dev/null
+++ b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/InvalidMessageException.java
@@ -0,0 +1,37 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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.dmaapclient;
+
+public class InvalidMessageException extends Exception {
+
+ public InvalidMessageException() {
+ super();
+ }
+
+ public InvalidMessageException(String msg) {
+ super(msg);
+ }
+
+ public InvalidMessageException(String msg, Throwable t) {
+ super(msg, t);
+ }
+}
diff --git a/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncDmaapConsumer.java b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncDmaapConsumer.java
new file mode 100644
index 00000000..5b55bda5
--- /dev/null
+++ b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncDmaapConsumer.java
@@ -0,0 +1,146 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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.dmaapclient;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Properties;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.att.nsa.mr.client.MRClientFactory;
+import com.att.nsa.mr.client.MRConsumer;
+import com.att.nsa.mr.client.response.MRConsumerResponse;
+
+public abstract class SdncDmaapConsumer implements Runnable {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(SdncDmaapConsumer.class);
+
+ private String propertiesPath = "";
+ private Properties properties = null;
+ MRConsumer consumer = null;
+ MRConsumerResponse consumerResponse = null;
+ boolean running = false;
+ boolean ready = false;
+ int fetchPause = 5000; // Default pause between fetchs - 5 seconds
+
+ public boolean isReady() {
+ return ready;
+ }
+
+ int timeout = 15000; // Default timeout - 15 seconds
+
+ public boolean isRunning() {
+ return running;
+ }
+
+ public SdncDmaapConsumer() {
+
+ }
+
+ public SdncDmaapConsumer(Properties properties, String propertiesPath) {
+ init(properties, propertiesPath);
+ }
+
+ public String getProperty(String name) {
+ return(properties.getProperty(name, ""));
+ }
+
+ public void init(Properties properties, String propertiesPath) {
+
+ this.propertiesPath = propertiesPath;
+
+ try {
+
+ this.properties = (Properties) properties.clone();
+
+ this.properties.load(new FileInputStream(new File(propertiesPath)));
+
+ String timeoutStr = properties.getProperty("timeout");
+
+ if ((timeoutStr != null) && (timeoutStr.length() > 0)) {
+ try {
+ timeout = Integer.parseInt(timeoutStr);
+ } catch (NumberFormatException e) {
+ LOG.error("Non-numeric value specified for timeout ("+timeoutStr+")");
+ }
+ }
+
+ String fetchPauseStr = properties.getProperty("fetchPause");
+ if ((fetchPauseStr != null) && (fetchPauseStr.length() > 0)) {
+ try {
+ fetchPause = Integer.parseInt(fetchPauseStr);
+ } catch (NumberFormatException e) {
+ LOG.error("Non-numeric valud specified for fetchPause ("+fetchPauseStr+")");
+ }
+ }
+
+ this.consumer = MRClientFactory.createConsumer(propertiesPath);
+ ready = true;
+ } catch (Exception e) {
+ LOG.error("Error initializing DMaaP consumer from file "+propertiesPath, e);
+ }
+ }
+
+
+ @Override
+ public void run() {
+ if (ready) {
+
+ running = true;
+
+ while (running) {
+
+ try {
+ boolean noData = true;
+ consumerResponse = consumer.fetchWithReturnConsumerResponse(timeout, -1);
+ for (String msg : consumerResponse.getActualMessages()) {
+ noData = false;
+ LOG.info("Received message from DMaaP:\n"+msg);
+ processMsg(msg);
+ }
+
+ if (noData) {
+ if (fetchPause > 0) {
+
+ LOG.info("No data received from fetch. Pausing "+fetchPause+" ms before retry");
+ Thread.sleep(fetchPause);
+ } else {
+
+ LOG.info("No data received from fetch. No fetch pause specified - retrying immediately");
+ }
+ }
+ } catch (Exception e) {
+ LOG.error("Caught exception reading from DMaaP", e);
+ running = false;
+ }
+
+
+ }
+ }
+
+ }
+
+ abstract public void processMsg(String msg) throws InvalidMessageException;
+}
diff --git a/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncFlatJsonDmaapConsumer.java b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncFlatJsonDmaapConsumer.java
new file mode 100644
index 00000000..7e9c069a
--- /dev/null
+++ b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncFlatJsonDmaapConsumer.java
@@ -0,0 +1,196 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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.dmaapclient;
+
+import java.io.BufferedReader;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileReader;
+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.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLSession;
+
+import org.apache.commons.codec.binary.Base64;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+
+
+public class SdncFlatJsonDmaapConsumer extends SdncDmaapConsumer {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(SdncFlatJsonDmaapConsumer.class);
+
+ private static final String DMAAPLISTENERROOT = "DMAAPLISTENERROOT";
+ private static final String SDNC_ENDPOINT = "SDNC.endpoint";
+
+
+
+ @Override
+ public void processMsg(String msg) throws InvalidMessageException {
+
+ processMsg(msg, null);
+ }
+
+ public void processMsg(String msg, String mapDirName) throws InvalidMessageException {
+
+ if (msg == null) {
+ throw new InvalidMessageException("Null message");
+ }
+
+ ObjectMapper oMapper = new ObjectMapper();
+ JsonNode instarRootNode = null;
+ ObjectNode sdncRootNode = null;
+
+ String instarMsgName = null;
+
+ try {
+ instarRootNode = oMapper.readTree(msg);
+ } catch (Exception e) {
+ throw new InvalidMessageException("Cannot parse json object", e);
+ }
+
+ Iterator<Map.Entry<String, JsonNode>> instarFields = instarRootNode.fields();
+
+ while (instarFields.hasNext()) {
+ Map.Entry<String, JsonNode> entry = instarFields.next();
+
+ instarMsgName = entry.getKey();
+ instarRootNode = entry.getValue();
+ break;
+ }
+
+ Map<String,String> fieldMap = loadMap(instarMsgName, mapDirName);
+
+ if (fieldMap == null) {
+ throw new InvalidMessageException("Unable to process message - cannot load field mappings");
+ }
+
+ if (!fieldMap.containsKey(SDNC_ENDPOINT)) {
+ throw new InvalidMessageException("No SDNC endpoint known for message "+instarMsgName);
+ }
+
+ String sdncEndpoint = fieldMap.get(SDNC_ENDPOINT);
+
+ sdncRootNode = oMapper.createObjectNode();
+ ObjectNode inputNode = oMapper.createObjectNode();
+
+
+ for (String fromField : fieldMap.keySet()) {
+
+ if (!SDNC_ENDPOINT.equals(fromField)) {
+ JsonNode curNode = instarRootNode.get(fromField);
+ if (curNode != null) {
+ String fromValue = curNode.textValue();
+
+ inputNode.put(fieldMap.get(fromField), fromValue);
+ }
+ }
+ }
+ sdncRootNode.put("input", inputNode);
+
+ try {
+ String rpcMsgbody = oMapper.writeValueAsString(sdncRootNode);
+ String odlUrlBase = getProperty("sdnc.odl.url-base");
+ String odlUser = getProperty("sdnc.odl.user");
+ String odlPassword = getProperty("sdnc.odl.password");
+
+ if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) {
+ SdncOdlConnection conn = SdncOdlConnection.newInstance(odlUrlBase + sdncEndpoint, odlUser, odlPassword);
+
+ conn.send("POST", "application/json", rpcMsgbody);
+ } else {
+ LOG.info("POST message body would be:\n"+rpcMsgbody);
+ }
+ } catch (Exception e) {
+
+ }
+
+ }
+
+ private Map<String,String> loadMap(String msgType, String mapDirName) {
+ Map<String, String> results = new HashMap<String, String>();
+
+
+ if (mapDirName == null) {
+ String rootdir = System.getenv(DMAAPLISTENERROOT);
+
+ if ((rootdir == null) || (rootdir.length() == 0)) {
+ rootdir = "/opt/app/dmaap-listener";
+ }
+
+ mapDirName = rootdir + "/lib";
+
+ }
+
+ String mapFilename = mapDirName + "/" + msgType + ".map";
+
+ File mapFile = new File(mapFilename);
+
+ if (!mapFile.canRead()) {
+ LOG.error("Cannot read map file ("+mapFilename+")");
+ return(null);
+ }
+
+ try {
+ BufferedReader mapReader = new BufferedReader(new FileReader(mapFile));
+
+ String curLine = null;
+
+ while ((curLine = mapReader.readLine()) != null) {
+ curLine = curLine.trim();
+
+ if ((curLine.length() > 0) && (!curLine.startsWith("#"))) {
+
+ if (curLine.contains("=>")) {
+ String[] entry = curLine.split("=>");
+ if (entry.length == 2) {
+ results.put(entry[0].trim(), entry[1].trim());
+ }
+ }
+ }
+ }
+ mapReader.close();
+ } catch (Exception e) {
+ LOG.error("Caught exception reading map "+mapFilename, e);
+ return(null);
+ }
+
+ return(results);
+ }
+
+
+
+}
diff --git a/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncOdlConnection.java b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncOdlConnection.java
new file mode 100644
index 00000000..6c6f308f
--- /dev/null
+++ b/dmaap-listener/src/main/java/org/openecomp/sdnc/dmaapclient/SdncOdlConnection.java
@@ -0,0 +1,159 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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.dmaapclient;
+
+import java.io.BufferedReader;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.Authenticator;
+import java.net.HttpURLConnection;
+import java.net.PasswordAuthentication;
+import java.net.ProtocolException;
+import java.net.URL;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLSession;
+
+import org.apache.commons.codec.binary.Base64;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class SdncOdlConnection {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(SdncOdlConnection.class);
+
+ private HttpURLConnection httpConn = null;
+
+ private String url = null;
+ private String user = null;
+ private String password = null;
+
+ private class SdncAuthenticator extends Authenticator {
+
+ private String user;
+ private String passwd;
+
+ SdncAuthenticator(String user, String passwd) {
+ this.user = user;
+ this.passwd = passwd;
+ }
+ @Override
+ protected PasswordAuthentication getPasswordAuthentication() {
+ return new PasswordAuthentication(user, passwd.toCharArray());
+ }
+
+ }
+
+ private SdncOdlConnection() {
+
+ }
+
+ private SdncOdlConnection(String url, String user, String password) {
+ this.url = url;
+ this.user = user;
+ this.password = password;
+
+ try {
+ URL sdncUrl = new URL(url);
+ Authenticator.setDefault(new SdncAuthenticator(user, password));
+
+ this.httpConn = (HttpURLConnection) sdncUrl.openConnection();
+ } catch (Exception e) {
+ LOG.error("Unable to create http connection", e);
+ }
+ }
+
+ public static SdncOdlConnection newInstance(String url, String user, String password) throws IOException
+ {
+ return (new SdncOdlConnection(url, user, password));
+ }
+
+
+
+ public String send(String method, String contentType, String msg) throws IOException {
+
+ LOG.info("Sending REST " + method + " to " + url);
+ LOG.info("Message body:\n" + msg);
+ String authStr = user + ":" + password;
+ String encodedAuthStr = new String(Base64.encodeBase64(authStr.getBytes()));
+
+ httpConn.addRequestProperty("Authentication", "Basic " + encodedAuthStr);
+
+ httpConn.setRequestMethod(method);
+ httpConn.setRequestProperty("Content-Type", contentType);
+ httpConn.setRequestProperty("Accept", contentType);
+
+ httpConn.setDoInput(true);
+ httpConn.setDoOutput(true);
+ httpConn.setUseCaches(false);
+
+ if (httpConn instanceof HttpsURLConnection) {
+ HostnameVerifier hostnameVerifier = new HostnameVerifier() {
+ @Override
+ public boolean verify(String hostname, SSLSession session) {
+ return true;
+ }
+ };
+ ((HttpsURLConnection) httpConn).setHostnameVerifier(hostnameVerifier);
+ }
+
+ // Write message
+ httpConn.setRequestProperty("Content-Length", "" + msg.length());
+ DataOutputStream outStr = new DataOutputStream(httpConn.getOutputStream());
+ outStr.write(msg.getBytes());
+ outStr.close();
+
+ // Read response
+ BufferedReader respRdr;
+
+ LOG.info("Response: " + httpConn.getResponseCode() + " " + httpConn.getResponseMessage());
+
+ if (httpConn.getResponseCode() < 300) {
+
+ respRdr = new BufferedReader(new InputStreamReader(httpConn.getInputStream()));
+ } else {
+ respRdr = new BufferedReader(new InputStreamReader(httpConn.getErrorStream()));
+ }
+
+ 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);
+
+ return (respString);
+
+ }
+
+
+}
diff --git a/dmaap-listener/src/main/resources/edgeRouterStatusChange.map b/dmaap-listener/src/main/resources/edgeRouterStatusChange.map
new file mode 100644
index 00000000..57644bbd
--- /dev/null
+++ b/dmaap-listener/src/main/resources/edgeRouterStatusChange.map
@@ -0,0 +1,23 @@
+# SDN-C URL
+SDNC.endpoint => FLOWRED-API:process-edge-router-status-change
+
+# Field mapping
+equip_id => equip_id
+ptnii_equip_name => equip-name
+equip_type.equip_type => equip-type
+ip_addr => loopback0
+router_prov_status => prov-status
+country.region => region
+country_abbr => country
+equip_name_code => equip-name-code
+as_number => as-number
+loopback1 => loopback1
+loopback2 => loopback2
+loopback3 => loopback3
+loopback40 => loopback40
+loopback65535 => loopback65535
+inms_list => inms-list
+encrypted_access_flag => encrypted-access-flag
+sw_name => sw-name
+nmipaddr => nm-addr
+function_code => function-code \ No newline at end of file
diff --git a/dmaap-listener/src/main/resources/log4j.properties b/dmaap-listener/src/main/resources/log4j.properties
new file mode 100644
index 00000000..ba815871
--- /dev/null
+++ b/dmaap-listener/src/main/resources/log4j.properties
@@ -0,0 +1,37 @@
+###
+# ============LICENSE_START=======================================================
+# openECOMP : SDN-C
+# ================================================================================
+# Copyright (C) 2017 ONAP Intellectual Property. All rights
+# reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+log4j.rootLogger=DEBUG,CONSOLE,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/dmaap-listener/logs/dmaap-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/dmaap-listener/src/main/resources/preferredRoute.txt b/dmaap-listener/src/main/resources/preferredRoute.txt
new file mode 100644
index 00000000..662b0aa7
--- /dev/null
+++ b/dmaap-listener/src/main/resources/preferredRoute.txt
@@ -0,0 +1 @@
+preferredRouteKey=MR1 \ No newline at end of file
diff --git a/dmaap-listener/src/main/scripts/start-dmaap-listener.sh b/dmaap-listener/src/main/scripts/start-dmaap-listener.sh
new file mode 100644
index 00000000..5eeb62bb
--- /dev/null
+++ b/dmaap-listener/src/main/scripts/start-dmaap-listener.sh
@@ -0,0 +1,69 @@
+#!/bin/bash
+
+###
+# ============LICENSE_START=======================================================
+# openECOMP : SDN-C
+# ================================================================================
+# Copyright (C) 2017 ONAP Intellectual Property. All rights
+# reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+PROPERTY_DIR=${PROPERTY_DIR:-/opt/sdnc/data/properties}
+
+LISTENER=dmaap-listener
+
+
+
+PIDFILE=/tmp/.${LISTENER}-pid
+UEBLISTENERROOT=${UEBLISTENERROOT:-/opt/app/dmaap-listener}
+JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-oracle}
+JAVA_OPTS=${JAVA_OPTS:--Dhttps.protocols=TLSv1.1,TLSv1.2}
+JAVA=${JAVA:-${JAVA_HOME}/bin/java}
+
+# Redirect output from script to $LISTENER.out
+exec >> ${UEBLISTENERROOT}/logs/$LISTENER.out
+exec 2>&1
+
+if [ -f $PIDFILE ]
+then
+ pid=$(cat $PIDFILE)
+ if [ "$pid" != "" ]
+ then
+ if kill -0 $pid
+ then
+ echo "$LISTENER already running"
+ exit 0
+ fi
+ fi
+fi
+
+if [ ! -d ${UEBLISTENERROOT}/logs ]
+then
+ mkdir ${UEBLISTENERROOT}/logs
+fi
+
+for file in ${UEBLISTENERROOT}/lib/*.jar
+do
+ LISTENERCLASSPATH=$LISTENERCLASSPATH:$file
+done
+
+${JAVA} ${JAVA_OPTS} -Dlog4j.configuration=file:${UEBLISTENERROOT}/lib/log4j.properties -cp ${LISTENERCLASSPATH} com.att.sdnctl.dmaapclient.DmaapListener &
+
+
+echo $! > $PIDFILE
+
+echo "$LISTENER started!"
+exit 0
diff --git a/dmaap-listener/src/main/scripts/stop-dmaap-listener.sh b/dmaap-listener/src/main/scripts/stop-dmaap-listener.sh
new file mode 100644
index 00000000..42de474f
--- /dev/null
+++ b/dmaap-listener/src/main/scripts/stop-dmaap-listener.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+###
+# ============LICENSE_START=======================================================
+# openECOMP : SDN-C
+# ================================================================================
+# Copyright (C) 2017 ONAP Intellectual Property. All rights
+# reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+PROPERTY_DIR=${PROPERTY_DIR:-/opt/sdnc/data/properties}
+
+LISTENER=dmaap-listener
+
+
+PIDFILE=/tmp/.${LISTENER}-pid
+UEBLISTENERROOT=${UEBLISTENERROOT:-/opt/app/dmaap-listener}
+
+if [ -f $PIDFILE ]
+then
+ pid=$(cat $PIDFILE)
+ if [ "$pid" != "" ]
+ then
+ if kill -0 $pid
+ then
+ echo "Stopping $LISTENER"
+ kill $pid && rm $PIDFILE
+ exit 0
+ else
+ echo "$LISTENER not running"
+ exit 1
+ fi
+ else
+ echo "$LISTENER not running"
+ exit 1
+ fi
+fi
+
+
diff --git a/dmaap-listener/src/site/apt/index.apt b/dmaap-listener/src/site/apt/index.apt
new file mode 100644
index 00000000..dd9d3ec3
--- /dev/null
+++ b/dmaap-listener/src/site/apt/index.apt
@@ -0,0 +1,46 @@
+~~~
+~~ ============LICENSE_START=======================================================
+~~ openECOMP : SDN-C
+~~ ================================================================================
+~~ Copyright (C) 2017 ONAP 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/dmaap-listener/src/site/site.xml b/dmaap-listener/src/site/site.xml
new file mode 100644
index 00000000..356c9c95
--- /dev/null
+++ b/dmaap-listener/src/site/site.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : SDN-C
+ ================================================================================
+ Copyright (C) 2017 ONAP 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/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..4d2bb209
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,119 @@
+<?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.onap.ccsdk.parent</groupId>
+ <artifactId>odlparent-boron-sr3</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>pom</packaging>
+ <groupId>org.onap.ccsdk.sli.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>
+ <profiles>
+ <profile>
+ <id>blackduck</id>
+ <activation>
+ <property>
+ <name>blackduck-scan</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <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>
+
+ </profile>
+
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.17</version>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>nexus-staging-maven-plugin</artifactId>
+ <version>1.6.7</version>
+ <extensions>true</extensions>
+ <configuration>
+ <nexusUrl>https://${openecomp.nexus.host}</nexusUrl>
+ <stagingProfileId>${openecomp.nexus.staging.profile-id}</stagingProfileId>
+ <serverId>${openecomp.nexus.staging.server-id}</serverId>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </build>
+ <modules>
+ <module>asdcApi</module>
+ <module>dataChange</module>
+ <module>dmaap-listener</module>
+ <module>ueb-listener</module>
+ </modules>
+ <organization>
+ <name>AT&amp;T</name>
+ </organization>
+ <version>0.0.1-SNAPSHOT</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..e0b96aaf
--- /dev/null
+++ b/ueb-listener/pom.xml
@@ -0,0 +1,128 @@
+<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.onap.ccsdk.sli.northbound</groupId>
+ <packaging>jar</packaging>
+ <artifactId>ueb-listener</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <name>UEB Listener</name>
+ <description>UEB Listener</description>
+ <parent>
+ <groupId>org.onap.ccsdk.sli.northbound</groupId>
+ <artifactId>sdnc-northbound</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <properties>
+ <sdc.client.version>1.1.7-SNAPSHOT</sdc.client.version>
+ <fasterxml.jackson.version>2.9.0.pr1</fasterxml.jackson.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.sdc-distribution-client</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>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>${fasterxml.jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>${fasterxml.jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.ccsdk.sli.core</groupId>
+ <artifactId>dblib-provider</artifactId>
+ <version>${sdnctl.dblib.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>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>create-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <attach>true</attach>
+ <finalName>${project.artifactId}.${project.version}</finalName>
+ <attach>true</attach>
+ <descriptors>
+ <descriptor>src/assembly/assemble_zip.xml</descriptor>
+ </descriptors>
+ <appendAssemblyId>false</appendAssemblyId>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+</project>
diff --git a/ueb-listener/src/assembly/assemble_zip.xml b/ueb-listener/src/assembly/assemble_zip.xml
new file mode 100644
index 00000000..d1f6679e
--- /dev/null
+++ b/ueb-listener/src/assembly/assemble_zip.xml
@@ -0,0 +1,63 @@
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : SDN-C
+ ================================================================================
+ Copyright (C) 2017 ONAP Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <id>assemble_zip</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>src/main/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>
+ <include>*.properties</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/SdncARModel.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncARModel.java
new file mode 100644
index 00000000..3472b443
--- /dev/null
+++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncARModel.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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.tosca.parser.api.ISdcCsarHelper;
+import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames;
+import org.openecomp.sdc.toscaparser.api.Metadata;
+import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SdncARModel extends SdncBaseModel {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(SdncARModel.class);
+
+ public SdncARModel(ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate) {
+
+ super(sdcCsarHelper, nodeTemplate);
+
+ // extract metadata
+ Metadata metadata = nodeTemplate.getMetadata();
+ addParameter("type", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_TYPE));
+
+ // extract properties
+ //addParameter("role", extractValue (sdcCsarHelper, nodeTemplate, SdcPropertyNames.PROPERTY_NAME_ROLE));
+ //addParameter("type", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_TYPE)); - wrong location, get from metadata
+ addParameter("ecomp_generated_naming", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VFCNAMING_ECOMPGENERATEDNAMING));
+ addParameter("naming_policy", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VFCNAMING_NAMINGPOLICY));
+ //addParameter("depending_service", extractValue (sdcCsarHelper, nodeTemplate, SdcPropertyNames.PROPERTY_NAME_DEPENDINGSERVICE));
+ //addParameter("service_dependency", extractValue (sdcCsarHelper, nodeTemplate, SdcPropertyNames.PROPERTY_NAME_SERVICEDEPENDENCY));
+ }
+
+}
diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncArtifactMap.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncArtifactMap.java
new file mode 100644
index 00000000..4a9f02a8
--- /dev/null
+++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncArtifactMap.java
@@ -0,0 +1,134 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SdncArtifactMap {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(SdncArtifactMap.class);
+
+ public class SdncArtifactType {
+ private String tag;
+ private String artifactType;
+ private String rpc;
+ private int pass;
+
+ public String getTag() {
+ return tag;
+ }
+ public String getArtifactType() {
+ return artifactType;
+ }
+ public String getRpc() {
+ return rpc;
+ }
+
+ public int getPass() {
+ return pass;
+ }
+
+ public String getRpcUrl(String base) {
+ return(base+rpc);
+ }
+
+ private SdncArtifactType(String tag, String rpc, String pass) {
+ this.tag = tag;
+ this.rpc = rpc;
+ try {
+ this.pass = Integer.parseInt(pass);
+ } catch (Exception e) {
+ LOG.error("Invalid pass value for artifact map entry ("+tag+","+rpc+","+pass+")");
+ }
+ }
+ }
+
+
+
+ private Map<String, SdncArtifactType> mapItems = new HashMap<String, SdncArtifactType>();
+
+ private int NumPasses = 1;
+
+ public int getNumPasses() {
+ return NumPasses;
+ }
+
+ public void load(String fileName) {
+
+ File mapFile = new File(fileName);
+
+ if (mapFile.exists() && mapFile.canRead()) {
+
+ BufferedReader rdr = null;
+ try {
+
+ rdr = new BufferedReader(new FileReader(mapFile));
+
+ for (String ln ; (ln = rdr.readLine()) != null ; ) {
+ String[] lnFields = ln.split(",");
+ if (lnFields.length == 3) {
+ SdncArtifactType entry = new SdncArtifactType(lnFields[0], lnFields[1], lnFields[2]);
+ mapItems.put(entry.getTag(), entry);
+ if (entry.getPass() + 1 > NumPasses ) {
+ NumPasses = entry.getPass() + 1;
+ }
+ }
+ }
+
+
+ } catch (Exception e) {
+ LOG.error("Caught exception reading artifact map", e);
+ return;
+ } finally {
+ if (rdr != null) {
+ try {
+ rdr.close();
+ } catch (IOException e) {
+
+ }
+ }
+ }
+ }
+ }
+
+ public SdncArtifactType getMapping(String tag) {
+ if (mapItems.containsKey(tag)) {
+ return(mapItems.get(tag));
+ } else {
+ return(null);
+ }
+ }
+
+ public static SdncArtifactMap getInstance() {
+ return new SdncArtifactMap();
+ }
+
+}
diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncBaseModel.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncBaseModel.java
new file mode 100644
index 00000000..39c50aed
--- /dev/null
+++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncBaseModel.java
@@ -0,0 +1,297 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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.util.HashMap;
+import java.util.Map;
+
+import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
+import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames;
+import org.openecomp.sdc.toscaparser.api.Group;
+import org.openecomp.sdc.toscaparser.api.Metadata;
+import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SdncBaseModel {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(SdncBaseModel.class);
+
+ protected String customizationUUID = null;
+ protected String invariantUUID = null;
+ protected String model_yaml = null;
+ protected String version = null;
+
+ protected Map<String, String> params = null;
+ protected ISdcCsarHelper sdcCsarHelper = null;
+
+ public SdncBaseModel() {
+
+ }
+
+ public SdncBaseModel(ISdcCsarHelper sdcCsarHelper, Metadata metadata) {
+
+ params = new HashMap<String, String>();
+ this.sdcCsarHelper = sdcCsarHelper;
+
+ // extract service metadata
+ invariantUUID = extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID);
+ addParameter("invariant_uuid",invariantUUID);
+ addParameter("version",extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_VERSION));
+ addParameter("name",extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_NAME));
+ addParameter("description",extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ addParameter("type",extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_TYPE));
+ addParameter("category",extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_CATEGORY));
+ }
+
+ public SdncBaseModel(ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate) {
+
+ params = new HashMap<String, String>();
+ this.sdcCsarHelper = sdcCsarHelper;
+
+ // extract nodeTemplate metadata
+ Metadata metadata = nodeTemplate.getMetadata();
+ customizationUUID = extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
+ addParameter("invariant_uuid", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ addParameter("uuid", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_UUID));
+ addParameter("version", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VERSION));
+ }
+
+ public SdncBaseModel(ISdcCsarHelper sdcCsarHelper, Group group) {
+
+ params = new HashMap<String, String>();
+ this.sdcCsarHelper = sdcCsarHelper;
+
+ // extract group metadata
+ Metadata metadata = group.getMetadata();
+ //customizationUUID = extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULECUSTOMIZATIONUUID); - returning null
+ customizationUUID = extractValue (metadata, "vfModuleModelCustomizationUUID");
+ addParameter("invariant_uuid", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID));
+ addParameter("uuid", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID));
+ addParameter("version", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION));
+ }
+
+ protected void addParameter (String name, String value) {
+ if (value != null && !value.isEmpty()) {
+ params.put(name, "\"" + value + "\"");
+ }
+ }
+
+ protected void addIntParameter (String name, String value) {
+ if (value != null && !value.isEmpty()) {
+ params.put(name, value);
+ }
+ }
+
+ public static void addIntParameter (String name, String value, Map<String, String> params) {
+ if (value != null && !value.isEmpty()) {
+ params.put(name, value);
+ }
+ }
+
+ public static void addParameter (String name, String value, Map<String, String> params) {
+ if (value != null && !value.isEmpty()) {
+ params.put(name, "\"" + value + "\"");
+ }
+ }
+
+ protected String extractValue (Metadata metadata, String name) {
+ String value = sdcCsarHelper.getMetadataPropertyValue(metadata, name);
+ if (value != null) {
+ return value;
+ } else {
+ return "";
+ }
+ }
+
+ public static String extractValue (ISdcCsarHelper sdcCsarHelper, Metadata metadata, String name) {
+ String value = sdcCsarHelper.getMetadataPropertyValue(metadata, name);
+ if (value != null) {
+ return value;
+ } else {
+ return "";
+ }
+ }
+
+ protected String extractValue (NodeTemplate nodeTemplate, String name) {
+ String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, name);
+ if (value != null) {
+ return value;
+ } else {
+ return "";
+ }
+ }
+
+ public static String extractValue (ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate, String name) {
+ String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, name);
+ if (value != null) {
+ return value;
+ } else {
+ return "";
+ }
+ }
+
+ protected String extractBooleanValue (NodeTemplate nodeTemplate, String name) {
+ String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, name);
+ if (value != null && !value.isEmpty()) {
+ return value.contains("true") ? "Y" : "N";
+ } else {
+ return "";
+ }
+ }
+
+ public static String extractBooleanValue (ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate, String name) {
+ String value = sdcCsarHelper.getNodeTemplatePropertyLeafValue(nodeTemplate, name);
+ if (value != null && !value.isEmpty()) {
+ return value.contains("true") ? "Y" : "N";
+ } else {
+ return "";
+ }
+ }
+
+ protected String extractValue (Group group, String name) {
+ String value = sdcCsarHelper.getGroupPropertyLeafValue(group, name);
+ if (value != null) {
+ return value;
+ } else {
+ return "";
+ }
+ }
+
+ protected String extractBooleanValue (Group group, String name) {
+ String value = sdcCsarHelper.getGroupPropertyLeafValue(group, name);
+ if (value != null && !value.isEmpty()) {
+ return value.contains("true") ? "Y" : "N";
+ } else {
+ return "";
+ }
+ }
+
+ protected String extractInputDefaultValue (String name) {
+ String value = sdcCsarHelper.getServiceInputLeafValueOfDefault(name);
+ if (value != null) {
+ return value;
+ } else {
+ return "";
+ }
+ }
+
+ protected String extractBooleanInputDefaultValue (String name) {
+ String value = sdcCsarHelper.getServiceInputLeafValueOfDefault(name);
+ if (value != null && !value.isEmpty()) {
+ return value.contains("true") ? "Y" : "N";
+ } else {
+ return "";
+ }
+ }
+
+ public static String extractInputDefaultValue (ISdcCsarHelper sdcCsarHelper, String name) {
+ String value = sdcCsarHelper.getServiceInputLeafValueOfDefault(name);
+ if (value != null) {
+ return value;
+ } else {
+ return "";
+ }
+ }
+
+ public static String extractBooleanInputDefaultValue (ISdcCsarHelper sdcCsarHelper, String name) {
+ String value = sdcCsarHelper.getServiceInputLeafValueOfDefault(name);
+ if (value != null && !value.isEmpty()) {
+ return value.contains("true") ? "Y" : "N";
+ } else {
+ return "";
+ }
+ }
+
+ public static String extractSubstitutionMappingTypeName (ISdcCsarHelper sdcCsarHelper) {
+ String value = sdcCsarHelper.getServiceSubstitutionMappingsTypeName();
+ if (value != null) {
+ return value;
+ } else {
+ return "";
+ }
+ }
+
+ public String getCustomizationUUID() {
+ return ("\"" + customizationUUID + "\"");
+ }
+ public String getCustomizationUUIDNoQuotes() {
+ return (customizationUUID);
+ }
+ public void setCustomizationUUID(String customizationUUID) {
+ this.customizationUUID = customizationUUID;
+ }
+
+ public String getSql(String tableName, String model_yaml) {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("INSERT into " + tableName + " (customization_uuid, model_yaml, ");
+
+ int paramCount = 0;
+ for (String paramKey : params.keySet()) {
+ paramCount++;
+ sb.append(paramKey);
+ if (paramCount < params.size()) sb.append(", ");
+ }
+
+ sb.append(") values (" + getCustomizationUUID() + ", \"" + model_yaml + "\", ");
+
+ paramCount = 0;
+ for (String paramKey : params.keySet()) {
+ paramCount++;
+ String paramValue = params.get(paramKey);
+ sb.append(paramValue);
+ if (paramCount < params.size()) sb.append(", ");
+ }
+
+ sb.append(");");
+ return sb.toString();
+ }
+
+ public static String getSql(String tableName, String keyName, String keyValue, String model_yaml, Map<String, String> params) {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("INSERT into " + tableName + " (" + keyName + ", ");
+
+ int paramCount = 0;
+ for (String paramKey : params.keySet()) {
+ paramCount++;
+ sb.append(paramKey);
+ if (paramCount < params.size()) sb.append(", ");
+ }
+
+ sb.append(") values (" + keyValue + ", ");
+
+ paramCount = 0;
+ for (String paramKey : params.keySet()) {
+ paramCount++;
+ String paramValue = params.get(paramKey);
+ sb.append(paramValue);
+ if (paramCount < params.size()) sb.append(", ");
+ }
+
+ sb.append(");");
+ return sb.toString();
+ }
+
+}
diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncNodeModel.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncNodeModel.java
new file mode 100644
index 00000000..f8e5a5b8
--- /dev/null
+++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncNodeModel.java
@@ -0,0 +1,145 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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.tosca.parser.api.ISdcCsarHelper;
+import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames;
+import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SdncNodeModel extends SdncBaseModel {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(SdncNodeModel.class);
+
+ private String serviceUUID = null;
+ private String ecompGeneratedNaming = null;
+ private String [] bindingUuids = null;
+
+ // Using ASDC TOSCA Parser 17.07
+ public SdncNodeModel(ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate) {
+
+ super(sdcCsarHelper, nodeTemplate);
+
+ // extract inputs
+ String ecompGeneratedNaming = extractBooleanInputDefaultValue(SdcPropertyNames.PROPERTY_NAME_SERVICENAMING_DEFAULT_ECOMPGENERATEDNAMING);
+ addParameter("ecomp_generated_naming",ecompGeneratedNaming);
+ addParameter("naming_policy", extractInputDefaultValue(SdcPropertyNames.PROPERTY_NAME_SERVICENAMING_DEFAULT_NAMINGPOLICY));
+
+ // extract properties
+ addParameter("network_type", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE));
+ addParameter("network_role", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE));
+ addParameter("network_scope", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE));
+ addParameter("network_technology", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY));
+
+ // extract properties - network_assignments
+ addParameter("is_shared_network", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_ISSHAREDNETWORK));
+ addParameter("is_external_network", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_ISEXTERNALNETWORK));
+
+ // extract properties - network_assignments - ipv4_subnet_default_assignment
+ String useIpv4 = extractBooleanValue(nodeTemplate, "network_assignments#ipv4_subnet_default_assignment#use_ipv4");
+ addParameter("use_ipv4", useIpv4);
+ addParameter("ipv4_dhcp_enabled", extractBooleanValue(nodeTemplate, "network_assignments#ipv4_subnet_default_assignment#dhcp_enabled"));
+ if (useIpv4.contains("Y")) {
+ addParameter("ipv4_ip_version", "ipv4");
+ }
+ addParameter("ipv4_cidr_mask", extractValue(nodeTemplate, "network_assignments#ipv4_subnet_default_assignment#cidr_mask"));
+ addParameter("eipam_v4_address_plan", extractValue(nodeTemplate, "network_assignments#ipv4_subnet_default_assignment#ip_network_address_plan"));
+
+ // extract properties - network_assignments - ipv6_subnet_default_assignment
+ String useIpv6 = extractBooleanValue(nodeTemplate, "network_assignments#ipv6_subnet_default_assignment#use_ipv6");
+ addParameter("use_ipv6", useIpv6);
+ addParameter("ipv6_dhcp_enabled", extractBooleanValue(nodeTemplate, "network_assignments#ipv6_subnet_default_assignment#dhcp_enabled"));
+ if (useIpv6.contains("Y")) {
+ addParameter("ipv6_ip_version", "ipv6");
+ }
+ addParameter("ipv6_cidr_mask", extractValue(nodeTemplate, "network_assignments#ipv6_subnet_default_assignment#cidr_mask"));
+ addParameter("eipam_v6_address_plan", extractValue(nodeTemplate, "network_assignments#ipv6_subnet_default_assignment#ip_network_address_plan"));
+
+ // extract properties - provider_network
+ addParameter("is_provider_network", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK));
+ addParameter("physical_network_name", extractValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_PHYSICALNETWORKNAME));
+
+ // extract properties - network_flows
+ addParameter("is_bound_to_vpn", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKFLOWS_ISBOUNDTOVPN));
+
+ // extract properties - network_flows - vpn_bindings
+ String vpnBindingString = extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NETWORKFLOWS_VPNBINDING);
+ bindingUuids = vpnBindingString.split(",");
+
+}
+
+ public String getServiceUUID() {
+ return serviceUUID;
+ }
+ public void setServiceUUID(String serviceUUID) {
+ this.serviceUUID = serviceUUID;
+ }
+
+ public String getEcompGeneratedNaming() {
+ return ecompGeneratedNaming;
+ }
+ public void setEcompGeneratedNaming(String ecompGeneratedNaming) {
+ this.ecompGeneratedNaming = ecompGeneratedNaming;
+ if (ecompGeneratedNaming != null && !ecompGeneratedNaming.isEmpty()) {
+ params.put("ecomp_generated_naming", "\"" + ecompGeneratedNaming + "\"");
+ }
+ }
+
+ public String getSql(String model_yaml) {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("INSERT into NETWORK_MODEL (service_uuid, customization_uuid, model_yaml, ");
+
+ int paramCount = 0;
+ for (String paramKey : params.keySet()) {
+ paramCount++;
+ sb.append(paramKey);
+ if (paramCount < params.size()) sb.append(", ");
+ }
+
+ sb.append(") values (" + serviceUUID + ", " + getCustomizationUUID() + ", \"" + model_yaml + "\", ");
+
+ paramCount = 0;
+ for (String paramKey : params.keySet()) {
+ paramCount++;
+ String paramValue = params.get(paramKey);
+ sb.append(paramValue);
+ if (paramCount < params.size()) sb.append(", ");
+ }
+
+ sb.append(");");
+ return sb.toString();
+ }
+
+ public String getVpnBindingsSql() {
+
+ StringBuilder sb = new StringBuilder();
+ for (int i=0; i < bindingUuids.length; i++) {
+ sb.append("INSERT into VPN_BINDINGS (network_customization_uuid, binding_uuid) values (" + getCustomizationUUID() + ", \"" + bindingUuids[i] + "\"); ");
+ }
+
+ return sb.toString();
+ }
+
+}
diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncOdlConnection.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncOdlConnection.java
new file mode 100644
index 00000000..4e0cffab
--- /dev/null
+++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncOdlConnection.java
@@ -0,0 +1,158 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.Authenticator;
+import java.net.HttpURLConnection;
+import java.net.PasswordAuthentication;
+import java.net.URL;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLSession;
+
+import org.apache.commons.codec.binary.Base64;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class SdncOdlConnection {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(SdncOdlConnection.class);
+
+ private HttpURLConnection httpConn = null;
+
+ private String url = null;
+ private String user = null;
+ private String password = null;
+
+ private class SdncAuthenticator extends Authenticator {
+
+ private String user;
+ private String passwd;
+
+ SdncAuthenticator(String user, String passwd) {
+ this.user = user;
+ this.passwd = passwd;
+ }
+ @Override
+ protected PasswordAuthentication getPasswordAuthentication() {
+ return new PasswordAuthentication(user, passwd.toCharArray());
+ }
+
+ }
+
+ private SdncOdlConnection() {
+
+ }
+
+ private SdncOdlConnection(String url, String user, String password) {
+ this.url = url;
+ this.user = user;
+ this.password = password;
+
+ try {
+ URL sdncUrl = new URL(url);
+ Authenticator.setDefault(new SdncAuthenticator(user, password));
+
+ this.httpConn = (HttpURLConnection) sdncUrl.openConnection();
+ } catch (Exception e) {
+ LOG.error("Unable to create http connection", e);
+ }
+ }
+
+ public static SdncOdlConnection newInstance(String url, String user, String password) throws IOException
+ {
+ return (new SdncOdlConnection(url, user, password));
+ }
+
+
+
+ public String send(String method, String contentType, String msg) throws IOException {
+
+ LOG.info("Sending REST " + method + " to " + url);
+ LOG.info("Message body:\n" + msg);
+ String authStr = user + ":" + password;
+ String encodedAuthStr = new String(Base64.encodeBase64(authStr.getBytes()));
+
+ httpConn.addRequestProperty("Authentication", "Basic " + encodedAuthStr);
+
+ httpConn.setRequestMethod(method);
+ httpConn.setRequestProperty("Content-Type", contentType);
+ httpConn.setRequestProperty("Accept", contentType);
+
+ httpConn.setDoInput(true);
+ httpConn.setDoOutput(true);
+ httpConn.setUseCaches(false);
+
+ if (httpConn instanceof HttpsURLConnection) {
+ HostnameVerifier hostnameVerifier = new HostnameVerifier() {
+ @Override
+ public boolean verify(String hostname, SSLSession session) {
+ return true;
+ }
+ };
+ ((HttpsURLConnection) httpConn).setHostnameVerifier(hostnameVerifier);
+ }
+
+ // Write message
+ httpConn.setRequestProperty("Content-Length", "" + msg.length());
+ DataOutputStream outStr = new DataOutputStream(httpConn.getOutputStream());
+ outStr.write(msg.getBytes());
+ outStr.close();
+
+ // Read response
+ BufferedReader respRdr;
+
+ LOG.info("Response: " + httpConn.getResponseCode() + " " + httpConn.getResponseMessage());
+
+ if (httpConn.getResponseCode() < 300) {
+
+ respRdr = new BufferedReader(new InputStreamReader(httpConn.getInputStream()));
+ } else {
+ respRdr = new BufferedReader(new InputStreamReader(httpConn.getErrorStream()));
+ }
+
+ 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);
+
+ return (respString);
+
+ }
+
+
+}
diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncServiceModel.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncServiceModel.java
new file mode 100644
index 00000000..0f645d7a
--- /dev/null
+++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncServiceModel.java
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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.tosca.parser.api.ISdcCsarHelper;
+import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames;
+import org.openecomp.sdc.toscaparser.api.Metadata;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SdncServiceModel extends SdncBaseModel {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(SdncServiceModel.class);
+
+ private String UUID = null;
+ private String serviceInstanceNamePrefix = null;
+ private String filename = null;
+
+ public SdncServiceModel(ISdcCsarHelper sdcCsarHelper, Metadata metadata) {
+
+ super(sdcCsarHelper, metadata);
+
+ UUID = extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_UUID);
+
+ // extract service topology template input data
+ addParameter("ecomp_naming",extractBooleanInputDefaultValue(SdcPropertyNames.PROPERTY_NAME_SERVICENAMING_DEFAULT_ECOMPGENERATEDNAMING));
+ addParameter("naming_policy",extractInputDefaultValue(SdcPropertyNames.PROPERTY_NAME_SERVICENAMING_DEFAULT_NAMINGPOLICY));
+ }
+
+ public String getServiceUUID() {
+ return ("\"" + UUID + "\"");
+ }
+ public void setServiceUUID(String serviceUUID) {
+ this.UUID = serviceUUID;
+ }
+ public String getServiceInstanceNamePrefix() {
+ return serviceInstanceNamePrefix;
+ }
+ public void setServiceInstanceNamePrefix(String serviceInstanceNamePrefix) {
+ if (serviceInstanceNamePrefix != null && !serviceInstanceNamePrefix.isEmpty()) {
+ this.serviceInstanceNamePrefix = serviceInstanceNamePrefix;
+ params.put("service_instance_name_prefix", "\"" + serviceInstanceNamePrefix + "\"");
+ }
+ }
+ public String getFilename() {
+ return filename;
+ }
+ public void setFilename(String filename) {
+ this.filename = filename;
+ }
+
+ public String getSql(String model_yaml) {
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("INSERT into SERVICE_MODEL (service_uuid, model_yaml, filename, ");
+
+ int paramCount = 0;
+ for (String paramKey : params.keySet()) {
+ paramCount++;
+ sb.append(paramKey);
+ if (paramCount < params.size()) sb.append(", ");
+ }
+
+ sb.append(") values (" + getServiceUUID() + ", \"" + model_yaml + "\", \"" + filename + "\", ");
+
+ paramCount = 0;
+ for (String paramKey : params.keySet()) {
+ paramCount++;
+ String paramValue = params.get(paramKey);
+ sb.append(paramValue);
+ if (paramCount < params.size()) sb.append(", ");
+ }
+
+ sb.append(");");
+ return sb.toString();
+ }
+
+}
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..496c2cef
--- /dev/null
+++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebCallback.java
@@ -0,0 +1,1125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.net.Authenticator;
+import java.net.HttpURLConnection;
+import java.net.PasswordAuthentication;
+import java.net.URL;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+import java.sql.SQLException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import javax.sql.rowset.CachedRowSet;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathFactory;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.tuple.Pair;
+import org.onap.ccsdk.sli.core.dblib.DBResourceManager;
+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.tosca.parser.api.ISdcCsarHelper;
+import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
+import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames;
+import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory;
+import org.openecomp.sdc.toscaparser.api.Group;
+import org.openecomp.sdc.toscaparser.api.Metadata;
+import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.openecomp.sdc.utils.ArtifactTypeEnum;
+import org.openecomp.sdc.utils.DistributionActionResultEnum;
+import org.openecomp.sdc.utils.DistributionStatusEnum;
+import org.openecomp.sdnc.uebclient.SdncArtifactMap.SdncArtifactType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public class SdncUebCallback implements INotificationCallback {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(SdncUebCallback.class);
+
+ private static DBResourceManager jdbcDataSource = null;
+ private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR";
+
+
+ private class SdncAuthenticator extends Authenticator {
+
+ private final String user;
+ private final String passwd;
+
+ SdncAuthenticator(String user, String passwd) {
+ this.user = user;
+ this.passwd = passwd;
+ }
+ @Override
+ protected PasswordAuthentication getPasswordAuthentication() {
+ return new PasswordAuthentication(user, passwd.toCharArray());
+ }
+
+ }
+
+ private class DeployableArtifact {
+ SdncArtifactType type;
+ IArtifactInfo artifactInfo;
+ String svcName;
+ String resourceName;
+ String artifactName;
+ String artifactVersion;
+ File file;
+
+ public String getArtifactName() {
+ return artifactName;
+ }
+
+
+
+ public String getArtifactVersion() {
+ return artifactVersion;
+ }
+
+
+ public SdncArtifactType getType() {
+ return type;
+ }
+
+
+
+ public IArtifactInfo getArtifactInfo() {
+ return artifactInfo;
+ }
+
+
+ public File getFile() {
+ return file;
+ }
+
+
+
+
+ public DeployableArtifact(SdncArtifactType type, String svcName, String resourceName, IArtifactInfo artifactInfo, File file) {
+ this.type = type;
+ this.artifactInfo = artifactInfo;
+ this.svcName = svcName;
+ this.resourceName = resourceName;
+ this.artifactName = artifactInfo.getArtifactName();
+ this.artifactVersion = artifactInfo.getArtifactVersion();
+ this.file = file;
+ }
+
+
+ public DeployableArtifact(SdncArtifactType type, String svcName, String resourceName, String artifactName, String artifactVersion, File file) {
+ this.type = type;
+ this.artifactInfo = null;
+ this.svcName = svcName;
+ this.resourceName = resourceName;
+ this.artifactName = artifactName;
+ this.artifactVersion = artifactVersion;
+ this.file = file;
+ }
+
+
+
+ public String getSvcName() {
+ return svcName;
+ }
+
+
+
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ }
+
+ private final IDistributionClient client;
+ private final SdncUebConfiguration config;
+
+ private LinkedList<DeployableArtifact> deployList[];
+
+ private static void setJdbcDataSource() throws IOException {
+
+ String propPath = null;
+ String propDir = System.getenv(SDNC_CONFIG_DIR);
+ if (propDir == null) {
+
+ propDir = "/opt/sdnc/data/properties";
+ }
+ propPath = propDir + "/dblib.properties";
+ File propFile = new File(propPath);
+
+ if (!propFile.exists()) {
+
+ throw new FileNotFoundException(
+ "Missing configuration properties file : "
+ + propFile);
+ }
+
+ Properties props = new Properties();
+ props.load(new FileInputStream(propFile));
+
+ try {
+ jdbcDataSource = DBResourceManager.create(props);
+ } catch(Throwable exc) {
+ LOG.error("", exc);
+ }
+
+ if(((DBResourceManager)jdbcDataSource).isActive()){
+ LOG.warn( "DBLIB: JDBC DataSource has been initialized.");
+ } else {
+ LOG.warn( "DBLIB: JDBC DataSource did not initialize successfully.");
+ }
+ }
+
+ private static void loadArtifactMap() {
+
+ }
+
+ public SdncUebCallback(IDistributionClient client, SdncUebConfiguration config) {
+ this.client = client;
+ this.config = config;
+
+ }
+
+ @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, 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(), curResource.getResourceType(), 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
+ int numPasses = config.getMaxPasses();
+
+ deployList = new LinkedList[numPasses];
+
+ for (int i = 0 ; i < numPasses ; i++) {
+ deployList[i] = new LinkedList<DeployableArtifact>();
+ }
+ for (int pass = 0 ; pass < config.getMaxPasses() ; pass++) {
+
+ if (deployList[pass] != null) {
+ while (! deployList[pass].isEmpty()) {
+ DeployableArtifact artifact = deployList[pass].pop();
+
+ DistributionStatusEnum deployResult = DistributionStatusEnum.DEPLOY_ERROR;
+
+
+ try {
+
+ deployResult = deploySpoolFile(artifact);
+ } catch (Exception e) {
+ LOG.error("Caught exception trying to deploy file", e);
+ }
+
+
+ IArtifactInfo artifactInfo = artifact.getArtifactInfo();
+
+ if ((artifactInfo != null) && (data != null)) {
+ IDistributionClientResult deploymentStatus;
+ deploymentStatus = client.sendDeploymentStatus(buildStatusMessage(
+ client, data, artifactInfo,
+ deployResult));
+ }
+
+ }
+ }
+ }
+ }
+
+ private void handleArtifact(INotificationData data, String svcName, String resourceName, String resourceType, IArtifactInfo artifact, File incomingDir, File archiveDir) {
+
+ // Download Artifact
+ IDistributionClientDownloadResult downloadResult = client
+ .download(artifact);
+
+ if (downloadResult == null) {
+
+ handleFailedDownload(data, artifact);
+ return;
+ }
+
+ byte[] payloadBytes = downloadResult.getArtifactPayload();
+
+ if (payloadBytes == null) {
+ handleFailedDownload(data, artifact);
+ return;
+ }
+
+ String payload = new String(payloadBytes);
+
+
+ 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;
+
+ boolean toscaYamlType = false;
+ if (artifact != null) {
+ String artifactTypeString = artifact.getArtifactType();
+ if (artifactTypeString.contains("TOSCA_TEMPLATE")) {
+ toscaYamlType = true;
+ }
+ } else {
+ if (spoolFile.toString().contains(".yml") || spoolFile.toString().contains(".csar")) {
+ toscaYamlType = true;
+ }
+ }
+ String overrideFileName = config.getOverrideFile();
+ if ((overrideFileName != null) && (overrideFileName.length() > 0)) {
+ File overrideFile = new File(overrideFileName);
+
+ if (overrideFile.exists()) {
+ artifactEnum = ArtifactTypeEnum.YANG_XML;
+ spoolFile = overrideFile;
+ }
+
+ }
+
+ if (toscaYamlType == true) {
+ processToscaYaml (data, svcName, resourceName, artifact, spoolFile, archiveDir);
+
+ 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);
+ }
+
+ return;
+ }
+
+ // Process spool file
+ Document spoolDoc = null;
+ File transformedFile = null;
+
+ // Apply XSLTs and get Doc object
+ try {
+ if (!spoolFile.isDirectory()) {
+ transformedFile = applyXslts(spoolFile);
+ }
+ } catch (Exception e) {
+ LOG.error("Caught exception trying to parse XML file", e);
+ }
+
+ if (transformedFile != null) {
+ try {
+
+ try {
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory
+ .newInstance();
+ 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 != null) {
+
+ scheduleDeployment(artifactType, svcName, resourceName, artifact, spoolFile.getName(), transformedFile);
+
+ }
+
+ // SDNGC-2660 : Move file to archive directory even if it is an unrecognized type so that
+ // we do not keep trying and failing to process it.
+ try {
+ Path source = spoolFile.toPath();
+ Path targetDir = archiveDir.toPath();
+
+ Files.move(source, targetDir.resolve(source.getFileName()), StandardCopyOption.REPLACE_EXISTING);
+ } catch (IOException e) {
+ LOG.warn("Could not move "+spoolFile.getAbsolutePath()+" to "+archiveDir.getAbsolutePath(), e);
+ }
+ }
+
+
+ }
+
+
+ private void processToscaYaml(INotificationData data, String svcName, String resourceName,
+ IArtifactInfo artifact, File spoolFile, File archiveDir) {
+
+ // Use ASDC Dist Client 1.1.5 with TOSCA parsing APIs to extract relevant TOSCA model data
+
+ // TOSCA data extraction flow 1707:
+ // Use ASDC dist-client to get yaml string - not yet available
+ String model_yaml = null;
+ LOG.info("Process TOSCA YAML file: "+spoolFile.toString());
+
+ SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();
+ ISdcCsarHelper sdcCsarHelper = null;
+ try {
+ sdcCsarHelper = factory.getSdcCsarHelper(spoolFile.getAbsolutePath());
+ } catch (SdcToscaParserException e) {
+ LOG.error("Could not create SDC TOSCA Parser ", e);
+ factory.close();
+ return;
+ }
+
+ // Ingest Service Data - 1707
+ Metadata serviceMetadata = sdcCsarHelper.getServiceMetadata();
+ SdncServiceModel serviceModel = new SdncServiceModel(sdcCsarHelper, serviceMetadata);
+ serviceModel.setFilename(spoolFile.toString().substring(spoolFile.toString().lastIndexOf("/")+1)); // will be csar file name
+ serviceModel.setServiceInstanceNamePrefix(SdncBaseModel.extractSubstitutionMappingTypeName(sdcCsarHelper).substring(SdncBaseModel.extractSubstitutionMappingTypeName(sdcCsarHelper).lastIndexOf(".")+1));
+
+ try {
+ cleanUpExistingToscaServiceData(serviceModel.getServiceUUID());
+ LOG.info("Call insertToscaData for SERVICE_MODEL serviceUUID = " + serviceModel.getServiceUUID());
+ insertToscaData(serviceModel.getSql(model_yaml));
+ } catch (IOException e) {
+ LOG.error("Could not insert Tosca YAML data into the SERVICE_MODEL table ", e);
+ factory.close();
+ return;
+ }
+
+ // Ingest Network (VL) Data - 1707
+ //List<NodeTemplate> vlNodeTemplatesList = sdcCsarHelper.getServiceNodeTemplatesByType("VL");
+ List<NodeTemplate> vlNodeTemplatesList = sdcCsarHelper.getServiceVlList();
+
+ for (NodeTemplate nodeTemplate : vlNodeTemplatesList) {
+ SdncNodeModel nodeModel = new SdncNodeModel (sdcCsarHelper, nodeTemplate);
+ nodeModel.setServiceUUID(serviceModel.getServiceUUID());
+ nodeModel.setEcompGeneratedNaming(SdncBaseModel.extractBooleanInputDefaultValue(sdcCsarHelper, SdcPropertyNames.PROPERTY_NAME_SERVICENAMING_DEFAULT_ECOMPGENERATEDNAMING));//service_naming#default#ecomp_generated_naming
+
+ try {
+ cleanUpExistingToscaData("NETWORK_MODEL", "customization_uuid", nodeModel.getCustomizationUUID());
+ cleanUpExistingToscaData("VPN_BINDINGS", "network_customization_uuid", nodeModel.getCustomizationUUID());
+ LOG.info("Call insertToscaData for NETWORK_MODEL customizationUUID = " + nodeModel.getCustomizationUUID());
+ // using ASDC dist-client use method for get yaml string
+ insertToscaData(nodeModel.getSql(model_yaml));
+ insertToscaData(nodeModel.getVpnBindingsSql());
+ } catch (IOException e) {
+ LOG.error("Could not insert Tosca YAML data into the NETWORK_MODEL table ", e);
+ }
+ }
+
+ // Ingest Allotted Resource Data - 1707
+ List<NodeTemplate> arNodeTemplatesList = sdcCsarHelper.getAllottedResources();
+
+ for (NodeTemplate nodeTemplate : arNodeTemplatesList) {
+ SdncARModel nodeModel = new SdncARModel (sdcCsarHelper, nodeTemplate);
+
+ try {
+ cleanUpExistingToscaData("ALLOTTED_RESOURCE_MODEL", "customization_uuid", nodeModel.getCustomizationUUID());
+ LOG.info("Call insertToscaData for ALLOTTED_RESOURCE_MODEL customizationUUID = " + nodeModel.getCustomizationUUID());
+ // using ASDC dist-client use method for get yaml string
+ insertToscaData(nodeModel.getSql("ALLOTTED_RESOURCE_MODEL", model_yaml));
+ } catch (IOException e) {
+ LOG.error("Could not insert Tosca YAML data into the NETWORK_MODEL table ", e);
+ }
+ }
+
+ // Ingest Network (VF) Data - 1707
+ //List<NodeTemplate> nodeTemplatesList = sdcCsarHelper.getServiceNodeTemplatesByType("VF");
+ List<NodeTemplate> vfNodeTemplatesList = sdcCsarHelper.getServiceVfList();
+
+ for (NodeTemplate nodeTemplate : vfNodeTemplatesList) {
+ SdncVFModel vfNodeModel = new SdncVFModel (sdcCsarHelper, nodeTemplate);
+
+ try {
+ cleanUpExistingToscaData("VF_MODEL", "customization_uuid", vfNodeModel.getCustomizationUUID()) ;
+ LOG.info("Call insertToscaData for VF_MODEL customizationUUID = " + vfNodeModel.getCustomizationUUID());
+ insertToscaData(vfNodeModel.getSql("VF_MODEL", model_yaml));
+ } catch (IOException e) {
+ LOG.error("Could not insert Tosca YAML data into the VF_MODEL table ", e);
+ }
+
+ // For each VF, insert VF_MODULE_MODEL data
+ List<Group> vfModules = sdcCsarHelper.getVfModulesByVf(vfNodeModel.getCustomizationUUIDNoQuotes());
+ for (Group group : vfModules){
+ SdncVFModuleModel vfModuleModel = new SdncVFModuleModel(sdcCsarHelper, group);
+
+ try {
+ cleanUpExistingToscaData("VF_MODULE_MODEL", "customization_uuid", vfModuleModel.getCustomizationUUID());
+ LOG.info("Call insertToscaData for VF_MODULE_MODEL customizationUUID = " + vfModuleModel.getCustomizationUUID());
+ insertToscaData(vfModuleModel.getSql("VF_MODULE_MODEL", model_yaml));
+ } catch (IOException e) {
+ LOG.error("Could not insert Tosca YAML data into the VF_MODULE_MODEL table ", e);
+ }
+
+ // For each VF Module, get the VFC list, insert VF_MODULE_TO_VFC_MAPPING data
+ // List<NodeTemplate> groupMembers = sdcCsarHelper.getMembersOfGroup(group); - old version
+ // For each vfcNode (group member) in the groupMembers list, extract vm_type and vm_count.
+ // Insert vf_module.customizationUUID, vfcNode.customizationUUID and vm_type and vm_count into VF_MODULE_TO_VFC_MAPPING
+ List<NodeTemplate> groupMembers = sdcCsarHelper.getMembersOfVfModule(nodeTemplate, group); // not yet available
+ for (NodeTemplate vfcNode : groupMembers){
+ SdncVFCModel vfcModel = new SdncVFCModel(sdcCsarHelper, vfcNode);
+
+ try {
+ cleanUpExistingToscaData("VF_MODULE_TO_VFC_MAPPING", "vf_module_customization_uuid", vfModuleModel.getCustomizationUUID());
+ LOG.info("Call insertToscaData for VF_MODULE_TO_VFC_MAPPING customizationUUID = " + vfModuleModel.getCustomizationUUID());
+ insertToscaData("insert into VF_MODULE_TO_VFC_MAPPING (vf_module_customization_uuid, vfc_customization_uuid, vm_type, vm_count) values (" +
+ vfModuleModel.getCustomizationUUID() + ", " + vfcModel.getCustomizationUUID() + ", \"" + vfcModel.getVmType() + "\", \"" + vfcModel.getVmCount() + "\")");
+ } catch (IOException e) {
+ LOG.error("Could not insert Tosca YAML data into the VF_MODULE_TO_VFC_MAPPING table ", e);
+ }
+
+ }
+
+ }
+
+ // For each VF, insert VFC_MODEL data
+ List<NodeTemplate> vfcNodes = sdcCsarHelper.getVfcListByVf(vfNodeModel.getCustomizationUUIDNoQuotes());
+ for (NodeTemplate vfcNode : vfcNodes){
+ SdncVFCModel vfcModel = new SdncVFCModel(sdcCsarHelper, vfcNode);
+
+ try {
+ cleanUpExistingToscaData("VFC_MODEL", "customization_uuid", vfcModel.getCustomizationUUID());
+ LOG.info("Call insertToscaData for VFC_MODEL customizationUUID = " + vfcModel.getCustomizationUUID());
+ insertToscaData(vfcModel.getSql("VFC_MODEL", model_yaml));
+ } catch (IOException e) {
+ LOG.error("Could not insert Tosca YAML data into the VFC_MODEL table ", e);
+ }
+
+ }
+
+ // For each VF, insert VF_TO_NETWORK_ROLE_MAPPING data
+ List<NodeTemplate> cpNodes = sdcCsarHelper.getCpListByVf(vfNodeModel.getCustomizationUUIDNoQuotes());
+ for (NodeTemplate cpNode : cpNodes){
+
+ // Insert into VF_TO_NETWORK_ROLE_MAPPING vf_customization_uuid and network_role
+ String cpNetworkRole = sdcCsarHelper.getNodeTemplatePropertyLeafValue(cpNode, "network_role_tag");
+
+ try {
+ cleanUpExistingToscaData("VF_TO_NETWORK_ROLE_MAPPING", "vf_customization_uuid", vfNodeModel.getCustomizationUUID());
+ LOG.info("Call insertToscaData for VF_TO_NETWORK_ROLE_MAPPING vfCustomizationUUID = " + vfNodeModel.getCustomizationUUID());
+ insertToscaData("insert into VF_TO_NETWORK_ROLE_MAPPING (vf_customization_uuid, network_role) values (" +
+ vfNodeModel.getCustomizationUUID() + ", \"" + cpNetworkRole + "\")");
+ } catch (IOException e) {
+ LOG.error("Could not insert Tosca YAML data into the VF_TO_NETWORK_ROLE_MAPPING table ", e);
+ }
+
+ // Insert VFC_TO_NETWORK_ROLE_MAPPING data
+ Map<String, String> mappingParams = new HashMap<String, String>();
+ //String cpNetworkRoleTag = "\"" + sdcCsarHelper.getNodeTemplatePropertyLeafValue(cpNode, SdcPropertyNames.PROPERTY_NAME_NETWORKROLETAG) + "\"";
+ // extract network_role, network_role_tag and virtual_binding from this cpNode
+ SdncBaseModel.addParameter("network_role", SdncBaseModel.extractValue(sdcCsarHelper, cpNode, "network_role"), mappingParams);
+ SdncBaseModel.addParameter("network_role_tag", SdncBaseModel.extractValue(sdcCsarHelper, cpNode, "network_role_tag"), mappingParams);
+ String virtualBinding = "\"" + SdncBaseModel.extractValue(sdcCsarHelper, cpNode, "requirements#virtualBinding") + "\"";
+
+ // get list of cpNodes and vfcNodes with matching virtualBinding
+ List<Pair<NodeTemplate, NodeTemplate>> matchList = sdcCsarHelper.getNodeTemplatePairsByReqName(sdcCsarHelper.getCpListByVf(vfNodeModel.getCustomizationUUIDNoQuotes()), sdcCsarHelper.getVfcListByVf(vfNodeModel.getCustomizationUUIDNoQuotes()), virtualBinding);
+ for (Pair<NodeTemplate, NodeTemplate> match : matchList) { // should be 1 match?
+
+ // extract values from the left "CP" Node
+ SdncBaseModel.addParameter("ipv4_use_dhcp", SdncBaseModel.extractBooleanValue(sdcCsarHelper, match.getLeft(), SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_IPV4SUBNETDEFAULTASSIGNMENTS_DHCPENABLED), mappingParams);
+ //SdncBaseModel.addParameter("ipv4_ip_version", SdncBaseModel.extractValue(sdcCsarHelper, match.getLeft(), SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_IPV4SUBNETDEFAULTASSIGNMENTS_IPVERSION), mappingParams);
+ SdncBaseModel.addParameter("ipv4_ip_version", "dummy_ipv4_vers", mappingParams);
+ SdncBaseModel.addParameter("ipv6_use_dhcp", SdncBaseModel.extractBooleanValue(sdcCsarHelper, match.getLeft(), SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_IPV6SUBNETDEFAULTASSIGNMENTS_DHCPENABLED), mappingParams);
+ //SdncBaseModel.addParameter("ipv6_ip_version", SdncBaseModel.extractValue(sdcCsarHelper, match.getLeft(), SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_IPV6SUBNETDEFAULTASSIGNMENTS_IPVERSION), mappingParams);
+ SdncBaseModel.addParameter("ipv6_ip_version", "dummy_ipv6_vers", mappingParams);
+ //String extcp_subnetpool_id = "\"" + SdncBaseModel.extractValue(sdcCsarHelper, match.getLeft(), SdcPropertyNames.PROPERTY_NAME_SUBNETPOOLID) + "\""; // need path to subnetpoolid
+
+ // extract values from the right "VFC" Node
+ String vfcCustomizationUuid = "\"" + SdncBaseModel.extractValue(sdcCsarHelper, match.getRight().getMetadata(), "customization_uuid") + "\"";
+ SdncBaseModel.addParameter("vm_type", SdncBaseModel.extractValue(sdcCsarHelper, match.getRight(), SdcPropertyNames.PROPERTY_NAME_VMTYPE), mappingParams);
+ SdncBaseModel.addIntParameter("ipv4_count", SdncBaseModel.extractValue(sdcCsarHelper, match.getRight(), SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_IPV4SUBNETDEFAULTASSIGNMENTS_MINSUBNETSCOUNT), mappingParams);
+ SdncBaseModel.addIntParameter("ipv6_count", SdncBaseModel.extractValue(sdcCsarHelper, match.getRight(), SdcPropertyNames.PROPERTY_NAME_NETWORKASSIGNMENTS_IPV6SUBNETDEFAULTASSIGNMENTS_MINSUBNETSCOUNT), mappingParams);
+
+ try {
+ cleanUpExistingToscaData("VFC_TO_NETWORK_ROLE_MAPPING", "vfc_customization_uuid", vfcCustomizationUuid);
+ LOG.info("Call insertToscaData for VFC_TO_NETWORK_ROLE_MAPPING vfcCustomizationUUID = " + vfcCustomizationUuid);
+ insertToscaData(SdncBaseModel.getSql("VFC_TO_NETWORK_ROLE_MAPPING", "vfc_customization_uuid", vfcCustomizationUuid, "", mappingParams));
+ } catch (IOException e) {
+ LOG.error("Could not insert Tosca YAML data into the VFC_TO_NETWORK_ROLE_MAPPING table ", e);
+ }
+
+ }
+
+ } // CP loop
+
+ } // VF loop
+
+ // Close ASDC TOSCA Parser factory - we are done processing this distribution
+ factory.close();
+
+ if ((artifact != null) && (data != null)) {
+ LOG.info("Update to SDN-C succeeded");
+ IDistributionClientResult deploymentStatus;
+ deploymentStatus = client.sendDeploymentStatus(buildStatusMessage(
+ client, data, artifact,
+ DistributionStatusEnum.DEPLOY_OK));
+ }
+
+ }
+
+ private void cleanUpExistingToscaData(String tableName, String keyName, String keyValue) throws IOException
+ {
+
+ if (jdbcDataSource == null) {
+ setJdbcDataSource();
+ }
+ try {
+ int rowCount = 0;
+ CachedRowSet data = jdbcDataSource.getData("SELECT * from " + tableName + " where " + keyName + " = " + keyValue + ";", null, "");
+ while(data.next()) {
+ rowCount ++;
+ }
+ if (rowCount != 0) {
+ LOG.info("cleanUpExistingToscaData: " + keyValue);
+ jdbcDataSource.writeData("DELETE from " + tableName + " where " + keyName + " = " + keyValue + ";", null, null);
+ }
+
+ } catch (SQLException e) {
+ LOG.error("Could not clean up existing " + tableName + " for " + keyValue, e);
+ }
+
+ }
+
+
+ private void cleanUpExistingToscaServiceData(String serviceUUID) throws IOException
+ {
+
+ if (jdbcDataSource == null) {
+ setJdbcDataSource();
+ }
+ try {
+ int rowCount = 0;
+ CachedRowSet data = jdbcDataSource.getData("SELECT * from SERVICE_MODEL where service_uuid = " + serviceUUID + ";", null, "");
+ while(data.next()) {
+ rowCount ++;
+ }
+ if (rowCount != 0) {
+ LOG.info("cleanUpExistingToscaData: " + serviceUUID);
+ jdbcDataSource.writeData("DELETE from NETWORK_MODEL where service_uuid = " + serviceUUID + ";", null, null);
+ jdbcDataSource.writeData("DELETE from SERVICE_MODEL where service_uuid = " + serviceUUID + ";", null, null);
+ }
+
+ } catch (SQLException e) {
+ LOG.error("Could not clean up existing NETWORK_MODEL and SERVICE_MODEL for service_UUID " + serviceUUID, e);
+ }
+
+ }
+
+
+ private void insertToscaData(String toscaDataString) throws IOException
+ {
+ LOG.debug("insertToscaData: " + toscaDataString);
+
+ if (jdbcDataSource == null) {
+ setJdbcDataSource();
+ }
+ try {
+
+ jdbcDataSource.writeData(toscaDataString, null, null);
+
+ } catch (SQLException e) {
+ LOG.error("Could not insert Tosca YAML data into the database ", e);
+ }
+
+ }
+
+
+ private SdncArtifactType analyzeFileType(ArtifactTypeEnum artifactType, File spoolFile, Document spoolDoc) {
+
+ if (artifactType != ArtifactTypeEnum.YANG_XML) {
+ LOG.error("Unexpected artifact type - expecting YANG_XML, got "+artifactType);
+ return (null);
+ }
+
+ // Examine outer tag
+
+ try {
+
+
+ Element root = spoolDoc.getDocumentElement();
+
+ String rootName = root.getTagName();
+
+ if (rootName.contains(":")) {
+ String[] rootNameElems = rootName.split(":");
+ rootName = rootNameElems[rootNameElems.length - 1];
+ }
+
+ if (rootName != null) {
+ SdncArtifactType mapEntry = config.getMapping(rootName);
+
+
+ if (mapEntry == null) {
+
+ LOG.error("Unexpected file contents - root tag is "+rootName);
+ }
+ return(mapEntry);
+ } else {
+ LOG.error("Cannot get root tag from file");
+ return(null);
+ }
+
+ } catch (Exception e) {
+ LOG.error("Could not parse YANG_XML file "+spoolFile.getName(), e);
+ return(null);
+ }
+ }
+
+ private void scheduleDeployment(SdncArtifactType type, String svcName, String resourceName, IArtifactInfo artifactInfo, String spoolFileName, File spoolFile) {
+
+ if (type.getPass() < deployList.length) {
+
+ if (artifactInfo != null) {
+ LOG.debug("Scheduling "+artifactInfo.getArtifactName()+" version "+artifactInfo.getArtifactVersion()+" for deployment");
+
+ deployList[type.getPass()].add(new DeployableArtifact(type, svcName, resourceName, artifactInfo, spoolFile));
+ } else {
+ SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss.SSS");//dd/MM/yyyy
+ Date now = new Date();
+ String artifactVersion = sdfDate.format(now);
+ LOG.debug("Scheduling "+spoolFileName+" version "+artifactVersion+" for deployment");
+ String artifactName = spoolFileName;
+ if (artifactInfo != null) {
+ artifactName = artifactInfo.getArtifactName();
+ }
+ deployList[type.getPass()].add(new DeployableArtifact(type, svcName, resourceName, artifactName, artifactVersion, spoolFile));
+ }
+ } else {
+ LOG.info("Pass for type "+type.getTag()+" is "+type.getPass()+" which is not <= "+deployList.length);
+ }
+ }
+
+
+ private DistributionStatusEnum deploySpoolFile(DeployableArtifact artifact) {
+
+ DistributionStatusEnum deployResult = DistributionStatusEnum.DEPLOY_OK;
+
+ StringBuffer msgBuffer = new StringBuffer();
+
+
+ String namespace = config.getAsdcApiNamespace();
+ 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;
+
+ try {
+ SdncOdlConnection odlConn = SdncOdlConnection.newInstance(urlString, config.getSdncUser(), config.getSdncPasswd());
+
+ String sdncResp = odlConn.send("POST", "application/xml", new String(msgBytes));
+
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ DocumentBuilder db = dbf.newDocumentBuilder();
+
+
+ response = db.parse(new ByteArrayInputStream(sdncResp.getBytes()));
+ } catch (Exception e) {
+ LOG.error("Caught exception posting to ODL tier", e);
+ }
+
+ return(response);
+
+ }
+
+ private File applyXslts(File srcFile) {
+
+ Document doc = null;
+
+
+ File inFile = srcFile;
+ File outFile = null;
+
+ String xsltPathList = config.getXsltPathList();
+
+ if ((xsltPathList == null) || (xsltPathList.length() == 0)) {
+ outFile = inFile;
+ } else {
+
+ String[] xsltPaths = xsltPathList.split(",");
+
+ for (String xsltPath : xsltPaths) {
+ try{
+
+ outFile = File.createTempFile("tmp", "xml");
+ TransformerFactory factory = TransformerFactory.newInstance();
+ 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..df5dfc0a
--- /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 ONAP 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..7855b5ba
--- /dev/null
+++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncUebConfiguration.java
@@ -0,0 +1,280 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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;
+
+ private SdncArtifactMap artifactMap = SdncArtifactMap.getInstance();
+
+ 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");
+
+
+ String artifactMapFile = props.getProperty("org.openecomp.sdnc.uebclient.artifact-map");
+ if (artifactMapFile != null) {
+ artifactMap.load(artifactMapFile);
+ }
+
+ }
+
+ @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;
+ }
+
+ public int getMaxPasses() {
+ return(artifactMap.getNumPasses());
+ }
+
+ public SdncArtifactMap.SdncArtifactType getMapping(String tag) {
+ return(artifactMap.getMapping(tag));
+ }
+
+ @Override
+ public boolean isFilterInEmptyResources() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+
+}
diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFCModel.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFCModel.java
new file mode 100644
index 00000000..67b78689
--- /dev/null
+++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFCModel.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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.tosca.parser.api.ISdcCsarHelper;
+import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames;
+import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SdncVFCModel extends SdncBaseModel {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(SdncVFCModel.class);
+
+ private String vmType = null;
+ private String vmCount = null;
+
+ public SdncVFCModel(ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate) {
+
+ super(sdcCsarHelper, nodeTemplate);
+
+ // extract properties
+ vmType = extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VMTYPE);
+ //vmCount = extractValue (sdcCsarHelper, nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VMCOUNT); - need path to vm_count
+ vmCount = "1";
+ addParameter("vm_type", vmType);
+ addParameter("vm_type_tag", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VMTYPETAG));
+ addParameter("ecomp_generated_naming", extractBooleanValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VFCNAMING_ECOMPGENERATEDNAMING));
+ addParameter("naming_policy", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VFCNAMING_NAMINGPOLICY));
+ addParameter("nfc_naming_code", extractValue (nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFCCODE));
+ }
+
+ public String getVmType() {
+ return vmType;
+ }
+
+ public void setVmType(String vmType) {
+ this.vmType = vmType;
+ }
+
+ public String getVmCount() {
+ return vmCount;
+ }
+
+ public void setVmCount(String vmCount) {
+ this.vmCount = vmCount;
+ }
+
+}
diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFModel.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFModel.java
new file mode 100644
index 00000000..4e95e46b
--- /dev/null
+++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFModel.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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.tosca.parser.api.ISdcCsarHelper;
+import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames;
+import org.openecomp.sdc.toscaparser.api.Metadata;
+import org.openecomp.sdc.toscaparser.api.NodeTemplate;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SdncVFModel extends SdncBaseModel {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(SdncVFModel.class);
+
+ public SdncVFModel(ISdcCsarHelper sdcCsarHelper, NodeTemplate nodeTemplate) {
+
+ super(sdcCsarHelper, nodeTemplate);
+
+ // extract metadata
+ Metadata metadata = nodeTemplate.getMetadata();
+ addParameter("name", extractValue(metadata, SdcPropertyNames.PROPERTY_NAME_NAME));
+ addParameter("vendor", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_RESOURCEVENDOR));
+ addParameter("vendor_version", extractValue (metadata, SdcPropertyNames.PROPERTY_NAME_RESOURCEVENDORRELEASE));
+
+ // extract properties
+ addParameter("ecomp_generated_naming", extractBooleanValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VNFECOMPNAMING_ECOMPGENERATEDNAMING));
+ addParameter("naming_policy", extractValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_VNFECOMPNAMING_NAMINGPOLICY));
+ addParameter("nf_type", extractValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+ addParameter("nf_role", extractValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ addParameter("nf_code", extractValue( nodeTemplate, "nf_naming_code"));
+ addParameter("nf_function", extractValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ addParameter("avail_zone_max_count", extractValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONEMAXCOUNT));
+ }
+
+}
diff --git a/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFModuleModel.java b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFModuleModel.java
new file mode 100644
index 00000000..86df8b2a
--- /dev/null
+++ b/ueb-listener/src/main/java/org/openecomp/sdnc/uebclient/SdncVFModuleModel.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 ONAP 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.tosca.parser.api.ISdcCsarHelper;
+import org.openecomp.sdc.tosca.parser.impl.SdcPropertyNames;
+import org.openecomp.sdc.toscaparser.api.Group;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SdncVFModuleModel extends SdncBaseModel {
+
+ private static final Logger LOG = LoggerFactory
+ .getLogger(SdncVFModuleModel.class);
+
+ public SdncVFModuleModel(ISdcCsarHelper sdcCsarHelper, Group group) {
+
+ super(sdcCsarHelper, group);
+
+ // extract properties
+ addParameter("vf_module_type", extractValue(group, SdcPropertyNames.PROPERTY_NAME_VFMODULETYPE));
+ addIntParameter("availability_zone_count", extractValue(group, SdcPropertyNames.PROPERTY_NAME_AVAILABILITYZONECOUNT));
+ addParameter("ecomp_generated_vm_assignments", extractBooleanValue(group, SdcPropertyNames.PROPERTY_NAME_ECOMPGENERATEDVMASSIGNMENTS));
+ }
+
+}
diff --git a/ueb-listener/src/main/resources/log4j.properties b/ueb-listener/src/main/resources/log4j.properties
new file mode 100644
index 00000000..670e48e1
--- /dev/null
+++ b/ueb-listener/src/main/resources/log4j.properties
@@ -0,0 +1,37 @@
+###
+# ============LICENSE_START=======================================================
+# openECOMP : SDN-C
+# ================================================================================
+# Copyright (C) 2017 ONAP Intellectual Property. All rights
+# reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+log4j.rootLogger=DEBUG,CONSOLE,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/main/scripts/start-ueb-listener.sh b/ueb-listener/src/main/scripts/start-ueb-listener.sh
new file mode 100644
index 00000000..db00726b
--- /dev/null
+++ b/ueb-listener/src/main/scripts/start-ueb-listener.sh
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+###
+# ============LICENSE_START=======================================================
+# openECOMP : SDN-C
+# ================================================================================
+# Copyright (C) 2017 ONAP Intellectual Property. All rights
+# reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+PROPERTY_DIR=${PROPERTY_DIR:-/opt/sdnc/data/properties}
+
+
+LISTENER=ueb-listener
+
+PIDFILE=/tmp/.${LISTENER}-pid
+UEBLISTENERROOT=${UEBLISTENERROOT:-/opt/app/ueb-listener}
+JAVA_HOME=${JAVA_HOME:-/usr/lib/jvm/java-7-oracle}
+JAVA_OPTS=${JAVA_OPTS:--Dhttps.protocols=TLSv1.1,TLSv1.2}
+JAVA=${JAVA:-${JAVA_HOME}/bin/java}
+
+# Redirect output from script to $LISTENER.out
+exec >> ${UEBLISTENERROOT}/logs/$LISTENER.out
+exec 2>&1
+
+if [ -f $PIDFILE ]
+then
+ pid=$(cat $PIDFILE)
+ if [ "$pid" != "" ]
+ then
+ if kill -0 $pid
+ then
+ echo "$LISTENER already running"
+ exit 0
+ fi
+ fi
+fi
+
+if [ ! -d ${UEBLISTENERROOT}/logs ]
+then
+ mkdir ${UEBLISTENERROOT}/logs
+fi
+
+for file in ${UEBLISTENERROOT}/lib/*.jar
+do
+ LISTENERCLASSPATH=$LISTENERCLASSPATH:$file
+done
+
+${JAVA} ${JAVA_OPTS} -jar ${UEBLISTENERROOT}/lib/ueb-listener*.jar -Dlog4j.configuration=file:${UEBLISTENERROOT}/lib/log4j.properties -cp ${LISTENERCLASSPATH} &
+
+
+echo $! > $PIDFILE
+
+echo "$LISTENER started!"
+exit 0
diff --git a/ueb-listener/src/main/scripts/stop-ueb-listener.sh b/ueb-listener/src/main/scripts/stop-ueb-listener.sh
new file mode 100644
index 00000000..2e3b4dd2
--- /dev/null
+++ b/ueb-listener/src/main/scripts/stop-ueb-listener.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+###
+# ============LICENSE_START=======================================================
+# openECOMP : SDN-C
+# ================================================================================
+# Copyright (C) 2017 ONAP Intellectual Property. All rights
+# reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+PROPERTY_DIR=${PROPERTY_DIR:-/opt/sdnc/data/properties}
+
+if [ -f ${PROPERTY_DIR}/dmaap-listener.properties ]
+then
+ LISTENER=dmaap-listener
+else
+ LISTENER=ueb-listener
+fi
+
+PIDFILE=/tmp/.${LISTENER}-pid
+UEBLISTENERROOT=${UEBLISTENERROOT:-/opt/app/ueb-listener}
+
+if [ -f $PIDFILE ]
+then
+ pid=$(cat $PIDFILE)
+ if [ "$pid" != "" ]
+ then
+ if kill -0 $pid
+ then
+ echo "Stopping $LISTENER"
+ kill $pid && rm $PIDFILE
+ exit 0
+ else
+ echo "$LISTENER not running"
+ exit 1
+ fi
+ else
+ echo "$LISTENER not running"
+ exit 1
+ fi
+fi
+
+
diff --git a/ueb-listener/src/site/apt/index.apt b/ueb-listener/src/site/apt/index.apt
new file mode 100644
index 00000000..dd9d3ec3
--- /dev/null
+++ b/ueb-listener/src/site/apt/index.apt
@@ -0,0 +1,46 @@
+~~~
+~~ ============LICENSE_START=======================================================
+~~ openECOMP : SDN-C
+~~ ================================================================================
+~~ Copyright (C) 2017 ONAP 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..356c9c95
--- /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 ONAP 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..70925039
--- /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=0
+feature_revision=1
+
+base_version=${release_name}.${sprint_number}.${feature_revision}
+
+release_version=${base_version}
+snapshot_version=${base_version}-SNAPSHOT
+