aboutsummaryrefslogtreecommitdiffstats
path: root/vnftools
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2017-02-15 15:09:44 -0500
committerDan Timoney <dtimoney@att.com>2017-02-15 15:11:54 -0500
commit1b47683183e05c39e55d14c904caf073b65825ef (patch)
tree30d6ed61324f59b014ab2e935979c6aaef6d7fba /vnftools
parent66fe1714388c1d1f82097de468ef3789b178743d (diff)
Initial commit for OpenECOMP SDN-C northbound
Change-Id: Iffe4d4fbcfd21ecbc1000238354094cc064298ce Signed-off-by: Dan Timoney <dtimoney@att.com>
Diffstat (limited to 'vnftools')
-rw-r--r--vnftools/.gitignore34
-rw-r--r--vnftools/features/pom.xml133
-rw-r--r--vnftools/features/src/main/resources/features.xml38
-rwxr-xr-xvnftools/installer/pom.xml137
-rw-r--r--vnftools/installer/src/assembly/assemble_installer_zip.xml58
-rw-r--r--vnftools/installer/src/assembly/assemble_mvnrepo_zip.xml48
-rw-r--r--vnftools/installer/src/main/resources/scripts/install-feature.sh40
-rw-r--r--vnftools/pom.xml49
-rw-r--r--vnftools/provider/pom.xml83
-rw-r--r--vnftools/provider/src/main/java/org/openecomp/sdnc/vnftools/VnfTools.java205
-rw-r--r--vnftools/provider/src/main/java/org/openecomp/sdnc/vnftools/VnfToolsActivator.java87
-rw-r--r--vnftools/provider/src/main/resources/l3ucpetools.properties23
12 files changed, 935 insertions, 0 deletions
diff --git a/vnftools/.gitignore b/vnftools/.gitignore
new file mode 100644
index 00000000..b73caf31
--- /dev/null
+++ b/vnftools/.gitignore
@@ -0,0 +1,34 @@
+#####standard .git ignore entries#####
+
+## IDE Specific Files ##
+org.eclipse.core.resources.prefs
+.classpath
+.project
+.settings
+.idea
+.externalToolBuilders
+maven-eclipse.xml
+workspace
+
+## Compilation Files ##
+*.class
+**/target
+target
+target-ide
+MANIFEST.MF
+
+## Misc Ignores (OS specific etc) ##
+bin/
+dist
+*~
+*.ipr
+*.iml
+*.iws
+classes
+out/
+.DS_STORE
+.metadata
+
+## Folders which contain auto generated source code ##
+yang-gen-config
+yang-gen-sal
diff --git a/vnftools/features/pom.xml b/vnftools/features/pom.xml
new file mode 100644
index 00000000..7f0797f3
--- /dev/null
+++ b/vnftools/features/pom.xml
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>vnftools</artifactId>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>vnftools-features</artifactId>
+ <name>VNF tools Plugin - Features</name>
+
+ <packaging>jar</packaging>
+
+ <dependencies>
+
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnftools-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>features-mdsal</artifactId>
+ <version>${odl.mdsal.features.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+
+ <scope>runtime</scope>
+ </dependency>
+
+
+ <!-- dependency for opendaylight-karaf-empty for use by testing -->
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>opendaylight-karaf-empty</artifactId>
+ <type>zip</type>
+ </dependency>
+
+
+ <dependency>
+ <!-- Required for launching the feature tests -->
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>features-test</artifactId>
+ <scope>test</scope>
+ <version>${odl.commons.opendaylight.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>features-yangtools</artifactId>
+ <version>${odl.yangtools.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <resources>
+ <resource>
+ <filtering>true</filtering>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>filter</id>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ <phase>generate-resources</phase>
+ </execution>
+ </executions>
+ </plugin>
+ <!-- launches the feature test, which validates that your karaf feature
+ can be installed inside of a karaf container. It doesn't validate that your
+ functionality works correctly, just that you have all of the dependent bundles
+ defined correctly.
+ <plugin>
+
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.16</version>
+ <configuration>
+ <systemPropertyVariables>
+ <karaf.distro.groupId>org.opendaylight.controller</karaf.distro.groupId>
+ <karaf.distro.artifactId>opendaylight-karaf-empty</karaf.distro.artifactId>
+ <karaf.distro.version>${odl.karaf.empty.distro.version}</karaf.distro.version>
+ </systemPropertyVariables>
+ <dependenciesToScan>
+ <dependency>org.opendaylight.yangtools:features-test</dependency>
+ </dependenciesToScan>
+ </configuration>
+ </plugin>
+ -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <goals>
+ <goal>attach-artifact</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <artifacts>
+ <artifact>
+ <file>${project.build.directory}/classes/${features.file}</file>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </artifact>
+ </artifacts>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/vnftools/features/src/main/resources/features.xml b/vnftools/features/src/main/resources/features.xml
new file mode 100644
index 00000000..8cd1ca27
--- /dev/null
+++ b/vnftools/features/src/main/resources/features.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : SDN-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+
+<features name="sdnc-vnftools-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+
+ <repository>mvn:org.opendaylight.controller/features-mdsal/${odl.mdsal.version}/xml/features</repository>
+
+
+ <feature name='sdnc-vnftools' description="sdnc-vnftools" version='${project.version}'>
+ <!-- Most applications will have a dependency on the ODL MD-SAL Broker -->
+ <feature version="${odl.mdsal.version}">odl-mdsal-broker</feature>
+ <feature>sdnc-sli</feature>
+ <bundle>mvn:org.openecomp.sdnc.northbound/vnftools-provider/${project.version}</bundle>
+ </feature>
+
+</features>
diff --git a/vnftools/installer/pom.xml b/vnftools/installer/pom.xml
new file mode 100755
index 00000000..acf7dccd
--- /dev/null
+++ b/vnftools/installer/pom.xml
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>vnftools</artifactId>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>vnftools-installer</artifactId>
+ <name>VNF Tools Plugin - Karaf Installer</name>
+ <packaging>pom</packaging>
+
+ <properties>
+ <application.name>sdnc-vnftools</application.name>
+ <features.boot>sdnc-vnftools</features.boot>
+ <features.repositories>mvn:org.openecomp.sdnc.northbound/vnftools-features/${project.version}/xml/features</features.repositories>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnftools-features</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnftools-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>maven-repo-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <attach>false</attach>
+ <finalName>stage/${application.name}-${project.version}</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_mvnrepo_zip.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ <execution>
+ <id>installer-zip</id>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <phase>package</phase>
+ <configuration>
+ <attach>true</attach>
+ <finalName>${application.name}-${project.version}-installer</finalName>
+ <descriptors>
+ <descriptor>src/assembly/assemble_installer_zip.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <transitive>false</transitive>
+ <outputDirectory>${project.build.directory}/assembly/system</outputDirectory>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
+ <useRepositoryLayout>true</useRepositoryLayout>
+ <addParentPoms>false</addParentPoms>
+ <copyPom>false</copyPom>
+ <includeGroupIds>org.openecomp.sdnc</includeGroupIds>
+ <excludeArtifactIds>sli-common,sli-provider,dblib-common,dblib-provider,sliPluginUtils-provider</excludeArtifactIds>
+ <scope>provided</scope>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>2.6</version>
+ <executions>
+ <execution>
+ <id>copy-version</id>
+ <goals>
+ <goal>copy-resources</goal>
+ </goals><!-- here the phase you need -->
+ <phase>validate</phase>
+ <configuration>
+ <outputDirectory>${basedir}/target/stage</outputDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources/scripts</directory>
+ <includes>
+ <include>install-feature.sh</include>
+ </includes>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+ </configuration>
+ </execution>
+
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+</project>
diff --git a/vnftools/installer/src/assembly/assemble_installer_zip.xml b/vnftools/installer/src/assembly/assemble_installer_zip.xml
new file mode 100644
index 00000000..0ce9b1ac
--- /dev/null
+++ b/vnftools/installer/src/assembly/assemble_installer_zip.xml
@@ -0,0 +1,58 @@
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : SDN-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level
+ as this file is suppose to be unzip on top of a karaf
+ distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target/stage/</directory>
+ <outputDirectory>${application.name}</outputDirectory>
+ <fileMode>755</fileMode>
+ <includes>
+ <include>*.sh</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>target/stage/</directory>
+ <outputDirectory>${application.name}</outputDirectory>
+ <fileMode>644</fileMode>
+ <excludes>
+ <exclude>*.sh</exclude>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+
+
+</assembly>
diff --git a/vnftools/installer/src/assembly/assemble_mvnrepo_zip.xml b/vnftools/installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100644
index 00000000..ba21ddac
--- /dev/null
+++ b/vnftools/installer/src/assembly/assemble_mvnrepo_zip.xml
@@ -0,0 +1,48 @@
+<!--
+ ============LICENSE_START=======================================================
+ openECOMP : SDN-C
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights
+ reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<!-- Defines how we build the .zip file which is our distribution. -->
+
+<assembly
+ xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level
+ as this file is suppose to be unzip on top of a karaf
+ distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target/assembly/</directory>
+ <outputDirectory>.</outputDirectory>
+ <excludes>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+
+
+</assembly>
diff --git a/vnftools/installer/src/main/resources/scripts/install-feature.sh b/vnftools/installer/src/main/resources/scripts/install-feature.sh
new file mode 100644
index 00000000..33e9b036
--- /dev/null
+++ b/vnftools/installer/src/main/resources/scripts/install-feature.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+###
+# ============LICENSE_START=======================================================
+# openECOMP : SDN-C
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights
+# reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}
+ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client}
+ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"}
+INSTALLERDIR=$(dirname $0)
+
+REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip
+
+if [ -f ${REPOZIP} ]
+then
+ unzip -d ${ODL_HOME} ${REPOZIP}
+else
+ echo "ERROR : repo zip ($REPOZIP) not found"
+ exit 1
+fi
+
+${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories}
+${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot}
diff --git a/vnftools/pom.xml b/vnftools/pom.xml
new file mode 100644
index 00000000..59a876f3
--- /dev/null
+++ b/vnftools/pom.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>sdnc-northbound</artifactId>
+ <version>1.0.0</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>pom</packaging>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnftools</artifactId>
+
+ <properties>
+ <feature-name>vnftools</feature-name>
+ </properties>
+
+ <name>VNF Tools Plugin</name>
+ <description>Provides execute nodes to Directed Graphs that use the VNF Module.</description>
+
+ <version>1.0.0</version>
+
+ <dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnftools-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnftools-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+
+ </dependencyManagement>
+
+ <modules>
+ <module>provider</module>
+ <module>features</module>
+ <module>installer</module>
+ </modules>
+</project>
diff --git a/vnftools/provider/pom.xml b/vnftools/provider/pom.xml
new file mode 100644
index 00000000..cce9e246
--- /dev/null
+++ b/vnftools/provider/pom.xml
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.sdnc.northbound</groupId>
+ <artifactId>vnftools</artifactId>
+ <version>1.0.0</version>
+ </parent>
+ <artifactId>vnftools-provider</artifactId>
+ <packaging>bundle</packaging>
+ <name>VNF Tools Plugin - Provider</name>
+ <url>http://maven.apache.org</url>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-common</artifactId>
+ <version>${sdnctl.sli.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ <version>${sdnctl.sli.version}</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>equinoxSDK381</groupId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ <version>${equinox.osgi.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sliPluginUtils-provider</artifactId>
+ <version>${sdnctl.slipluginutils.version}</version>
+ <type>jar</type>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>${bundle.plugin.version}</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>org.openecomp.sdnc.vnftools</Bundle-SymbolicName>
+ <Bundle-Activator>org.openecomp.sdnc.vnftools.VnfToolsActivator</Bundle-Activator>
+ <Export-Package>org.openecomp.sdnc.vnftools</Export-Package>
+ <Import-Package>org.openecomp.sdnc.*,org.osgi.framework.*,org.slf4j.*,java.net.*,org.apache.commons.*</Import-Package>
+ <Embed-Dependency>*;scope=compile|runtime;artifactId=!sli-common|org.eclipse.osgi|mysql-connector-java|slf4j-api|jcl-over-slf4j|xml-apis|InetAddress|commons-lang3</Embed-Dependency>
+ <Embed-Transitive>true</Embed-Transitive>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+
+ </build>
+</project>
diff --git a/vnftools/provider/src/main/java/org/openecomp/sdnc/vnftools/VnfTools.java b/vnftools/provider/src/main/java/org/openecomp/sdnc/vnftools/VnfTools.java
new file mode 100644
index 00000000..52864961
--- /dev/null
+++ b/vnftools/provider/src/main/java/org/openecomp/sdnc/vnftools/VnfTools.java
@@ -0,0 +1,205 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.vnftools;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.SvcLogicJavaPlugin;
+import org.openecomp.sdnc.sli.SliPluginUtils.SliPluginUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class VnfTools implements SvcLogicJavaPlugin {
+ // ========== FIELDS ==========
+
+ private static final Logger LOG = LoggerFactory.getLogger(VnfTools.class);
+
+ // ========== CONSTRUCTORS ==========
+
+ public VnfTools(Properties props) {
+ if (props != null) {
+ LOG.debug("props is not null.");
+ }
+ }
+
+
+ public void checkIfActivateReady( Map<String, String> parameters, SvcLogicContext ctx ) throws SvcLogicException {
+ LOG.debug("Checking if enough data is available to send the NCS Activate request...");
+
+ SliPluginUtils.checkParameters(parameters, new String[]{"return-key"}, LOG);
+ final String returnKey = parameters.get("return-key");
+ ctx.setAttribute(returnKey, "true");
+
+ }
+
+ /**
+ * DG node performs a java String.contains(String) and writes true or false
+ * to a key in context memory.
+ * @param parameters Hashmap in context memory must contain the following:
+ * <table border='1'>
+ * <thead>
+ * <th>Key</th>
+ * <th>Description</th>
+ * </thead>
+ * <tbody>
+ * <tr>
+ * <td>string_to_search</td>
+ * <td>String to perform java String.contains(String) on</td>
+ * </tr>
+ * <tr>
+ * <td>string_to_find</td>
+ * <td>String to find in the string_to_search</td>
+ * </tr>
+ * <tr>
+ * <td>result_ctx_string</td>
+ * <td>Context memory key to write the result ("true" or "false") to</td>
+ * </tr>
+ * </tbody>
+ * </table>
+ * @param ctx Reference to context memory
+ * @throws SvcLogicException
+ */
+ public void stringContains( Map<String, String> parameters, SvcLogicContext ctx ) throws SvcLogicException {
+ SliPluginUtils.checkParameters(parameters, new String[]{"string_to_search","string_to_find","result_ctx_string"}, LOG);
+ ctx.setAttribute(parameters.get("result_ctx_string"), Boolean.toString(parameters.get("string_to_search").contains(parameters.get("string_to_find"))));
+ }
+
+
+ public void generateName( Map<String, String> parameters, SvcLogicContext ctx ) throws SvcLogicException {
+ LOG.debug("generateName");
+
+ SliPluginUtils.checkParameters(parameters, new String[]{"base","suffix","return-path"}, LOG);
+
+ String base = parameters.get("base");
+ ctx.setAttribute( parameters.get("return-path"), base.substring(0, base.length() - 4) + parameters.get("suffix") + base.substring(base.length() - 2) );
+ }
+
+
+ private boolean matches(String str1, String str2) {
+ if (str1 == null) {
+ if (str2 == null) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ if (str2 == null) {
+ return false;
+ } else {
+ return str1.equals(str2);
+ }
+ }
+ }
+
+ private void setIfNotNull(String property, String value, SvcLogicContext ctx) {
+ if (value != null) {
+ LOG.debug("Setting " + property + " to " + value);
+ ctx.setAttribute(property, value);
+ }
+ }
+
+ /*
+ * Moves an array element from one index to another
+ */
+ private void copyArrayEntry(String srcRoot, String destRoot, SvcLogicContext ctx) {
+ LOG.debug("copyArrayEntry called: srcRoot=" + srcRoot + ", destRoot=" + destRoot);
+
+ // Record all of the source keys
+ List<String> keysToMove = new ArrayList<String>();
+ for (String key : ctx.getAttributeKeySet()) {
+ if (key.startsWith(srcRoot)) {
+ keysToMove.add(key);
+ }
+ }
+
+ // Now loop through and copy those keys to the destination, and then delete the source
+ for (String key : keysToMove) {
+ String suffix = key.substring(srcRoot.length());
+ LOG.debug("Move " + key + " to " + destRoot + suffix);
+ ctx.setAttribute(destRoot + suffix, ctx.getAttribute(key));
+ ctx.setAttribute(key, null);
+ }
+
+ }
+
+ public void printContext(Map<String, String> parameters, SvcLogicContext ctx) throws SvcLogicException {
+ if (parameters == null) {
+ throw new SvcLogicException("no parameters passed");
+ }
+
+ String fileName = parameters.get("filename");
+
+ if ((fileName == null) || (fileName.length() == 0)) {
+ throw new SvcLogicException("printContext requires 'filename' parameter");
+ }
+
+ PrintStream pstr = null;
+
+ try {
+ pstr = new PrintStream(new FileOutputStream(new File(fileName), true));
+ } catch (Exception e) {
+ throw new SvcLogicException("Cannot open file " + fileName, e);
+ }
+ pstr.println("#######################################");
+ for (String attr : ctx.getAttributeKeySet()) {
+ pstr.println(attr + " = " + ctx.getAttribute(attr));
+ }
+ pstr.flush();
+ pstr.close();
+ }
+
+ static int getArrayLength( SvcLogicContext ctx, String key ) {
+ try {
+ return Integer.parseInt(ctx.getAttribute(key));
+ } catch( NumberFormatException e ) {}
+
+ return 0;
+ }
+
+ static int getArrayLength( SvcLogicContext ctx, String key, String debug ) {
+ try {
+ return Integer.parseInt(ctx.getAttribute(key));
+ } catch( NumberFormatException e ) {
+ LOG.debug(debug);
+ }
+
+ return 0;
+ }
+
+ /**
+ * Returns true if string is null or empty.
+ * @param str
+ * @return
+ */
+ private static boolean stringIsBlank( String str ) {
+ return str == null || str.isEmpty();
+ }
+
+}
diff --git a/vnftools/provider/src/main/java/org/openecomp/sdnc/vnftools/VnfToolsActivator.java b/vnftools/provider/src/main/java/org/openecomp/sdnc/vnftools/VnfToolsActivator.java
new file mode 100644
index 00000000..7e8e615a
--- /dev/null
+++ b/vnftools/provider/src/main/java/org/openecomp/sdnc/vnftools/VnfToolsActivator.java
@@ -0,0 +1,87 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * openECOMP : SDN-C
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights
+ * reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.vnftools;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+
+import org.openecomp.sdnc.sli.ConfigurationException;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class VnfToolsActivator implements BundleActivator {
+
+ private static final String VNFTOOLS_PROP_VAR = "/vnftools.properties";
+ private static final String SDNC_CONFIG_DIR = "SDNC_CONFIG_DIR";
+
+ @SuppressWarnings("rawtypes")
+ private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>();
+
+ private static final Logger LOG = LoggerFactory.getLogger(VnfToolsActivator.class);
+
+ @Override
+ public void start(BundleContext ctx) throws Exception {
+ // Read properties
+ Properties props = new Properties();
+
+ String propDir = System.getenv(SDNC_CONFIG_DIR);
+ if (propDir == null) {
+ propDir = "/opt/sdnc/data/properties";
+ }
+
+ String propPath = propDir + VNFTOOLS_PROP_VAR;
+
+ File propFile = new File(propPath);
+
+ if (!propFile.exists()) {
+ props = null;
+ } else {
+
+ try {
+ props.load(new FileInputStream(propFile));
+ } catch (Exception e) {
+ throw new ConfigurationException("Could not load properties file " + propPath, e);
+ }
+ }
+ VnfTools plugin = new VnfTools(props);
+
+ LOG.info("Registering service " + plugin.getClass().getName());
+ registrations.add(ctx.registerService(plugin.getClass().getName(), plugin, null));
+ }
+
+ @Override
+ public void stop(BundleContext ctx) throws Exception {
+
+ for (@SuppressWarnings("rawtypes")
+ ServiceRegistration registration : registrations) {
+ registration.unregister();
+ registration = null;
+ }
+ }
+
+}
diff --git a/vnftools/provider/src/main/resources/l3ucpetools.properties b/vnftools/provider/src/main/resources/l3ucpetools.properties
new file mode 100644
index 00000000..1abb05a0
--- /dev/null
+++ b/vnftools/provider/src/main/resources/l3ucpetools.properties
@@ -0,0 +1,23 @@
+###
+# ============LICENSE_START=======================================================
+# openECOMP : SDN-C
+# ================================================================================
+# Copyright (C) 2017 AT&T Intellectual Property. All rights
+# reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+###
+
+changeorder.timeout=86400
+breakfix.timeout=7200