aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnand Chaturvedi <ac204h@att.com>2017-08-12 01:31:10 -0400
committerAnand Chaturvedi <ac204h@att.com>2017-08-14 16:11:44 -0400
commit0df7ab4f7ef0bfb21797775ec41fcdfb94e2270c (patch)
tree403ebc2806491d70aa8b494b0f2a92e5f1ae6a74
parent4971579332666d84721c2635b6d978f31b1ea5e9 (diff)
Initial commit for appc-config-params
Change-Id: I5805591892184b4456dd30639417d783d353a6a3 Signed-off-by: Anand Chaturvedi <ac204h@att.com> Issue-Id:APPC-9
-rw-r--r--appc-config/.gitignore32
-rw-r--r--appc-config/appc-config-params/.gitignore1
-rw-r--r--appc-config/appc-config-params/features/.gitignore1
-rw-r--r--appc-config/appc-config-params/features/pom.xml112
-rw-r--r--appc-config/appc-config-params/features/src/main/resources/features.xml53
-rw-r--r--appc-config/appc-config-params/installer/pom.xml127
-rw-r--r--appc-config/appc-config-params/installer/src/assembly/assemble_installer_zip.xml59
-rw-r--r--appc-config/appc-config-params/installer/src/assembly/assemble_mvnrepo_zip.xml47
-rw-r--r--appc-config/appc-config-params/installer/src/main/resources/scripts/install-feature.sh40
-rw-r--r--appc-config/appc-config-params/pom.xml49
-rw-r--r--appc-config/appc-config-params/provider/.gitignore1
-rw-r--r--appc-config/appc-config-params/provider/pom.xml97
-rw-r--r--appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/ParamsHandlerActivator.java68
-rw-r--r--appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/ParamsHandlerConstant.java53
-rw-r--r--appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/Parameter.java124
-rw-r--r--appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/PropertyDefinition.java54
-rw-r--r--appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/RequestKey.java49
-rw-r--r--appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/ResponseKey.java55
-rw-r--r--appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/parser/PropertyDefinitionNode.java249
-rw-r--r--appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/ArtificatTransformer.java85
-rw-r--r--appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessor.java66
-rw-r--r--appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessorFactory.java41
-rw-r--r--appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessorImpl.java399
-rw-r--r--appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/exceptions/ArtifactProcessorException.java46
-rw-r--r--appc-config/appc-config-params/provider/src/main/resources/adaptor.properties27
-rw-r--r--appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/parser/TestPropertyDefinitionNode.java131
-rw-r--r--appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java104
-rw-r--r--appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java265
-rw-r--r--appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java156
-rw-r--r--appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java170
-rw-r--r--appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestReadArtifact.java107
-rw-r--r--appc-config/appc-config-params/provider/src/test/resources/parser/merge-param.json26
-rw-r--r--appc-config/appc-config-params/provider/src/test/resources/parser/pd.yaml75
-rw-r--r--appc-config/appc-config-params/provider/src/test/resources/parser/request-param.json27
-rw-r--r--appc-config/appc-config-params/provider/src/test/resources/parser/system-param.json25
-rw-r--r--appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition.yml21
-rw-r--r--appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition2.yml21
-rw-r--r--appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition3.yml21
-rw-r--r--appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition4.yml21
-rw-r--r--appc-config/appc-config-params/provider/src/test/resources/tosca/ExpectedTosca.yml75
-rw-r--r--appc-config/appc-config-params/provider/src/test/resources/tosca/ReadArtifactNegetiveInputTosca.yml47
-rw-r--r--appc-config/appc-config-params/provider/src/test/resources/tosca/ReadArtifactPositiveInputTosca.yml47
-rw-r--r--appc-config/jacoco.execbin0 -> 9623 bytes
-rw-r--r--appc-config/pom.xml94
-rw-r--r--pom.xml2
45 files changed, 3370 insertions, 0 deletions
diff --git a/appc-config/.gitignore b/appc-config/.gitignore
new file mode 100644
index 000000000..4b38b789e
--- /dev/null
+++ b/appc-config/.gitignore
@@ -0,0 +1,32 @@
+# Target dirs in all projects
+**/target/*
+
+# Added for Intellij IDEA IDE
+**/.idea/*
+*.iml
+
+# Generated models and features
+**/bin/*
+
+# MANIFEST.MF is updated on every clean install
+**/src/main/resources/META-INF/
+**/pom.xml.versionsBackup
+pom.xml.versionsBackup
+
+.project
+
+*.prefs
+.classpath
+**/.classpath
+/target/
+logs/
+debug-logs/
+/.settings/
+**/*.iml
+/.idea/
+
+
+# MANIFEST.MF is updated on every clean install
+**/src/main/resources/META-INF/
+**/src/main/yang-gen-sal
+**/src/main/yang-gen-config
diff --git a/appc-config/appc-config-params/.gitignore b/appc-config/appc-config-params/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-config/appc-config-params/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-config/appc-config-params/features/.gitignore b/appc-config/appc-config-params/features/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-config/appc-config-params/features/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-config/appc-config-params/features/pom.xml b/appc-config/appc-config-params/features/pom.xml
new file mode 100644
index 000000000..52b7587a4
--- /dev/null
+++ b/appc-config/appc-config-params/features/pom.xml
@@ -0,0 +1,112 @@
+<?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.appc</groupId>
+ <artifactId>appc-config-params</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>appc-config-params-features</artifactId>
+ <name>Config Params Plugin - Features</name>
+ <packaging>jar</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-params-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.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>
+ <version>${odl.commons.opendaylight.version}</version>
+ <scope>test</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/appc-config/appc-config-params/features/src/main/resources/features.xml b/appc-config/appc-config-params/features/src/main/resources/features.xml
new file mode 100644
index 000000000..d02b8400c
--- /dev/null
+++ b/appc-config/appc-config-params/features/src/main/resources/features.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APPC
+ ================================================================================
+ 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.
+
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ ============LICENSE_END=========================================================
+ -->
+
+
+<features name="appc-config-params-${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.version}/xml/features</repository>
+
+ <feature name='appc-config-params' description="Application Controller Config Params"
+ version='${project.version}'>
+ <!-- Most applications will have a dependency on the ODL MD-SAL Broker -->
+ <feature version="${broker-mdsal.version}">odl-mdsal-broker</feature>
+ <feature version= '${sdnc.sli.version}'>sdnc-sli</feature>
+
+ <bundle>mvn:commons-lang/commons-lang/2.6</bundle>
+ <bundle>mvn:commons-collections/commons-collections/${common.collections.version}</bundle>
+
+ <bundle>wrap:mvn:com.fasterxml.jackson.core/jackson-databind/${jackson.version}</bundle>
+ <bundle>wrap:mvn:com.fasterxml.jackson.core/jackson-annotations/${jackson.version}</bundle>
+ <bundle>wrap:mvn:com.fasterxml.jackson.core/jackson-core/${jackson.version}</bundle>
+ <bundle>wrap:mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/${jackson.version}</bundle>
+ <bundle>wrap:mvn:org.yaml/snakeyaml/${snakeyaml.version}</bundle>
+ <bundle>wrap:mvn:org.openecomp.appc/appc-yang-generator/${project.version}</bundle>
+ <bundle>wrap:mvn:org.openecomp.sdc.common/openecomp-tosca-datatype/${tosca.datatype.version}</bundle>
+
+ <bundle>wrap:mvn:com.att.eelf/eelf-core/${eelf.version}</bundle>
+ <bundle>mvn:ch.qos.logback/logback-core/${logback.version}</bundle>
+ <bundle>mvn:ch.qos.logback/logback-classic/${logback.version}</bundle>
+ <bundle>mvn:org.openecomp.appc/appc-config-params-provider/${project.version}</bundle>
+ </feature>
+</features>
diff --git a/appc-config/appc-config-params/installer/pom.xml b/appc-config/appc-config-params/installer/pom.xml
new file mode 100644
index 000000000..f63b83766
--- /dev/null
+++ b/appc-config/appc-config-params/installer/pom.xml
@@ -0,0 +1,127 @@
+<?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.appc</groupId>
+ <artifactId>appc-config-params</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>appc-config-params-installer</artifactId>
+ <name>Config Component Params - Installer</name>
+ <packaging>pom</packaging>
+ <properties>
+ <application.name>appc-config-params</application.name>
+ <features.boot>appc-config-params</features.boot>
+ <features.repositories>mvn:org.openecomp.appc/appc-config-params-features/${project.version}/xml/features</features.repositories>
+ <include.transitive.dependencies>false</include.transitive.dependencies>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-params-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <exclusions>
+ <exclusion>
+ <groupId>*</groupId>
+ <artifactId>*</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-params-provider</artifactId>
+ <version>1.1.0-SNAPSHOT</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>
+ <appendAssemblyId>false</appendAssemblyId>
+ <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>
+ <appendAssemblyId>false</appendAssemblyId>
+ <attach>true</attach>
+ <finalName>${application.name}-${project.version}</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>
+ <excludeGroupIds>org.opendaylight</excludeGroupIds>
+ <scope>provided</scope>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <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/appc-config/appc-config-params/installer/src/assembly/assemble_installer_zip.xml b/appc-config/appc-config-params/installer/src/assembly/assemble_installer_zip.xml
new file mode 100644
index 000000000..706fab4f4
--- /dev/null
+++ b/appc-config/appc-config-params/installer/src/assembly/assemble_installer_zip.xml
@@ -0,0 +1,59 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APP-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=========================================================
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ -->
+
+<!-- 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>params</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/appc-config/appc-config-params/installer/src/assembly/assemble_mvnrepo_zip.xml b/appc-config/appc-config-params/installer/src/assembly/assemble_mvnrepo_zip.xml
new file mode 100644
index 000000000..f7e0c9586
--- /dev/null
+++ b/appc-config/appc-config-params/installer/src/assembly/assemble_mvnrepo_zip.xml
@@ -0,0 +1,47 @@
+<!--
+ ============LICENSE_START=======================================================
+ ONAP : APP-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=========================================================
+ ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ -->
+
+<!-- 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>params</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+
+ <!-- we want "system" and related files right at the root level
+ as this file is suppose to be unzip on top of a karaf
+ distro. -->
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>target/assembly/</directory>
+ <outputDirectory>.</outputDirectory>
+ <excludes>
+ </excludes>
+ </fileSet>
+ </fileSets>
+
+</assembly>
diff --git a/appc-config/appc-config-params/installer/src/main/resources/scripts/install-feature.sh b/appc-config/appc-config-params/installer/src/main/resources/scripts/install-feature.sh
new file mode 100644
index 000000000..d3d2ea6e7
--- /dev/null
+++ b/appc-config/appc-config-params/installer/src/main/resources/scripts/install-feature.sh
@@ -0,0 +1,40 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : APP-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=========================================================
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+###
+
+#!/bin/bash
+
+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 -n -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/appc-config/appc-config-params/pom.xml b/appc-config/appc-config-params/pom.xml
new file mode 100644
index 000000000..307baceb5
--- /dev/null
+++ b/appc-config/appc-config-params/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.appc</groupId>
+ <artifactId>appc-config</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <packaging>pom</packaging>
+ <artifactId>appc-config-params</artifactId>
+
+ <name>Config Params Node</name>
+ <description>Config Params Utilities for DG</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+
+ <dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-params-features</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-params-provider</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+
+ </dependencyManagement>
+
+
+ <modules>
+ <module>provider</module>
+ <module>features</module>
+ <module>installer</module>
+ </modules>
+</project>
diff --git a/appc-config/appc-config-params/provider/.gitignore b/appc-config/appc-config-params/provider/.gitignore
new file mode 100644
index 000000000..b83d22266
--- /dev/null
+++ b/appc-config/appc-config-params/provider/.gitignore
@@ -0,0 +1 @@
+/target/
diff --git a/appc-config/appc-config-params/provider/pom.xml b/appc-config/appc-config-params/provider/pom.xml
new file mode 100644
index 000000000..2619ca34a
--- /dev/null
+++ b/appc-config/appc-config-params/provider/pom.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config-params</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>appc-config-params-provider</artifactId>
+ <packaging>bundle</packaging>
+ <name>Config Params - Provider</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>equinoxSDK381</groupId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ <version>${equinox.osgi.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdnc.core</groupId>
+ <artifactId>sli-provider</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.sdc.common</groupId>
+ <artifactId>openecomp-tosca-datatype</artifactId>
+ <version>${tosca.datatype.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-yaml</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</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.config.params</Bundle-SymbolicName>
+ <Bundle-Activator>org.openecomp.sdnc.config.params.ParamsHandlerActivator</Bundle-Activator>
+ <Export-Package>org.openecomp.sdnc.config.params,org.openecomp.sdnc.config.params.data,
+ org.openecomp.sdnc.config.params.parser,org.openecomp.sdnc.config.params.transformer,
+ org.openecomp.sdnc.config.params.transformer.tosca,org.openecomp.sdnc.config.params.transformer.tosca.exceptions</Export-Package>
+ <Import-Package>*</Import-Package>
+ <DynamicImport-Package>*</DynamicImport-Package>
+ </instructions>
+ <manifestLocation>${project.basedir}/src/main/resources/META-INF</manifestLocation>
+ </configuration>
+ </plugin>
+ </plugins>
+ <pluginManagement>
+ <plugins>
+ <!--This plugin's configuration is used to store Eclipse m2e settings
+ only. It has no influence on the Maven build itself. -->
+ </plugins>
+ </pluginManagement>
+ </build>
+</project>
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/ParamsHandlerActivator.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/ParamsHandlerActivator.java
new file mode 100644
index 000000000..f248159de
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/ParamsHandlerActivator.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.openecomp.sdnc.config.params.parser.PropertyDefinitionNode;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+public class ParamsHandlerActivator implements BundleActivator{
+
+ private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>();
+
+
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(ParamsHandlerActivator.class);
+
+ @Override
+ public void start(BundleContext ctx) throws Exception
+ {
+
+ try {
+ PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
+ log.info("Registering service "+ propertyDefinitionNode.getClass().getName());
+ registrations.add(ctx.registerService(propertyDefinitionNode.getClass().getName(), propertyDefinitionNode, null));
+ log.info("Registering service sccessful for "+ propertyDefinitionNode.getClass().getName());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+ @Override
+ public void stop(BundleContext arg0) throws Exception
+ {
+ for (ServiceRegistration registration: registrations)
+ {
+ registration.unregister();
+ registration = null;
+ }
+
+ }
+
+}
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/ParamsHandlerConstant.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/ParamsHandlerConstant.java
new file mode 100644
index 000000000..4b541982c
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/ParamsHandlerConstant.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params;
+
+public class ParamsHandlerConstant {
+
+ public static String STRING_ENCODING = "utf-8";
+ public static String Y = "Y";
+ public static String N = "N";
+ public static String DATA_TYPE_TEXT = "TEXT";
+ public static String DATA_TYPE_JSON = "JSON";
+ public static String DATA_TYPE_XML = "XML";
+ public static String DATA_TYPE_SQL = "SQL";
+
+
+ public static String INPUT_PARAM_PD_CONTENT = "pdContent";
+ public static String INPUT_PARAM_SYSTEM_NAME = "systemName";
+ public static String INPUT_PARAM_JSON_DATA = "jsonData";
+ public static String INPUT_PARAM_MERGE__JSON_DATA = "mergeJsonData";
+
+
+ public static String INPUT_PARAM_REQUEST_DATA = "requestData";
+ public static String INPUT_PARAM_RESPONSE_PRIFIX = "responsePrefix";
+ public static String OUTPUT_PARAM_CONFIGURATION_PARAMETER = "configuration-parameters";
+
+
+
+ public static String OUTPUT_PARAM_STATUS = "status";
+ public static String OUTPUT_PARAM_ERROR_MESSAGE = "error-message";
+ public static String OUTPUT_STATUS_SUCCESS = "success";
+ public static String OUTPUT_STATUS_FAILURE = "failure";
+
+}
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/Parameter.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/Parameter.java
new file mode 100644
index 000000000..6a03eddb3
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/Parameter.java
@@ -0,0 +1,124 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params.data;
+
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Parameter {
+ private String name;
+ private String description;
+ private String type;
+ private boolean required;
+ private String source;
+
+ @JsonProperty("rule-type")
+ private String ruleType;
+
+ @JsonProperty("default")
+ private String defaultValue;
+
+ @JsonProperty("request-keys")
+ private List<RequestKey> requestKeys;
+
+ @JsonProperty("response-keys")
+ private List<ResponseKey> responseKeys;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public boolean isRequired() {
+ return required;
+ }
+
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+
+ public String getSource() {
+ return source;
+ }
+
+ public void setSource(String source) {
+ this.source = source;
+ }
+
+ public String getRuleType() {
+ return ruleType;
+ }
+
+ public void setRuleType(String ruleType) {
+ this.ruleType = ruleType;
+ }
+
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ public List<RequestKey> getRequestKeys() {
+ return requestKeys;
+ }
+
+ public void setRequestKeys(List<RequestKey> requestKeys) {
+ this.requestKeys = requestKeys;
+ }
+
+ public List<ResponseKey> getResponseKeys() {
+ return responseKeys;
+ }
+
+ public void setResponseKeys(List<ResponseKey> responseKeys) {
+ this.responseKeys = responseKeys;
+ }
+
+
+
+
+
+}
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/PropertyDefinition.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/PropertyDefinition.java
new file mode 100644
index 000000000..0fd1b92c8
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/PropertyDefinition.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params.data;
+
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class PropertyDefinition {
+ public String kind = "Property Definition";
+ public String version = "V1";
+
+ @JsonProperty("vnf-parameter-list")
+ public List<Parameter> parameters;
+ public String getKind() {
+ return kind;
+ }
+ public void setKind(String kind) {
+ this.kind = kind;
+ }
+ public String getVersion() {
+ return version;
+ }
+ public void setVersion(String version) {
+ this.version = version;
+ }
+ public List<Parameter> getParameters() {
+ return parameters;
+ }
+ public void setParameters(List<Parameter> parameters) {
+ this.parameters = parameters;
+ }
+
+}
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/RequestKey.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/RequestKey.java
new file mode 100644
index 000000000..c1cf0e19a
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/RequestKey.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params.data;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class RequestKey{
+ @JsonProperty("key-name")
+ private String keyName;
+ @JsonProperty("key-value")
+ private String keyValue;
+
+ public String getKeyName() {
+ return keyName;
+ }
+ public void setKeyName(String keyName) {
+ this.keyName = keyName;
+ }
+ public String getKeyValue() {
+ return keyValue;
+ }
+ public void setKeyValue(String keyValue) {
+ this.keyValue = keyValue;
+ }
+
+
+
+
+}
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/ResponseKey.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/ResponseKey.java
new file mode 100644
index 000000000..9e394e465
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/data/ResponseKey.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params.data;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class ResponseKey{
+ @JsonProperty("unique-key-name")
+ private String uniqueKeyName;
+ @JsonProperty("unique-key-value")
+ private String uniqueKeyValue;
+ @JsonProperty("field-key-name")
+ private String fieldKeyName;
+
+ public String getUniqueKeyName() {
+ return uniqueKeyName;
+ }
+ public void setUniqueKeyName(String uniqueKeyName) {
+ this.uniqueKeyName = uniqueKeyName;
+ }
+ public String getUniqueKeyValue() {
+ return uniqueKeyValue;
+ }
+ public void setUniqueKeyValue(String uniqueKeyValue) {
+ this.uniqueKeyValue = uniqueKeyValue;
+ }
+ public String getFieldKeyName() {
+ return fieldKeyName;
+ }
+ public void setFieldKeyName(String fieldKeyName) {
+ this.fieldKeyName = fieldKeyName;
+ }
+
+
+}
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/parser/PropertyDefinitionNode.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/parser/PropertyDefinitionNode.java
new file mode 100644
index 000000000..a19c2b927
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/parser/PropertyDefinitionNode.java
@@ -0,0 +1,249 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params.parser;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.sdnc.config.params.ParamsHandlerConstant;
+import org.openecomp.sdnc.config.params.data.Parameter;
+import org.openecomp.sdnc.config.params.data.PropertyDefinition;
+import org.openecomp.sdnc.sli.SvcLogicContext;
+import org.openecomp.sdnc.sli.SvcLogicException;
+import org.openecomp.sdnc.sli.SvcLogicJavaPlugin;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
+
+public class PropertyDefinitionNode implements SvcLogicJavaPlugin{
+
+
+ private static final EELFLogger log = EELFManager.getInstance().getLogger(PropertyDefinitionNode.class);
+
+ public void processMissingParamKeys(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+ log.info("Received processParamKeys call with params : " + inParams);
+ String responsePrefix = inParams.get(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+ try{
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+
+ String requestParamJson = inParams.get(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA);
+ String pdContent = inParams.get(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT);
+
+ if(StringUtils.isBlank(pdContent)){
+ throw new Exception("Request Param (pdContent) is Missing ..");
+ }
+
+ if(StringUtils.isBlank(requestParamJson)){
+ throw new Exception("Request Param (jsonData) is Missing ..");
+ }
+
+ PropertyDefinition propertyDefinition = parsePDContent(pdContent);
+ if(propertyDefinition != null){
+ requestParamJson = mergeMissingRequestParamFromPD(propertyDefinition, requestParamJson);
+ ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER, requestParamJson);
+ }
+
+ ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+ } catch (Exception e) {
+ ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
+ ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+ log.error("Failed in merging data to template " + e.getMessage());
+ throw new SvcLogicException(e.getMessage());
+ }
+ }
+
+ public void processExternalSystemParamKeys(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+ log.info("Received processExternalSystemParamKeys call with params : " + inParams);
+ String responsePrefix = inParams.get(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+ try{
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+
+ String requestParamJson = inParams.get(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA);
+ String pdContent = inParams.get(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT);
+ String systemName = inParams.get(ParamsHandlerConstant.INPUT_PARAM_SYSTEM_NAME);
+
+
+ if(StringUtils.isBlank(pdContent)){
+ throw new Exception("Request Param (pdContent) is Missing ..");
+ }
+
+ if(StringUtils.isBlank(requestParamJson)){
+ throw new Exception("Request Param (jsonData) is Missing ..");
+ }
+
+ if(StringUtils.isBlank(systemName)){
+ throw new Exception("Request Param (systemName) is Missing ..");
+ }
+
+ PropertyDefinition propertyDefinition = parsePDContent(pdContent);
+ if(propertyDefinition != null){
+ getSystemRequestParamInfoFromPD(propertyDefinition, requestParamJson, systemName, ctx);
+ }
+
+ ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+ } catch (Exception e) {
+ ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
+ ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+ log.error("Failed in merging data to template " + e.getMessage());
+ throw new SvcLogicException(e.getMessage());
+ }
+ }
+
+
+ public void mergeJsonData(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException {
+ log.info("Received mergeJsonData call with params : " + inParams);
+ String responsePrefix = inParams.get(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX);
+ try{
+ responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : "";
+
+ String requestParamJson = inParams.get(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA);
+ String mergeJsonData = inParams.get(ParamsHandlerConstant.INPUT_PARAM_MERGE__JSON_DATA);
+
+ if(StringUtils.isBlank(requestParamJson)){
+ throw new Exception("Request Param (jsonData) is Missing ..");
+ }
+
+ if(StringUtils.isBlank(mergeJsonData)){
+ throw new Exception("Request Param (mergeJsonData) is Missing ..");
+ }
+
+ requestParamJson = mergeJson(requestParamJson, mergeJsonData);
+ ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER, requestParamJson);
+ ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+ } catch (Exception e) {
+ ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_STATUS, ParamsHandlerConstant.OUTPUT_STATUS_FAILURE);
+ ctx.setAttribute(responsePrefix + ParamsHandlerConstant.OUTPUT_PARAM_ERROR_MESSAGE,e.getMessage());
+ log.error("Failed in merging data to template " + e.getMessage());
+ throw new SvcLogicException(e.getMessage());
+ }
+ }
+
+
+ /* */
+
+ private PropertyDefinition parsePDContent(String pdContent) throws JsonParseException, JsonMappingException, IOException{
+ PropertyDefinition propertyDefinition = null;
+ if(StringUtils.isNotBlank(pdContent)){
+ ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+ propertyDefinition = mapper.readValue(pdContent, PropertyDefinition.class);
+ }
+ return propertyDefinition;
+ }
+
+
+ private String mergeMissingRequestParamFromPD(PropertyDefinition propertyDefinition, String requestParamJson) throws Exception{
+
+ if(propertyDefinition == null){
+ throw new Exception("PropertyDefinition is Missing ..");
+ }
+
+ if(StringUtils.isBlank(requestParamJson)){
+ throw new Exception("Request Param is Missing ..");
+ }
+
+ ObjectMapper mapper = new ObjectMapper();
+ Map<String, String> requestParamMap = mapper.readValue(requestParamJson, HashMap.class);
+ if(requestParamMap != null){
+ List<Parameter> parameters = propertyDefinition.getParameters();
+ for (Parameter parameter : parameters) {
+ if(parameter != null){
+
+ log.info("Checking Key " + parameter.getName() + ":: Source :" +parameter.getSource());
+ // Add Only non external system keys,If it is not present in request Params
+ if( !requestParamMap.containsKey(parameter.getName())
+ && StringUtils.isBlank(parameter.getSource())
+ ){
+ log.info("Adding New Key " + parameter.getName());
+ requestParamMap.put(parameter.getName(), parameter.getDefaultValue());
+ }
+ }
+ }
+ requestParamJson = mapper.writeValueAsString(requestParamMap);
+ log.info("Processed Request Param " + requestParamJson);
+ }
+
+ return requestParamJson;
+ }
+
+ private void getSystemRequestParamInfoFromPD(PropertyDefinition propertyDefinition, String requestParamJson, String systemName, SvcLogicContext ctx) throws Exception{
+
+ if(propertyDefinition == null){
+ throw new Exception("PropertyDefinition is Missing ..");
+ }
+
+ if(StringUtils.isBlank(requestParamJson)){
+ throw new Exception("Request Param is Missing ..");
+ }
+
+ ObjectMapper mapper = new ObjectMapper();
+ Map<String, String> requestParamMap = mapper.readValue(requestParamJson, HashMap.class);
+ if(requestParamMap != null){
+ List<Parameter> parameters = propertyDefinition.getParameters();
+
+ List<String> externalSystemKeys = new ArrayList<String>();
+ for (Parameter parameter : parameters) {
+ if(parameter != null){
+ if( !requestParamMap.containsKey(parameter.getName()) && StringUtils.isNotBlank(parameter.getSource()) ){
+ log.info("Adding New System Key " + parameter.getName() + ":"+ mapper.writeValueAsString(parameter));
+ externalSystemKeys.add(parameter.getName());
+ ctx.setAttribute(systemName +"."+parameter.getName(), mapper.writeValueAsString(parameter));
+ }
+ }
+ }
+
+ String systemKeys = systemName+".keys";
+ ctx.setAttribute(systemKeys, mapper.writeValueAsString(externalSystemKeys));
+ }
+ }
+
+
+ private String mergeJson(String requestParamJson, String systemParamJson) throws Exception {
+ ObjectMapper mapper = new ObjectMapper();
+ Map<String, String> requestParamMap = mapper.readValue(requestParamJson, HashMap.class);
+ if(requestParamMap != null){
+ Map<String, String> systemParamMap = mapper.readValue(systemParamJson, HashMap.class);
+ if(systemParamMap != null){
+ for (String systemParamKey : systemParamMap.keySet()) {
+ log.trace("Megging System Key Values " + systemParamKey);
+ requestParamMap.put( systemParamKey , systemParamMap.get(systemParamKey));
+ }
+ }
+ requestParamJson = mapper.writeValueAsString(requestParamMap);
+ log.info("Processed Request Param " + requestParamJson);
+ }
+
+ return requestParamJson;
+ }
+
+
+
+
+}
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/ArtificatTransformer.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/ArtificatTransformer.java
new file mode 100644
index 000000000..c646d9bd6
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/ArtificatTransformer.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params.transformer;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+import org.openecomp.sdnc.config.params.data.Parameter;
+import org.openecomp.sdnc.config.params.data.PropertyDefinition;
+
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
+
+public class ArtificatTransformer {
+
+
+ public String convertPDToYaml(PropertyDefinition propertyDefinition) throws JsonParseException, JsonMappingException, IOException{
+ String yamlContent = null;
+ if(propertyDefinition != null){
+ ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+ mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
+ yamlContent = mapper.writeValueAsString(propertyDefinition);
+ }
+ return yamlContent;
+ }
+
+ public String transformYamlToJson(String yaml) throws JsonParseException, JsonMappingException, IOException {
+ ObjectMapper yamlReader = new ObjectMapper(new YAMLFactory());
+ Object obj = yamlReader.readValue(yaml, Object.class);
+ ObjectMapper jsonWriter = new ObjectMapper();
+ jsonWriter.enable(SerializationFeature.INDENT_OUTPUT);
+ return jsonWriter.writeValueAsString(obj);
+ }
+
+ public PropertyDefinition convertYAMLToPD(String pdContent) throws JsonParseException, JsonMappingException, IOException{
+ PropertyDefinition propertyDefinition = null;
+ if(StringUtils.isNotBlank(pdContent)){
+ ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+ propertyDefinition = mapper.readValue(pdContent, PropertyDefinition.class);
+ }
+ return propertyDefinition;
+ }
+
+ public String convertYAMLToParams(String pdContent) throws JsonParseException, JsonMappingException, IOException{
+ String paramJson = null;
+ if(StringUtils.isNotBlank(pdContent)){
+ paramJson = convertPdToParams(convertYAMLToPD(pdContent));
+ }
+ return paramJson;
+ }
+
+ public String convertPdToParams(PropertyDefinition propertyDefinition) throws JsonParseException, JsonMappingException, IOException{
+ String paramJson = null;
+ if(propertyDefinition != null && propertyDefinition.getParameters() != null){
+ List<Parameter> parameters = propertyDefinition.getParameters();
+
+ }
+ return paramJson;
+ }
+
+}
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessor.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessor.java
new file mode 100644
index 000000000..b4c688075
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessor.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params.transformer.tosca;
+
+import org.openecomp.sdnc.config.params.data.PropertyDefinition;
+import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
+
+import java.io.OutputStream;
+
+public interface ArtifactProcessor
+{
+ /**
+ * Generates Tosca artifact from PropertyDefinition object.
+ *
+ * @param artifact
+ * PropertyDefinition object which is to be converted to Tosca.
+ * @param stream
+ * Stream to which the generated Tosca is to be written.
+ * @throws ArtifactProcessorException
+ * If the Tosca Generation failed
+ */
+ void generateArtifact(PropertyDefinition artifact, OutputStream stream) throws ArtifactProcessorException;
+
+ /**
+ * Generates Tosca artifact from PropertyDefinition string.
+ *
+ * @param artifact
+ * PropertyDefinition string which is to be converted to Tosca.
+ * @param stream
+ * Stream to which the generated Tosca is to be written.
+ * @throws ArtifactProcessorException
+ * If the Tosca Generation failed
+ */
+ void generateArtifact(String artifact, OutputStream stream) throws ArtifactProcessorException;
+
+ /**
+ * Generates the PropertyDefinition object from a Tosca artifact.
+ *
+ * @param toscaArtifact
+ * Tosca artifact which is to be converted.
+ * @return PropertyDefinition object generated from Tosca
+ * @throws ArtifactProcessorException
+ * If the PropertyDefinition Generation failed
+ */
+ PropertyDefinition readArtifact(String toscaArtifact) throws ArtifactProcessorException;
+}
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessorFactory.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessorFactory.java
new file mode 100644
index 000000000..65da0c4f6
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessorFactory.java
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params.transformer.tosca;
+
+/**
+ * Created by pranavdi on 3/29/2017.
+ */
+public class ArtifactProcessorFactory
+{
+ private static class InstanceHolder
+ {
+ private static ArtifactProcessorImpl instance = new ArtifactProcessorImpl();
+ }
+
+ private ArtifactProcessorFactory(){}
+
+ public static ArtifactProcessor getArtifactProcessor()
+ {
+ return InstanceHolder.instance;
+ }
+}
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessorImpl.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessorImpl.java
new file mode 100644
index 000000000..754676c26
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/ArtifactProcessorImpl.java
@@ -0,0 +1,399 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params.transformer.tosca;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
+import org.apache.commons.lang.StringUtils;
+
+import org.openecomp.sdc.tosca.datatypes.model.*;
+import org.openecomp.sdc.tosca.services.YamlUtil;
+import org.openecomp.sdnc.config.params.data.Parameter;
+import org.openecomp.sdnc.config.params.data.PropertyDefinition;
+import org.openecomp.sdnc.config.params.data.RequestKey;
+import org.openecomp.sdnc.config.params.data.ResponseKey;
+import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
+import org.slf4j.MDC;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import static com.att.eelf.configuration.Configuration.MDC_SERVICE_NAME;
+
+public class ArtifactProcessorImpl implements ArtifactProcessor
+{
+ private static final String DERIVEDFROM = "org.openecomp.genericvnf";
+ private static final EELFLogger Log = EELFManager.getInstance().getLogger(ArtifactProcessorImpl.class);
+ private static final String EQUALSENCODING = "&equals;";
+ private static final String COLONENCODING = "&colon;";
+ private static final String COMMAENCODING = "&comma;";
+ private static final String GREATERTHANENCODING = "&gt;";
+ private static final String LESSTHANENCODING = "&lt;";
+
+ @Override
+ public void generateArtifact(PropertyDefinition artifact, OutputStream stream) throws ArtifactProcessorException
+ {
+ MDC.clear();
+ MDC.put(MDC_SERVICE_NAME,"ArtifactGenerator");
+ Log.info("Entered into generateArtifact");
+ if(!StringUtils.isBlank(artifact.getKind())) {
+ logArtifact(artifact);
+ ServiceTemplate serviceTemplate = new ServiceTemplate();
+
+ addNodeType(artifact, serviceTemplate);
+
+ TopologyTemplate topologyTemplate = new TopologyTemplate();
+ serviceTemplate.setTopology_template(topologyTemplate);
+ addNodeTemplate(artifact, serviceTemplate);
+
+ String tosca = new YamlUtil().objectToYaml(serviceTemplate);
+ OutputStreamWriter writer = new OutputStreamWriter(stream);
+ try {
+ writer.write(tosca);
+ writer.flush();
+ } catch (IOException e) {
+ Log.error("Error writing to outputstream", e);
+ throw new ArtifactProcessorException(e);
+ } finally {
+ try {
+ writer.close();
+ } catch (IOException e) {
+ Log.error("Error while closing outputstream writer", e);
+ }
+ MDC.clear();
+ }
+ }
+ else
+ {
+ Log.error("Kind in PropertyDefinition is blank or null");
+ throw new ArtifactProcessorException("Kind in PropertyDefinition is blank or null");
+ }
+ }
+
+ @Override
+ public void generateArtifact(String artifact, OutputStream stream) throws ArtifactProcessorException
+ {
+ ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+ try {
+ PropertyDefinition pd = mapper.readValue(artifact, PropertyDefinition.class);
+ generateArtifact(pd, stream);
+ }
+ catch (IOException e)
+ {
+ Log.error("Error parsing property definition content = "+ artifact,e);
+ throw new ArtifactProcessorException(e);
+ }
+ }
+
+ @Override
+ public PropertyDefinition readArtifact(String toscaArtifact) throws ArtifactProcessorException{
+ Log.info("Entered into readArtifact.");
+ Log.info("Received ToscaArtifact:\n" + toscaArtifact);
+
+ PropertyDefinition propertyDefinitionObj = new PropertyDefinition();
+ ServiceTemplate serviceTemplate = new YamlUtil().yamlToObject(toscaArtifact, ServiceTemplate.class);
+
+ //mapping parameters
+ Map<String, NodeType> nodeTypeMap = serviceTemplate.getNode_types();
+ Map<String, NodeTemplate> nodeTemplateMap = serviceTemplate.getTopology_template().getNode_templates();
+
+ String nodeTemplateName = nodeTemplateMap.keySet().toArray(new String[0])[0];
+ NodeTemplate nodeTemplate = nodeTemplateMap.get(nodeTemplateName);
+ Map<String, Object> nodeTemplateProperties = nodeTemplate.getProperties();
+
+ String kind = nodeTypeMap.keySet().toArray(new String[0])[0];
+ NodeType nodeType = nodeTypeMap.get(kind);
+ String version = nodeType.getVersion();
+ Log.info("ReadArtifact for "+ kind + " with version "+version);
+ propertyDefinitionObj.setKind(kind);
+ propertyDefinitionObj.setVersion(version);
+
+ List<Parameter> parameterList = new LinkedList<>();
+
+ Map<String, org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition> propertyDefinitionFromTOSCA = nodeType.getProperties();
+ if(null != propertyDefinitionFromTOSCA){
+ for (String propertyName : propertyDefinitionFromTOSCA.keySet()) {
+ org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition propertyDefinition = propertyDefinitionFromTOSCA.get(propertyName);
+
+ Parameter parameter = new Parameter();
+ parameter.setName(propertyName);
+
+ if (propertyDefinition.get_default() != null) {
+ parameter.setDefaultValue(propertyDefinition.get_default().toString());
+ }
+ parameter.setDescription(propertyDefinition.getDescription());
+ if (null != propertyDefinition.getRequired()) {
+ parameter.setRequired(propertyDefinition.getRequired());
+ } else {
+ parameter.setRequired(false);
+ }
+
+ if (StringUtils.isNotEmpty(propertyDefinition.getType())) {
+ parameter.setType(propertyDefinition.getType());
+ }
+
+ String propertValueExpr = (String) nodeTemplateProperties.get(propertyName);
+ String[] stringTokens = parsePropertyValueExpression(propertValueExpr);
+ String ruleType = stringTokens[0].substring(stringTokens[0].indexOf('=')+1,stringTokens[0].length()).replaceAll(">","").trim();
+ String responseExpression = stringTokens[1].substring(stringTokens[1].indexOf('=')+1,stringTokens[1].length());
+ String source = stringTokens[2].substring(stringTokens[2].indexOf('=')+1,stringTokens[2].length()).replaceAll(">","").trim();
+ String requestExpression = stringTokens[3].substring(stringTokens[3].indexOf('=')+1,stringTokens[3].length());
+
+ List<RequestKey> requestKeys = readRequestKeys(requestExpression);
+ List<ResponseKey> responseKeys = readResponseKeys(responseExpression);
+
+ parameter.setRuleType(ruleType);
+ parameter.setSource(source);
+ parameter.setRequestKeys(requestKeys);
+ parameter.setResponseKeys(responseKeys);
+
+ parameterList.add(parameter);
+
+ }
+ }
+ propertyDefinitionObj.setParameters(parameterList);
+ Log.info("Exiting from readArtifact. ");
+ return propertyDefinitionObj;
+ }
+
+ private List<ResponseKey> readResponseKeys(String responseExpression) throws ArtifactProcessorException {
+ Log.info("Entered into readResponseKeys.");
+ List<ResponseKey> responseKeyList = null;
+ String expression;
+ expression = responseExpression.replaceAll("<", "").replaceAll(">", "").trim();
+ if (StringUtils.isNotEmpty(expression)) {
+ responseKeyList = new ArrayList<>();
+
+ String[] responseKeys = expression.split(",");
+ for (String responseKeyStr : responseKeys) {
+ ResponseKey responseKey = new ResponseKey();
+ try {
+ responseKey.setUniqueKeyName(responseKeyStr.split(":")[0].replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">").replaceAll(COLONENCODING, ":").replaceAll(COMMAENCODING, ",").replaceAll(EQUALSENCODING,"=").trim());
+ responseKey.setUniqueKeyValue(responseKeyStr.split(":")[1].replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">").replaceAll(COLONENCODING, ":").replaceAll(COMMAENCODING, ",").replaceAll(EQUALSENCODING,"=").trim());
+ responseKey.setFieldKeyName(responseKeyStr.split(":")[2].replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">").replaceAll(COLONENCODING, ":").replaceAll(COMMAENCODING, ",").replaceAll(EQUALSENCODING,"=").trim());
+ } catch (ArrayIndexOutOfBoundsException e) {
+ Log.error("Invalid response attribute found :" + responseKeyStr + "due to "+e);
+ throw new ArtifactProcessorException("Invalid response attribute found :" + responseKeyStr);
+ }
+ responseKeyList.add(responseKey);
+ }
+ }
+ Log.info("Exiting from readResponseKeys.");
+ return responseKeyList;
+ }
+
+ private List<RequestKey> readRequestKeys(String requestExpression) {
+ Log.info("Entered into readRequestKeys.");
+ List<RequestKey> requestKeyList = null;
+ String expression;
+ expression = requestExpression.replaceAll("<","").replaceAll(">","").trim();
+ if(StringUtils.isNotEmpty(expression)){
+ requestKeyList = new ArrayList<>();
+ String[] requestKeys = expression.split(",");
+ for(String responseKeyStr :requestKeys){
+ RequestKey requestKey = new RequestKey();
+ requestKey.setKeyName(responseKeyStr.split(":")[0].replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">").replaceAll(COLONENCODING,":").replaceAll(COMMAENCODING,",").replaceAll(EQUALSENCODING,"=").trim());
+ requestKey.setKeyValue(responseKeyStr.split(":")[1].replaceAll(LESSTHANENCODING, "<").replaceAll(GREATERTHANENCODING, ">").replaceAll(COLONENCODING,":").replaceAll(COMMAENCODING,",").replaceAll(EQUALSENCODING,"=").trim());
+ requestKeyList.add(requestKey);
+ }
+ }
+ Log.info("Exiting from readRequestKeys.");
+ return requestKeyList;
+ }
+
+ private String[] parsePropertyValueExpression(String propertValueExpr) throws ArtifactProcessorException{
+ Log.info("Entered into parsePropertyValueExpression.");
+ String nodeRegex = "<(.*?)>";
+ Pattern pattern = Pattern.compile(nodeRegex, Pattern.CASE_INSENSITIVE);
+ Matcher matcher = pattern.matcher(propertValueExpr);
+ List<String> stringTokens = new ArrayList<>();
+ while(matcher.find()){
+ stringTokens.add(matcher.group(0));
+ }
+ String[] propertiesArr = new String[stringTokens.size()];
+ propertiesArr = stringTokens.toArray(propertiesArr);
+ if(propertiesArr.length!=4){
+ throw new ArtifactProcessorException("Invalid input found " + propertValueExpr);
+ }
+ Log.info("Exiting from parsePropertyValueExpression.");
+ return propertiesArr;
+ }
+
+ private void addNodeType(PropertyDefinition artifact, ServiceTemplate toscaTemplate) throws ArtifactProcessorException {
+ //Add basic fields for the node
+ NodeType toscaNodeType = new NodeType();
+ toscaNodeType.setDerived_from(DERIVEDFROM);
+ toscaNodeType.setVersion(artifact.getVersion());
+ toscaNodeType.setDescription("");
+ if(artifact.getParameters()!=null) {
+ Map<String, org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition> toscaPropertyMap = new HashMap<>();
+ toscaNodeType.setProperties(toscaPropertyMap);
+
+ //Add properties from parameters of PD
+ for (Parameter pdParameter : artifact.getParameters()) {
+ addProperty(toscaNodeType, pdParameter);
+ }
+ }
+
+ // This is where it adds node in node Map and adds the map in tosca template
+ Map<String,NodeType> toscaNodeMap = new HashMap<>();
+ toscaNodeMap.put(artifact.getKind(),toscaNodeType);
+ toscaTemplate.setNode_types(toscaNodeMap);
+ }
+
+ private void addProperty(NodeType toscaNodeType, Parameter pdParameter) throws ArtifactProcessorException {
+ if(!StringUtils.isBlank(pdParameter.getName())&& !pdParameter.getName().matches(".*\\s+.*")) {
+ Log.info("Adding parameter " + pdParameter.getName() + " in node type");
+ org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition toscaProperty = new org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition();
+
+ toscaProperty.setType(StringUtils.isBlank(pdParameter.getType()) ? "string" : pdParameter.getType());
+ toscaProperty.set_default(pdParameter.getDefaultValue());
+
+ toscaProperty.setDescription(pdParameter.getDescription());
+ toscaProperty.setRequired(pdParameter.isRequired());
+
+ toscaNodeType.getProperties().put(pdParameter.getName(), toscaProperty);
+ }
+ else
+ {
+ String message ="Parameter name is empty,null or contains whitespace";
+ Log.error(message);
+ throw new ArtifactProcessorException(message);
+ }
+ }
+
+ private void addNodeTemplate(PropertyDefinition artifact, ServiceTemplate toscaTemplate)
+ {
+ NodeTemplate nodeTemplate = new NodeTemplate();
+ nodeTemplate.setType(artifact.getKind());
+ Map<String,Object> templateProperties = new HashMap<>();
+ //Add properties from parameters of PD
+ if(artifact.getParameters()!=null) {
+ for (Parameter pdParameter : artifact.getParameters()) {
+ addTemplateProperty(templateProperties, pdParameter);
+ }
+ nodeTemplate.setProperties(templateProperties);
+ }
+ Map<String,NodeTemplate> nodeTemplateMap = new HashMap<>();
+ nodeTemplateMap.put(artifact.getKind()+"_Template",nodeTemplate);
+ toscaTemplate.getTopology_template().setNode_templates(nodeTemplateMap);
+ }
+
+ private void addTemplateProperty(Map<String,Object> templateProperties, Parameter pdParameter)
+ {
+ Log.info("Adding parameter "+ pdParameter.getName() + " in node templates");
+ String responseKeys = buildResponseKeyExpression(pdParameter.getResponseKeys());
+ String requestKeys = buildRequestKeyExpression(pdParameter.getRequestKeys());
+ String ruleType = buildRuleType(pdParameter.getRuleType());
+ String source = buildSourceSystem(pdParameter.getSource());
+ String properties = ruleType + " " + responseKeys + " " + source + " " + requestKeys;
+ templateProperties.put(pdParameter.getName(),properties);
+ }
+
+ protected String buildResponseKeyExpression(List<ResponseKey> responseKeys)
+ {
+ StringBuilder propertyBuilder = new StringBuilder();
+ propertyBuilder.append("<response-keys = ");
+ if(responseKeys!=null) {
+ Iterator<ResponseKey> itr = responseKeys.iterator();
+ while (itr.hasNext()) {
+ ResponseKey res = itr.next();
+ if(res!=null)
+ propertyBuilder.append(encode(res.getUniqueKeyName()) + ":" + encode(res.getUniqueKeyValue()) + ":" + encode(res.getFieldKeyName()));
+ if (itr.hasNext())
+ propertyBuilder.append(" , ");
+ }
+ }
+ propertyBuilder.append(">");
+ return propertyBuilder.toString();
+ }
+
+ protected String buildRequestKeyExpression(List<RequestKey> requestKeys)
+ {
+ StringBuilder propertyBuilder = new StringBuilder();
+ propertyBuilder.append("<request-keys = ");
+ if(requestKeys!=null) {
+ Iterator<RequestKey> itr = requestKeys.iterator();
+ while (itr.hasNext()) {
+ RequestKey res = itr.next();
+ if(res!=null)
+ propertyBuilder.append(encode(res.getKeyName()) + ":" + encode(res.getKeyValue()));
+ if (itr.hasNext())
+ propertyBuilder.append(" , ");
+ }
+ }
+ propertyBuilder.append(">");
+ return propertyBuilder.toString();
+ }
+
+ protected String buildRuleType(String classType)
+ {
+ StringBuilder propertyBuilder = new StringBuilder();
+ String encodedClassType = StringUtils.isBlank(encode(classType))?"":encode(classType);
+ propertyBuilder.append("<");
+ propertyBuilder.append("rule-type = "+encodedClassType);
+ propertyBuilder.append(">");
+ return propertyBuilder.toString();
+ }
+
+ protected String buildSourceSystem(String source)
+ {
+ StringBuilder sourceBuilder = new StringBuilder();
+ sourceBuilder.append("<source-system = ");
+ sourceBuilder.append(StringUtils.isBlank(encode(source))?"":encode(source));
+ sourceBuilder.append(">");
+ return sourceBuilder.toString();
+ }
+
+ protected String encode(String string)
+ {
+ String encodedString = null;
+ if(string!=null) {
+ encodedString = string.trim().replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll(":","&colon;").replaceAll(",","&comma;").replaceAll("=","&equals;");
+ }
+ return encodedString;
+ }
+
+ private void logArtifact(PropertyDefinition artifact)
+ {
+ ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+ String stringArtifact=null;
+ try
+ {
+ stringArtifact = mapper.writeValueAsString(artifact);
+ Log.info("Received PropertyDefinition:\n" + stringArtifact);
+ }
+ catch (JsonProcessingException e)
+ {
+ Log.error("Exception while logging artifact:",e);
+ }
+
+ }
+}
diff --git a/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/exceptions/ArtifactProcessorException.java b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/exceptions/ArtifactProcessorException.java
new file mode 100644
index 000000000..e4ce87976
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/main/java/org/openecomp/sdnc/config/params/transformer/tosca/exceptions/ArtifactProcessorException.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params.transformer.tosca.exceptions;
+
+/**
+ * Created by pranavdi on 3/17/2017.
+ */
+public class ArtifactProcessorException extends Exception
+{
+ public ArtifactProcessorException() {}
+
+ public ArtifactProcessorException(String message)
+ {
+ super(message);
+ }
+
+ public ArtifactProcessorException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public ArtifactProcessorException(String message, Throwable cause)
+ {
+ super(message,cause);
+ }
+}
diff --git a/appc-config/appc-config-params/provider/src/main/resources/adaptor.properties b/appc-config/appc-config-params/provider/src/main/resources/adaptor.properties
new file mode 100644
index 000000000..525fcf9ba
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/main/resources/adaptor.properties
@@ -0,0 +1,27 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : APPC
+# ================================================================================
+# 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.
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# ============LICENSE_END=========================================================
+###
+
+adaptorName=
+vSphere.url=
+vSphere.user=
+vSphere.passwd=
+org.xml.sax.driver=
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/parser/TestPropertyDefinitionNode.java b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/parser/TestPropertyDefinitionNode.java
new file mode 100644
index 000000000..81f4a6685
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/parser/TestPropertyDefinitionNode.java
@@ -0,0 +1,131 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params.parser;
+
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Test;
+import org.junit.Ignore;
+import org.openecomp.sdnc.config.params.ParamsHandlerConstant;
+import org.openecomp.sdnc.config.params.data.PropertyDefinition;
+import org.openecomp.sdnc.config.params.parser.PropertyDefinitionNode;
+import org.openecomp.sdnc.config.params.transformer.ArtificatTransformer;
+
+import org.openecomp.sdnc.sli.SvcLogicContext;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class TestPropertyDefinitionNode {
+
+@Ignore
+ public void testProcessMissingParamKeys() throws Exception {
+ PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+
+ String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT, yamlData);
+
+ String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA, jsonData);
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ propertyDefinitionNode.processMissingParamKeys(inParams, ctx);
+ assertEquals(ctx.getAttribute("test."+ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+
+ }
+
+ public void testProcessExternalSystemParamKeys() throws Exception {
+ PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+
+ String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_PD_CONTENT, yamlData);
+
+ String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA, jsonData);
+
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_SYSTEM_NAME, "INSTAR");
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ propertyDefinitionNode.processExternalSystemParamKeys(inParams, ctx);
+ assertEquals(ctx.getAttribute("test."+ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+
+ System.out.println("Result: " + ctx.getAttributeKeySet());
+ System.out.println("INSTAR.keys : " + ctx.getAttribute("INSTAR.keys"));
+ System.out.println("INSTAR.LOCAL_CORE_ALT_IP_ADDR.request-logic : " + ctx.getAttribute("INSTAR.LOCAL_ACCESS_IP_ADDR"));
+ System.out.println("INSTAR.LOCAL_CORE_ALT_IP_ADDR.request-logic : " + ctx.getAttribute("INSTAR.LOCAL_CORE_ALT_IP_ADDR"));
+
+ }
+
+ public void mergeJsonData() throws Exception {
+ PropertyDefinitionNode propertyDefinitionNode = new PropertyDefinitionNode();
+ Map<String, String> inParams = new HashMap<String, String>();
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_RESPONSE_PRIFIX, "test");
+
+ String jsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/request-param.json"), Charset.defaultCharset());
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_JSON_DATA, jsonData);
+
+ String mergeJsonData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/merge-param.json"), Charset.defaultCharset());
+ inParams.put(ParamsHandlerConstant.INPUT_PARAM_MERGE__JSON_DATA, mergeJsonData);
+
+ SvcLogicContext ctx = new SvcLogicContext();
+ propertyDefinitionNode.mergeJsonData(inParams, ctx);
+ assertEquals(ctx.getAttribute("test."+ParamsHandlerConstant.OUTPUT_PARAM_STATUS), ParamsHandlerConstant.OUTPUT_STATUS_SUCCESS);
+
+ System.out.println("Result: " + ctx.getAttributeKeySet());
+ System.out.println("Merged Value : " + ctx.getAttribute("test." +ParamsHandlerConstant.OUTPUT_PARAM_CONFIGURATION_PARAMETER) );
+
+
+ }
+
+// @Test
+ public void testArtificatTransformer() throws Exception {
+ ArtificatTransformer transformer = new ArtificatTransformer();
+ String yamlData = IOUtils.toString(TestPropertyDefinitionNode.class.getClassLoader().getResourceAsStream("parser/pd.yaml"), Charset.defaultCharset());
+
+ PropertyDefinition propertyDefinition = transformer.convertYAMLToPD(yamlData);
+
+ // String json = transformer.transformYamlToJson(yamlData);
+ // System.out.println("TestPropertyDefinitionNode.testArtificatTransformer()" + json);
+ String yaml = transformer.convertPDToYaml(propertyDefinition);
+ System.out.println("TestPropertyDefinitionNode.testArtificatTransformer():\n" + yaml);
+
+ }
+
+
+
+
+}
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java
new file mode 100644
index 000000000..5a8930fa7
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestArtifactProcessor.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params.transformer.tosca;
+
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
+
+import java.io.*;
+
+public class TestArtifactProcessor{
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+// @Test
+ public void testArtifactProcessor() throws IOException, ArtifactProcessorException {
+
+ ArtifactProcessor arp = ArtifactProcessorFactory.getArtifactProcessor();
+
+ String pdString = getFileContent("tosca/ExamplePropertyDefinition.yml");
+ OutputStream outstream=null;
+
+ File tempFile = temporaryFolder.newFile("TestTosca.yml");
+ outstream = new FileOutputStream(tempFile);
+ arp.generateArtifact(pdString,outstream);
+ outstream.flush();
+ outstream.close();
+
+ String expectedTosca = getFileContent("tosca/ExpectedTosca.yml");
+ String toscaString = getFileContent(tempFile);
+ Assert.assertEquals(expectedTosca,toscaString);
+ }
+
+ // @Test
+ public void testArtifactProcessorWithStringOutput() throws IOException, ArtifactProcessorException {
+
+ ArtifactProcessor arp = ArtifactProcessorFactory.getArtifactProcessor();
+
+ String pdString = getFileContent("tosca/ExamplePropertyDefinition.yml");
+ OutputStream outstream=null;
+
+ outstream = new ByteArrayOutputStream();
+ arp.generateArtifact(pdString,outstream);
+ outstream.flush();
+ outstream.close();
+
+ String expectedTosca = getFileContent("tosca/ExpectedTosca.yml");
+ String toscaString = outstream.toString();
+ Assert.assertEquals(expectedTosca,toscaString);
+ }
+
+ private String getFileContent(String fileName) throws IOException{
+ ClassLoader classLoader = new TestArtifactProcessor().getClass().getClassLoader();
+ InputStream is = new FileInputStream(classLoader.getResource(fileName).getFile());
+ BufferedReader buf = new BufferedReader(new InputStreamReader(is));
+ String line = buf.readLine();
+ StringBuilder sb = new StringBuilder();
+
+ while (line != null) {
+ sb.append(line).append("\n");
+ line = buf.readLine();
+ }
+ String fileString = sb.toString();
+ is.close();
+ return fileString;
+ }
+
+ private String getFileContent(File file) throws IOException{
+ InputStream is = new FileInputStream(file);
+ BufferedReader buf = new BufferedReader(new InputStreamReader(is));
+ String line = buf.readLine();
+ StringBuilder sb = new StringBuilder();
+
+ while (line != null) {
+ sb.append(line).append("\n");
+ line = buf.readLine();
+ }
+ String fileString = sb.toString();
+ is.close();
+ return fileString;
+ }
+}
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java
new file mode 100644
index 000000000..8fe8dc73a
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestGenerateArtifactObject.java
@@ -0,0 +1,265 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params.transformer.tosca;
+
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.openecomp.sdnc.config.params.data.Parameter;
+import org.openecomp.sdnc.config.params.data.PropertyDefinition;
+import org.openecomp.sdnc.config.params.data.RequestKey;
+import org.openecomp.sdnc.config.params.data.ResponseKey;
+import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
+
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * Created by pranavdi on 3/15/2017.
+ */
+public class TestGenerateArtifactObject
+{
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ @Test
+ public void testObjectArtifactProcessor() throws IOException, ArtifactProcessorException {
+
+ String expectedTosca="node_types:\n" +
+ " VNF:\n" +
+ " derived_from: org.openecomp.genericvnf\n" +
+ " version: V1\n" +
+ " description: ''\n" +
+ " properties:\n" +
+ " LOCAL_ACCESS_IP_ADDR:\n" +
+ " type: string\n" +
+ " required: false\n" +
+ " default: 192.168.30.1\n" +
+ " status: SUPPORTED\n" +
+ " LOCAL_CORE_ALT_IP_ADDR:\n" +
+ " type: String\n" +
+ " required: false\n" +
+ " default: fd00:f4d5:ea06:1:0:110:254\n" +
+ " status: SUPPORTED\n" +
+ "topology_template:\n" +
+ " node_templates:\n" +
+ " VNF_Template:\n" +
+ " type: VNF\n" +
+ " properties:\n" +
+ " LOCAL_ACCESS_IP_ADDR: <rule-type = myRule1> <response-keys = > <source-system = INSTAR> <request-keys = class-type:interface-ip-address , address_fqdn:someVal , address_type:v4>\n" +
+ " LOCAL_CORE_ALT_IP_ADDR: <rule-type = myRule2> <response-keys = name1:value1:field1> <source-system = INSTAR> <request-keys = >\n";
+ //Create object
+ PropertyDefinition pd = new PropertyDefinition();
+ pd.setKind("VNF");
+ pd.setVersion("V1");
+ pd.setParameters(createParameters());
+
+ //Call ArtifactProcessor
+ OutputStream outstream=null;
+
+ File toscaFile =temporaryFolder.newFile("TestTosca.yml");
+ outstream = new FileOutputStream(toscaFile);
+ ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
+ arp.generateArtifact(pd,outstream);
+ outstream.flush();
+ outstream.close();
+
+ String toscaString = getFileContent(toscaFile);
+ Assert.assertEquals(expectedTosca,toscaString);
+
+ }
+
+// @Test
+ public void testPDpropertiesSetNull() throws IOException, ArtifactProcessorException {
+ String expectedTosca = "node_types:\n" +
+ " PropertyDefinition:\n" +
+ " derived_from: org.openecomp.genericvnf\n" +
+ " version: V1\n" +
+ " description: ''\n" +
+ "topology_template:\n" +
+ " node_templates:\n" +
+ " PropertyDefinition_Template:\n" +
+ " type: PropertyDefinition\n";
+ //Create object
+ PropertyDefinition pd = new PropertyDefinition();
+ pd.setKind("PropertyDefinition");
+ pd.setVersion("V1");
+// pd.setParameters(createParameters());
+
+ //Call ArtifactProcessor
+ OutputStream outstream=null;
+
+ File toscaFile =temporaryFolder.newFile("TestTosca.yml");
+ outstream = new FileOutputStream(toscaFile);
+
+ ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
+ arp.generateArtifact(pd,outstream);
+ outstream.flush();
+ outstream.close();
+
+ String toscaString = getFileContent(toscaFile);
+ Assert.assertEquals(expectedTosca,toscaString);
+ }
+
+ // @Test
+ public void testArtifactGeneratorInvalidStream() throws IOException {
+ String expectedMsg = "java.io.IOException: Stream Closed";
+ PropertyDefinition pd = new PropertyDefinition();
+ pd.setKind("VNF");
+ pd.setVersion("V1");
+ pd.setParameters(createParameters());
+
+ //Call ArtifactProcessor
+ OutputStream outstream=null;
+ try {
+ File toscaFile =temporaryFolder.newFile("TestTosca.yml");
+ outstream = new FileOutputStream(toscaFile);
+ outstream.close();
+ ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
+ arp.generateArtifact(pd,outstream);
+ Assert.fail();
+ }
+ catch (ArtifactProcessorException e)
+ {
+ Assert.assertEquals(expectedMsg,e.getMessage());
+ }
+ }
+
+ private List<Parameter> createParameters()
+ {
+ //Create single Parameter object 1
+ Parameter singleParameter1 = new Parameter();
+ singleParameter1.setName("LOCAL_ACCESS_IP_ADDR");
+// singleParameter1.setList(false);
+ singleParameter1.setRequired(false);
+ singleParameter1.setSource("INSTAR");
+ singleParameter1.setDefaultValue("192.168.30.1");
+ singleParameter1.setRuleType("myRule1");
+ singleParameter1.setRequestKeys(createRequestKeys());
+
+ //Create single Parameter object 2
+ Parameter singleParameter2 = new Parameter();
+ singleParameter2.setName("LOCAL_CORE_ALT_IP_ADDR");
+ singleParameter2.setType("String");
+// singleParameter2.setList(false);
+ singleParameter2.setRequired(false);
+ singleParameter2.setSource("INSTAR");
+ singleParameter2.setDefaultValue("fd00:f4d5:ea06:1:0:110:254");
+ singleParameter2.setRuleType("myRule2");
+ singleParameter2.setResponseKeys(createResponseKeys());
+
+
+ //Add the Parameter objects to the List
+ List<Parameter> parameterList = new ArrayList<Parameter>();
+ parameterList.add(singleParameter1);
+ parameterList.add(singleParameter2);
+ return parameterList;
+ }
+
+ private List<RequestKey> createRequestKeys()
+ {
+ //Create RequestKey object 1
+ RequestKey requestKey1 = new RequestKey();
+ requestKey1.setKeyName("class-type");
+ requestKey1.setKeyValue("interface-ip-address");
+
+ //Create RequestKey object 2
+ RequestKey requestKey2 = new RequestKey();
+ requestKey2.setKeyName("address_fqdn");
+ requestKey2.setKeyValue("someVal");
+
+ //Create RequestKey object 3
+ RequestKey requestKey3 = new RequestKey();
+ requestKey3.setKeyName("address_type");
+ requestKey3.setKeyValue("v4");
+
+ //Add the RequestKey Objects to the List
+ List<RequestKey> requestKeyList = new ArrayList<RequestKey>();
+ requestKeyList.add(requestKey1);
+ requestKeyList.add(requestKey2);
+ requestKeyList.add(requestKey3);
+ return requestKeyList;
+ }
+
+ private List<ResponseKey> createResponseKeys()
+ {
+ //Create RequestKey object 1
+ ResponseKey responseKey1 = new ResponseKey();
+
+ responseKey1.setUniqueKeyName("name1");
+ responseKey1.setUniqueKeyValue("value1");
+ responseKey1.setFieldKeyName("field1");
+
+ //Add the RequestKey Objects to the List
+ List<ResponseKey> responseKeyList = new ArrayList<ResponseKey>();
+ responseKeyList.add(responseKey1);
+
+ return responseKeyList;
+ }
+
+ private Parameter createParameter()
+ {
+ Parameter singleParameter1 = new Parameter();
+ singleParameter1.setName("LOCAL_ACCESS_IP_ADDR");
+ //singleParameter1.setList(false);
+ singleParameter1.setRequired(false);
+ singleParameter1.setSource("INSTAR");
+ singleParameter1.setDefaultValue("192.168.30.1");
+ singleParameter1.setRequestKeys(createRequestKeys());
+ singleParameter1.setResponseKeys(createResponseKeys());
+ return singleParameter1;
+ }
+
+ //@Test
+ public void testPDnull() throws IOException, ArtifactProcessorException {
+ PropertyDefinition pd = null;
+ OutputStream outstream=null;
+
+ outstream = new FileOutputStream(".\\TestTosca.yml");
+ ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
+ arp.generateArtifact(pd,outstream);
+ outstream.flush();
+ outstream.close();
+
+
+ }
+
+ private String getFileContent(File file) throws IOException
+ {
+ InputStream is = new FileInputStream(file);
+ BufferedReader buf = new BufferedReader(new InputStreamReader(is));
+ String line = buf.readLine();
+ StringBuilder sb = new StringBuilder();
+
+ while (line != null) {
+ sb.append(line).append("\n");
+ line = buf.readLine();
+ }
+ String fileString = sb.toString();
+ is.close();
+ return fileString;
+ }
+}
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java
new file mode 100644
index 000000000..51c458cff
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestGenerateArtifactString.java
@@ -0,0 +1,156 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params.transformer.tosca;
+
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
+
+import java.io.*;
+import java.net.URL;
+
+/**
+ * Created by pranavdi on 3/21/2017.
+ */
+public class TestGenerateArtifactString{
+
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+// @Test
+ public void testStringArtifactGenerator() throws IOException, ArtifactProcessorException {
+
+ String pdString = getFileContent("tosca/ExamplePropertyDefinition.yml");
+ OutputStream outstream=null;
+
+ File tempFile = temporaryFolder.newFile("TestTosca.yml");
+ outstream = new FileOutputStream(tempFile);
+ ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
+ arp.generateArtifact(pdString,outstream);
+ outstream.flush();
+ outstream.close();
+
+ String expectedTosca = getFileContent("tosca/ExpectedTosca.yml");
+ String toscaString = getFileContent(tempFile);
+ Assert.assertEquals(expectedTosca,toscaString);
+
+ }
+
+ // @Test
+ public void testArtifactGeneratorWithParameterNameBlank() throws IOException, ArtifactProcessorException {
+
+ String pdString = getFileContent("tosca/ExamplePropertyDefinition2.yml");
+ OutputStream outstream=null;
+ String expectedMsg ="Parameter name is empty,null or contains whitespace";
+
+ File tempFile = temporaryFolder.newFile("TestTosca.yml");
+ outstream = new FileOutputStream(tempFile);
+ ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
+ try {
+ arp.generateArtifact(pdString, outstream);
+ }
+ catch (ArtifactProcessorException e)
+ {
+ Assert.assertEquals(expectedMsg,e.getMessage());
+ }
+ outstream.flush();
+ outstream.close();
+ }
+
+ // @Test
+ public void testArtifactGeneratorWithParameterNameNull() throws IOException, ArtifactProcessorException {
+
+ String pdString = getFileContent("tosca/ExamplePropertyDefinition3.yml");
+ OutputStream outstream=null;
+ String expectedMsg ="Parameter name is empty,null or contains whitespace";
+
+ File tempFile = temporaryFolder.newFile("TestTosca.yml");
+ outstream = new FileOutputStream(tempFile);
+ ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
+ try {
+ arp.generateArtifact(pdString, outstream);
+ }
+ catch (ArtifactProcessorException e)
+ {
+ Assert.assertEquals(expectedMsg,e.getMessage());
+ }
+ outstream.flush();
+ outstream.close();
+ }
+
+ // @Test
+ public void testArtifactGeneratorWithKindNull() throws IOException, ArtifactProcessorException {
+
+ String pdString = getFileContent("tosca/ExamplePropertyDefinition4.yml");
+ OutputStream outstream=null;
+ String expectedMsg ="Kind in PropertyDefinition is blank or null";
+
+ File tempFile = temporaryFolder.newFile("TestTosca.yml");
+ outstream = new FileOutputStream(tempFile);
+ ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
+ try {
+ arp.generateArtifact(pdString, outstream);
+ }
+ catch (ArtifactProcessorException e)
+ {
+ Assert.assertEquals(expectedMsg,e.getMessage());
+ }
+ outstream.flush();
+ outstream.close();
+ }
+
+ private String getFileContent(String fileName) throws IOException
+ {
+ ClassLoader classLoader = new TestGenerateArtifactString().getClass().getClassLoader();
+ InputStream is = new FileInputStream(classLoader.getResource(fileName).getFile());
+ BufferedReader buf = new BufferedReader(new InputStreamReader(is));
+ String line = buf.readLine();
+ StringBuilder sb = new StringBuilder();
+
+ while (line != null) {
+ sb.append(line).append("\n");
+ line = buf.readLine();
+ }
+ String fileString = sb.toString();
+ is.close();
+ return fileString;
+ }
+
+ private String getFileContent(File file) throws IOException
+ {
+ InputStream is = new FileInputStream(file);
+ BufferedReader buf = new BufferedReader(new InputStreamReader(is));
+ String line = buf.readLine();
+ StringBuilder sb = new StringBuilder();
+
+ while (line != null) {
+ sb.append(line).append("\n");
+ line = buf.readLine();
+ }
+ String fileString = sb.toString();
+ is.close();
+ return fileString;
+ }
+}
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java
new file mode 100644
index 000000000..438884350
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestPropertyQueryString.java
@@ -0,0 +1,170 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params.transformer.tosca;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.sdnc.config.params.data.RequestKey;
+import org.openecomp.sdnc.config.params.data.ResponseKey;
+
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+public class TestPropertyQueryString
+{
+ // @Test
+ public void testBuildResponseKeys()
+ {
+ ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
+ String properties= arp.buildResponseKeyExpression(createResponseKeys());
+ Assert.assertEquals("<response-keys = address-fqdn:000000000000000000000:ipaddress-v4 , key2:value2:field2>",properties);
+ }
+
+ //@Test
+ public void testBuildRequestKeys()
+ {
+ ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
+ String properties= arp.buildRequestKeyExpression(createRequestKeys());
+ Assert.assertEquals("<request-keys = class-type:interface-ip-address , address_fqdn:m001dbj001p1n004v006 , address_type:v4>",properties);
+ }
+
+ //@Test
+ public void testEncoding()
+ {
+ ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
+
+ String expected1 = "&lt;class-type&gt;";
+ String encoded1 = arp.encode("<class-type>");
+ Assert.assertEquals(expected1,encoded1);
+
+ String expected2 = "&lt;&lt;&lt;metallica&lt;&gt;iron_maiden&gt;&gt;&gt;";
+ String encoded2 = arp.encode("<<<metallica<>iron_maiden>>>");
+ Assert.assertEquals(expected2,encoded2);
+
+ String expected3 = "band-list&colon;metallica&comma;ironmaiden";
+ String encoded3 = arp.encode("band-list:metallica,ironmaiden");
+ Assert.assertEquals(expected3,encoded3);
+
+ String expected4 = "motorhead&equals;lemmy";
+ String encoded4 = arp.encode("motorhead=lemmy");
+ Assert.assertEquals(expected4,encoded4);
+
+ String expected5 = "DreamTheater";
+ String encoded5 = arp.encode(" DreamTheater ");
+ Assert.assertEquals(expected5,encoded5);
+ }
+
+ //@Test
+ public void testBuildRuleType()
+ {
+ ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
+ String input = "IPV4";
+ String expected = "<rule-type = IPV4>";
+ Assert.assertEquals(expected,arp.buildRuleType(input));
+ }
+
+ // @Test
+ public void testRuleTypeSetNull()
+ {
+ ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
+ String expected = "<rule-type = >";
+ Assert.assertEquals(expected,arp.buildRuleType(null));
+ }
+
+ //@Test
+ public void testBuildRequestKeysWithKeyNull()
+ {
+ ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
+ List<RequestKey> requestKeyList = new ArrayList<RequestKey>();
+ requestKeyList.add(null);
+ String properties= arp.buildRequestKeyExpression(requestKeyList);
+ Assert.assertEquals("<request-keys = >",properties);
+ }
+
+ //@Test
+ public void testBuildResponseKeysWithKeyNull()
+ {
+ ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
+ List<ResponseKey> responseKeyList = new ArrayList<ResponseKey>();
+ responseKeyList.add(null);
+ String properties= arp.buildResponseKeyExpression(responseKeyList);
+ Assert.assertEquals("<response-keys = >",properties);
+ }
+
+ //@Test
+ public void testBuildSourceSystem()
+ {
+ ArtifactProcessorImpl arp = new ArtifactProcessorImpl();
+ Assert.assertEquals("<source-system = INSTAR>",arp.buildSourceSystem("INSTAR"));
+ }
+ //@Test
+ private List<RequestKey> createRequestKeys()
+ {
+ //Create RequestKey object 1
+ RequestKey requestKey1 = new RequestKey();
+ requestKey1.setKeyName("class-type");
+ requestKey1.setKeyValue("interface-ip-address");
+
+ //Create RequestKey object 2
+ RequestKey requestKey2 = new RequestKey();
+ requestKey2.setKeyName("address_fqdn");
+ requestKey2.setKeyValue("00000000000000");
+
+ //Create RequestKey object 3
+ RequestKey requestKey3 = new RequestKey();
+ requestKey3.setKeyName("address_type");
+ requestKey3.setKeyValue("v4");
+
+ //Add the RequestKey Objects to the List
+ List<RequestKey> requestKeyList = new ArrayList<RequestKey>();
+ requestKeyList.add(requestKey1);
+ requestKeyList.add(requestKey2);
+ requestKeyList.add(requestKey3);
+ return requestKeyList;
+ }
+ //@Test
+ private List<ResponseKey> createResponseKeys()
+ {
+ //Create RequestKey object 1
+ ResponseKey responseKey1 = new ResponseKey();
+
+ responseKey1.setUniqueKeyName("address-fqdn");
+ responseKey1.setUniqueKeyValue("0000000000000");
+ responseKey1.setFieldKeyName("ipaddress-v4");
+
+ ResponseKey responseKey2 = new ResponseKey();
+ responseKey2.setUniqueKeyName("key2");
+ responseKey2.setUniqueKeyValue("value2");
+ responseKey2.setFieldKeyName("field2");
+
+
+ //Add the RequestKey Objects to the List
+ List<ResponseKey> responseKeyList = new ArrayList<ResponseKey>();
+ responseKeyList.add(responseKey1);
+ responseKeyList.add(responseKey2);
+
+ return responseKeyList;
+ }
+}
diff --git a/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestReadArtifact.java b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestReadArtifact.java
new file mode 100644
index 000000000..654b4c1b3
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/test/java/org/openecomp/sdnc/config/params/transformer/tosca/TestReadArtifact.java
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APPC
+ * ================================================================================
+ * 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.
+ *
+ * ECOMP is a trademark and service mark of AT&T Intellectual Property.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdnc.config.params.transformer.tosca;
+
+//import static org.junit.Assert;
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.sdnc.config.params.data.PropertyDefinition;
+import org.openecomp.sdnc.config.params.transformer.tosca.exceptions.ArtifactProcessorException;
+
+import java.io.*;
+
+
+/**
+ * @author thakkerp
+ * @since March 23,2017
+ */
+public class TestReadArtifact {
+// @Test
+ public void testReadArtifactPositive() throws ArtifactProcessorException, IOException {
+
+ String toscaArtifact = getFileContent("tosca/ReadArtifactPositiveInputTosca.yml");
+ ArtifactProcessorImpl artifact = new ArtifactProcessorImpl();
+ PropertyDefinition ouptPD = artifact.readArtifact(toscaArtifact);
+ Assert.assertEquals(ouptPD.getKind(),"Property Definition");
+ Assert.assertEquals(ouptPD.getVersion(),"V1");
+
+ Assert.assertEquals(ouptPD.getParameters().get(0).getDefaultValue(),"0.0.0.0");
+ Assert.assertEquals(ouptPD.getParameters().get(0).getName(),"abc");
+ Assert.assertEquals(ouptPD.getParameters().get(0).getSource(),"INSTAR");
+ Assert.assertEquals(ouptPD.getParameters().get(0).getRuleType(),"interface-ip-address");
+ Assert.assertEquals(ouptPD.getParameters().get(0).getDescription(),"param_desc");
+ Assert.assertEquals(ouptPD.getParameters().get(0).getType(),"param1_type");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),"address_fqdn");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),"000000000");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),"address_fqdn");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),"000000000");
+ Assert.assertEquals(ouptPD.getParameters().get(0).getResponseKeys().get(0).getUniqueKeyName(),"address-fqdn");
+ //Assert.assertEquals(ouptPD.getParameters().get(0).getResponseKeys().get(0).getUniqueKeyValue(),"000000000");
+ Assert.assertEquals(ouptPD.getParameters().get(0).getResponseKeys().get(0).getFieldKeyName(),"ipaddress-v4");
+
+ Assert.assertEquals(ouptPD.getParameters().get(1).getDefaultValue(),"0:0:0:0:0:0:0:0");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getName(),"param 2");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getSource(),"INSTAR");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRuleType(),"interface-ip-address");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getDescription(),"param2");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getType(),"param2 type");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyName(),"address_fqdn");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(0).getKeyValue(),"000000000");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(1).getKeyName(),"address_type");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getRequestKeys().get(1).getKeyValue(),"v4");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getResponseKeys().get(0).getUniqueKeyName(),"address-fqdn");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getResponseKeys().get(0).getUniqueKeyValue(),"000000000");
+ Assert.assertEquals(ouptPD.getParameters().get(1).getResponseKeys().get(0).getFieldKeyName(),"ipaddress-v4");
+
+ }
+//@Test
+ public void testReadArtifactNegetive() throws IOException {
+
+ String toscaArtifact = getFileContent("tosca/ReadArtifactNegetiveInputTosca.yml");
+ ArtifactProcessorImpl artifact = new ArtifactProcessorImpl();
+ try {
+ PropertyDefinition ouptPD = artifact.readArtifact(toscaArtifact);
+ } catch (ArtifactProcessorException e) {
+ Assert.assertNotNull(e);
+ Assert.assertEquals(e.getMessage(),"Invalid input found <> source1 <reqk1:reqv1 , reqk2:reqv2>");
+ }
+ }
+
+ private String getFileContent(String fileName) throws IOException
+ {
+ ClassLoader classLoader = new TestReadArtifact().getClass().getClassLoader();
+ InputStream is = new FileInputStream(classLoader.getResource(fileName).getFile());
+ BufferedReader buf = new BufferedReader(new InputStreamReader(is));
+ String line = buf.readLine();
+ StringBuilder sb = new StringBuilder();
+
+ while (line != null) {
+ sb.append(line).append("\n");
+ line = buf.readLine();
+ }
+ String fileString = sb.toString();
+ is.close();
+ return fileString;
+ }
+
+}
diff --git a/appc-config/appc-config-params/provider/src/test/resources/parser/merge-param.json b/appc-config/appc-config-params/provider/src/test/resources/parser/merge-param.json
new file mode 100644
index 000000000..e610d079a
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/test/resources/parser/merge-param.json
@@ -0,0 +1,26 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-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=========================================================
+ */
+
+ {
+ "Additional1": "XX.XX.XX",
+ "Additional2": "XXXXXX",
+ "Additiona3": "00",
+ "Additional": "00"
+}
diff --git a/appc-config/appc-config-params/provider/src/test/resources/parser/pd.yaml b/appc-config/appc-config-params/provider/src/test/resources/parser/pd.yaml
new file mode 100644
index 000000000..868665fb4
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/test/resources/parser/pd.yaml
@@ -0,0 +1,75 @@
+---
+kind: "Property Definition"
+version: "V1"
+vnf-parameter-list:
+- name: "LOCAL_ACCESS_IP_ADDR"
+ description: null
+ type: null
+ required: false
+ source: "INSTAR"
+ rule-type: "interface-ip-address"
+ default: "192.168.30.1"
+ request-keys:
+ - key-name: "address_fqdn"
+ key-value: "someValue"
+ - key-name: "address_type"
+ key-value: "v4"
+ response-keys: null
+- name: "LOCAL_CORE_ALT_IP_ADDR"
+ description: null
+ type: null
+ required: false
+ source: "INSTAR"
+ rule-type: null
+ default: "fd00:f4d5:ea06:1:0:110:136:254"
+ request-keys:
+ - key-name: "address_fqdn"
+ key-value: "someValue"
+ - key-name: "address_type"
+ key-value: "v4"
+ response-keys: null
+- name: "LOCAL_BILLING_IP_ADDR"
+ description: null
+ type: null
+ required: false
+ source: null
+ rule-type: null
+ default: "192.168.30.1"
+ request-keys: null
+ response-keys: null
+- name: "REMOTE_ACCESS_IP_ADDR"
+ description: null
+ type: null
+ required: false
+ source: null
+ rule-type: null
+ default: "192.168.30.1"
+ request-keys: null
+ response-keys: null
+- name: "REMOTE_CORE_ALT_IP_ADDR"
+ description: null
+ type: null
+ required: false
+ source: null
+ rule-type: null
+ default: "fd00:f4d5:ea06:1:0:110:136:254"
+ request-keys: null
+ response-keys: null
+- name: "REMOTE_BILLING_IP_ADDR"
+ description: null
+ type: null
+ required: false
+ source: "INSTAR"
+ rule-type: null
+ default: "192.168.30.1"
+ request-keys: null
+ response-keys: null
+- name: "CORE_NETWORK_PLEN"
+ description: null
+ type: null
+ required: false
+ source: null
+ rule-type: null
+ default: "32"
+ request-keys: null
+ response-keys: null
diff --git a/appc-config/appc-config-params/provider/src/test/resources/parser/request-param.json b/appc-config/appc-config-params/provider/src/test/resources/parser/request-param.json
new file mode 100644
index 000000000..f84141b1a
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/test/resources/parser/request-param.json
@@ -0,0 +1,27 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-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=========================================================
+ */
+
+ {
+ "LOCAL_BILLING_IP_ADDR": "192.168.30.1",
+ "REMOTE_CORE_ALT_IP_ADDR": "fd00:f4d5:ea06:1:0:110:136:254",
+ "REMOTE_BILLING_IP_ADDR": "192.168.30.1",
+ "CORE_NETWORK_PLEN": "32"
+}
+
diff --git a/appc-config/appc-config-params/provider/src/test/resources/parser/system-param.json b/appc-config/appc-config-params/provider/src/test/resources/parser/system-param.json
new file mode 100644
index 000000000..648abac30
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/test/resources/parser/system-param.json
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP : APP-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=========================================================
+ */
+
+ {
+ "LOCAL_ACCESS_IP_ADDR": "XX.XX.XX",
+ "LOCAL_BILLING_IP_ADDR": "XXXXXX",
+ "CORE_NETWORK_PLEN": "00"
+}
diff --git a/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition.yml b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition.yml
new file mode 100644
index 000000000..7c8b31d52
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition.yml
@@ -0,0 +1,21 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : APPC
+# ================================================================================
+# 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.
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# ============LICENSE_END=========================================================
+###
diff --git a/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition2.yml b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition2.yml
new file mode 100644
index 000000000..7c8b31d52
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition2.yml
@@ -0,0 +1,21 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : APPC
+# ================================================================================
+# 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.
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# ============LICENSE_END=========================================================
+###
diff --git a/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition3.yml b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition3.yml
new file mode 100644
index 000000000..7c8b31d52
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition3.yml
@@ -0,0 +1,21 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : APPC
+# ================================================================================
+# 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.
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# ============LICENSE_END=========================================================
+###
diff --git a/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition4.yml b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition4.yml
new file mode 100644
index 000000000..7c8b31d52
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExamplePropertyDefinition4.yml
@@ -0,0 +1,21 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : APPC
+# ================================================================================
+# 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.
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# ============LICENSE_END=========================================================
+###
diff --git a/appc-config/appc-config-params/provider/src/test/resources/tosca/ExpectedTosca.yml b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExpectedTosca.yml
new file mode 100644
index 000000000..d379c4730
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/test/resources/tosca/ExpectedTosca.yml
@@ -0,0 +1,75 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : APPC
+# ================================================================================
+# 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.
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# ============LICENSE_END=========================================================
+###
+
+node_types:
+ Property Definition:
+ derived_from: org.openecomp.genericvnf
+ version: V1
+ description: ''
+ properties:
+ LOCAL_BILLING_IP_ADDR:
+ type: string
+ required: false
+ default: 192.168.30.1
+ status: SUPPORTED
+ LOCAL_ACCESS_IP_ADDR:
+ type: string
+ required: false
+ default: 192.168.30.1
+ status: SUPPORTED
+ LOCAL_CORE_ALT_IP_ADDR:
+ type: string
+ required: false
+ default: fd00:f4d5:ea06:1:0:110:136:254
+ status: SUPPORTED
+ CORE_NETWORK_PLEN:
+ type: string
+ required: false
+ default: '32'
+ status: SUPPORTED
+ REMOTE_CORE_ALT_IP_ADDR:
+ type: string
+ required: false
+ default: fd00:f4d5:ea06:1:0:110:136:254
+ status: SUPPORTED
+ REMOTE_ACCESS_IP_ADDR:
+ type: string
+ required: false
+ default: 192.168.30.1
+ status: SUPPORTED
+ REMOTE_BILLING_IP_ADDR:
+ type: string
+ required: false
+ default: 192.168.30.1
+ status: SUPPORTED
+topology_template:
+ node_templates:
+ Property Definition_Template:
+ type: Property Definition
+ properties:
+ LOCAL_BILLING_IP_ADDR: <rule-type = > <response-keys = > <source-system = > <request-keys = >
+ LOCAL_ACCESS_IP_ADDR: <rule-type = interface-ip-address> <response-keys = > <source-system = INSTAR> <request-keys = address_fqdn:someValue , address_type:v4>
+ LOCAL_CORE_ALT_IP_ADDR: <rule-type = > <response-keys = > <source-system = INSTAR> <request-keys = >
+ CORE_NETWORK_PLEN: <rule-type = > <response-keys = > <source-system = > <request-keys = >
+ REMOTE_CORE_ALT_IP_ADDR: <rule-type = > <response-keys = > <source-system = > <request-keys = >
+ REMOTE_ACCESS_IP_ADDR: <rule-type = > <response-keys = > <source-system = > <request-keys = >
+ REMOTE_BILLING_IP_ADDR: <rule-type = > <response-keys = > <source-system = INSTAR> <request-keys = >
diff --git a/appc-config/appc-config-params/provider/src/test/resources/tosca/ReadArtifactNegetiveInputTosca.yml b/appc-config/appc-config-params/provider/src/test/resources/tosca/ReadArtifactNegetiveInputTosca.yml
new file mode 100644
index 000000000..092575329
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/test/resources/tosca/ReadArtifactNegetiveInputTosca.yml
@@ -0,0 +1,47 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : APPC
+# ================================================================================
+# 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.
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# ============LICENSE_END=========================================================
+###
+
+node_types:
+ Property Definition:
+ derived_from: org.openecomp.genericvnf
+ version: V1
+ description: ''
+ properties:
+ abc:
+ type: param1_type
+ description: param_desc
+ required: false
+ default: 192.168.30.1
+ status: SUPPORTED
+ param 2:
+ type: param2 type
+ description: param2
+ required: false
+ default: fd00:f4d5:ea06:1:0:110:136:254
+ status: SUPPORTED
+topology_template:
+ node_templates:
+ Property Definition_Template:
+ type: Property Definition
+ properties:
+ abc: <> source1 <reqk1:reqv1 , reqk2:reqv2>
+ param 2: <rule-type:rule 2> <> source2 <>
diff --git a/appc-config/appc-config-params/provider/src/test/resources/tosca/ReadArtifactPositiveInputTosca.yml b/appc-config/appc-config-params/provider/src/test/resources/tosca/ReadArtifactPositiveInputTosca.yml
new file mode 100644
index 000000000..6c1214206
--- /dev/null
+++ b/appc-config/appc-config-params/provider/src/test/resources/tosca/ReadArtifactPositiveInputTosca.yml
@@ -0,0 +1,47 @@
+###
+# ============LICENSE_START=======================================================
+# ONAP : APPC
+# ================================================================================
+# 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.
+#
+# ECOMP is a trademark and service mark of AT&T Intellectual Property.
+# ============LICENSE_END=========================================================
+###
+
+node_types:
+ Property Definition:
+ derived_from: org.openecomp.genericvnf
+ version: V1
+ description: ''
+ properties:
+ abc:
+ type: param1_type
+ description: param_desc
+ required: false
+ default: 0.0.0.0
+ status: SUPPORTED
+ param 2:
+ type: param2 type
+ description: param2
+ required: abc
+ default: 0:0:0:0:0:0:0:0
+ status: SUPPORTED
+topology_template:
+ node_templates:
+ Property Definition_Template:
+ type: Property Definition
+ properties:
+ abc: <rule-type = interface-ip-address> <response-keys = address-fqdn:000000000&equals;000000000:ipaddress-v4 > <source-system=INSTAR> <request-keys=address_fqdn:m001&colon;00000000 , address_type:v&comma;4>
+ param 2: <rule-type = interface-ip-address> <response-keys = address-fqdn:000000000:ipaddress-v4 > <source-system = INSTAR> <request-keys = address_fqdn:000000000 , address_type:v4>
diff --git a/appc-config/jacoco.exec b/appc-config/jacoco.exec
new file mode 100644
index 000000000..c1ac989b4
--- /dev/null
+++ b/appc-config/jacoco.exec
Binary files differ
diff --git a/appc-config/pom.xml b/appc-config/pom.xml
new file mode 100644
index 000000000..93d2ca3d9
--- /dev/null
+++ b/appc-config/pom.xml
@@ -0,0 +1,94 @@
+<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.appc</groupId>
+ <artifactId>appc</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.openecomp.appc</groupId>
+ <artifactId>appc-config</artifactId>
+ <packaging>pom</packaging>
+ <name>Application Controller Config</name>
+ <description>Application Controller Config</description>
+
+ <properties>
+ <odl.mdsal.version>2.1.1-Boron-SR1</odl.mdsal.version>
+ <jackson.version>2.3.2</jackson.version>
+ <snakeyaml.version>1.12</snakeyaml.version>
+ <velocity.version>1.7</velocity.version>
+ <jettison.version>1.3.7</jettison.version>
+ <common.collections.version>3.2.1</common.collections.version>
+ <common.io.version>2.5</common.io.version>
+
+ <sdnc.sql.resource.version>1.1.0</sdnc.sql.resource.version>
+ <openecomp.sdnc.sql-resource.version>1.1.0</openecomp.sdnc.sql-resource.version>
+ <sdnc.sli.version>1.1.0</sdnc.sli.version>
+ <tosca.datatype.version>1.1.0</tosca.datatype.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+
+ <dependency>
+ <groupId>org.openecomp.sdnc.adaptors</groupId>
+ <artifactId>sql-resource-provider</artifactId>
+ <version>${openecomp.sdnc.sql-resource.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-properties</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-yaml</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ <version>${snakeyaml.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.velocity</groupId>
+ <artifactId>velocity</artifactId>
+ <version>${velocity.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>${common.io.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jettison</groupId>
+ <artifactId>jettison</artifactId>
+ <version>${jettison.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ </dependencyManagement>
+
+ <modules>
+ <module>appc-config-params</module>
+ </modules>
+
+</project>
diff --git a/pom.xml b/pom.xml
index 4cc40026e..6f5dbc4e8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,6 +51,7 @@
<sdnctl.sli.version>1.1.2-SNAPSHOT</sdnctl.sli.version>
<sdnctl.dblib.version>1.1.2-SNAPSHOT</sdnctl.dblib.version>
<sdnctl.aai.service.version>1.1.2-SNAPSHOT</sdnctl.aai.service.version>
+ <openecomp.sdnc.sql-resource.version>1.1.2-SNAPSHOT</openecomp.sdnc.sql-resource.version>
<cdp.pal.version>1.1.7-oss</cdp.pal.version>
<dmaap.client.version>0.2.12</dmaap.client.version>
@@ -642,6 +643,7 @@
<module>appc-asdc-listener</module>
<module>appc-lifecycle-management</module>
<module>appc-oam</module>
+ <module>appc-config</module>
</modules>
</profile>
<profile>