[VID-6] Initial rebase push
Change-Id: I9077be9663754d9b22f77c6a7b3109b361b39346
Signed-off-by: jimmydot <jf2512@att.com>
diff --git a/vid-app-common/.classpath b/vid-app-common/.classpath
new file mode 100755
index 0000000..0f8fecb
--- /dev/null
+++ b/vid-app-common/.classpath
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/classes" path="target/generated-sources">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java">
+ <attributes>
+ <attribute name="optional" value="true"/>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/vid-app-common/.project b/vid-app-common/.project
new file mode 100755
index 0000000..f0b63c3
--- /dev/null
+++ b/vid-app-common/.project
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>vid-app-common</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.common.project.facet.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.wst.validation.validationbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.m2e.core.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+ <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>
+ <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
+ <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+ </natures>
+</projectDescription>
diff --git a/vid-app-common/.settings/.jsdtscope b/vid-app-common/.settings/.jsdtscope
new file mode 100755
index 0000000..c34a336
--- /dev/null
+++ b/vid-app-common/.settings/.jsdtscope
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="src/main/webapp"/>
+ <classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
+ <attributes>
+ <attribute name="hide" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
+ <classpathentry kind="output" path=""/>
+</classpath>
diff --git a/vid-app-common/.settings/org.eclipse.core.resources.prefs b/vid-app-common/.settings/org.eclipse.core.resources.prefs
new file mode 100755
index 0000000..1a9f2d2
--- /dev/null
+++ b/vid-app-common/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/main/resources=UTF-8
+encoding//src/test/java=UTF-8
+encoding//src/test/resources=UTF-8
diff --git a/vid-app-common/.settings/org.eclipse.jdt.core.prefs b/vid-app-common/.settings/org.eclipse.jdt.core.prefs
new file mode 100755
index 0000000..1ab2bb5
--- /dev/null
+++ b/vid-app-common/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/vid-app-common/.settings/org.eclipse.m2e.core.prefs b/vid-app-common/.settings/org.eclipse.m2e.core.prefs
new file mode 100755
index 0000000..14b697b
--- /dev/null
+++ b/vid-app-common/.settings/org.eclipse.m2e.core.prefs
@@ -0,0 +1,4 @@
+activeProfiles=
+eclipse.preferences.version=1
+resolveWorkspaceProjects=true
+version=1
diff --git a/vid-app-common/.settings/org.eclipse.wst.common.component b/vid-app-common/.settings/org.eclipse.wst.common.component
new file mode 100755
index 0000000..40a2cb3
--- /dev/null
+++ b/vid-app-common/.settings/org.eclipse.wst.common.component
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
+ <wb-module deploy-name="vid-app-common">
+ <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
+ <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
+ <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
+ <wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources"/>
+ <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
+ <dependent-module deploy-path="/" handle="module:/overlay/var/M2_REPO/org/openecomp/ecompsdkos/epsdk-app-overlay/1.1.0-SNAPSHOT/epsdk-app-overlay-1.1.0-SNAPSHOT.war?unpackFolder=target/m2e-wtp/overlays&includes=**/**&excludes=META-INF/MANIFEST.MF">
+ <dependency-type>consumes</dependency-type>
+ </dependent-module>
+ <dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&excludes=META-INF/MANIFEST.MF">
+ <dependency-type>consumes</dependency-type>
+ </dependent-module>
+ <property name="java-output-path" value="/vid-app-common/target/classes"/>
+ <property name="component.exclusion.patterns" value="WEB-INF/lib/*.jar"/>
+ <property name="context-root" value="vid-common"/>
+ </wb-module>
+</project-modules>
diff --git a/vid-app-common/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml b/vid-app-common/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
new file mode 100755
index 0000000..b01fdb7
--- /dev/null
+++ b/vid-app-common/.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
@@ -0,0 +1,7 @@
+<root>
+ <facet id="jst.jaxrs">
+ <node name="libprov">
+ <attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
+ </node>
+ </facet>
+</root>
diff --git a/vid-app-common/.settings/org.eclipse.wst.common.project.facet.core.xml b/vid-app-common/.settings/org.eclipse.wst.common.project.facet.core.xml
new file mode 100755
index 0000000..91e8c54
--- /dev/null
+++ b/vid-app-common/.settings/org.eclipse.wst.common.project.facet.core.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<faceted-project>
+ <fixed facet="wst.jsdt.web"/>
+ <installed facet="java" version="1.8"/>
+ <installed facet="jst.web" version="3.1"/>
+ <installed facet="jst.jaxrs" version="2.0"/>
+ <installed facet="wst.jsdt.web" version="1.0"/>
+</faceted-project>
diff --git a/vid-app-common/.settings/org.eclipse.wst.jsdt.ui.superType.container b/vid-app-common/.settings/org.eclipse.wst.jsdt.ui.superType.container
new file mode 100755
index 0000000..3bd5d0a
--- /dev/null
+++ b/vid-app-common/.settings/org.eclipse.wst.jsdt.ui.superType.container
@@ -0,0 +1 @@
+org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
diff --git a/vid-app-common/.settings/org.eclipse.wst.jsdt.ui.superType.name b/vid-app-common/.settings/org.eclipse.wst.jsdt.ui.superType.name
new file mode 100755
index 0000000..05bd71b
--- /dev/null
+++ b/vid-app-common/.settings/org.eclipse.wst.jsdt.ui.superType.name
@@ -0,0 +1 @@
+Window
\ No newline at end of file
diff --git a/vid-app-common/.settings/org.eclipse.wst.validation.prefs b/vid-app-common/.settings/org.eclipse.wst.validation.prefs
new file mode 100755
index 0000000..6f1cba6
--- /dev/null
+++ b/vid-app-common/.settings/org.eclipse.wst.validation.prefs
@@ -0,0 +1,2 @@
+disabled=06target
+eclipse.preferences.version=1
diff --git a/vid-app-common/pom.xml b/vid-app-common/pom.xml
new file mode 100755
index 0000000..5f1a07d
--- /dev/null
+++ b/vid-app-common/pom.xml
@@ -0,0 +1,392 @@
+<?xml version="1.0"?>
+<project
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
+ xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+
+ <!-- This is the Maven project object model (POM) file for VID web application
+ based on the ECOMP SDK distribution. This file stands alone; it does not
+ inherit from a parent maven module. -->
+ <groupId>org.openecomp.vid</groupId>
+ <artifactId>vid-app-common</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <packaging>war</packaging>
+ <name>VID Common</name>
+ <description>VID Common code for opensource version</description>
+
+ <properties>
+ <encoding>UTF-8</encoding>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+ <epsdk.version>1.1.0-SNAPSHOT</epsdk.version>
+ <springframework.version>4.2.0.RELEASE</springframework.version>
+ <hibernate.version>4.3.11.Final</hibernate.version>
+ <!-- Skip assembling the zip by default -->
+ <skipassembly>true</skipassembly>
+ <!-- Tests usually require some setup that maven cannot do, so skip. -->
+ <skiptests>true</skiptests>
+ <nexusproxy>https://nexus.onap.org</nexusproxy>
+ <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
+ <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
+ <stagingNexusPath>/content/repositories/staging/</stagingNexusPath>
+ <sitePath>/content/sites/site/org/openecomp/vid/${project.version}</sitePath>
+ </properties>
+
+
+ <!-- this should be commented for local debugging -->
+ <!-- <deployenv>local</deployenv> -->
+
+ <repositories>
+ <repository>
+ <id>ecomp-releases</id>
+ <name>VID Release Repository</name>
+ <url>${nexusproxy}${releaseNexusPath}</url>
+ </repository>
+ <repository>
+ <id>ecomp-snapshots</id>
+ <name>VID Snapshot Repository</name>
+ <url>${nexusproxy}${snapshotNexusPath}</url>
+ </repository>
+ <repository>
+ <id>ecomp-staging</id>
+ <name>VID Staging Repository</name>
+ <url>${nexusproxy}${stagingNexusPath}</url>
+ </repository>
+ <repository>
+ <!-- Snapshots repository has ECOMP snapshot artifacts -->
+ <id>oss-snapshots</id>
+ <name>oss Central - Snapshots</name>
+ <url>https://oss.sonatype.org/service/local/repositories/releases/content/</url>
+ </repository>
+ </repositories>
+
+ <build>
+ <finalName>vid-common</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>cobertura-maven-plugin</artifactId>
+ <version>2.7</version>
+ <configuration>
+ <formats>
+ <format>xml</format>
+ </formats>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>cobertura</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tomcat.maven</groupId>
+ <artifactId>tomcat6-maven-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.tomcat.maven</groupId>
+ <artifactId>tomcat7-maven-plugin</artifactId>
+ <version>2.2</version>
+ </plugin>
+
+ <!-- Generate POJOs from MSO json schema -->
+ <plugin>
+ <groupId>org.jsonschema2pojo</groupId>
+ <artifactId>jsonschema2pojo-maven-plugin</artifactId>
+ <version>0.4.23</version>
+ <configuration>
+ <sourceDirectory>${basedir}/src/main/resources/json/mso</sourceDirectory>
+ <targetPackage>org.openecomp.vid.domain.mso</targetPackage>
+ <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.8</source>
+ <target>1.8</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.19.1</version>
+ <configuration>
+ <skipTests>${skiptests}</skipTests>
+ <includes>
+ <include>**/Test*.java</include>
+ <include>**/*Test.java</include>
+ <include>**/*TestCase.java</include>
+ </includes>
+ <excludes>
+ <exclude>**/selenium/*.java</exclude>
+ </excludes>
+ <additionalClasspathElements>
+ <additionalClasspathElement>${basedir}/war</additionalClasspathElement>
+ </additionalClasspathElements>
+ <systemPropertyVariables>
+ <container.classpath>classpath:</container.classpath>
+ </systemPropertyVariables>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <skipAssembly>${skipassembly}</skipAssembly>
+ <descriptors>
+ <descriptor>${basedir}/distribution.xml</descriptor>
+ </descriptors>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>3.0.0</version>
+ <configuration>
+ <!-- Build a jar with all the Java classes -->
+ <attachClasses>true</attachClasses>
+ <!-- Do not put any jars in the war -->
+ <packagingExcludes>WEB-INF/lib/*.jar</packagingExcludes>
+ </configuration>
+ </plugin>
+
+ </plugins>
+
+
+ </build>
+
+ <dependencies>
+ <!-- SDK overlay war -->
+
+ <dependency>
+ <groupId>org.openecomp.ecompsdkos</groupId>
+ <artifactId>epsdk-app-overlay</artifactId>
+ <version>${epsdk.version}</version>
+ <type>war</type>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.ecompsdkos</groupId>
+ <artifactId>epsdk-app-common</artifactId>
+ <version>${epsdk.version}</version>
+ <type>jar</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openecomp.ecompsdkos</groupId>
+ <artifactId>epsdk-core</artifactId>
+ <version>${epsdk.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.ecompsdkos</groupId>
+ <artifactId>epsdk-analytics</artifactId>
+ <version>${epsdk.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.ecompsdkos</groupId>
+ <artifactId>epsdk-workflow</artifactId>
+ <version>${epsdk.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.att.eelf</groupId>
+ <artifactId>eelf-core</artifactId>
+ <version>1.0.0</version>
+ </dependency>
+
+ <!-- Mapper -->
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.jackson</groupId>
+ <artifactId>jackson-mapper-asl</artifactId>
+ <version>1.9.13</version>
+ </dependency>
+ <dependency>
+ <groupId>com.mchange</groupId>
+ <artifactId>c3p0</artifactId>
+ <version>0.9.5.2</version>
+ </dependency>
+ <dependency>
+ <groupId>io.searchbox</groupId>
+ <artifactId>jest</artifactId>
+ <version>2.0.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.1.0</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.12</version>
+ </dependency>
+ <dependency>
+ <groupId>org.json</groupId>
+ <artifactId>json</artifactId>
+ <version>20160212</version>
+ </dependency>
+ <dependency>
+ <groupId>org.quartz-scheduler</groupId>
+ <artifactId>quartz</artifactId>
+ <version>2.2.1</version>
+ <exclusions>
+ <!-- exclude 0.9.1.1 to avoid dupe of com.mchange:c3p0:0.9.2.1 -->
+ <exclusion>
+ <groupId>c3p0</groupId>
+ <artifactId>c3p0</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <!-- bridge to implement commons-logging using slf4j -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>1.7.12</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context-support</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${springframework.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-tx</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-webmvc</artifactId>
+ <version>${springframework.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-client</artifactId>
+ <version>2.23.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.connectors</groupId>
+ <artifactId>jersey-jetty-connector</artifactId>
+ <version>2.23.1</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.jaxrs</groupId>
+ <artifactId>jackson-jaxrs-json-provider</artifactId>
+ <version>2.6.3</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <version>1.9.3</version>
+ </dependency>
+ <dependency>
+ <groupId>com.googlecode.json-simple</groupId>
+ <artifactId>json-simple</artifactId>
+ <version>1.1.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.seleniumhq.selenium</groupId>
+ <artifactId>selenium-java</artifactId>
+ <version>2.53.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.seleniumhq.selenium</groupId>
+ <artifactId>selenium-api</artifactId>
+ <version>2.53.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>6.8</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.seleniumhq.selenium</groupId>
+ <artifactId>selenium-firefox-driver</artifactId>
+ <version>2.53.1</version>
+ </dependency>
+ <dependency>
+ <groupId>xml-apis</groupId>
+ <artifactId>xml-apis</artifactId>
+ <version>1.4.01</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mariadb.jdbc</groupId>
+ <artifactId>mariadb-java-client</artifactId>
+ <version>1.4.6</version>
+ </dependency>
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ <version>1.16</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/vid-app-common/src/main/java/org/openecomp/aai/util/AAIProperties.java b/vid-app-common/src/main/java/org/openecomp/aai/util/AAIProperties.java
new file mode 100755
index 0000000..ca710f6
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/aai/util/AAIProperties.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.aai.util;
+
+
+import org.openecomp.portalsdk.core.util.SystemProperties;
+
+/**
+ * The Class AAIProperties.
+ */
+public class AAIProperties extends SystemProperties {
+
+ /** The Constant AAI_SERVER_URL_BASE. */
+ //VID Specific
+ public static final String AAI_SERVER_URL_BASE = "aai.server.url.base";
+
+ /** The Constant AAI_SERVER_URL. */
+ public static final String AAI_SERVER_URL = "aai.server.url";
+
+ /** The Constant AAI_OLDSERVER_URL_BASE. */
+ public static final String AAI_OLDSERVER_URL_BASE = "aai.oldserver.url.base";
+
+ /** The Constant AAI_OLDSERVER_URL. */
+ public static final String AAI_OLDSERVER_URL = "aai.oldserver.url";
+
+ /** The Constant AAI_TRUSTSTORE_FILENAME. */
+ public static final String AAI_TRUSTSTORE_FILENAME = "aai.truststore.filename";
+
+ /** The Constant AAI_TRUSTSTORE_PASSWD_X. */
+ public static final String AAI_TRUSTSTORE_PASSWD_X = "aai.truststore.passwd.x";
+
+ /** The Constant AAI_KEYSTORE_FILENAME. */
+ public static final String AAI_KEYSTORE_FILENAME = "aai.keystore.filename";
+
+ /** The Constant AAI_KEYSTORE_PASSWD_X. */
+ public static final String AAI_KEYSTORE_PASSWD_X = "aai.keystore.passwd.x";
+
+ /** The Constant AAI_VID_USERNAME. */
+ public static final String AAI_VID_USERNAME = "aai.vid.username";
+
+ /** The Constant AAI_VID_PASSWD_X. */
+ public static final String AAI_VID_PASSWD_X = "aai.vid.passwd.x";
+
+ /** The Constant FILESEPARTOR. */
+ public static final String FILESEPARTOR = (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator");
+
+ /** The Constant AAI_USE_CLIENT_CERT */
+ public static final String AAI_USE_CLIENT_CERT = "aai.use.client.cert";
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/aai/util/AAIRestInterface.java b/vid-app-common/src/main/java/org/openecomp/aai/util/AAIRestInterface.java
new file mode 100755
index 0000000..fa4eefc
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/aai/util/AAIRestInterface.java
@@ -0,0 +1,303 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.aai.util;
+
+
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.security.KeyManagementException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Base64;
+import java.util.Date;
+import java.util.UUID;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.eclipse.jetty.util.security.Password;
+import org.openecomp.aai.util.AAIProperties;
+import org.openecomp.aai.util.HttpsAuthClient;
+/**
+ * The Class AAIRestInterface.
+ */
+public class AAIRestInterface {
+
+ /** The logger. */
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AAIRestInterface.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The client. */
+ private static Client client = null;
+
+ /** The rest srvr base URL. */
+ private String restSrvrBaseURL;
+
+ /** The certificate path. */
+ public String certificatePath = "";
+
+ /**
+ * Instantiates a new AAI rest interface.
+ *
+ * @param certPath the cert path
+ */
+ public AAIRestInterface(String certPath)
+ {
+ certificatePath = certPath;
+ }
+
+ /**
+ * Encode URL.
+ *
+ * @param nodeKey the node key
+ * @return the string
+ * @throws UnsupportedEncodingException the unsupported encoding exception
+ */
+ public String encodeURL (String nodeKey) throws UnsupportedEncodingException {
+ return URLEncoder.encode(nodeKey, "UTF-8").replaceAll("\\+", "%20");
+ }
+
+ /**
+ * Inits the rest client.
+ */
+ private void initRestClient()
+ {
+ String methodName = "initRestClient";
+
+ if (client == null) {
+ try {
+ client = HttpsAuthClient.getClient(certificatePath);
+ }
+ catch (KeyManagementException e){
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== KeyManagementException in " + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== KeyManagementException in " + methodName + e.toString());
+ } catch (Exception e) {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== Exception in REST call to DB in initRestClient" + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== Exception in REST call to DB : " + e.toString());
+ }
+ }
+ }
+
+ /**
+ * Sets the rest srvr base URL.
+ *
+ * @param baseURL the base URL
+ */
+ public void SetRestSrvrBaseURL(String baseURL)
+ {
+ if (baseURL == null)
+ {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== REST Server base URL cannot be null.");
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== REST Server base URL cannot be null.");
+ }
+
+ restSrvrBaseURL = baseURL;
+ }
+
+ /**
+ * Gets the rest srvr base URL.
+ *
+ * @return the rest srvr base URL
+ */
+ public String getRestSrvrBaseURL()
+ {
+ return restSrvrBaseURL;
+ }
+
+
+ /**
+ * Rest get.
+ *
+ * @param fromAppId the from app id
+ * @param transId the trans id
+ * @param requestUri the request uri
+ * @param xml the xml
+ * @return the string
+ * @throws UnsupportedEncodingException
+ */
+ public Response RestGet(String fromAppId, String transId, String requestUri, boolean xml) throws UnsupportedEncodingException {
+ String methodName = "RestGet";
+
+ String responseType = "application/json";
+ if (xml)
+ responseType = "application/xml";
+
+ initRestClient();
+
+ String clientCert = SystemProperties.getProperty(AAIProperties.AAI_USE_CLIENT_CERT);
+
+ boolean useClientCert = false;
+ if (clientCert != null &&
+ SystemProperties.getProperty(AAIProperties.AAI_USE_CLIENT_CERT).equalsIgnoreCase("true")) {
+ useClientCert = true;
+ }
+ String url = "";
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ url = SystemProperties.getProperty(AAIProperties.AAI_SERVER_URL) + requestUri;
+
+ try {
+ // what is the point of this, just to check syntax??
+ URL urlObj= new URL(url);
+ URI uri = new URI(urlObj.getProtocol(), urlObj.getUserInfo(), urlObj.getHost(), urlObj.getPort(), urlObj.getPath(), urlObj.getQuery(), urlObj.getRef());
+ url = uri.toASCIIString();
+ } catch (URISyntaxException | MalformedURLException e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " bad URL");
+ return null;
+ }
+ logger.debug(dateFormat.format(new Date()) + "<== " + url + " for the get REST API");
+
+ final Response cres;
+ if (useClientCert == true) {
+ cres = client.target(url)
+ .request()
+ .accept(responseType)
+ .header("X-TransactionId", transId)
+ .header("X-FromAppId", fromAppId)
+ .header("Content-Type", "application/json")
+ .get();
+ } else {
+
+ String vidUsername = SystemProperties.getProperty(AAIProperties.AAI_VID_USERNAME);
+ String vidPassword = Password.deobfuscate(SystemProperties.getProperty(AAIProperties.AAI_VID_PASSWD_X));
+ String encodeThis = vidUsername + ":" + vidPassword;
+
+ cres = client.target(url)
+ .request()
+ .accept(responseType)
+ .header("X-TransactionId", transId)
+ .header("X-FromAppId", fromAppId)
+ .header("Content-Type", "application/json")
+ .header("Authorization", "Basic " + Base64.getEncoder().encodeToString(encodeThis.getBytes("utf-8")))
+ .get();
+ }
+// String r = cres.readEntity(String.class);
+ if (cres.getStatus() == 200) {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api GET was successful!");
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api GET was successful!");
+ } else {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName +" with status="+cres.getStatus()+", url="+url);
+ }
+ return cres;
+// logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName +" resp=" + r );
+// return r;
+ }
+
+
+ /**
+ * Delete.
+ *
+ * @param sourceID the source ID
+ * @param transId the trans id
+ * @param path the path
+ * @return true, if successful
+ */
+ public boolean Delete(String sourceID, String transId, String path) {
+ String methodName = "Delete";
+ String url="";
+ transId += ":" + UUID.randomUUID().toString();
+ logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ initRestClient();
+ String request = "{}";
+ url = SystemProperties.getProperty(AAIProperties.AAI_SERVER_URL) + path;
+ final Response cres = client.target(url)
+ .request()
+ .accept("application/json")
+ .header("X-TransactionId", transId)
+ .header("X-FromAppId", sourceID)
+ //.entity(request)
+ .delete();
+
+ if (cres.getStatus() == 404) { // resource not found
+ String msg = "Resource does not exist...: " + cres.getStatus()
+ + ":" + cres.readEntity(String.class);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + msg);
+ return false;
+ } else if (cres.getStatus() == 200 || cres.getStatus() == 204){
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "Resource " + url + " deleted");
+ return true;
+ } else {
+ String msg = "Deleting Resource failed: " + cres.getStatus()
+ + ":" + cres.readEntity(String.class);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + msg);
+ }
+
+ return false;
+ }
+
+
+ /**
+ * Rest post.
+ *
+ * @param fromAppId the from app id
+ * @param transId the trans id
+ * @param path the path
+ * @param payload the payload
+ * @param xml the xml
+ * @return the string
+ */
+ public Response RestPost(String fromAppId, String transId, String path, String payload, boolean xml) {
+ String methodName = "RestPost";
+ String url="";
+ transId = UUID.randomUUID().toString();
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ try {
+
+ String responseType = "application/json";
+ if (xml)
+ responseType = "application/xml";
+
+ initRestClient();
+
+ url = SystemProperties.getProperty(AAIProperties.AAI_SERVER_URL_BASE) + path;
+
+ final Response cres = client.target(url)
+ .request()
+ .accept(responseType)
+ .header("X-TransactionId", transId)
+ .header("X-FromAppId", fromAppId)
+ .post(Entity.entity(payload, MediaType.APPLICATION_JSON));
+
+ if (cres.getStatus() == 200 && cres.getStatus() <= 299) {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!");
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!");
+ } else {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName +" with status="+cres.getStatus()+", url="+url);
+ }
+ return cres;
+ } catch (Exception e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " with url="+url+ ", Exception: " + e.toString());
+ }
+ return null;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/aai/util/CustomJacksonJaxBJsonProvider.java b/vid-app-common/src/main/java/org/openecomp/aai/util/CustomJacksonJaxBJsonProvider.java
new file mode 100755
index 0000000..2623d6b
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/aai/util/CustomJacksonJaxBJsonProvider.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.aai.util;
+
+
+import javax.ws.rs.ext.Provider;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
+import com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule;
+
+/**
+ * The Class CustomJacksonJaxBJsonProvider.
+ */
+@Provider
+public class CustomJacksonJaxBJsonProvider extends JacksonJaxbJsonProvider {
+
+ /** The common mapper. */
+ private static ObjectMapper commonMapper = null;
+
+ /**
+ * Instantiates a new custom jackson jax B json provider.
+ */
+ public CustomJacksonJaxBJsonProvider() {
+ if (commonMapper == null) {
+ ObjectMapper mapper = new ObjectMapper();
+
+ mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
+
+ mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
+ mapper.configure(SerializationFeature.INDENT_OUTPUT, false);
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
+
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+ mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
+
+ mapper.registerModule(new JaxbAnnotationModule());
+
+ commonMapper = mapper;
+ }
+ super.setMapper(commonMapper);
+ }
+
+ /**
+ * Gets the mapper.
+ *
+ * @return the mapper
+ */
+ public ObjectMapper getMapper() {
+ return commonMapper;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/aai/util/HttpsAuthClient.java b/vid-app-common/src/main/java/org/openecomp/aai/util/HttpsAuthClient.java
new file mode 100755
index 0000000..8335d15
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/aai/util/HttpsAuthClient.java
@@ -0,0 +1,140 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.aai.util;
+
+
+import java.io.FileInputStream;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+
+import org.eclipse.jetty.util.security.Password;
+import org.glassfish.jersey.client.ClientConfig;
+import org.glassfish.jersey.client.HttpUrlConnectorProvider;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+/**
+ * The Class HttpsAuthClient.
+ */
+public class HttpsAuthClient{
+ /** The logger. */
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HttpsAuthClient.class);
+
+ /**
+ * Gets the client.
+ *
+ * @param certFilePath the cert file path
+ * @return the client
+ * @throws KeyManagementException the key management exception
+ */
+ public static Client getClient(String certFilePath) throws KeyManagementException {
+
+ ClientConfig config = new ClientConfig();
+ //config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
+ //config.getClasses().add(org.openecomp.aai.util.CustomJacksonJaxBJsonProvider.class);
+
+ try {
+
+ config.property(HttpUrlConnectorProvider.SET_METHOD_WORKAROUND, Boolean.TRUE );
+
+ config.connectorProvider(new HttpUrlConnectorProvider().useSetMethodWorkaround());
+ String truststore_path = certFilePath + AAIProperties.FILESEPARTOR + SystemProperties.getProperty(AAIProperties.AAI_TRUSTSTORE_FILENAME);
+ String truststore_password = SystemProperties.getProperty(AAIProperties.AAI_TRUSTSTORE_PASSWD_X);
+ String decrypted_truststore_password = Password.deobfuscate(truststore_password);
+
+ boolean useClientCert = false;
+
+ String keystore_path = certFilePath + AAIProperties.FILESEPARTOR + SystemProperties.getProperty(AAIProperties.AAI_KEYSTORE_FILENAME);
+ String keystore_password = SystemProperties.getProperty(AAIProperties.AAI_KEYSTORE_PASSWD_X);
+ String decrypted_keystore_password = Password.deobfuscate(keystore_password);
+
+ String clientCert = SystemProperties.getProperty(AAIProperties.AAI_USE_CLIENT_CERT);
+
+ if (clientCert != null &&
+ SystemProperties.getProperty(AAIProperties.AAI_USE_CLIENT_CERT).equalsIgnoreCase("true")) {
+ useClientCert = true;
+ }
+
+ System.setProperty("javax.net.ssl.trustStore", truststore_path);
+ System.setProperty("javax.net.ssl.trustStorePassword", decrypted_truststore_password);
+ HttpsURLConnection.setDefaultHostnameVerifier( new HostnameVerifier(){
+ public boolean verify(String string,SSLSession ssls) {
+ return true;
+ }
+ });
+
+ final SSLContext ctx = SSLContext.getInstance("TLS");
+
+ KeyManagerFactory kmf = null;
+ if (useClientCert) {
+
+ try {
+ kmf = KeyManagerFactory.getInstance("SunX509");
+ FileInputStream fin = new FileInputStream(keystore_path);
+ KeyStore ks = KeyStore.getInstance("PKCS12");
+ char[] pwd = decrypted_keystore_password.toCharArray();
+ ks.load(fin, pwd);
+ kmf.init(ks, pwd);
+ } catch (Exception e) {
+ //System.out.println("Error setting up kmf: exiting");
+ logger.debug(EELFLoggerDelegate.debugLogger, "Error setting up kmf: exiting");
+ e.printStackTrace();
+ return null;
+ }
+ ctx.init(kmf.getKeyManagers(), null, null);
+
+ return ClientBuilder.newBuilder()
+ .sslContext(ctx)
+ .hostnameVerifier(new HostnameVerifier() {
+ @Override
+ public boolean verify( String s, SSLSession sslSession ) {
+ return true;
+ }
+ }).withConfig(config)
+ .build()
+ .register(org.openecomp.aai.util.CustomJacksonJaxBJsonProvider.class);
+ } else {
+ return ClientBuilder.newBuilder()
+ .hostnameVerifier(new HostnameVerifier() {
+ @Override
+ public boolean verify( String s, SSLSession sslSession ) {
+ return true;
+ }
+ }).withConfig(config)
+ .build()
+ .register(org.openecomp.aai.util.CustomJacksonJaxBJsonProvider.class);
+ }
+ } catch (Exception e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, "Error setting up config: exiting");
+ //System.out.println("Error setting up config: exiting");
+ e.printStackTrace();
+ System.exit(1);
+ return null;
+ }
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/aai/util/HttpsComponentsClient.java b/vid-app-common/src/main/java/org/openecomp/aai/util/HttpsComponentsClient.java
new file mode 100755
index 0000000..a041c65
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/aai/util/HttpsComponentsClient.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.aai.util;
+
+import java.io.FileInputStream;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+
+import javax.net.ssl.SSLContext;
+
+import org.apache.http.conn.ssl.SSLContextBuilder;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.impl.client.HttpClients;
+import org.eclipse.jetty.util.security.Password;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+
+
+/**
+ * The Class HttpsComponentsClient.
+ */
+public class HttpsComponentsClient{
+
+ /**
+ * Gets the client.
+ *
+ * @param certFilePath the cert file path
+ * @return the client
+ * @throws KeyManagementException the key management exception
+ */
+ public static CloseableHttpClient getClient(String certFilePath) throws Exception {
+ CloseableHttpClient httpclient = null;
+ try {
+
+ String truststore_path = certFilePath + AAIProperties.FILESEPARTOR + SystemProperties.getProperty(AAIProperties.AAI_TRUSTSTORE_FILENAME);
+ String truststore_password = SystemProperties.getProperty(AAIProperties.AAI_TRUSTSTORE_PASSWD_X);
+ String decrypted_truststore_password = Password.deobfuscate(truststore_password);
+ String keystore_path = certFilePath + AAIProperties.FILESEPARTOR + SystemProperties.getProperty(AAIProperties.AAI_KEYSTORE_FILENAME);
+ String keystore_password = SystemProperties.getProperty(AAIProperties.AAI_KEYSTORE_PASSWD_X);
+ String decrypted_keystore_password = Password.deobfuscate(keystore_password);
+
+ SSLContextBuilder sslContextB = new SSLContextBuilder();
+
+ KeyStore ks = KeyStore.getInstance("PKCS12");
+ FileInputStream fin = new FileInputStream(keystore_path);
+ char[] pwd = decrypted_keystore_password.toCharArray();
+ ks.load(fin, pwd);
+
+ sslContextB.loadKeyMaterial(ks, pwd);
+
+ KeyStore ts = KeyStore.getInstance("JKS");
+ FileInputStream fin1 = new FileInputStream(truststore_path);
+ char[] pwd1 = decrypted_truststore_password.toCharArray();
+ ts.load(fin1, pwd1);
+
+ sslContextB.loadTrustMaterial(ts);
+ sslContextB.loadKeyMaterial(ks, pwd);
+ sslContextB.useTLS();
+
+ SSLContext sslcontext = sslContextB.build();
+
+ SSLConnectionSocketFactory sslFactory = new SSLConnectionSocketFactory(
+ sslcontext,
+ new String[] { "TLSv1.1", "TLSv1.2" },
+ null,
+ SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER );
+
+ httpclient = HttpClients.custom()
+ .setSSLSocketFactory(sslFactory)
+ .build();
+
+
+ } catch (Exception e) {
+ throw e;
+ }
+ return httpclient;
+ }
+
+
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/aai/util/JettyObfuscationConversionCommandLineUtil.java b/vid-app-common/src/main/java/org/openecomp/aai/util/JettyObfuscationConversionCommandLineUtil.java
new file mode 100755
index 0000000..e4c4bce
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/aai/util/JettyObfuscationConversionCommandLineUtil.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.aai.util;
+
+
+import org.apache.commons.cli.BasicParser;
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.CommandLineParser;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.eclipse.jetty.util.security.Password;
+
+
+public class JettyObfuscationConversionCommandLineUtil {
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
+ public static void main(String[] args){
+ Options options = new Options();
+ options.addOption("e", true, "obfuscate the given string");
+ options.addOption("d", true, "deobfuscate the given string");
+
+ CommandLineParser parser = new BasicParser();
+
+ try {
+ CommandLine cmd = parser.parse(options, args);
+ String toProcess = null;
+
+ if (cmd.hasOption("e")){
+ toProcess = cmd.getOptionValue("e");
+ String encoded = Password.obfuscate(toProcess);
+ System.out.println(encoded);
+ } else if (cmd.hasOption("d")) {
+ toProcess = cmd.getOptionValue("d");
+ String decoded_str = Password.deobfuscate(toProcess);
+ System.out.println(decoded_str);
+ } else {
+ usage();
+ }
+ } catch (ParseException e) {
+ System.out.println("failed to parse input");
+ System.out.println(e.toString());
+ usage();
+ } catch (Exception e) {
+ System.out.println("exception:" + e.toString());
+ }
+ }
+
+ /**
+ * Usage.
+ */
+ private static void usage(){
+ System.out.println("usage:");;
+ System.out.println("-e [string] to obfuscate");
+ System.out.println("-d [string] to deobfuscate");
+ System.out.println("-h help");
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/AsdcCatalogException.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/AsdcCatalogException.java
new file mode 100755
index 0000000..aafb11c
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/AsdcCatalogException.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc;
+
+/**
+ * The Class AsdcCatalogException.
+ */
+public class AsdcCatalogException extends Exception {
+
+ /** The Constant serialVersionUID. */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Instantiates a new sdc catalog exception.
+ *
+ * @param msg the msg
+ */
+ public AsdcCatalogException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Instantiates a new sdc catalog exception.
+ *
+ * @param cause the cause
+ */
+ public AsdcCatalogException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Instantiates a new sdc catalog exception.
+ *
+ * @param msg the msg
+ * @param t the t
+ */
+ public AsdcCatalogException(String msg, Throwable t) {
+ super(msg, t);
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/AsdcClient.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/AsdcClient.java
new file mode 100755
index 0000000..c4a8b1c
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/AsdcClient.java
@@ -0,0 +1,128 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.UUID;
+
+import org.openecomp.vid.asdc.beans.Artifact;
+import org.openecomp.vid.asdc.beans.Resource;
+import org.openecomp.vid.asdc.beans.Service;
+import org.openecomp.vid.asdc.beans.tosca.ToscaCsar;
+
+/**
+ * The Interface AsdcClient.
+ */
+public interface AsdcClient {
+
+ /**
+ * Gets the resource.
+ *
+ * @param uuid the uuid
+ * @return the resource
+ * @throws AsdcCatalogException the sdc catalog exception
+ */
+ public Resource getResource(UUID uuid) throws AsdcCatalogException;
+
+ /**
+ * Gets the resources.
+ *
+ * @return the resources
+ * @throws AsdcCatalogException the sdc catalog exception
+ */
+ public Collection<Resource> getResources() throws AsdcCatalogException;
+
+ /**
+ * Gets the resources.
+ *
+ * @param filter the filter
+ * @return the resources
+ * @throws AsdcCatalogException the sdc catalog exception
+ */
+ public Collection<Resource> getResources(Map<String, String[]> filter) throws AsdcCatalogException;
+
+ /**
+ * Gets the resource artifact.
+ *
+ * @param resourceUuid the resource uuid
+ * @param artifactUuid the artifact uuid
+ * @return the resource artifact
+ * @throws AsdcCatalogException the sdc catalog exception
+ */
+ public Artifact getResourceArtifact(UUID resourceUuid, UUID artifactUuid) throws AsdcCatalogException;
+
+ /**
+ * Gets the resource tosca model.
+ *
+ * @param uuid the uuid
+ * @return the resource tosca model
+ * @throws AsdcCatalogException the sdc catalog exception
+ */
+ public ToscaCsar getResourceToscaModel(UUID uuid) throws AsdcCatalogException;
+
+ /**
+ * Gets the service.
+ *
+ * @param uuid the uuid
+ * @return the service
+ * @throws AsdcCatalogException the sdc catalog exception
+ */
+ public Service getService(UUID uuid) throws AsdcCatalogException;
+
+ /**
+ * Gets the services.
+ *
+ * @return the services
+ * @throws AsdcCatalogException the sdc catalog exception
+ */
+ public Collection<Service> getServices() throws AsdcCatalogException;
+
+ /**
+ * Gets the services.
+ *
+ * @param filter the filter
+ * @return the services
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ public Collection<Service> getServices(Map<String, String[]> filter) throws AsdcCatalogException;
+
+ /**
+ * Gets the service artifact.
+ *
+ * @param serviceUuid the service uuid
+ * @param artifactUuid the artifact uuid
+ * @return the service artifact
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ public Artifact getServiceArtifact(UUID serviceUuid, UUID artifactUuid) throws AsdcCatalogException;
+
+ /**
+ * Gets the service tosca model.
+ *
+ * @param uuid the uuid
+ * @return the service tosca model
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ public ToscaCsar getServiceToscaModel(UUID uuid) throws AsdcCatalogException;
+
+ //TODO: Collect TOSCA information from CSAR
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Artifact.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Artifact.java
new file mode 100755
index 0000000..d24d123
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Artifact.java
@@ -0,0 +1,314 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans;
+
+import java.util.UUID;
+
+/**
+ * The Class Artifact.
+ */
+public class Artifact {
+
+/*
+ * SDC has widened this to a String type for 1610.
+ public enum Type {
+ HEAT,
+ HEAT_ENV,
+ HEAT_VOL,
+ HEAT_NET,
+ HEAT_NESTED,
+ HEAT_ARTIFACT,
+ YANG_XML,
+ VNF_CATALOG,
+ VF_LICENSE,
+ VENDOR_LICENSE,
+ ASSET_INVENTORY_PROFILE,
+ ASSET_QUERY_SPEC,
+ APPC_CONFIG,
+ VF_MODULES_METADATA,
+ DCAE_TOSCA,
+ DCAE_JSON,
+ DCAE_EMF,
+ DCAE_DOC,
+ DCAE_BLUEPRINT,
+ DCAE_EVENT,
+ DCAE_INVENTORY_TOSCA,
+ DCAE_INVENTORY_JSON,
+ DCAE_INVENTORY_EMF,
+ DCAE_INVENTORY_DOC,
+ DCAE_INVENTORY_BLUEPRINT,
+ DCAE_INVENTORY_EVENT,
+ OTHER,
+ AAI_SERVICE_MODEL //HEY! READ ME! YES, YOU! I AM A TEMPORARY FIX, PLEASE REMOVE ME BECAUSE I AM A FRAUD. I DON'T BELONG HERE.
+ //Warm Regards,
+ // *The* Artifact.Type.AAI_SERVICE_MODEL Constant
+ }
+ */
+
+ /** The artifact name. */
+ private String artifactName;
+
+ /** The artifact label. */
+ private String artifactLabel;
+
+ /** The artifact group type. */
+ private String artifactGroupType;
+
+ /** The artifact type. */
+ private String artifactType;
+
+ /** The artifact URL. */
+ private String artifactURL;
+
+ /** The artifact description. */
+ private String artifactDescription;
+
+ /** The artifact timeout. */
+ private int artifactTimeout;
+
+ /** The artifact checksum. */
+ private String artifactChecksum;
+
+ /** The artifact UUID. */
+ private String artifactUUID;
+
+ /** The artifact version. */
+ private String artifactVersion;
+
+ /** The generated from UUID. */
+ private String generatedFromUUID;
+
+ /**
+ * Gets the artifact name.
+ *
+ * @return the artifact name
+ */
+ public String getArtifactName() {
+ return artifactName;
+ }
+
+ /**
+ * Gets the artifact type.
+ *
+ * @return the artifact type
+ */
+ public String getArtifactType() {
+ return artifactType;
+ }
+ /**
+ * Gets the artifact group type.
+ *
+ * @return the artifact group type
+ */
+ public String getArtifactGroupType() {
+ return artifactGroupType;
+ }
+
+ /**
+ * Gets the artifact label.
+ *
+ * @return the artifact label
+ */
+ public String getArtifactLabel() {
+ return artifactLabel;
+ }
+ /**
+ * Gets the artifact URL.
+ *
+ * @return the artifact URL
+ */
+ public String getArtifactURL() {
+ return artifactURL;
+ }
+
+ /**
+ * Gets the artifact description.
+ *
+ * @return the artifact description
+ */
+ public String getArtifactDescription() {
+ return artifactDescription;
+ }
+
+ /**
+ * Gets the artifact timeout.
+ *
+ * @return the artifact timeout
+ */
+ public int getArtifactTimeout() {
+ return artifactTimeout;
+ }
+
+ /**
+ * Gets the artifact checksum.
+ *
+ * @return the artifact checksum
+ */
+ public String getArtifactChecksum() {
+ return artifactChecksum;
+ }
+
+ /**
+ * Gets the artifact UUID.
+ *
+ * @return the artifact UUID
+ */
+ public String getArtifactUUID() {
+ return artifactUUID;
+ }
+
+ /**
+ * Gets the artifact version.
+ *
+ * @return the artifact version
+ */
+ public String getArtifactVersion() {
+ return artifactVersion;
+ }
+
+ /**
+ * Gets the generated from UUID.
+ *
+ * @return the generated from UUID
+ */
+ public String getGeneratedFromUUID() {
+ return generatedFromUUID;
+ }
+
+ /**
+ * Sets the artifact name.
+ *
+ * @param artifactName the new artifact name
+ */
+ public void setArtifactName(String artifactName) {
+ this.artifactName = artifactName;
+ }
+
+ /**
+ * Sets the artifact type.
+ *
+ * @param artifactType the new artifact type
+ */
+ public void setArtifactType(String artifactType) {
+ this.artifactType = artifactType;
+ }
+ /**
+ * Sets the artifact group type.
+ *
+ * @param artifactGroupType the new artifact group type
+ */
+ public void setArtifactGroupType(String artifactGroupType) {
+ this.artifactGroupType = artifactGroupType;
+ }
+ /**
+ * Sets the artifact label.
+ *
+ * @param artifactGroupType the new artifact label
+ */
+ public void setArtifactLabel(String artifactLabel) {
+ this.artifactLabel = artifactLabel;
+ }
+ /**
+ * Sets the artifact URL.
+ *
+ * @param artifactURL the new artifact URL
+ */
+ public void setArtifactURL(String artifactURL) {
+ this.artifactURL = artifactURL;
+ }
+
+ /**
+ * Sets the artifact description.
+ *
+ * @param artifactDescription the new artifact description
+ */
+ public void setArtifactDescription(String artifactDescription) {
+ this.artifactDescription = artifactDescription;
+ }
+
+ /**
+ * Sets the artifact timeout.
+ *
+ * @param artifactTimeout the new artifact timeout
+ */
+ public void setArtifactTimeout(int artifactTimeout) {
+ this.artifactTimeout = artifactTimeout;
+ }
+
+ /**
+ * Sets the artifact checksum.
+ *
+ * @param artifactChecksum the new artifact checksum
+ */
+ public void setArtifactChecksum(String artifactChecksum) {
+ this.artifactChecksum = artifactChecksum;
+ }
+
+ /**
+ * Sets the artifact UUID.
+ *
+ * @param artifactUUID the new artifact UUID
+ */
+ public void setArtifactUUID(String artifactUUID) {
+ this.artifactUUID = artifactUUID;
+ }
+
+ /**
+ * Sets the artifact version.
+ *
+ * @param artifactVersion the new artifact version
+ */
+ public void setArtifactVersion(String artifactVersion) {
+ this.artifactVersion = artifactVersion;
+ }
+
+ /**
+ * Sets the generated from UUID.
+ *
+ * @param generatedFromUUID the new generated from UUID
+ */
+ public void setGeneratedFromUUID(String generatedFromUUID) {
+ this.generatedFromUUID = generatedFromUUID;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final UUID uuid = UUID.fromString(getArtifactUUID());
+
+ return uuid.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof Artifact)) return false;
+
+ final Artifact artifact = (Artifact) o;
+
+ return (artifact.getArtifactUUID().equals(getArtifactUUID()));
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Resource.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Resource.java
new file mode 100755
index 0000000..3911c69
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Resource.java
@@ -0,0 +1,429 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans;
+
+import java.util.Collection;
+import java.util.UUID;
+
+/**
+ * The Class Resource.
+ */
+public class Resource {
+
+ /**
+ * The Enum Type.
+ */
+ public enum Type {
+
+ /** The vf. */
+ VF,
+
+ /** The vfc. */
+ VFC,
+
+ /** The cp. */
+ CP,
+
+ /** The vl. */
+ VL,
+
+ /** The vfcmt. */
+ VFCMT
+ }
+
+ /**
+ * The Enum LifecycleState.
+ */
+ public enum LifecycleState {
+
+ /** The not certified checkout. */
+ NOT_CERTIFIED_CHECKOUT,
+
+ /** The not certified checkin. */
+ NOT_CERTIFIED_CHECKIN,
+
+ /** The ready for certification. */
+ READY_FOR_CERTIFICATION,
+
+ /** The certification in progress. */
+ CERTIFICATION_IN_PROGRESS,
+
+ /** The certified. */
+ CERTIFIED
+ }
+
+ /** The uuid. */
+ private String uuid;
+
+ /** The invariant UUID. */
+ private String invariantUUID;
+
+ /** The name. */
+ private String name;
+
+ /** The description. */
+ private String description;
+
+ /** The version. */
+ private String version;
+
+ /** The tosca model URL. */
+ private String toscaModelURL;
+
+ /** The category. */
+ private String category;
+
+ /** The sub category. */
+ private String subCategory;
+
+ /** The resource type. */
+ private Resource.Type resourceType;
+
+ /** The lifecycle state. */
+ private Resource.LifecycleState lifecycleState;
+
+ /** The last updater user ID. */
+ private String lastUpdaterUserId;
+
+ /** The last updater full name. */
+ private String lastUpdaterFullName;
+
+ /** The tosca model. */
+ private String toscaModel;
+
+ /** The tosca resource name. */
+ private String toscaResourceName;
+
+ /** The artifacts. */
+ private Collection<Artifact> artifacts;
+
+ /** The resources. */
+ private Collection<SubResource> resources;
+
+ /**
+ * Gets the uuid.
+ *
+ * @return the uuid
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * Gets the invariant UUID.
+ *
+ * @return the invariant UUID
+ */
+ public String getInvariantUUID() {
+ return invariantUUID;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Gets the tosca model URL.
+ *
+ * @return the tosca model URL
+ */
+ public String getToscaModelURL() {
+ return toscaModelURL;
+ }
+
+ /**
+ * Gets the category.
+ *
+ * @return the category
+ */
+ public String getCategory() {
+ return category;
+ }
+
+ /**
+ * Gets the sub category.
+ *
+ * @return the sub category
+ */
+ public String getSubCategory() {
+ return subCategory;
+ }
+
+ /**
+ * Gets the resource type.
+ *
+ * @return the resource type
+ */
+ public Resource.Type getResourceType() {
+ return resourceType;
+ }
+
+ /**
+ * Gets the lifecycle state.
+ *
+ * @return the lifecycle state
+ */
+ public Resource.LifecycleState getLifecycleState() {
+ return lifecycleState;
+ }
+
+ /**
+ * Gets the last updater user ID.
+ *
+ * @return the last updater user ID
+ */
+ public String getLastUpdaterUserId() {
+ return lastUpdaterUserId;
+ }
+
+ /**
+ * Gets the last updater full name.
+ *
+ * @return the last updater full name
+ */
+ public String getLastUpdaterFullName() {
+ return lastUpdaterFullName;
+ }
+
+ /**
+ * Gets the tosca model.
+ *
+ * @return the tosca model
+ */
+ public String getToscaModel() {
+ return toscaModel;
+ }
+
+ /**
+ * Gets the tosca resource name.
+ *
+ * @return the tosca resource name
+ */
+ public String getToscaResourceName() {
+ return toscaResourceName;
+ }
+
+ /**
+ * Gets the artifacts.
+ *
+ * @return the artifacts
+ */
+ public Collection<Artifact> getArtifacts() {
+ return artifacts;
+ }
+
+ /**
+ * Gets the resources.
+ *
+ * @return the resources
+ */
+ public Collection<SubResource> getResources() {
+ return resources;
+ }
+
+ /**
+ * Sets the uuid.
+ *
+ * @param uuid the new uuid
+ */
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * Sets the invariant UUID.
+ *
+ * @param invariantUUID the new invariant UUID
+ */
+ public void setInvariantUUID(String invariantUUID) {
+ this.invariantUUID = invariantUUID;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+ /**
+ * Sets the description.
+ *
+ * @param name the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+ /**
+ * Sets the version.
+ *
+ * @param version the new version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * Sets the tosca model URL.
+ *
+ * @param toscaModelURL the new tosca model URL
+ */
+ public void setToscaModelURL(String toscaModelURL) {
+ this.toscaModelURL = toscaModelURL;
+ }
+
+ /**
+ * Sets the category.
+ *
+ * @param category the new category
+ */
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ /**
+ * Sets the sub category.
+ *
+ * @param subCategory the new sub category
+ */
+ public void setSubCategory(String subCategory) {
+ this.subCategory = subCategory;
+ }
+
+ /**
+ * Sets the resource type.
+ *
+ * @param resourceType the new resource type
+ */
+ public void setResourceType(Resource.Type resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ /**
+ * Sets the lifecycle state.
+ *
+ * @param lifecycleState the new lifecycle state
+ */
+ public void setLifecycleState(Resource.LifecycleState lifecycleState) {
+ this.lifecycleState = lifecycleState;
+ }
+
+ /**
+ * Sets the last updater user ID.
+ *
+ * @param lastUpdaterUserId the new last updater user ID
+ */
+ public void setLastUpdaterUserId(String lastUpdaterUserId) {
+ this.lastUpdaterUserId = lastUpdaterUserId;
+ }
+
+ /**
+ * Sets the last updater full name.
+ *
+ * @param lastUpdaterFullName the new last updater full name
+ */
+ public void setLastUpdaterFullName(String lastUpdaterFullName) {
+ this.lastUpdaterFullName = lastUpdaterFullName;
+ }
+
+ /**
+ * Sets the tosca model.
+ *
+ * @param toscaModel the new tosca model
+ */
+ public void setToscaModel(String toscaModel) {
+ this.toscaModel = toscaModel;
+ }
+
+ /**
+ * Sets the tosca resource name.
+ *
+ * @param toscaResourceName the new tosca resource name
+ */
+ public void setToscaResourceName(String toscaResourceName) {
+ this.toscaResourceName = toscaResourceName;
+ }
+
+ /**
+ * Sets the artifacts.
+ *
+ * @param artifacts the new artifacts
+ */
+ public void setArtifacts(Collection<Artifact> artifacts) {
+ this.artifacts = artifacts;
+ }
+
+ /**
+ * Sets the resources.
+ *
+ * @param resources the new resources
+ */
+ public void setResources(Collection<SubResource> resources) {
+ this.resources = resources;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final UUID uuid = UUID.fromString(getUuid());
+
+ return uuid.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof Resource)) return false;
+
+ final Resource resource = (Resource) o;
+
+ return (resource.getUuid().equals(getUuid()));
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Service.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Service.java
new file mode 100755
index 0000000..fa898e5
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Service.java
@@ -0,0 +1,351 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans;
+
+import java.util.Collection;
+import java.util.UUID;
+/**
+ * The Class Service.
+ */
+public class Service {
+
+ /**
+ * The Enum DistributionStatus.
+ */
+ public enum DistributionStatus {
+
+ /** The distribution not approved. */
+ DISTRIBUTION_NOT_APPROVED,
+
+ /** The distribution approved. */
+ DISTRIBUTION_APPROVED,
+
+ /** The distributed. */
+ DISTRIBUTED,
+
+ /** The distribution rejected. */
+ DISTRIBUTION_REJECTED
+ }
+
+ /**
+ * The Enum LifecycleState.
+ */
+ public enum LifecycleState {
+
+ /** The not certified checkout. */
+ NOT_CERTIFIED_CHECKOUT,
+
+ /** The not certified checkin. */
+ NOT_CERTIFIED_CHECKIN,
+
+ /** The ready for certification. */
+ READY_FOR_CERTIFICATION,
+
+ /** The certification in progress. */
+ CERTIFICATION_IN_PROGRESS,
+
+ /** The certified. */
+ CERTIFIED
+ }
+
+ /** The uuid. */
+ private String uuid;
+
+ /** The invariant UUID. */
+ private String invariantUUID;
+
+ /** The name. */
+ private String name;
+
+ /** The version. */
+ private String version;
+
+ /** The tosca model URL. */
+ private String toscaModelURL;
+
+ /** The category. */
+ private String category;
+
+ /** The lifecycle state. */
+ private Service.LifecycleState lifecycleState;
+
+ /** The last updater user uid. */
+ private String lastUpdaterUserId;
+
+ /** The last updater full name. */
+ private String lastUpdaterFullName;
+
+ /** The distribution status. */
+ private Service.DistributionStatus distributionStatus;
+
+ /** The artifacts. */
+ private Collection<Artifact> artifacts;
+
+ /** The resources. */
+ private Collection<SubResource> resources;
+
+ /**
+ * Gets the uuid.
+ *
+ * @return the uuid
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * Gets the invariant UUID.
+ *
+ * @return the invariant UUID
+ */
+ public String getInvariantUUID() {
+ return invariantUUID;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Gets the tosca model URL.
+ *
+ * @return the tosca model URL
+ */
+ public String getToscaModelURL() {
+ return toscaModelURL;
+ }
+
+ /**
+ * Gets the category.
+ *
+ * @return the category
+ */
+ public String getCategory() {
+ return category;
+ }
+
+ /**
+ * Gets the lifecycle state.
+ *
+ * @return the lifecycle state
+ */
+ public Service.LifecycleState getLifecycleState() {
+ return lifecycleState;
+ }
+
+ /**
+ * Gets the last updater user uid.
+ *
+ * @return the last updater user uid
+ */
+ public String getLastUpdaterUserId() {
+ return lastUpdaterUserId;
+ }
+
+ /**
+ * Gets the last updater full name.
+ *
+ * @return the last updater full name
+ */
+ public String getLastUpdaterFullName() {
+ return lastUpdaterFullName;
+ }
+
+ /**
+ * Gets the distribution status.
+ *
+ * @return the distribution status
+ */
+ public Service.DistributionStatus getDistributionStatus() {
+ return distributionStatus;
+ }
+
+ /**
+ * Gets the artifacts.
+ *
+ * @return the artifacts
+ */
+ public Collection<Artifact> getArtifacts() {
+ return artifacts;
+ }
+
+ /**
+ * Gets the resources.
+ *
+ * @return the resources
+ */
+ public Collection<SubResource> getResources() {
+ return resources;
+ }
+
+ /**
+ * Sets the uuid.
+ *
+ * @param uuid the new uuid
+ */
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * Sets the invariant UUID.
+ *
+ * @param invariantUUID the new invariant UUID
+ */
+ public void setInvariantUUID(String invariantUUID) {
+ this.invariantUUID = invariantUUID;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the version.
+ *
+ * @param version the new version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * Sets the tosca model URL.
+ *
+ * @param toscaModelURL the new tosca model URL
+ */
+ public void setToscaModelURL(String toscaModelURL) {
+ this.toscaModelURL = toscaModelURL;
+ }
+
+ /**
+ * Sets the category.
+ *
+ * @param category the new category
+ */
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ /**
+ * Sets the lifecycle state.
+ *
+ * @param lifecycleState the new lifecycle state
+ */
+ public void setLifecycleState(Service.LifecycleState lifecycleState) {
+ this.lifecycleState = lifecycleState;
+ }
+
+ /**
+ * Sets the last updater user uid.
+ *
+ * @param lastUpdaterUserId the new last updater user uid
+ */
+ public void set(String lastUpdaterUserId) {
+ this.lastUpdaterUserId = lastUpdaterUserId;
+ }
+
+ /**
+ * Sets the last updater full name.
+ *
+ * @param lastUpdaterFullName the new last updater full name
+ */
+ public void setLastUpdaterFullName(String lastUpdaterFullName) {
+ this.lastUpdaterFullName = lastUpdaterFullName;
+ }
+
+ /**
+ * Sets the distribution status.
+ *
+ * @param distributionStatus the new distribution status
+ */
+ public void setDistributionStatus(Service.DistributionStatus distributionStatus) {
+ this.distributionStatus = distributionStatus;
+ }
+
+ /**
+ * Sets the artifacts.
+ *
+ * @param artifacts the new artifacts
+ */
+ public void setArtifacts(Collection<Artifact> artifacts) {
+ this.artifacts = artifacts;
+ }
+
+ /**
+ * Sets the resources.
+ *
+ * @param resources the new resources
+ */
+ public void setResources(Collection<SubResource> resources) {
+ this.resources = resources;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return uuid;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final UUID uuid = UUID.fromString(getUuid());
+
+ return uuid.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof Service)) return false;
+
+ final Service service = (Service) o;
+
+ return (service.getUuid().equals(getUuid()));
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/SubResource.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/SubResource.java
new file mode 100755
index 0000000..6d7fb41
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/SubResource.java
@@ -0,0 +1,175 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans;
+
+import java.util.Collection;
+/**
+ * The Class SubResource.
+ */
+public class SubResource {
+
+ /** The resource instance name. */
+ private String resourceInstanceName;
+
+ /** The resource name. */
+ private String resourceName;
+
+ /** The resource invariant UUID. */
+ private String resourceInvariantUUID;
+
+ /** The resource version. */
+ private String resourceVersion;
+
+ /** The resource type. */
+ private String resourceType;
+
+ /** The resource UUID. */
+ private String resourceUUID;
+
+ /** The artifacts. */
+ private Collection<Artifact> artifacts;
+
+ /**
+ * Gets the resource instance name.
+ *
+ * @return the resource instance name
+ */
+ public String getResourceInstanceName() {
+ return resourceInstanceName;
+ }
+
+ /**
+ * Gets the resource name.
+ *
+ * @return the resource name
+ */
+ public String getResourceName() {
+ return resourceName;
+ }
+
+ /**
+ * Gets the resource invariant UUID.
+ *
+ * @return the resource invariant UUID
+ */
+ public String getResourceInvariantUUID() {
+ return resourceInvariantUUID;
+ }
+
+ /**
+ * Gets the resource version.
+ *
+ * @return the resource version
+ */
+ public String getResourceVersion() {
+ return resourceVersion;
+ }
+
+ /**
+ * Gets the resoucre type.
+ *
+ * @return the resoucre type
+ */
+ public String getResoucreType() {
+ return resourceType;
+ }
+
+ /**
+ * Gets the resource UUID.
+ *
+ * @return the resource UUID
+ */
+ public String getResourceUUID() {
+ return resourceUUID;
+ }
+
+ /**
+ * Gets the artifacts.
+ *
+ * @return the artifacts
+ */
+ public Collection<Artifact> getArtifacts() {
+ return artifacts;
+ }
+
+ /**
+ * Sets the resource instance name.
+ *
+ * @param resourceInstanceName the new resource instance name
+ */
+ public void setResourceInstanceName(String resourceInstanceName) {
+ this.resourceInstanceName = resourceInstanceName;
+ }
+
+ /**
+ * Sets the resource name.
+ *
+ * @param resourceName the new resource name
+ */
+ public void setResourceName(String resourceName) {
+ this.resourceName = resourceName;
+ }
+
+ /**
+ * Sets the resource invariant UUID.
+ *
+ * @param resourceInvariantUUID the new resource invariant UUID
+ */
+ public void setResourceInvariantUUID(String resourceInvariantUUID) {
+ this.resourceInvariantUUID = resourceInvariantUUID;
+ }
+
+ /**
+ * Sets the resource version.
+ *
+ * @param resourceVersion the new resource version
+ */
+ public void setResourceVersion(String resourceVersion) {
+ this.resourceVersion = resourceVersion;
+ }
+
+ /**
+ * Sets the resoucre type.
+ *
+ * @param resourceType the new resoucre type
+ */
+ public void setResoucreType(String resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ /**
+ * Sets the resource UUID.
+ *
+ * @param resourceUUID the new resource UUID
+ */
+ public void setResourceUUID(String resourceUUID) {
+ this.resourceUUID = resourceUUID;
+ }
+
+ /**
+ * Sets the artifacts.
+ *
+ * @param artifacts the new artifacts
+ */
+ public void setArtifacts(Collection<Artifact> artifacts) {
+ this.artifacts = artifacts;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Capability.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Capability.java
new file mode 100755
index 0000000..21a50d3
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Capability.java
@@ -0,0 +1,140 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * The Class Capability.
+ */
+public class Capability {
+
+ /** The type. */
+ private String type; //FIXME: Make an enumeration?
+
+ /** The description. */
+ private String description;
+
+ /** The occurrences. */
+ private Collection<String> occurrences; //FIXME: Make an enumeration?
+
+ /** The properties. */
+ private Map<String, Property> properties;
+
+ /** The valid source types. */
+ private Collection<String> valid_source_types; //FIXME: Make an enumeration?
+
+ /**
+ * Instantiates a new capability.
+ */
+ public Capability() {}
+
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the occurrences.
+ *
+ * @return the occurrences
+ */
+ public Collection<String> getOccurrences() {
+ return occurrences;
+ }
+
+ /**
+ * Gets the properties.
+ *
+ * @return the properties
+ */
+ public Map<String, Property> getProperties() {
+ return properties;
+ }
+
+ /**
+ * Gets the valid source types.
+ *
+ * @return the valid source types
+ */
+ public Collection<String> getValid_source_types() {
+ return valid_source_types;
+ }
+
+ /**
+ * Sets the type.
+ *
+ * @param type the new type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the occurrences.
+ *
+ * @param occurrences the new occurrences
+ */
+ public void setOccurrences(Collection<String> occurrences) {
+ this.occurrences = occurrences;
+ }
+
+ /**
+ * Sets the properties.
+ *
+ * @param properties the properties
+ */
+ public void setProperties(Map<String, Property> properties) {
+ this.properties = properties;
+ }
+
+ /**
+ * Sets the valid source types.
+ *
+ * @param valid_source_types the new valid source types
+ */
+ public void setValid_source_types(Collection<String> valid_source_types) {
+ this.valid_source_types = valid_source_types;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Constraint.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Constraint.java
new file mode 100755
index 0000000..b68b51a
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Constraint.java
@@ -0,0 +1,199 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.openecomp.vid.asdc.beans.tosca;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * The Class Constraint.
+ */
+
+public class Constraint {
+ private List<Object> valid_values;
+ private Object equal;
+ private Object greater_than;
+ private Object greater_or_equal;
+ private Object less_than;
+ private Object less_or_equal;
+ private List<Object> in_range;
+ private Object length;
+ private Object min_length;
+ private Object max_length;
+
+ /**
+ * Instantiates a new Constraint.
+ */
+ public Constraint() {
+ valid_values = new ArrayList<Object>();
+ in_range = new ArrayList<Object>();
+ }
+
+ /**
+ * Gets the valid_values.
+ *
+ * @return the valid_values
+ */
+ public List<Object> getvalid_values() {
+ return valid_values;
+ }
+ /**
+ * Gets equal.
+ *
+ * @return equal
+ */
+ public Object getEqual() {
+ return equal;
+ }
+ /**
+ * Gets greater_than.
+ *
+ * @return greater_than
+ */
+ public Object getGreater_than() {
+ return greater_than;
+ }
+ /**
+ * Gets greater_or_equal.
+ *
+ * @return greater_or_equal
+ */
+ public Object getGreater_or_equal() {
+ return greater_or_equal;
+ }
+ /**
+ * Gets less_than.
+ *
+ * @return less_than
+ */
+ public Object getLess_than() {
+ return less_than;
+ }
+ /**
+ * Gets less_or_equal.
+ *
+ * @return less_or_equal
+ */
+ public Object getLess_or_equal() {
+ return less_or_equal;
+ }
+ /**
+ * Gets in_range.
+ *
+ * @return in_range
+ */
+ public List<Object> getIn_range() {
+ return in_range;
+ }
+ /**
+ * Gets length.
+ *
+ * @return length
+ */
+ public Object getLength() {
+ return length;
+ }
+ /**
+ * Gets min_length.
+ *
+ * @return min_length
+ */
+ public Object getMin_length() {
+ return min_length;
+ }
+ /**
+ * Gets max_length.
+ *
+ * @return max_length
+ */
+ public Object getMax_length() {
+ return max_length;
+ }
+ /**
+ * Sets the valid_values.
+ *
+ * @param op the new valid_values
+ */
+ public void setvalid_values(List<Object> vlist) {
+ this.valid_values = vlist;
+ }
+ /**
+ * Sets equal.
+ *
+ * @param e the new equal
+ */
+ public void setEqual(Object e) {
+ this.equal = e;
+ }
+ /**
+ * Sets greater_than.
+ *
+ * @param e the new greater_than
+ */
+ public void setGreater_than(Object e) {
+ this.greater_than = e;
+ }
+ /**
+ * Sets less_than.
+ *
+ * @param e the new less_than
+ */
+ public void setLess_than(Object e) {
+ this.less_than = e;
+ }
+ /**
+ * Sets in_range.
+ *
+ * @param e the new in_range
+ */
+ public void setIn_range(List<Object> e) {
+ this.in_range = e;
+ }
+ /**
+ * Sets length.
+ *
+ * @param e the length
+ */
+ public void setLength(Object e) {
+ this.length = e;
+ }
+ /**
+ * Sets min_length.
+ *
+ * @param e the min_length
+ */
+ public void setMin_length(Object e) {
+ this.min_length = e;
+ }
+ /**
+ * Sets max_length.
+ *
+ * @param e the max_length
+ */
+ public void setMax_length(Object e) {
+ this.max_length = e;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "valid_values=" + valid_values;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Group.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Group.java
new file mode 100755
index 0000000..275db3c
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Group.java
@@ -0,0 +1,135 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.util.Collection;
+import java.util.Map;
+
+/**
+ * The Class Group.
+ */
+public class Group {
+
+ /** The type. */
+ private String type;
+
+ /** The members. */
+ private Collection<String> members;
+
+ /** The metadata. */
+ private ToscaMetadata metadata;
+
+ /** The vf module type. */
+ private String vf_module_type;
+
+ /** The properties. */
+ private Map<String, Object> properties;
+
+ /**
+ * Gets the metadata.
+ *
+ * @return the metadata
+ */
+ public ToscaMetadata getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * Sets the metadata.
+ *
+ * @param metadata the new metadata
+ */
+ public void setMetadata(ToscaMetadata metadata) {
+ this.metadata = metadata;
+ }
+
+ /**
+ * Gets the members.
+ *
+ * @return the members
+ */
+ public Collection<String> getMembers() {
+ return members;
+ }
+
+ /**
+ * Sets the members.
+ *
+ * @param members the new members
+ */
+ public void setMembers(Collection<String> members) {
+ this.members = members;
+ }
+
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Sets the type.
+ *
+ * @param type the new type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Gets the vf module type.
+ *
+ * @return the vf module type
+ */
+ public String getvf_module_type() {
+ return vf_module_type;
+ }
+
+ /**
+ * Sets the vf module type.
+ *
+ * @param vf_module_type the new vf module type
+ */
+ public void setvf_module_type(String vf_module_type) {
+ this.vf_module_type = vf_module_type;
+ }
+
+ /**
+ * Gets the properties.
+ *
+ * @return the properties
+ */
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ /**
+ * Sets the properties.
+ *
+ * @param properties the properties
+ */
+ public void setProperties(Map<String, Object> properties) {
+ this.properties = properties;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Import.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Import.java
new file mode 100755
index 0000000..33f3175
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Import.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+/**
+ * The Class Import.
+ */
+public class Import {
+
+ /** The file. */
+ private String file;
+
+ /**
+ * Gets the file.
+ *
+ * @return the file
+ */
+ public String getFile() {
+ return file;
+ }
+
+ /**
+ * Sets the file.
+ *
+ * @param file the new file
+ */
+ public void setFile(String file) {
+ this.file = file;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Input.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Input.java
new file mode 100755
index 0000000..f988207
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Input.java
@@ -0,0 +1,166 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.util.List;
+import java.util.ArrayList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Input.
+ */
+public class Input {
+
+ /** The type. */
+ private String type;
+
+ /** The description. */
+ private String description;
+
+ /** The default. */
+ private Object _default;
+
+ /** The entry schema. */
+ private Input entry_schema;
+
+ /** The constraints */
+ private List<Constraint> constraints;
+
+ /** The required field. If not set, the default is true */
+ private boolean required = true;
+
+ /**
+ * Instantiates a new input.
+ */
+ public Input() {
+ constraints = new ArrayList<Constraint>();
+ }
+
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Sets the type.
+ *
+ * @param type the new type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+ /**
+ * Gets the required field.
+ *
+ * @return the required field
+ */
+ public boolean getRequired() {
+ return required;
+ }
+ /**
+ * Sets the required value.
+ *
+ * @param required the new required value
+ */
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Gets the default.
+ *
+ * @return the default
+ */
+ public Object getDefault() {
+ return _default;
+ }
+
+ /**
+ * Sets the default.
+ *
+ * @param _default the new default
+ */
+ public void setDefault(Object _default) {
+ this._default = _default;
+ }
+
+ /**
+ * Gets the entry schema.
+ *
+ * @return the entry schema
+ */
+ public Input getentry_schema() {
+ return entry_schema;
+ }
+ /**
+ * Sets the entry schema.
+ *
+ * @param the entry schema
+ */
+ public void setentry_schema(Input s) {
+ this.entry_schema = s;
+ }
+ /**
+ * Sets the constraints.
+ *
+ * @param c the new constraints
+ */
+ public void setConstraints(List<Constraint> c) {
+ this.constraints = c;
+ }
+ /**
+ * Gets the constraints
+ *
+ * @return the constraints
+ */
+ public List<Constraint> getConstraints() {
+ return constraints;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "type=" + type + ",description=" + description + ",default=" + _default;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/NodeTemplate.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/NodeTemplate.java
new file mode 100755
index 0000000..73eead9
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/NodeTemplate.java
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.util.Map;
+import java.util.HashMap;
+
+/**
+ * The Class NodeTemplate.
+ */
+public class NodeTemplate {
+
+ /** The type. */
+ private String type;
+
+ /** The metadata. */
+ private ToscaMetadata metadata;
+
+ /** The properties. */
+ private Map<String, Object> properties; //HEAT?
+
+ /** The requirements. */
+ private Object requirements;
+
+ public NodeTemplate () {
+ properties = new HashMap<String,Object>();
+ }
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Sets the type.
+ *
+ * @param type the new type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Gets the metadata.
+ *
+ * @return the metadata
+ */
+ public ToscaMetadata getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * Sets the metadata.
+ *
+ * @param metadata the new metadata
+ */
+ public void setMetadata(ToscaMetadata metadata) {
+ this.metadata = metadata;
+ }
+
+ /**
+ * Gets the properties.
+ *
+ * @return the properties
+ */
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ /**
+ * Sets the properties.
+ *
+ * @param properties the properties
+ */
+ public void setProperties(Map<String, Object> properties) {
+ this.properties = properties;
+ }
+
+ /**
+ * Gets the requirements.
+ *
+ * @return the requirements
+ */
+ public Object getRequirements() {
+ return requirements;
+ }
+
+ /**
+ * Sets the requirements.
+ *
+ * @param requirements the new requirements
+ */
+ public void setRequirements(Object requirements) {
+ this.requirements = requirements;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Property.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Property.java
new file mode 100755
index 0000000..c8f048c
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Property.java
@@ -0,0 +1,157 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+/**
+ * The Class Property.
+ */
+public class Property {
+
+ /** The type. */
+ private String type;
+
+ /** The description. */
+ private String description;
+
+ /** The entry schema. */
+ private Schema entry_schema;
+
+ /** The default. */
+ private String _default;
+
+ /** The required. */
+ private boolean required;
+
+ /**
+ * Instantiates a new property.
+ */
+ private Property() {}
+
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the entry schema.
+ *
+ * @return the entry schema
+ */
+ public Schema getEntry_schema() {
+ return entry_schema;
+ }
+
+ /**
+ * Gets the default.
+ *
+ * @return the default
+ */
+ public String get_default() {
+ return _default;
+ }
+
+ /**
+ * Sets the type.
+ *
+ * @param type the new type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the entry schema.
+ *
+ * @param entry_schema the new entry schema
+ */
+ public void setEntry_schema(Schema entry_schema) {
+ this.entry_schema = entry_schema;
+ }
+
+ /**
+ * Sets the default.
+ *
+ * @param _default the new default
+ */
+ public void set_default(String _default) {
+ this._default = _default;
+ }
+
+ /**
+ * Gets the default.
+ *
+ * @return the default
+ */
+ public String getDefault() {
+ return _default;
+ }
+
+ /**
+ * Checks if is required.
+ *
+ * @return true, if is required
+ */
+ public boolean isRequired() {
+ return required;
+ }
+
+ /**
+ * Sets the default.
+ *
+ * @param _default the new default
+ */
+ public void setDefault(String _default) {
+ this._default = _default;
+ }
+
+ /**
+ * Sets the required.
+ *
+ * @param required the new required
+ */
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Requirement.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Requirement.java
new file mode 100755
index 0000000..fce41ec
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Requirement.java
@@ -0,0 +1,120 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.util.Collection;
+
+/**
+ * The Class Requirement.
+ */
+public class Requirement {
+
+ /** The occurrences. */
+ private Collection<String> occurrences;
+
+ /** The capability. */
+ private String capability;
+
+ /** The node. */
+ private String node;
+
+ /** The relationship. */
+ private String relationship;
+
+ /**
+ * Instantiates a new requirement.
+ */
+ private Requirement() {}
+
+ /**
+ * Gets the occurrences.
+ *
+ * @return the occurrences
+ */
+ public Collection<String> getOccurrences() {
+ return occurrences;
+ }
+
+ /**
+ * Gets the capability.
+ *
+ * @return the capability
+ */
+ public String getCapability() {
+ return capability;
+ }
+
+ /**
+ * Gets the node.
+ *
+ * @return the node
+ */
+ public String getNode() {
+ return node;
+ }
+
+ /**
+ * Gets the relationship.
+ *
+ * @return the relationship
+ */
+ public String getRelationship() {
+ return relationship;
+ }
+
+ /**
+ * Sets the occurrences.
+ *
+ * @param occurrences the new occurrences
+ */
+ public void setOccurrences(Collection<String> occurrences) {
+ this.occurrences = occurrences;
+ }
+
+ /**
+ * Sets the capability.
+ *
+ * @param capability the new capability
+ */
+ public void setCapability(String capability) {
+ this.capability = capability;
+ }
+
+ /**
+ * Sets the node.
+ *
+ * @param node the new node
+ */
+ public void setNode(String node) {
+ this.node = node;
+ }
+
+ /**
+ * Sets the relationship.
+ *
+ * @param relationship the new relationship
+ */
+ public void setRelationship(String relationship) {
+ this.relationship = relationship;
+ }
+
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Schema.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Schema.java
new file mode 100755
index 0000000..bd3a2f0
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Schema.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+/**
+ * The Class Schema.
+ */
+public class Schema {
+
+ /** The type. */
+ public String type;
+
+ /**
+ * Instantiates a new schema.
+ */
+ public Schema() {}
+
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Sets the type.
+ *
+ * @param type the new type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/SubstitutionMappings.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/SubstitutionMappings.java
new file mode 100755
index 0000000..026f29b
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/SubstitutionMappings.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The Class SubstitutionMappings.
+ */
+public class SubstitutionMappings {
+
+ /** The node type. */
+ private String node_type;
+
+ /** The capabilities. */
+ private Map<String, Object> capabilities;
+
+ /** The requirements. */
+ private Map<String, Object> requirements;
+
+ /**
+ * Instantiates a new substitution mappings.
+ */
+ public SubstitutionMappings() {
+ capabilities = new HashMap<String, Object> ();
+ requirements = new HashMap<String, Object> ();
+ }
+
+ /**
+ * Gets the node type.
+ *
+ * @return the node type
+ */
+ public String getnode_type() {
+ return node_type;
+ }
+
+ /**
+ * Sets the node type.
+ *
+ * @param node_type the new node type
+ */
+ public void setnode_type(String node_type) {
+ this.node_type = node_type;
+ }
+
+ /**
+ * Gets the capabilities.
+ *
+ * @return the capabilities
+ */
+ public Map<String, Object> getCapabilities() {
+ return capabilities;
+ }
+
+ /**
+ * Sets the capabilities.
+ *
+ * @param capabilities the capabilities
+ */
+ public void setCapabilities(Map<String, Object> capabilities) {
+ this.capabilities = capabilities;
+ }
+
+ /**
+ * Gets the requirements.
+ *
+ * @return the requirements
+ */
+ public Map<String, Object> getRequirements() {
+ return requirements;
+ }
+
+ /**
+ * Sets the requirements.
+ *
+ * @param requirements the requirements
+ */
+ public void setRequirements(Map<String, Object> requirements) {
+ this.requirements = requirements;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/TopologyTemplate.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/TopologyTemplate.java
new file mode 100755
index 0000000..ce7ce57
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/TopologyTemplate.java
@@ -0,0 +1,124 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The Class TopologyTemplate.
+ */
+public class TopologyTemplate {
+
+ /** The substitution mappings. */
+ private SubstitutionMappings substitution_mappings;
+
+ /** The inputs. */
+ private Map<String, Input> inputs;
+
+ /** The node templates. */
+ private Map<String, NodeTemplate> node_templates;
+
+ /** The groups. */
+ private Map<String, Group> groups;
+
+ /**
+ * Instantiates a new topology template.
+ */
+ public TopologyTemplate() {
+ substitution_mappings = new SubstitutionMappings();
+ inputs = new HashMap<String, Input> ();
+ node_templates = new HashMap<String, NodeTemplate> ();
+ groups = new HashMap<String, Group> ();
+ }
+
+ /**
+ * Gets the substitution mappings.
+ *
+ * @return the substitution mappings
+ */
+ public SubstitutionMappings getsubstitution_mappings() {
+ return this.substitution_mappings;
+ }
+
+ /**
+ * Sets the substitution mappings.
+ *
+ * @param substitution_mappings the new substitution mappings
+ */
+ public void setsubstitution_mappings(SubstitutionMappings substitution_mappings) {
+ this.substitution_mappings = substitution_mappings;
+ }
+
+ /**
+ * Gets the inputs.
+ *
+ * @return the inputs
+ */
+ public Map<String, Input> getInputs() {
+ return inputs;
+ }
+
+ /**
+ * Sets the inputs.
+ *
+ * @param inputs the inputs
+ */
+ public void setInputs(Map<String, Input> inputs) {
+ this.inputs = inputs;
+ }
+
+ /**
+ * Gets the node templates.
+ *
+ * @return the node templates
+ */
+ public Map<String, NodeTemplate> getnode_templates() {
+ return node_templates;
+ }
+
+ /**
+ * Setnode templates.
+ *
+ * @param node_templates the node templates
+ */
+ public void setnode_templates(Map<String, NodeTemplate> node_templates) {
+ this.node_templates = node_templates;
+ }
+
+ /**
+ * Gets the groups.
+ *
+ * @return the groups
+ */
+ public Map<String, Group> getGroups() {
+ return groups;
+ }
+
+ /**
+ * Sets the groups.
+ *
+ * @param groups the groups
+ */
+ public void setGroups(Map<String, Group> groups) {
+ this.groups = groups;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaCsar.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaCsar.java
new file mode 100755
index 0000000..cca4ae7
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaCsar.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+/**
+ * The Class ToscaCsar.
+ */
+public class ToscaCsar {
+
+ /** The parent. */
+ private final ToscaModel parent;
+
+ /** The children. */
+ private final Collection<ToscaModel> children;
+
+ /**
+ * The Class Builder.
+ */
+ public static class Builder {
+
+ /** The parent. */
+ private final ToscaModel parent;
+
+ /** The children. */
+ private Collection<ToscaModel> children = new LinkedList<ToscaModel> ();
+
+ /**
+ * Instantiates a new builder.
+ *
+ * @param parent the parent
+ */
+ public Builder(ToscaModel parent) {
+ this.parent = parent;
+ }
+
+ /**
+ * Adds the vnf.
+ *
+ * @param child the child
+ * @return the builder
+ */
+ public Builder addVnf(ToscaModel child) {
+ children.add(child);
+ return this;
+ }
+
+ /**
+ * Builds the.
+ *
+ * @return the tosca csar
+ */
+ public ToscaCsar build() {
+ return new ToscaCsar(this);
+ }
+ }
+
+ /**
+ * Instantiates a new tosca csar.
+ *
+ * @param builder the builder
+ */
+ public ToscaCsar(Builder builder) {
+ this.parent = builder.parent;
+ this.children = builder.children;
+ }
+
+ /**
+ * Gets the parent.
+ *
+ * @return the parent
+ */
+ public ToscaModel getParent() { return parent; }
+
+ /**
+ * Gets the children.
+ *
+ * @return the children
+ */
+ public Collection<ToscaModel> getChildren() { return children; }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMeta.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMeta.java
new file mode 100755
index 0000000..6693837
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMeta.java
@@ -0,0 +1,122 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.openecomp.vid.asdc.AsdcCatalogException;
+
+/**
+ * The Class ToscaMeta.
+ */
+public class ToscaMeta {
+
+ /** The metadata. */
+ private final Map<String, String> metadata;
+
+ /**
+ * Instantiates a new tosca meta.
+ *
+ * @param builder the builder
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ private ToscaMeta(Builder builder) throws IOException, AsdcCatalogException {
+ metadata = new HashMap<String, String> ();
+
+ read(builder.inputStream);
+ }
+
+ /**
+ * The Class Builder.
+ */
+ public static class Builder {
+
+ /** The input stream. */
+ private final InputStream inputStream;
+
+ /**
+ * Instantiates a new builder.
+ *
+ * @param inputStream the input stream
+ */
+ public Builder(InputStream inputStream) {
+ this.inputStream = inputStream;
+ }
+
+ /**
+ * Builds the.
+ *
+ * @return the tosca meta
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ public ToscaMeta build() throws IOException, AsdcCatalogException {
+ return new ToscaMeta(this);
+ }
+ }
+
+ /**
+ * Gets the.
+ *
+ * @param property the property
+ * @return the string
+ */
+ public String get(String property) {
+ return metadata.get(property);
+ }
+
+ /**
+ * Read.
+ *
+ * @param inputStream the input stream
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ private void read(InputStream inputStream) throws IOException, AsdcCatalogException {
+
+ final BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
+
+ String line;
+
+ try {
+ while ((line = br.readLine()) != null) {
+ final String[] entry = line.split(":");
+
+ if (entry.length != 2) throw new AsdcCatalogException("TOSCA.meta file cannot be parsed (more than 1 colon found on a single line");
+ if (!entry[1].startsWith(" ")) throw new AsdcCatalogException("TOSCA.meta file cannot be parsed (: not immediately followed by ' ')");
+
+ metadata.put(entry[0], entry[1].substring(1));
+ }
+ } catch (IOException e) {
+ metadata.clear();
+ throw e;
+ } catch (AsdcCatalogException e) {
+ metadata.clear();
+ throw e;
+ }
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadata.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadata.java
new file mode 100755
index 0000000..d42c1f1
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadata.java
@@ -0,0 +1,461 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+/**
+ * The Class ToscaMetadata.
+ */
+public class ToscaMetadata {
+
+ /** The template name. */
+ private String template_name;
+
+ /** The invariant UUID. */
+ private String invariantUUID;
+
+ /** The customization UUID. */
+ private String customizationUUID;
+
+ /** The uuid. */
+ private String uuid;
+
+ /** The version. */
+ private String version;
+
+ /** The name. */
+ private String name;
+
+ /** The description. */
+ private String description;
+
+ /** The category. */
+ private String category;
+
+ /** The subcategory. */
+ private String subcategory;
+
+ /** The type. */
+ private String type;
+
+ /** The resource vendor. */
+ private String resourceVendor;
+
+ /** The resource vendor release. */
+ private String resourceVendorRelease;
+
+ /** The service ecomp naming. */
+ private String serviceEcompNaming;
+
+ /** The ecomp generated naming - duplicate for serviceEcompNaming */
+ private boolean ecompGeneratedNaming;
+
+ /** The naming policy */
+ private String namingPolicy;
+
+ /** The service homing. */
+ private boolean serviceHoming;
+
+ /** The vf module model name. */
+ //ToscaMetadata for VF Modules
+ private String vfModuleModelName;
+
+ /** The vf module model invariant UUID. */
+ private String vfModuleModelInvariantUUID;
+
+ /** The vf module model customization UUID. */
+ private String vfModuleModelCustomizationUUID;
+
+ /** The vf module model UUID. */
+ private String vfModuleModelUUID;
+
+ /** The vf module model version. */
+ private String vfModuleModelVersion;
+
+ /**
+ * Instantiates a new tosca metadata.
+ */
+ public ToscaMetadata() {}
+
+ /**
+ * Gets the type.
+ *
+ * @return the type
+ */
+ public String getType() {
+ return type;
+ }
+
+ /**
+ * Gets the invariant UUID.
+ *
+ * @return the invariant UUID
+ */
+ public String getInvariantUUID() {
+ return invariantUUID;
+ }
+ /**
+ * Gets the customization UUID.
+ *
+ * @return the customization UUID
+ */
+ public String getCustomizationUUID() {
+ return customizationUUID;
+ }
+ /**
+ * Gets the uuid.
+ *
+ * @return the uuid
+ */
+ public String getUUID() {
+ return uuid;
+ }
+
+ /**
+ * Gets the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the category.
+ *
+ * @return the category
+ */
+ public String getCategory() {
+ return category;
+ }
+
+ /**
+ * Gets the subcategory.
+ *
+ * @return the subcategory
+ */
+ public String getSubcategory() {
+ return subcategory;
+ }
+
+ /**
+ * Gets the resource vendor.
+ *
+ * @return the resource vendor
+ */
+ public String getResourceVendor() {
+ return resourceVendor;
+ }
+
+ /**
+ * Gets the resource vendor release.
+ *
+ * @return the resource vendor release
+ */
+ public String getResourceVendorRelease() {
+ return resourceVendorRelease;
+ }
+
+ /**
+ * Returns the value of service ecomp naming.
+ *
+ * @return serviceEcompNaming
+ */
+ public String getServiceEcompNaming() {
+ return serviceEcompNaming;
+ }
+ /**
+ * Returns the value of the naming policy.
+ *
+ * @return namingPolicy
+ */
+ public String getNamingPolicy() {
+ return namingPolicy;
+ }
+ /**
+ * Checks if is service homing.
+ *
+ * @return true, if is service homing
+ */
+ public boolean isServiceHoming() {
+ return serviceHoming;
+ }
+ /**
+ * Checks if is ecomp generated naming.
+ *
+ * @return true, if ecomp generated naming is true
+ */
+ public boolean isEcompGeneratedNaming() {
+ return ecompGeneratedNaming;
+ }
+ /**
+ * Sets the type.
+ *
+ * @param type the new type
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ /**
+ * Sets the invariant UUID.
+ *
+ * @param invariantUUID the new invariant UUID
+ */
+ public void setInvariantUUID(String invariantUUID) {
+ this.invariantUUID = invariantUUID;
+ }
+ /**
+ * Sets the naming policy.
+ *
+ * @param namingPolicy the new naming policy
+ */
+ public void setNamingPolicy(String namingPolicy) {
+ this.namingPolicy = namingPolicy;
+ }
+ /**
+ * Sets the uuid.
+ *
+ * @param uuid the new uuid
+ */
+ public void setUUID(String uuid) {
+ this.uuid = uuid;
+ }
+ /**
+ * Sets the customization uuid.
+ *
+ * @param u the new customization uuid
+ */
+ public void setCustomizationUUID(String u) {
+ this.customizationUUID = u;
+ }
+ /**
+ * Sets the version.
+ *
+ * @param version the new version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the category.
+ *
+ * @param category the new category
+ */
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ /**
+ * Sets the service ecomp naming.
+ *
+ * @param serviceEcompNaming the new service ecomp naming
+ */
+ public void setServiceEcompNaming(String serviceEcompNaming) {
+ this.serviceEcompNaming = serviceEcompNaming;
+ }
+
+ /**
+ * Sets the service homing.
+ *
+ * @param serviceHoming the new service homing
+ */
+ public void setServiceHoming(boolean serviceHoming) {
+ this.serviceHoming = serviceHoming;
+ }
+ /**
+ * Sets the ecomp generated naming.
+ *
+ * @param ecompGeneratedNaming the new ecomp generated naming
+ */
+ public void setEcompGeneratedNaming(boolean ecompGeneratedNaming) {
+ this.ecompGeneratedNaming = ecompGeneratedNaming;
+ }
+ /**
+ * Gets the template name.
+ *
+ * @return the template name
+ */
+ public String gettemplate_name() {
+ return template_name;
+ }
+
+ /**
+ * Sets the template name.
+ *
+ * @param template_name the new template name
+ */
+ public void settemplate_name(String template_name) {
+ this.template_name = template_name;
+ }
+
+ /**
+ * Sets the subcategory.
+ *
+ * @param subcategory the new subcategory
+ */
+ public void setSubcategory(String subcategory) {
+ this.subcategory = subcategory;
+ }
+
+ /**
+ * Sets the resource vendor.
+ *
+ * @param resourceVendor the new resource vendor
+ */
+ public void setResourceVendor(String resourceVendor) {
+ this.resourceVendor = resourceVendor;
+ }
+
+ /**
+ * Sets the resource vendor release.
+ *
+ * @param resourceVendorRelease the new resource vendor release
+ */
+ public void setResourceVendorRelease(String resourceVendorRelease) {
+ this.resourceVendorRelease = resourceVendorRelease;
+ }
+
+ /**
+ * Gets the vf module model name.
+ *
+ * @return the vf module model name
+ */
+ public String getVfModuleModelName() {
+ return vfModuleModelName;
+ }
+
+ /**
+ * Sets the vf module model name.
+ *
+ * @param vfModuleModelName the new vf module model name
+ */
+ public void setVfModuleModelName(String vfModuleModelName) {
+ this.vfModuleModelName = vfModuleModelName;
+ }
+
+ /**
+ * Gets the vf module model invariant UUID.
+ *
+ * @return the vf module model invariant UUID
+ */
+ public String getVfModuleModelInvariantUUID() {
+ return vfModuleModelInvariantUUID;
+ }
+
+ /**
+ * Sets the vf module model invariant UUID.
+ *
+ * @param vfModuleModelInvariantUUID the new vf module model invariant UUID
+ */
+ public void setVfModuleModelInvariantUUID(String vfModuleModelInvariantUUID) {
+ this.vfModuleModelInvariantUUID = vfModuleModelInvariantUUID;
+ }
+
+ /**
+ * Gets the vf module model UUID.
+ *
+ * @return the vf module model UUID
+ */
+ public String getVfModuleModelUUID() {
+ return vfModuleModelUUID;
+ }
+
+ /**
+ * Sets the vf module model UUID.
+ *
+ * @param vfModuleModelUUID the new vf module model UUID
+ */
+ public void setVfModuleModelUUID(String vfModuleModelUUID) {
+ this.vfModuleModelUUID = vfModuleModelUUID;
+ }
+
+ /**
+ * Gets the vf module model version.
+ *
+ * @return the vf module model version
+ */
+ public String getVfModuleModelVersion() {
+ return vfModuleModelVersion;
+ }
+
+ /**
+ * Sets the vf module model version.
+ *
+ * @param vfModuleModelVersion the new vf module model version
+ */
+ public void setVfModuleModelVersion(String vfModuleModelVersion) {
+ this.vfModuleModelVersion = vfModuleModelVersion;
+ }
+ /**
+ * Sets the vf module customization uuid.
+ *
+ * @param u the new vf module model customization uuid
+ */
+ public void setVfModuleModelCustomizationUUID(String u) {
+ this.vfModuleModelCustomizationUUID = u;
+ }
+ /**
+ * Gets the vf module model customization uuid.
+ *
+ * @return the vf module model customization uuid
+ */
+ public String getVfModuleModelCustomizationUUID() {
+
+ return vfModuleModelCustomizationUUID;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaModel.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaModel.java
new file mode 100755
index 0000000..c9e42f2
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaModel.java
@@ -0,0 +1,166 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.beans.tosca;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.Map;
+
+/**
+ * The Class ToscaModel.
+ */
+public class ToscaModel {
+
+ /** The tosca definitions version. */
+ private String tosca_definitions_version;
+
+ /** The description. */
+ private String description;
+
+ /** The metadata. */
+ private ToscaMetadata metadata;
+
+ /** The topology template. */
+ private TopologyTemplate topology_template;
+
+ /** The imports. */
+ private Collection<Map<String, Map<String, String>>> imports;
+
+ /** The node types. */
+ private Map<String, Object> node_types;
+
+ /**
+ * Instantiates a new tosca model.
+ */
+ public ToscaModel() {
+ metadata = new ToscaMetadata();
+ topology_template = new TopologyTemplate();
+ imports = new LinkedList<Map<String, Map<String, String>>> ();
+ }
+
+ /**
+ * Gets the metadata.
+ *
+ * @return the metadata
+ */
+ public ToscaMetadata getMetadata() {
+ return metadata;
+ }
+
+ /**
+ * Sets the metadata.
+ *
+ * @param metadata the new metadata
+ */
+ public void setMetadata(ToscaMetadata metadata) {
+ this.metadata = metadata;
+ }
+
+ /**
+ * Gets the tosca definitions version.
+ *
+ * @return the tosca definitions version
+ */
+ public String gettosca_definitions_version() {
+ return tosca_definitions_version;
+ }
+
+ /**
+ * Sets the tosca definitions version.
+ *
+ * @param tosca_definitions_version the new tosca definitions version
+ */
+ public void settosca_definitions_version(String tosca_definitions_version) {
+ this.tosca_definitions_version = tosca_definitions_version;
+ }
+
+ /**
+ * Gets the topology template.
+ *
+ * @return the topology template
+ */
+ public TopologyTemplate gettopology_template() {
+ return topology_template;
+ }
+
+ /**
+ * Sets the topology template.
+ *
+ * @param topology_template the new topology template
+ */
+ public void settopology_template(TopologyTemplate topology_template) {
+ this.topology_template = topology_template;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Gets the imports.
+ *
+ * @return the imports
+ */
+ public Collection<Map<String, Map<String, String>>> getImports() {
+ return imports;
+ }
+
+ /**
+ * Sets the imports.
+ *
+ * @param imports the imports
+ */
+ public void setImports(Collection<Map<String, Map<String, String>>> imports) {
+ this.imports = imports;
+ }
+
+ /**
+ * Gets the node types.
+ *
+ * @return the node types
+ */
+ public Map<String, Object> getnode_types() {
+ return node_types;
+ }
+
+ /**
+ * Setnode types.
+ *
+ * @param node_types the node types
+ */
+ public void setnode_types(Map<String, Object> node_types) {
+ this.node_types = node_types;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/memory/InMemoryAsdcClient.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/memory/InMemoryAsdcClient.java
new file mode 100755
index 0000000..c5134bf
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/memory/InMemoryAsdcClient.java
@@ -0,0 +1,372 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.memory;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.UUID;
+import java.util.zip.ZipFile;
+
+import org.codehaus.jackson.JsonParseException;
+import org.codehaus.jackson.map.JsonMappingException;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.yaml.snakeyaml.Yaml;
+
+import org.openecomp.vid.asdc.AsdcCatalogException;
+import org.openecomp.vid.asdc.AsdcClient;
+import org.openecomp.vid.asdc.beans.Artifact;
+import org.openecomp.vid.asdc.beans.Resource;
+import org.openecomp.vid.asdc.beans.Service;
+import org.openecomp.vid.asdc.beans.tosca.ToscaCsar;
+import org.openecomp.vid.asdc.beans.tosca.ToscaMeta;
+import org.openecomp.vid.asdc.beans.tosca.ToscaModel;
+
+/**
+ * The Class InMemoryAsdcClient.
+ */
+public class InMemoryAsdcClient implements AsdcClient {
+
+ /** The catalog. */
+ private final JSONObject catalog;
+
+ /** The mapper. */
+ private final ObjectMapper mapper;
+
+ /**
+ * The Class Builder.
+ */
+ public static class Builder {
+
+ /** The catalog. */
+ private JSONObject catalog = new JSONObject()
+ .put("resources", new JSONObject())
+ .put("services", new JSONObject());
+
+ /** The mapper. */
+ private ObjectMapper mapper = new ObjectMapper();
+
+ /**
+ * Instantiates a new builder.
+ */
+ public Builder() {}
+
+ /**
+ * Catalog.
+ *
+ * @param catalog the catalog
+ * @return the builder
+ */
+ public Builder catalog(JSONObject catalog) {
+ this.catalog = catalog;
+ return this;
+ }
+
+ /**
+ * Mapper.
+ *
+ * @param mapper the mapper
+ * @return the builder
+ */
+ public Builder mapper(ObjectMapper mapper) {
+ this.mapper = mapper;
+ return this;
+ }
+
+ /**
+ * Builds the.
+ *
+ * @return the in memory sdc client
+ */
+ public InMemoryAsdcClient build() {
+ return new InMemoryAsdcClient(this);
+ }
+ }
+
+ /**
+ * Instantiates a new in memory sdc client.
+ *
+ * @param builder the builder
+ */
+ private InMemoryAsdcClient(Builder builder) {
+ catalog = builder.catalog;
+ mapper = builder.mapper;
+ }
+
+ /**
+ * Gets the catalog.
+ *
+ * @return the catalog
+ */
+ private JSONObject getCatalog() {
+ return catalog;
+ }
+
+ /**
+ * Gets the mapper.
+ *
+ * @return the mapper
+ */
+ private ObjectMapper getMapper() {
+ return mapper;
+ }
+
+ /**
+ * Convert.
+ *
+ * @param <T> the generic type
+ * @param json the json
+ * @param clazz the clazz
+ * @return the t
+ * @throws AsdcCatalogException the sdc catalog exception
+ */
+ private <T> T convert(JSONObject json, Class<T> clazz) throws AsdcCatalogException {
+ try {
+ return getMapper().readValue(json.toString(), clazz);
+ } catch (JsonParseException e) {
+ throw new AsdcCatalogException("Failed to parse SDC response (bad data)", e);
+ } catch (JsonMappingException e) {
+ throw new AsdcCatalogException("Failed to map SDC response to internal VID data structure(s)", e);
+ } catch (IOException e) {
+ throw new AsdcCatalogException("Failed to get a response from SDC", e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResource(java.util.UUID)
+ */
+ public Resource getResource(UUID uuid) throws AsdcCatalogException {
+ final JSONObject resource = getCatalog().getJSONObject("resources")
+ .getJSONObject(uuid.toString());
+ return convert(resource, Resource.class);
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResources()
+ */
+ public Collection<Resource> getResources() throws AsdcCatalogException {
+ final Collection<Resource> resources = new LinkedList<Resource> ();
+
+ for (String key : getCatalog().getJSONObject("resources").keySet()) {
+ final JSONObject json = getCatalog().getJSONObject("resources").getJSONObject(key);
+ final Resource resource = convert(json, Resource.class);
+ resources.add(resource);
+ }
+
+ return resources;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResources(java.util.Map)
+ */
+ public Collection<Resource> getResources(Map<String, String[]> filter) throws AsdcCatalogException {
+ final Collection<Resource> resources = new LinkedList<Resource> ();
+
+ for (String key : getCatalog().getJSONObject("resources").keySet()) {
+ final JSONObject json = getCatalog().getJSONObject("resources").getJSONObject(key);
+
+ boolean filterMatch = true;
+
+ for (Entry<String, String[]> entry : filter.entrySet()) {
+ for (int i = 0; i < entry.getValue().length; i++) {
+ if (!json.getString(entry.getKey()).equals(entry.getValue()[i])) {
+ filterMatch = false;
+ break;
+ }
+ }
+ }
+
+ if (filterMatch) resources.add(convert(json, Resource.class));
+ }
+
+ return resources;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getService(java.util.UUID)
+ */
+ public Service getService(UUID uuid) throws AsdcCatalogException {
+ final JSONObject service = getCatalog().getJSONObject("services")
+ .getJSONObject(uuid.toString());
+ return convert(service, Service.class);
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getServices()
+ */
+ public Collection<Service> getServices() throws AsdcCatalogException {
+ final Collection<Service> services = new LinkedList<Service> ();
+
+ for (String key : getCatalog().getJSONObject("services").keySet()) {
+ final JSONObject json = getCatalog().getJSONObject("services").getJSONObject(key);
+ final Service service = convert(json, Service.class);
+ services.add(service);
+ }
+
+ return services;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecompt.vid.asdc.AsdcClient#getServices(java.util.Map)
+ */
+ public Collection<Service> getServices(Map<String, String[]> filter) throws AsdcCatalogException {
+ final Collection<Service> services = new LinkedList<Service> ();
+
+ for (String key : getCatalog().getJSONObject("services").keySet()) {
+ final JSONObject json = getCatalog().getJSONObject("services").getJSONObject(key);
+
+ boolean filterMatch = true;
+
+ for (Entry<String, String[]> entry : filter.entrySet()) {
+ for (int i = 0; i < entry.getValue().length; i++) {
+ if (!json.getString(entry.getKey()).equals(entry.getValue()[i])) {
+ filterMatch = false;
+ break;
+ }
+ }
+ }
+
+ if (filterMatch) services.add(convert(json, Service.class));
+ }
+
+ return services;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResourceArtifact(java.util.UUID, java.util.UUID)
+ */
+ public Artifact getResourceArtifact(UUID resourceUuid, UUID artifactUuid) throws AsdcCatalogException {
+ final JSONArray artifacts = getCatalog().getJSONObject("resources")
+ .getJSONObject(resourceUuid.toString())
+ .getJSONArray("artifacts");
+
+ for (int i = 0; i < artifacts.length(); i++) {
+ final JSONObject artifact = artifacts.getJSONObject(i);
+
+ if (artifact.getString("artifactUUID").equals(artifactUuid.toString())) {
+ return convert(artifact, Artifact.class);
+ }
+ }
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getServiceArtifact(java.util.UUID, java.util.UUID)
+ */
+ public Artifact getServiceArtifact(UUID serviceUuid, UUID artifactUuid) throws AsdcCatalogException {
+ final JSONArray artifacts = getCatalog().getJSONObject("services")
+ .getJSONObject(serviceUuid.toString())
+ .getJSONArray("artifacts");
+
+ for (int i = 0; i < artifacts.length(); i++) {
+ final JSONObject artifact = artifacts.getJSONObject(i);
+
+ if (artifact.getString("artifactUUID").equals(artifactUuid.toString())) {
+ return convert(artifact, Artifact.class);
+ }
+ }
+
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResourceToscaModel(java.util.UUID)
+ */
+ public ToscaCsar getResourceToscaModel(UUID resourceUuid) throws AsdcCatalogException {
+ final String toscaModelURL = getCatalog().getJSONObject("resources")
+ .getJSONObject(resourceUuid.toString())
+ .getString("toscaModelURL");
+
+
+ final InputStream toscaModelStream = getClass().getClassLoader().getResourceAsStream(toscaModelURL);
+
+ if (toscaModelStream == null) return null;
+
+ return getToscaModel(toscaModelStream);
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getServiceToscaModel(java.util.UUID)
+ */
+ public ToscaCsar getServiceToscaModel(UUID serviceUuid) throws AsdcCatalogException {
+ final String toscaModelURL = getCatalog().getJSONObject("services")
+ .getJSONObject(serviceUuid.toString())
+ .getString("toscaModelURL");
+
+ final InputStream toscaModelStream = getClass().getClassLoader().getResourceAsStream(toscaModelURL);
+
+ if (toscaModelStream == null) return null;
+
+ return getToscaModel(toscaModelStream);
+ }
+
+ /**
+ * Gets the tosca model.
+ *
+ * @param csarInputStream the csar input stream
+ * @return the tosca model
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ private ToscaCsar getToscaModel(InputStream csarInputStream) throws AsdcCatalogException {
+ final Path csarFile;
+
+ try {
+ csarFile = Files.createTempFile("csar", ".zip");
+ Files.copy(csarInputStream, csarFile, StandardCopyOption.REPLACE_EXISTING);
+ } catch (IOException e) {
+ throw new AsdcCatalogException("Caught IOException while creating CSAR", e);
+ }
+
+ try (final ZipFile csar = new ZipFile(csarFile.toFile())) {
+
+ final InputStream toscaMetaStream = csar.getInputStream(csar.getEntry("TOSCA-Metadata/TOSCA.meta"));
+ final ToscaMeta toscaMeta = new ToscaMeta.Builder(toscaMetaStream).build();
+ final String entryDefinitions = toscaMeta.get("Entry-Definitions");
+ final InputStream toscaParentEntryYamlStream = csar.getInputStream(csar.getEntry(entryDefinitions));
+
+ final Yaml yaml = new Yaml();
+ final ToscaModel parentModel = yaml.loadAs(toscaParentEntryYamlStream, ToscaModel.class);
+
+ final ToscaCsar.Builder csarBuilder = new ToscaCsar.Builder(parentModel);
+
+ for (Map<String, Map<String, String>> imports : parentModel.getImports()) {
+ for (Entry<String, Map<String, String>> entry : imports.entrySet()) {
+ final InputStream toscaChildEntryYamlStream = csar.getInputStream(csar.getEntry("Definitions/" + entry.getValue().get("file")));
+ final ToscaModel childModel = yaml.loadAs(toscaChildEntryYamlStream, ToscaModel.class);
+ csarBuilder.addVnf(childModel);
+ }
+ }
+
+ return csarBuilder.build();
+ } catch (IOException e) {
+ throw new AsdcCatalogException("Caught IOException while processing CSAR", e);
+ }
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/rest/RestfulAsdcClient.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/rest/RestfulAsdcClient.java
new file mode 100755
index 0000000..26d45cc
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/asdc/rest/RestfulAsdcClient.java
@@ -0,0 +1,462 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.asdc.rest;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.UUID;
+import java.util.logging.Logger;
+import java.util.zip.ZipFile;
+
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.ProcessingException;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ResponseProcessingException;
+import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.GenericType;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedHashMap;
+
+import org.openecomp.vid.asdc.AsdcCatalogException;
+import org.openecomp.vid.asdc.AsdcClient;
+import org.openecomp.vid.asdc.beans.Artifact;
+import org.openecomp.vid.asdc.beans.Resource;
+import org.openecomp.vid.asdc.beans.Service;
+import org.openecomp.vid.asdc.beans.tosca.ToscaCsar;
+import org.openecomp.vid.asdc.beans.tosca.ToscaMeta;
+import org.openecomp.vid.asdc.beans.tosca.ToscaModel;
+import org.openecomp.vid.model.ModelConstants;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.error.YAMLException;
+
+import org.openecomp.vid.properties.VidProperties;
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+/**
+ * The Class RestfulAsdcClient.
+ */
+public class RestfulAsdcClient implements AsdcClient {
+
+ /** The Constant LOGGER. */
+ private static final Logger LOGGER = Logger.getLogger(RestfulAsdcClient.class.getName());
+
+ /** The client. */
+ private final Client client;
+
+ /** The uri. */
+ private final URI uri;
+
+ /** The common headers. */
+ private final MultivaluedHashMap<String, Object> commonHeaders;
+
+ /** The auth. */
+ private final String auth;
+
+ /**
+ * The Class Builder.
+ */
+ public static class Builder {
+
+ /** The client. */
+ private final Client client;
+
+ /** The uri. */
+ private final URI uri;
+
+ /** The auth. */
+ private String auth = null;
+
+ /**
+ * Instantiates a new builder.
+ *
+ * @param client the client
+ * @param uri the uri
+ */
+ public Builder(Client client, URI uri) {
+ this.client = client;
+ this.client.register(JacksonJsonProvider.class);
+ this.uri = uri;
+ }
+
+ /**
+ * Auth.
+ *
+ * @param auth the auth
+ * @return the builder
+ */
+ public Builder auth(String auth) {
+ this.auth = auth;
+ return this;
+ }
+
+ /**
+ * Builds the.
+ *
+ * @return the restful asdc client
+ */
+ public RestfulAsdcClient build() {
+ return new RestfulAsdcClient(this);
+ }
+ }
+
+ /**
+ * Instantiates a new restful asdc client.
+ *
+ * @param builder the builder
+ */
+ private RestfulAsdcClient(Builder builder) {
+ client = builder.client;
+ uri = builder.uri;
+ auth = builder.auth;
+
+ commonHeaders = new MultivaluedHashMap<String, Object> ();
+ commonHeaders.put("X-ECOMP-InstanceID", Collections.singletonList((Object) "VID"));
+ commonHeaders.put("Authorization", Collections.singletonList((Object) (auth)));
+ }
+
+ /**
+ * Gets the client.
+ *
+ * @return the client
+ */
+ private Client getClient() { return client; }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResource(java.util.UUID)
+ */
+ public Resource getResource(UUID uuid) throws AsdcCatalogException {
+ String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_RESOURCE_API_PATH, ModelConstants.DEFAULT_ASDC_RESOURCE_API_PATH);
+ try {
+ return getClient()
+ .target(uri)
+ .path(path + "/" + uuid.toString() + "/metadata")
+ .request(MediaType.APPLICATION_JSON_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_JSON)
+ .get(Resource.class);
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResources()
+ */
+ public Collection<Resource> getResources() throws AsdcCatalogException {
+ String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_RESOURCE_API_PATH, ModelConstants.DEFAULT_ASDC_RESOURCE_API_PATH);
+ try {
+ return getClient()
+ .target(uri)
+ .path(path)
+ .request(MediaType.APPLICATION_JSON_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_JSON)
+ .get(new GenericType<Collection<Resource>> () {});
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResources(java.util.Map)
+ */
+ public Collection<Resource> getResources(Map<String, String[]> filter) throws AsdcCatalogException {
+ String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_RESOURCE_API_PATH, ModelConstants.DEFAULT_ASDC_RESOURCE_API_PATH);
+ WebTarget target = getClient()
+ .target(uri)
+ .path(path);
+
+ for (Entry<String, String[]> filterEntry : filter.entrySet()) {
+ target = target.queryParam(filterEntry.getKey(), (Object []) filterEntry.getValue());
+ }
+
+ try {
+ return target.request()
+ .accept(MediaType.APPLICATION_JSON_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_JSON)
+ .get(new GenericType<Collection<Resource>> () {});
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (NotFoundException e) {
+ throw e;
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResourceArtifact(java.util.UUID, java.util.UUID)
+ */
+ public Artifact getResourceArtifact(UUID resourceUuid, UUID artifactUuid) throws AsdcCatalogException {
+ String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_RESOURCE_API_PATH, ModelConstants.DEFAULT_ASDC_RESOURCE_API_PATH);
+ try {
+ return getClient()
+ .target(uri)
+ .path(path + "/" + resourceUuid + "/artifacts/" + artifactUuid)
+ .request(MediaType.APPLICATION_JSON_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_JSON)
+ .get(Artifact.class);
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getService(java.util.UUID)
+ */
+ public Service getService(UUID uuid) throws AsdcCatalogException {
+
+ String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_SVC_API_PATH, ModelConstants.DEFAULT_ASDC_SVC_API_PATH);
+ try {
+ return getClient()
+ .target(uri)
+ .path( path + "/" + uuid.toString() + "/metadata")
+ .request(MediaType.APPLICATION_JSON)
+ .headers(commonHeaders)
+ .get(Service.class);
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getServices()
+ */
+ public Collection<Service> getServices() throws AsdcCatalogException {
+ String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_SVC_API_PATH, ModelConstants.DEFAULT_ASDC_SVC_API_PATH);
+ try {
+ return getClient()
+ .target(uri)
+ .path(path)
+ .request()
+ .accept(MediaType.APPLICATION_JSON_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_JSON)
+ .get(new GenericType<Collection<Service>> () {});
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getServices(java.util.Map)
+ */
+ public Collection<Service> getServices(Map<String, String[]> filter) throws AsdcCatalogException {
+
+ String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_SVC_API_PATH, ModelConstants.DEFAULT_ASDC_SVC_API_PATH);
+ WebTarget target = getClient()
+ .target(uri)
+ .path(path);
+
+
+ for (Entry<String, String[]> filterEntry : filter.entrySet()) {
+ target = target.queryParam(filterEntry.getKey(), (Object []) filterEntry.getValue());
+ }
+
+ try {
+ return target.request()
+ .accept(MediaType.APPLICATION_JSON_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_JSON)
+ .get(new GenericType<Collection<Service>> () {});
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (NotFoundException e) {
+ throw e;
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getServiceArtifact(java.util.UUID, java.util.UUID)
+ */
+ public Artifact getServiceArtifact(UUID serviceUuid, UUID artifactUuid) throws AsdcCatalogException {
+ String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_SVC_API_PATH, ModelConstants.DEFAULT_ASDC_SVC_API_PATH);
+ try {
+ return getClient()
+ .target(uri)
+ .path(path + "/" + serviceUuid + "/artifacts/" + artifactUuid)
+ .request(MediaType.APPLICATION_JSON_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_JSON)
+ .get(Artifact.class);
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getResourceToscaModel(java.util.UUID)
+ */
+ public ToscaCsar getResourceToscaModel(UUID resourceUuid) throws AsdcCatalogException {
+ String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_RESOURCE_API_PATH, ModelConstants.DEFAULT_ASDC_RESOURCE_API_PATH);
+ try (final InputStream csarInputStream = (InputStream) getClient()
+ .target(uri)
+ .path(path + "/" + resourceUuid + "/toscaModel")
+ .request(MediaType.APPLICATION_OCTET_STREAM_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_OCTET_STREAM)
+ .get(InputStream.class)) {
+
+ return getToscaModel(csarInputStream);
+ } catch (IOException e) {
+ throw new AsdcCatalogException("Failed to retrieve resource TOSCA model from ASDC", e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.asdc.AsdcClient#getServiceToscaModel(java.util.UUID)
+ */
+ public ToscaCsar getServiceToscaModel(UUID serviceUuid) throws AsdcCatalogException {
+ String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_SVC_API_PATH, ModelConstants.DEFAULT_ASDC_SVC_API_PATH);
+ try {
+ final InputStream csarInputStream = (InputStream) getClient()
+ .target(uri)
+ .path(path + "/" + serviceUuid + "/toscaModel")
+ .request(MediaType.APPLICATION_OCTET_STREAM_TYPE)
+ .headers(commonHeaders)
+ .header("Content-Type", MediaType.APPLICATION_OCTET_STREAM)
+ .get(InputStream.class);
+
+ return getToscaModel(csarInputStream);
+ } catch (ResponseProcessingException e) {
+ //Couldn't convert response to Java type
+ throw new AsdcCatalogException("ASDC response could not be processed", e);
+ } catch (ProcessingException e) {
+ //IO problems during request
+ throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
+ } catch (WebApplicationException e) {
+ //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
+ throw new AsdcCatalogException(e);
+ }
+ }
+
+ /**
+ * Gets the tosca model.
+ *
+ * @param csarInputStream the csar input stream
+ * @return the tosca model
+ * @throws AsdcCatalogException the asdc catalog exception
+ */
+ private ToscaCsar getToscaModel(InputStream csarInputStream) throws AsdcCatalogException {
+ final Path csarFile;
+
+ try {
+ csarFile = Files.createTempFile("csar", ".zip");
+ Files.copy(csarInputStream, csarFile, StandardCopyOption.REPLACE_EXISTING);
+ } catch (IOException e) {
+ throw new AsdcCatalogException("Caught IOException while creating CSAR", e);
+ }
+
+ try (final ZipFile csar = new ZipFile(csarFile.toFile())) {
+
+ final InputStream toscaMetaStream = csar.getInputStream(csar.getEntry("TOSCA-Metadata/TOSCA.meta"));
+ final ToscaMeta toscaMeta = new ToscaMeta.Builder(toscaMetaStream).build();
+ final String entryDefinitions = toscaMeta.get("Entry-Definitions");
+ final InputStream toscaParentEntryYamlStream = csar.getInputStream(csar.getEntry(entryDefinitions));
+
+ try {
+ final Yaml yaml = new Yaml();
+ final ToscaModel parentModel = yaml.loadAs(toscaParentEntryYamlStream, ToscaModel.class);
+
+ final ToscaCsar.Builder csarBuilder = new ToscaCsar.Builder(parentModel);
+
+ for (Map<String, Map<String, String>> imports : parentModel.getImports()) {
+ for (Entry<String, Map<String, String>> entry : imports.entrySet()) {
+ final InputStream toscaChildEntryYamlStream = csar.getInputStream(csar.getEntry("Definitions/" + entry.getValue().get("file")));
+ final ToscaModel childModel = yaml.loadAs(toscaChildEntryYamlStream, ToscaModel.class);
+ csarBuilder.addVnf(childModel);
+ }
+ }
+
+ return csarBuilder.build();
+ } catch (YAMLException e) {
+ throw new AsdcCatalogException("Caught exception while processing TOSCA YAML", e);
+ }
+ } catch (IOException e) {
+ throw new AsdcCatalogException("Caught IOException while processing CSAR", e);
+ }
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/client/HttpBasicClient.java b/vid-app-common/src/main/java/org/openecomp/vid/client/HttpBasicClient.java
new file mode 100755
index 0000000..ef2ade9
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/client/HttpBasicClient.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.client;
+
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+
+import javax.servlet.ServletContext;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+
+import org.glassfish.jersey.client.ClientConfig;
+import org.glassfish.jersey.client.ClientProperties;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+/**
+ * General HTTP client.
+ */
+
+public class HttpBasicClient{
+
+ /** The servlet context. */
+ @Autowired
+ private ServletContext servletContext;
+
+ /** The logger. */
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HttpBasicClient.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /**
+ * Obtain a basic HTTP client .
+ *
+ * @return Client client object
+ * @throws Exception the exception
+ */
+ public static Client getClient() throws Exception {
+
+ ClientConfig config = new ClientConfig();
+ config.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true);
+
+ return ClientBuilder.newClient(config)
+ .register(org.openecomp.aai.util.CustomJacksonJaxBJsonProvider.class);
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/client/HttpsBasicClient.java b/vid-app-common/src/main/java/org/openecomp/vid/client/HttpsBasicClient.java
new file mode 100755
index 0000000..dc0e355
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/client/HttpsBasicClient.java
@@ -0,0 +1,143 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.client;
+
+import java.io.File;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+
+import org.eclipse.jetty.util.security.Password;
+import org.glassfish.jersey.client.ClientConfig;
+import org.glassfish.jersey.client.ClientProperties;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.vid.properties.VidProperties;
+
+ /**
+ * General SSL client using the VID tomcat keystore. It doesn't use client certificates.
+ */
+
+public class HttpsBasicClient{
+
+ /** The logger. */
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HttpsBasicClient.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /**
+ * Retrieve an SSL client.
+ *
+ * @return Client The SSL client
+ * @throws Exception the exception
+ */
+ public static Client getClient() throws Exception {
+ String methodName = "getClient";
+ ClientConfig config = new ClientConfig();
+ //config.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE);
+ //config.getClasses().add(org.openecomp.aai.util.CustomJacksonJaxBJsonProvider.class);
+
+ SSLContext ctx = null;
+
+ try {
+
+ config.property(ClientProperties.SUPPRESS_HTTP_COMPLIANCE_VALIDATION, true);
+
+ String truststore_path = SystemProperties.getProperty(VidProperties.VID_TRUSTSTORE_FILENAME);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + " " + methodName + " truststore_path=" + truststore_path);
+ String truststore_password = SystemProperties.getProperty(VidProperties.VID_TRUSTSTORE_PASSWD_X);
+
+
+ String decrypted_truststore_password = Password.deobfuscate(truststore_password);
+ //logger.debug(dateFormat.format(new Date()) + " " + methodName + " decrypted_truststore_password=" + decrypted_truststore_password);
+
+ File tr = new File (truststore_path);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + " " + methodName + " absolute truststore path=" + tr.getAbsolutePath());
+
+ //String keystore_path = certFilePath + AAIProperties.FILESEPARTOR + SystemProperties.getProperty(AAIProperties.AAI_KEYSTORE_FILENAME);
+ //String keystore_password = SystemProperties.getProperty(AAIProperties.AAI_KEYSTORE_PASSWD_X);
+ //String decrypted_keystore_password = EncryptedPropValue.decryptTriple(keystore_password);
+
+ System.setProperty("javax.net.ssl.trustStore", truststore_path);
+ System.setProperty("javax.net.ssl.trustStorePassword", decrypted_truststore_password);
+ HttpsURLConnection.setDefaultHostnameVerifier( new HostnameVerifier(){
+ public boolean verify(String string,SSLSession ssls) {
+ return true;
+ }
+ });
+
+ //May need to make the algorithm a parameter. MSO requires TLSv1.1 or TLSv1.2
+ ctx = SSLContext.getInstance("TLSv1.2");
+
+ /*
+ KeyManagerFactory kmf = null;
+ try {
+ kmf = KeyManagerFactory.getInstance("SunX509");
+ FileInputStream fin = new FileInputStream(keystore_path);
+ KeyStore ks = KeyStore.getInstance("PKCS12");
+ char[] pwd = decrypted_keystore_password.toCharArray();
+ ks.load(fin, pwd);
+ kmf.init(ks, pwd);
+ } catch (Exception e) {
+ System.out.println("Error setting up kmf: exiting");
+ e.printStackTrace();
+ System.exit(1);
+ }
+
+ ctx.init(kmf.getKeyManagers(), null, null);
+ */
+ ctx.init(null, null, null);
+ //config.getProperties().put(HTTPSProperties.PROPERTY_HTTPS_PROPERTIES,
+ // new HTTPSProperties( , ctx));
+
+ return ClientBuilder.newBuilder()
+ .sslContext(ctx)
+ .hostnameVerifier(new HostnameVerifier() {
+ @Override
+ public boolean verify( String s, SSLSession sslSession ) {
+ return true;
+ }
+ }).withConfig(config)
+ .build()
+ .register(org.openecomp.aai.util.CustomJacksonJaxBJsonProvider.class);
+
+ } catch (Exception e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, "Error setting up config: exiting");
+ //System.out.println("Error setting up config: exiting");
+ e.printStackTrace();
+ return null;
+ }
+
+ //Client client = ClientBuilder.newClient(config);
+ // uncomment this line to get more logging for the request/response
+ // client.addFilter(new LoggingFilter(System.out));
+
+ //return client;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/AaiController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/AaiController.java
new file mode 100755
index 0000000..7cb25c2
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/controller/AaiController.java
@@ -0,0 +1,864 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.controller;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+import javax.ws.rs.BadRequestException;
+import javax.ws.rs.DefaultValue;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Response;
+
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.openecomp.aai.util.AAIRestInterface;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+
+/**
+ * Controller to handle a&ai requests.
+ */
+
+@RestController
+public class AaiController extends RestrictedBaseController{
+
+ /** The view name. */
+ String viewName;
+
+ /** The logger. */
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(AaiController.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The from app id. */
+ protected String fromAppId = "VidAaiController";
+
+ /** The model. */
+ private Map<String,Object> model = new HashMap<String,Object>();
+
+ /** The servlet context. */
+ private @Autowired ServletContext servletContext;
+
+ /**
+ * Welcome method.
+ *
+ * @param request the request
+ * @return ModelAndView The view
+ */
+ @RequestMapping(value = {"/subscriberSearch" }, method = RequestMethod.GET)
+ public ModelAndView welcome(HttpServletRequest request) {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== AaiController welcome start");
+ return new ModelAndView(getViewName());
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#getViewName()
+ */
+ public String getViewName() {
+ return viewName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#setViewName(java.lang.String)
+ */
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+
+ /**
+ * Get services from a&ai.
+ *
+ * @return ResponseEntity<String> The response entity with the logged in user uuid.
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws InterruptedException the interrupted exception
+ */
+ @RequestMapping(value = {"/getuserID" }, method = RequestMethod.GET)
+ public ResponseEntity<String> getUserID(HttpServletRequest request) throws IOException, InterruptedException {
+
+ String userId = "";
+ HttpSession session = request.getSession();
+ if (session != null)
+ {
+ User user = (User) session.getAttribute(SystemProperties.getProperty(SystemProperties.USER_ATTRIBUTE_NAME));
+ if (user != null)
+ {
+ userId = user.getHrid();
+ }
+ }
+
+ return new ResponseEntity<String>( userId, HttpStatus.OK);
+ }
+
+
+ /**
+ * Get services from a&ai.
+ *
+ * @return ResponseEntity<String> The response entity
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws InterruptedException the interrupted exception
+ */
+ @RequestMapping(value="/aai_get_services",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<String> doGetServices() throws IOException, InterruptedException {
+ File certiPath = GetCertificatesPath();
+ Response resp = doAaiGet(certiPath.getAbsolutePath(), "service-design-and-creation/services", false);
+
+ return convertResponseToResponseEntity(resp);
+ }
+
+ /**
+ * Lookup single service instance in a&ai. Get the service-subscription and customer, too, i guess?
+ *
+ * @param serviceInstanceId the service instance Id
+ * @return ResponseEntity The response entity
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws InterruptedException the interrupted exception
+ */
+ @RequestMapping(value="/aai_get_service_instance/{service-instance-id}/{service-instance-type}", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<String> doGetServiceInstance(@PathVariable("service-instance-id") String serviceInstanceId,@PathVariable("service-instance-type") String serviceInstanceType) throws IOException, InterruptedException {
+ File certiPath = GetCertificatesPath();
+ Response resp=null;
+
+ if(serviceInstanceType.equalsIgnoreCase("Service Instance Id")){
+ resp = doAaiGet( certiPath.getAbsolutePath(),
+ "search/nodes-query?search-node-type=service-instance&filter=service-instance-id:EQUALS:"
+ + serviceInstanceId, false);
+ } else {
+ resp = doAaiGet( certiPath.getAbsolutePath(),
+ "search/nodes-query?search-node-type=service-instance&filter=service-instance-name:EQUALS:"
+ + serviceInstanceId, false);
+ }
+ return convertResponseToResponseEntity(resp);
+ }
+
+
+ /**
+ * Get services from a&ai.
+ *
+ * @param globalCustomerId the global customer id
+ * @param serviceSubscriptionId the service subscription id
+ * @return ResponseEntity The response entity
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws InterruptedException the interrupted exception
+ */
+ @RequestMapping(value="/aai_get_service_subscription/{global-customer-id}/{service-subscription-id}",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<String> doGetServices(@PathVariable("global-customer-id") String globalCustomerId,
+ @PathVariable("service-subscription-id") String serviceSubscriptionId) throws IOException, InterruptedException {
+ File certiPath = GetCertificatesPath();
+ Response resp = doAaiGet(certiPath.getAbsolutePath(), "business/customers/customer/" + globalCustomerId
+ + "/service-subscriptions/service-subscription/" + serviceSubscriptionId + "?depth=0", false);
+ return convertResponseToResponseEntity(resp);
+ }
+
+ /**
+ * Obtain the subscriber list from a&ai.
+ *
+ * @param fullSet the full set
+ * @return ResponseEntity The response entity
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws InterruptedException the interrupted exception
+ */
+ @RequestMapping(value="/aai_get_subscribers",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<String> doGetSubscriberList(@DefaultValue("n") @QueryParam("fullSet") String fullSet) throws IOException, InterruptedException {
+ Response resp = getSubscribers(false);
+ return convertResponseToResponseEntity(resp);
+ }
+
+ /**
+ * Obtain the Target Prov Status from the System.Properties file.
+ *
+ * @return ResponseEntity The response entity
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws InterruptedException the interrupted exception
+ */
+ @RequestMapping(value="/get_system_prop_vnf_prov_status",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<String> getTargetProvStatus() throws IOException, InterruptedException {
+ String p = SystemProperties.getProperty("aai.vnf.provstatus");
+ return new ResponseEntity<String>(p, HttpStatus.OK);
+ }
+
+ /**
+ * Obtain the full subscriber list from a&ai.
+ *
+ * @return ResponseEntity The response entity
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws InterruptedException the interrupted exception
+ */
+ @RequestMapping(value="/aai_get_full_subscribers",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<String> getFullSubscriberList() throws IOException, InterruptedException {
+ Response resp = getSubscribers(true);
+ return convertResponseToResponseEntity(resp);
+ }
+
+
+ /**
+ * Refresh the subscriber list from a&ai.
+ *
+ * @return ResponseEntity The response entity
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ @RequestMapping(value="/aai_refresh_subscribers",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<String> doRefreshSubscriberList() throws IOException {
+ Response resp = getSubscribers(false);
+ return convertResponseToResponseEntity(resp);
+ }
+
+ /**
+ * Refresh the full subscriber list from a&ai.
+ *
+ * @return ResponseEntity The response entity
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ @RequestMapping(value="/aai_refresh_full_subscribers",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public ResponseEntity<String> doRefreshFullSubscriberList() throws IOException {
+ Response resp = getSubscribers(false);
+ return convertResponseToResponseEntity(resp);
+ }
+
+ /**
+ * Get subscriber details from a&ai.
+ *
+ * @param subscriberId the subscriber id
+ * @return ResponseEntity The response entity
+ */
+ @RequestMapping(value="/aai_sub_details/{subscriberId}", method = RequestMethod.GET)
+ public ResponseEntity<String> GetSubscriber(@PathVariable("subscriberId") String subscriberId) {
+ Response resp = getSubscriberDetails(subscriberId);
+ return convertResponseToResponseEntity(resp);
+ }
+
+ /**
+ * Issue a named query to a&ai.
+ *
+ * @param namedQueryId the named query id
+ * @param globalCustomerId the global customer id
+ * @param serviceType the service type
+ * @param serviceInstance the service instance
+ * @return ResponseEntity The response entity
+ */
+ @RequestMapping(value="/aai_sub_viewedit/{namedQueryId}/{globalCustomerId}/{serviceType}/{serviceInstance}", method = RequestMethod.GET)
+ public ResponseEntity<String> viewEditGetComponentList(
+ @PathVariable("namedQueryId") String namedQueryId,
+ @PathVariable("globalCustomerId") String globalCustomerId,
+ @PathVariable("serviceType") String serviceType,
+ @PathVariable("serviceInstance") String serviceInstance) {
+
+ String componentListPayload = getComponentListPutPayload(namedQueryId, globalCustomerId, serviceType, serviceInstance);
+ File certiPath = GetCertificatesPath();
+
+ Response resp = doAaiPost(certiPath.getAbsolutePath(), "search/named-query", componentListPayload, false);
+ return convertResponseToResponseEntity(resp);
+ }
+
+ /**
+ * Issue a named query to a&ai.
+ *
+ * @param namedQueryId the named query id
+ * @param globalCustomerId the global customer id
+ * @param serviceType the service type
+ * @param serviceInstance the service instance
+ * @return ResponseEntity The response entity
+ */
+ @RequestMapping(value="/aai_get_models_by_service_type/{namedQueryId}/{globalCustomerId}/{serviceType}", method = RequestMethod.GET)
+ public ResponseEntity<String> viewEditGetComponentList(
+ @PathVariable("namedQueryId") String namedQueryId,
+ @PathVariable("globalCustomerId") String globalCustomerId,
+ @PathVariable("serviceType") String serviceType) {
+
+ String componentListPayload = getModelsByServiceTypePayload(namedQueryId, globalCustomerId, serviceType);
+ File certiPath = GetCertificatesPath();
+
+ Response resp = doAaiPost(certiPath.getAbsolutePath(), "search/named-query", componentListPayload, false);
+ return convertResponseToResponseEntity(resp);
+ }
+
+ /**
+ * Parses the for tenants.
+ *
+ * @param resp the resp
+ * @return the string
+ */
+ private String parseForTenants(String resp)
+ {
+ String tenantList = "";
+
+ try
+ {
+ JSONParser jsonParser = new JSONParser();
+
+ JSONObject jsonObject = (JSONObject) jsonParser.parse(resp);
+
+ return parseCustomerObjectForTenants(jsonObject);
+ }
+ catch (Exception ex) {
+
+ }
+
+ return tenantList;
+ }
+
+ /**
+ * Parses the for tenants by service subscription.
+ *
+ * @param resp the resp
+ * @return the string
+ */
+ private String parseForTenantsByServiceSubscription(String resp)
+ {
+ String tenantList = "";
+
+ try
+ {
+ JSONParser jsonParser = new JSONParser();
+
+ JSONObject jsonObject = (JSONObject) jsonParser.parse(resp);
+
+ return parseServiceSubscriptionObjectForTenants(jsonObject);
+ }
+ catch (Exception ex) {
+
+ }
+
+ return tenantList;
+ }
+
+
+ // @RequestMapping(value="/aai_get_tenants/{global-customer-id}", method = RequestMethod.GET)
+ // public ResponseEntity<String> viewEditGetComponentList(
+ // @PathVariable("global-customer-id") String globalCustomerId) {
+ // return new ResponseEntity<String>(getTenants(globalCustomerId), HttpStatus.OK);
+ // }
+
+ /**
+ * Obtain tenants for a given service type.
+ *
+ * @param globalCustomerId the global customer id
+ * @param serviceType the service type
+ * @return ResponseEntity The response entity
+ */
+ @RequestMapping(value="/aai_get_tenants/{global-customer-id}/{service-type}", method = RequestMethod.GET)
+ public ResponseEntity<String> viewEditGetTenantsFromServiceType(
+ @PathVariable("global-customer-id") String globalCustomerId, @PathVariable("service-type") String serviceType) {
+ return getTenantsFromServiceType(globalCustomerId, serviceType);
+ }
+
+ private ResponseEntity<String> convertResponseToResponseEntity(Response resp) {
+ ResponseEntity<String> respEnt;
+ if (resp == null) {
+ respEnt = new ResponseEntity<String>("Failed to fetch data from A&AI, check server logs for details.", HttpStatus.INTERNAL_SERVER_ERROR);
+ } else {
+ respEnt = new ResponseEntity<String>((String)resp.readEntity(String.class), HttpStatus.valueOf(resp.getStatus()));
+ }
+ return respEnt;
+ }
+
+ /**
+ * Gets the tenants.
+ *
+ * @param globalCustomerId the global customer id
+ * @return the tenants
+ */
+ private ResponseEntity<String> getTenants(String globalCustomerId)
+ {
+ File certiPath = GetCertificatesPath();
+ Response resp = doAaiGet(certiPath.getAbsolutePath(), "business/customers/customer/" + globalCustomerId, false);
+
+ ResponseEntity<String> respEnt;
+ if (resp.getStatus() >= 200 && resp.getStatus() <= 299) {
+ respEnt = new ResponseEntity<String>(parseForTenants((String)resp.readEntity(String.class)), HttpStatus.OK);
+ } else {
+ respEnt = new ResponseEntity<String>((String)resp.readEntity(String.class), HttpStatus.valueOf(resp.getStatus()));
+ }
+ return respEnt;
+
+ }
+
+ /**
+ * Gets the tenants from service type.
+ *
+ * @param globalCustomerId the global customer id
+ * @param serviceType the service type
+ * @return the tenants from service type
+ */
+ private ResponseEntity<String> getTenantsFromServiceType(String globalCustomerId, String serviceType)
+ {
+ File certiPath = GetCertificatesPath();
+ String url = "business/customers/customer/" + globalCustomerId + "/service-subscriptions/service-subscription/" + serviceType;
+
+ Response resp = doAaiGet(certiPath.getAbsolutePath(), url, false);
+
+ ResponseEntity<String> respEnt;
+ if (resp.getStatus() >= 200 && resp.getStatus() <= 299) {
+ respEnt = new ResponseEntity<String>(parseForTenantsByServiceSubscription((String)resp.readEntity(String.class)), HttpStatus.OK);
+ } else {
+ respEnt = new ResponseEntity<String>((String)resp.readEntity(String.class), HttpStatus.valueOf(resp.getStatus()));
+ }
+ return respEnt;
+
+ }
+
+ /**
+ * Gets the services.
+ *
+ * @return the services
+ */
+ private Response getServices()
+ {
+ File certiPath = GetCertificatesPath();
+ Response resp = doAaiGet(certiPath.getAbsolutePath(), "service-design-and-creation/services", false);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "getServices() resp=" + resp.getStatusInfo());
+
+ //model.put("aai_get_services", resp);
+ return resp;
+ }
+
+
+ /**
+ * Gets the subscribers.
+ *
+ * @param isFullSet the is full set
+ * @return the subscribers
+ */
+ private Response getSubscribers(boolean isFullSet)
+ {
+ File certiPath = GetCertificatesPath();
+ String depth = "0";
+
+ Response resp = doAaiGet(certiPath.getAbsolutePath(), "business/customers?subscriber-type=INFRA&depth=" + depth, false);
+ if (resp != null) {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "getSubscribers() resp=" + resp.getStatusInfo().toString());
+ }
+ return resp;
+ }
+
+
+
+ /**
+ * Gets the subscriber details.
+ *
+ * @param subscriberId the subscriber id
+ * @return the subscriber details
+ */
+ private Response getSubscriberDetails(String subscriberId)
+ {
+ File certiPath = GetCertificatesPath();
+ Response resp = doAaiGet(certiPath.getAbsolutePath(), "business/customers/customer/" + subscriberId + "?depth=2", false);
+ //String resp = doAaiGet(certiPath.getAbsolutePath(), "business/customers/customer/" + subscriberId, false);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "getSubscriberDetails() resp=" + resp.getStatusInfo().toString());
+ return resp;
+ }
+
+ /**
+ * Gets the certificates path.
+ *
+ * @return the file
+ */
+ private File GetCertificatesPath()
+ {
+ if (servletContext != null)
+ return new File( servletContext.getRealPath("/WEB-INF/cert/") );
+ return null;
+ }
+
+ /**
+ * Send a GET request to a&ai.
+ *
+ * @param certiPath the certi path
+ * @param uri the uri
+ * @param xml the xml
+ * @return String The response
+ */
+ protected Response doAaiGet(String certiPath, String uri, boolean xml) {
+ String methodName = "getSubscriberList";
+ String transId = UUID.randomUUID().toString();
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ Response resp = null;
+ try {
+
+ AAIRestInterface restContrller = new AAIRestInterface(certiPath);
+ resp = restContrller.RestGet(fromAppId, transId, uri, xml);
+
+ } catch (WebApplicationException e) {
+ final String message = ((BadRequestException) e).getResponse().readEntity(String.class);
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + message);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + message);
+ } catch (Exception e) {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ }
+
+ return resp;
+ }
+
+ /**
+ * Send a POST request to a&ai.
+ *
+ * @param certiPath the certi path
+ * @param uri the uri
+ * @param payload the payload
+ * @param xml the xml
+ * @return String The response
+ */
+ protected Response doAaiPost(String certiPath, String uri, String payload, boolean xml) {
+ String methodName = "getSubscriberList";
+ String transId = UUID.randomUUID().toString();
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ Response resp = null;
+ try {
+
+ AAIRestInterface restContrller = new AAIRestInterface(certiPath);
+ resp = restContrller.RestPost(fromAppId, transId, uri, payload, xml);
+
+ } catch (Exception e) {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ }
+
+ return resp;
+ }
+
+ /**
+ * Gets the component list put payload.
+ *
+ * @param namedQueryId the named query id
+ * @param globalCustomerId the global customer id
+ * @param serviceType the service type
+ * @param serviceInstance the service instance
+ * @return the component list put payload
+ */
+ private String getComponentListPutPayload(String namedQueryId, String globalCustomerId, String serviceType, String serviceInstance) {
+ return
+ " {" +
+ " \"instance-filters\": {" +
+ " \"instance-filter\": [" +
+ " {" +
+ " \"customer\": {" +
+ " \"global-customer-id\": \"" + globalCustomerId + "\"" +
+ " }," +
+ " \"service-instance\": {" +
+ " \"service-instance-id\": \"" + serviceInstance + "\"" +
+ " }," +
+ " \"service-subscription\": {" +
+ " \"service-type\": \"" + serviceType + "\"" +
+ " }" +
+ " }" +
+ " ]" +
+ " }," +
+ " \"query-parameters\": {" +
+ " \"named-query\": {" +
+ " \"named-query-uuid\": \"" + namedQueryId + "\"" +
+ " }" +
+ " }" +
+ "}";
+
+ }
+ private String getModelsByServiceTypePayload(String namedQueryId, String globalCustomerId, String serviceType) {
+ // TODO Auto-generated method stub
+ return " {" +
+ " \"instance-filters\": {" +
+ " \"instance-filter\": [" +
+ " {" +
+ " \"customer\": {" +
+ " \"global-customer-id\": \"" + globalCustomerId + "\"" +
+ " }," +
+ " \"service-subscription\": {" +
+ " \"service-type\": \"" + serviceType + "\"" +
+ " }" +
+ " }" +
+ " ]" +
+ " }," +
+ " \"query-parameters\": {" +
+ " \"named-query\": {" +
+ " \"named-query-uuid\": \"" + namedQueryId + "\"" +
+ " }" +
+ " }" +
+ "}";
+
+ }
+
+ /**
+ * Return tenant details.
+ *
+ * @param jsonObject the json object
+ * @return String The parsing results
+ */
+ public static String parseCustomerObjectForTenants(JSONObject jsonObject) {
+
+ JSONArray tenantArray = new JSONArray();
+ boolean bconvert = false;
+
+ try {
+
+ JSONObject serviceSubsObj = (JSONObject) jsonObject.get("service-subscriptions");
+
+ if (serviceSubsObj != null)
+ {
+ JSONArray srvcSubArray = (JSONArray) serviceSubsObj.get("service-subscription");
+
+ if (srvcSubArray != null)
+ {
+ Iterator i = srvcSubArray.iterator();
+
+ while (i.hasNext()) {
+
+ JSONObject innerObj = (JSONObject) i.next();
+
+ if (innerObj == null)
+ continue;
+
+ JSONObject relationShipListsObj = (JSONObject) innerObj.get("relationship-list");
+ if (relationShipListsObj != null)
+ {
+ JSONArray rShipArray = (JSONArray) relationShipListsObj.get("relationship");
+ if (rShipArray != null)
+ {
+ Iterator i1 = rShipArray.iterator();
+
+ while (i1.hasNext()) {
+
+ JSONObject inner1Obj = (JSONObject) i1.next();
+
+ if (inner1Obj == null)
+ continue;
+
+ String relatedTo = checkForNull((String)inner1Obj.get("related-to"));
+ if (relatedTo.equalsIgnoreCase("tenant"))
+ {
+ JSONObject tenantNewObj = new JSONObject();
+
+ String relatedLink = checkForNull((String) inner1Obj.get("related-link"));
+ tenantNewObj.put("link", relatedLink);
+
+ JSONArray rDataArray = (JSONArray) inner1Obj.get("relationship-data");
+ if (rDataArray != null)
+ {
+ Iterator i2 = rDataArray.iterator();
+
+ while (i2.hasNext()) {
+ JSONObject inner2Obj = (JSONObject) i2.next();
+
+ if (inner2Obj == null)
+ continue;
+
+ String rShipKey = checkForNull((String)inner2Obj.get("relationship-key"));
+ String rShipVal = checkForNull((String)inner2Obj.get("relationship-value"));
+ if (rShipKey.equalsIgnoreCase("cloud-region.cloud-owner"))
+ {
+ tenantNewObj.put("cloudOwner", rShipVal);
+ }
+ else if (rShipKey.equalsIgnoreCase("cloud-region.cloud-region-id"))
+ {
+ tenantNewObj.put("cloudRegionID", rShipVal);
+ }
+
+ if (rShipKey.equalsIgnoreCase("tenant.tenant-id"))
+ {
+ tenantNewObj.put("tenantID", rShipVal);
+ }
+ }
+ }
+
+ JSONArray relatedTPropArray = (JSONArray) inner1Obj.get("related-to-property");
+ if (relatedTPropArray != null)
+ {
+ Iterator i3 = relatedTPropArray.iterator();
+
+ while (i3.hasNext()) {
+ JSONObject inner3Obj = (JSONObject) i3.next();
+
+ if (inner3Obj == null)
+ continue;
+
+ String propKey = checkForNull((String)inner3Obj.get("property-key"));
+ String propVal = checkForNull((String)inner3Obj.get("property-value"));
+ if (propKey.equalsIgnoreCase("tenant.tenant-name"))
+ {
+ tenantNewObj.put("tenantName", propVal);
+ }
+ }
+ }
+ bconvert = true;
+ tenantArray.add(tenantNewObj);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ } catch (NullPointerException ex) {
+
+
+ }
+
+ if (bconvert)
+ return tenantArray.toJSONString();
+ else
+ return "";
+
+ }
+
+
+ /**
+ * Retrieve the service subscription from the jsonObject.
+ *
+ * @param jsonObject the json object
+ * @return String
+ */
+ public static String parseServiceSubscriptionObjectForTenants(JSONObject jsonObject) {
+
+ JSONArray tenantArray = new JSONArray();
+ boolean bconvert = false;
+
+ try {
+ JSONObject relationShipListsObj = (JSONObject) jsonObject.get("relationship-list");
+ if (relationShipListsObj != null)
+ {
+ JSONArray rShipArray = (JSONArray) relationShipListsObj.get("relationship");
+ if (rShipArray != null)
+ {
+ Iterator i1 = rShipArray.iterator();
+
+ while (i1.hasNext()) {
+
+ JSONObject inner1Obj = (JSONObject) i1.next();
+
+ if (inner1Obj == null)
+ continue;
+
+ String relatedTo = checkForNull((String)inner1Obj.get("related-to"));
+ if (relatedTo.equalsIgnoreCase("tenant"))
+ {
+ JSONObject tenantNewObj = new JSONObject();
+
+ String relatedLink = checkForNull((String) inner1Obj.get("related-link"));
+ tenantNewObj.put("link", relatedLink);
+
+ JSONArray rDataArray = (JSONArray) inner1Obj.get("relationship-data");
+ if (rDataArray != null)
+ {
+ Iterator i2 = rDataArray.iterator();
+
+ while (i2.hasNext()) {
+ JSONObject inner2Obj = (JSONObject) i2.next();
+
+ if (inner2Obj == null)
+ continue;
+
+ String rShipKey = checkForNull((String)inner2Obj.get("relationship-key"));
+ String rShipVal = checkForNull((String)inner2Obj.get("relationship-value"));
+ if (rShipKey.equalsIgnoreCase("cloud-region.cloud-owner"))
+ {
+ tenantNewObj.put("cloudOwner", rShipVal);
+ }
+ else if (rShipKey.equalsIgnoreCase("cloud-region.cloud-region-id"))
+ {
+ tenantNewObj.put("cloudRegionID", rShipVal);
+ }
+
+ if (rShipKey.equalsIgnoreCase("tenant.tenant-id"))
+ {
+ tenantNewObj.put("tenantID", rShipVal);
+ }
+ }
+ }
+
+ JSONArray relatedTPropArray = (JSONArray) inner1Obj.get("related-to-property");
+ if (relatedTPropArray != null)
+ {
+ Iterator i3 = relatedTPropArray.iterator();
+
+ while (i3.hasNext()) {
+ JSONObject inner3Obj = (JSONObject) i3.next();
+
+ if (inner3Obj == null)
+ continue;
+
+ String propKey = checkForNull((String)inner3Obj.get("property-key"));
+ String propVal = checkForNull((String)inner3Obj.get("property-value"));
+ if (propKey.equalsIgnoreCase("tenant.tenant-name"))
+ {
+ tenantNewObj.put("tenantName", propVal);
+ }
+ }
+ }
+ bconvert = true;
+ tenantArray.add(tenantNewObj);
+ }
+ }
+
+ }
+ }
+ } catch (NullPointerException ex) {
+
+
+ }
+
+ if (bconvert)
+ return tenantArray.toJSONString();
+ else
+ return "";
+
+ }
+
+ /**
+ * Check for null.
+ *
+ * @param local the local
+ * @return the string
+ */
+ private static String checkForNull(String local)
+ {
+ if (local != null)
+ return local;
+ else
+ return "";
+
+ }
+}
+
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/BrowseServiceTypesController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/BrowseServiceTypesController.java
new file mode 100755
index 0000000..0698cfd
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/controller/BrowseServiceTypesController.java
@@ -0,0 +1,87 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.controller;
+
+
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+
+
+/**
+ * The Class BrowseServiceTypesController.
+ */
+@RestController
+public class BrowseServiceTypesController extends RestrictedBaseController{
+
+ /** The view name. */
+ String viewName;
+
+ /** The logger. */
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(BrowseServiceTypesController.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The servlet context. */
+ private @Autowired ServletContext servletContext;
+
+ /**
+ * Welcome.
+ *
+ * @param request the request
+ * @return the model and view
+ */
+ @RequestMapping(value = {"/browseservicetypes" }, method = RequestMethod.GET)
+ public ModelAndView welcome(HttpServletRequest request) {
+
+ return new ModelAndView(getViewName());
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#getViewName()
+ */
+ public String getViewName() {
+ return viewName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#setViewName(java.lang.String)
+ */
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/HealthCheckController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/HealthCheckController.java
new file mode 100755
index 0000000..abef8d6
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/controller/HealthCheckController.java
@@ -0,0 +1,196 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.controller;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import org.openecomp.portalsdk.core.controller.UnRestrictedBaseController;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.vid.dao.FnAppDoaImpl;
+
+/**
+ * Controller for user profile view. The view is restricted to authenticated
+ * users. The view name resolves to page user_profile.jsp which uses Angular.
+ */
+
+@RestController
+@RequestMapping("/")
+public class HealthCheckController extends UnRestrictedBaseController {
+
+
+ /** The logger. */
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(HealthCheckController.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ private static final String HEALTH_CHECK_PATH = "/healthCheck";
+
+ /**
+ * Model for JSON response with health-check results.
+ */
+ public class HealthStatus {
+ // Either 200 or 500
+ public int statusCode;
+
+ // Additional detail in case of error, empty in case of success.
+ public String message;
+
+ public String date;
+
+ public HealthStatus(int code, String msg) {
+ this.statusCode = code;
+ this.message = msg;
+ }
+
+ public HealthStatus(int code,String date, String msg) {
+ this.statusCode = code;
+ this.message = msg;
+ this.date=date;
+ }
+
+ public int getStatusCode() {
+ return statusCode;
+ }
+
+ public void setStatusCode(int code) {
+ this.statusCode = code;
+ }
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String msg) {
+ this.message = msg;
+ }
+
+ public String getDate() {
+ return date;
+ }
+
+ public void setDate(String date) {
+ this.date = date;
+ }
+
+ }
+
+ @SuppressWarnings("unchecked")
+ public int getProfileCount(String driver, String URL, String username, String password) {
+ FnAppDoaImpl doa= new FnAppDoaImpl();
+ int count= doa.getProfileCount(driver,URL,username,password);
+ return count;
+ }
+
+
+
+ /**
+ * Obtain the HealthCheck Status from the System.Properties file.
+ * Used by IDNS for redundancy
+ * @return ResponseEntity The response entity
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws InterruptedException the interrupted exception
+ */
+ @RequestMapping(value="/healthCheck",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public HealthStatus gethealthCheckStatusforIDNS() throws IOException, InterruptedException {
+
+ String driver = SystemProperties.getProperty("db.driver");
+ String URL = SystemProperties.getProperty("db.connectionURL");
+ String username = SystemProperties.getProperty("db.userName");
+ String password = SystemProperties.getProperty("db.password");
+
+ logger.debug(EELFLoggerDelegate.debugLogger, "driver ::" + driver);
+ logger.debug(EELFLoggerDelegate.debugLogger, "URL::" + URL);
+ logger.debug(EELFLoggerDelegate.debugLogger, "username::" + username);
+ logger.debug(EELFLoggerDelegate.debugLogger,"password::" + password);
+
+
+ HealthStatus healthStatus = null;
+ try {
+ logger.debug(EELFLoggerDelegate.debugLogger, "Performing health check");
+ int count=getProfileCount(driver,URL,username,password);
+ logger.debug(EELFLoggerDelegate.debugLogger,"count:::"+count);
+ healthStatus = new HealthStatus(200, "health check succeeded");
+ } catch (Exception ex) {
+
+ logger.error(EELFLoggerDelegate.errorLogger, "Failed to perform health check", ex);
+ healthStatus = new HealthStatus(500, "health check failed: " + ex.toString());
+ }
+ return healthStatus;
+ }
+
+ /**
+ * Obtain the HealthCheck Status from the System.Properties file.
+ *
+ * @return ResponseEntity The response entity
+ * @throws IOException Signals that an I/O exception has occurred.
+ * @throws InterruptedException the interrupted exception
+ * Project :
+ */
+ @RequestMapping(value="rest/healthCheck/{User-Agent}/{X-ECOMP-RequestID}",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public HealthStatus getHealthCheck(
+ @PathVariable("User-Agent") String UserAgent,
+ @PathVariable("X-ECOMP-RequestID") String ECOMPRequestID) throws IOException, InterruptedException {
+
+ String driver = SystemProperties.getProperty("db.driver");
+ String URL = SystemProperties.getProperty("db.connectionURL");
+ String username = SystemProperties.getProperty("db.userName");
+ String password = SystemProperties.getProperty("db.password");
+
+ logger.debug(EELFLoggerDelegate.debugLogger, "driver ::" + driver);
+ logger.debug(EELFLoggerDelegate.debugLogger, "URL::" + URL);
+ logger.debug(EELFLoggerDelegate.debugLogger, "username::" + username);
+ logger.debug(EELFLoggerDelegate.debugLogger,"password::" + password);
+
+
+ HealthStatus healthStatus = null;
+ try {
+ logger.debug(EELFLoggerDelegate.debugLogger, "Performing health check");
+ logger.debug(EELFLoggerDelegate.debugLogger, "User-Agent" + UserAgent);
+ logger.debug(EELFLoggerDelegate.debugLogger, "X-ECOMP-RequestID" + ECOMPRequestID);
+
+
+ int count=getProfileCount(driver,URL,username,password);
+
+ logger.debug(EELFLoggerDelegate.debugLogger,"count:::"+count);
+ healthStatus = new HealthStatus(200,dateFormat.format(new Date()) ,"health check succeeded");
+ } catch (Exception ex) {
+
+ logger.error(EELFLoggerDelegate.errorLogger, "Failed to perform health check", ex);
+ healthStatus = new HealthStatus(500,dateFormat.format(new Date()),"health check failed: " + ex.toString());
+ }
+ return healthStatus;
+ }
+}
+
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/MsoController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/MsoController.java
new file mode 100755
index 0000000..f051ed3
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/controller/MsoController.java
@@ -0,0 +1,761 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.controller;
+
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+//import java.util.UUID;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Scanner;
+import java.util.stream.Collectors;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.codehaus.jackson.JsonEncoding;
+import org.codehaus.jackson.JsonFactory;
+import org.codehaus.jackson.JsonGenerator;
+import org.codehaus.jackson.JsonParser;
+import org.codehaus.jackson.JsonToken;
+import org.glassfish.jersey.client.ClientResponse;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.openecomp.vid.domain.mso.CloudConfiguration;
+import org.openecomp.vid.domain.mso.ModelInfo;
+import org.openecomp.vid.domain.mso.ModelInfo.ModelType;
+import org.openecomp.vid.domain.mso.RequestInfo;
+import org.openecomp.vid.domain.mso.RequestParameters;
+import org.openecomp.vid.model.ExceptionResponse;
+import org.openecomp.vid.mso.MsoProperties;
+import org.openecomp.vid.mso.MsoResponseWrapper;
+import org.openecomp.vid.mso.MsoRestInterfaceFactory;
+import org.openecomp.vid.mso.MsoRestInterfaceIfc;
+import org.openecomp.vid.mso.MsoUtil;
+import org.openecomp.vid.mso.RestObject;
+import org.openecomp.vid.mso.rest.RelatedModel;
+import org.openecomp.vid.mso.rest.RequestDetails;
+import org.springframework.http.HttpStatus;
+//import org.springframework.http.ResponseEntity;
+//import org.springframework.http.RequestEntity;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.ObjectReader;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+
+/**
+ * The Class MsoController.
+ */
+@RestController
+@RequestMapping("mso")
+public class MsoController extends RestrictedBaseController{
+
+ /** The view name. */
+ String viewName;
+
+ /** The logger. */
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoController.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The Constant SVC_INSTANCE_ID. */
+ public final static String SVC_INSTANCE_ID = "<service_instance_id>";
+
+ /** The Constant VNF_INSTANCE_ID. */
+ public final static String VNF_INSTANCE_ID = "<vnf_instance_id>";
+
+ /**
+ * Welcome.
+ *
+ * @param request the request
+ * @return the model and view
+
+ public ModelAndView welcome(HttpServletRequest request) {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== MsoController welcome start");
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + " MSO_SERVER_URL=" +
+ SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) );
+ return new ModelAndView(getViewName());
+ }
+ */
+
+ /* (non-Javadoc)
+ * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#getViewName()
+
+ public String getViewName() {
+ return viewName;
+ }
+ */
+
+ /* (non-Javadoc)
+ * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#setViewName(java.lang.String)
+
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+ */
+
+ /**
+ * Creates the svc instance.
+ *
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_create_svc_instance", method = RequestMethod.POST)
+ public ResponseEntity<String> createSvcInstance(HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
+ String methodName = "createSvcInstance";
+
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start" );
+
+// mso_request = retrieveRequestObject (request, mso_request);
+
+ String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE);
+
+ MsoResponseWrapper w = createInstance(mso_request, p);
+ // always return OK, the MSO status code is embedded in the body
+
+ return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
+
+ }
+
+ /**
+ * Creates the vnf.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ @RequestMapping(value="/mso_create_vnf_instance/{serviceInstanceId}", method = RequestMethod.POST)
+ public ResponseEntity<String> createVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
+
+ String methodName = "createVnf";
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ //RequestDetails mso_request = retrieveRequestObject (request);
+ String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_VNF_INSTANCE);
+
+ if ( p == null || p.isEmpty()) {
+ throw new Exception ( "Vnf instance path is not defined");
+ }
+ // /serviceInstances/v2/<service_instance_id>/vnfs
+ String vnf_path = p.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId );
+ MsoResponseWrapper w = createInstance(mso_request, vnf_path);
+
+ // always return OK, the MSO status code is embedded in the body
+
+ return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
+
+ }
+
+ /**
+ * Creates the nw instance.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_create_nw_instance/{serviceInstanceId}", method = RequestMethod.POST)
+ public ResponseEntity<String> createNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
+
+ String methodName = "createNwInstance";
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start, serviceInstanceId = " + serviceInstanceId );
+
+ //RequestDetails mso_request = retrieveRequestObject (request);
+
+ String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_NETWORK_INSTANCE);
+
+ if ( p == null || p.isEmpty()) {
+ throw new Exception ( "Network instance path is not defined");
+ }
+ // /serviceInstances/v2/<serviceInstanceId>/networks/
+
+ String nw_path = p.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId );
+ MsoResponseWrapper w = createInstance(mso_request, nw_path);
+
+ // always return OK, the MSO status code is embedded in the body
+
+ return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
+
+ }
+
+ /**
+ * Creates the volume group instance.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param vnfInstanceId the vnf instance id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_create_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
+ public ResponseEntity<String> createVolumeGroupInstance(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
+ HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
+ String methodName = "createVolumeGroupInstance";
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ //RequestDetails mso_request = retrieveRequestObject (request);
+ String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE);
+
+ if ( p == null || p.isEmpty()) {
+ throw new Exception ( "Volume group instance path is not defined");
+ }
+ String path = p.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);
+ path = path.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId);
+
+ MsoResponseWrapper w = createInstance(mso_request, path);
+
+ // always return OK, the MSO status code is embedded in the body
+ return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
+ }
+
+ /**
+ * Creates the vf module instance.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param vnfInstanceId the vnf instance id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_create_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
+ public ResponseEntity<String> createVfModuleInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
+ @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
+ String methodName = "createVfModuleInstance";
+
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+ //RequestDetails mso_request = retrieveRequestObject (request);
+ String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE);
+
+ if ( p == null || p.isEmpty()) {
+ throw new Exception ( "VF module instance path is not defined");
+ }
+ // /serviceInstances/v2/<serviceInstanceId>/vnfs/<vnfInstanceId>/vfmodules
+ String path = p.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId);
+ path = path.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId);
+
+ MsoResponseWrapper w = createInstance(mso_request, path);
+
+ // always return OK, the MSO status code is embedded in the body
+
+ return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
+ }
+
+ /**
+ * Creates the instance.
+ *
+ * @param request the request
+ * @param path the path
+ * @return the mso response wrapper
+ * @throws ClientHandlerException the client handler exception
+ * @throws Exception the exception
+ */
+ protected MsoResponseWrapper createInstance(RequestDetails request, String path) throws Exception {
+ String methodName = "createInstance";
+ logger.debug(dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ try {
+ MsoRestInterfaceIfc restController = MsoRestInterfaceFactory.getInstance();
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Post, request = (" + request + ")");
+
+ RestObject<String> restObjStr = new RestObject<String>();
+ String str = new String();
+ restObjStr.set(str);
+ restController.<String>Post(str, request, "", path, restObjStr );
+ MsoResponseWrapper w = MsoUtil.wrapResponse (restObjStr);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
+ return w;
+ } catch (Exception e) {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ throw e;
+ }
+ }
+
+ /**
+ * Delete svc instance.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_delete_svc_instance/{serviceInstanceId}", method = RequestMethod.POST)
+ public ResponseEntity<String> deleteSvcInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
+ HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
+
+ String methodName = "deleteSvcInstance";
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ //RequestDetails mso_request = retrieveRequestObject (request);
+ String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE);
+ String path = p + "/" + serviceInstanceId;
+ MsoResponseWrapper w = deleteInstance ( mso_request, path );
+
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
+ // always return OK, the MSO status code is embedded in the body
+
+ return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
+
+ }
+
+ /**
+ * Delete vnf.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param vnfInstanceId the vnf instance id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_delete_vnf_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
+
+ public ResponseEntity<String> deleteVnf(@PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
+ HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
+ String methodName = "deleteVnf";
+
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ //RequestDetails mso_request = retrieveRequestObject (request);
+ String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_VNF_INSTANCE);
+ if ( p == null || p.isEmpty()) {
+ throw new Exception ( "Vnf instance path is not defined");
+ }
+ // /serviceInstances/v2/<service_instance_id>/vnfs/
+ String vnf_path = p.replaceFirst(SVC_INSTANCE_ID, vnfInstanceId );
+ MsoResponseWrapper w = deleteInstance ( mso_request, vnf_path + "/" + vnfInstanceId );
+
+ // always return OK, the MSO status code is embedded in the body
+ return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
+
+ }
+
+ /**
+ * Delete vf module.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param vnfInstanceId the vnf instance id
+ * @param vfModuleId the vf module id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ //mso_delete_vf_module/bc305d54-75b4-431b-adb2-eb6b9e546014/vnfs/fe9000-0009-9999/vfmodules/abeeee-abeeee-abeeee
+ @RequestMapping(value = "/mso_delete_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfModuleId}", method = RequestMethod.POST)
+ public ResponseEntity<String> deleteVfModule (
+ @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId,
+ @PathVariable("vfModuleId") String vfModuleId, HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
+
+ String methodName = "deleteVfModule";
+
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ //RequestDetails mso_request = new RequestDetails();
+ //mso_request = retrieveRequestObject (request);
+ String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE);
+ if ( p == null || p.isEmpty()) {
+ throw new Exception ( "VF Module instance path is not defined");
+ }
+ // /serviceInstances/v2/<serviceInstanceId>/vnfs/<vnfInstanceId>/vfmodules
+ String path = p.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId );
+ path = path.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId );
+ MsoResponseWrapper w = deleteInstance ( mso_request, path + "/" + vfModuleId);
+
+ // always return OK, the MSO status code is embedded in the body
+ return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
+
+ }
+
+ /**
+ * Delete volume group instance.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param vnfInstanceId the vnf instance id
+ * @param volumeGroupId the volume group id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_delete_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupId}", method = RequestMethod.POST)
+ public ResponseEntity<String> deleteVolumeGroupInstance (
+ @PathVariable("serviceInstanceId") String serviceInstanceId, @PathVariable("vnfInstanceId") String vnfInstanceId, @PathVariable("volumeGroupId") String volumeGroupId,
+ HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
+
+ String methodName = "deleteVolumeGroupInstance";
+
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+ //RequestDetails mso_request = retrieveRequestObject (request);
+
+ String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE);
+ if ( p == null || p.isEmpty()) {
+ throw new Exception ( "Volume group instance path is not defined");
+ }
+ // /serviceInstances/v2/{serviceInstanceId}/volumeGroups
+ String path = p.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId );
+ path = path.replaceFirst(VNF_INSTANCE_ID, vnfInstanceId );
+ MsoResponseWrapper w = deleteInstance ( mso_request, path + "/" + volumeGroupId);
+
+ // always return OK, the MSO status code is embedded in the body
+ return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
+ }
+
+ /**
+ * Delete nw instance.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param networkInstanceId the network instance id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_delete_nw_instance/{serviceInstanceId}/networks/{networkInstanceId}", method = RequestMethod.POST)
+ public ResponseEntity<String> deleteNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
+ @PathVariable("networkInstanceId") String networkInstanceId, HttpServletRequest request, @RequestBody RequestDetails mso_request) throws Exception {
+
+ String methodName = "deleteNwInstance";
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ //RequestDetails mso_request = retrieveRequestObject (request);
+
+ String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_NETWORK_INSTANCE);
+ if ( p == null || p.isEmpty()) {
+ throw new Exception ( "Network instance path is not defined");
+ }
+ // /serviceInstances/v2/<service_instance_id>/networks
+ String path = p.replaceFirst(SVC_INSTANCE_ID, serviceInstanceId );
+ MsoResponseWrapper w = deleteInstance ( mso_request, path + "/" + networkInstanceId);
+
+ // always return OK, the MSO status code is embedded in the body
+ return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
+
+ }
+
+ /**
+ * Delete instance.
+ *
+ * @param request the request
+ * @param path the path
+ * @return the mso response wrapper
+ * @throws Exception the exception
+ */
+ protected MsoResponseWrapper deleteInstance(RequestDetails request, String path) throws Exception {
+ String methodName = "deleteInstance";
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ try {
+ MsoRestInterfaceIfc restController = MsoRestInterfaceFactory.getInstance();
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " calling Delete, path =[" + path + "]");
+
+ RestObject<String> restObjStr = new RestObject<String>();
+ String str = new String();
+ restObjStr.set(str);
+ restController.<String>Delete(str, request, "", path, restObjStr );
+ MsoResponseWrapper w = MsoUtil.wrapResponse (restObjStr);
+
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
+ return w;
+
+ } catch (Exception e) {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ throw e;
+ }
+
+ }
+
+ /**
+ * Gets the orchestration request.
+ *
+ * @param requestId the request id
+ * @param request the request
+ * @return the orchestration request
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_get_orch_req/{requestId}", method = RequestMethod.GET)
+ public ResponseEntity<String> getOrchestrationRequest(@PathVariable("requestId") String requestId,
+ HttpServletRequest request) throws Exception {
+
+ String methodName = "getOrchestrationRequest";
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+ MsoResponseWrapper w = null;
+ try {
+ MsoRestInterfaceIfc restController = MsoRestInterfaceFactory.getInstance();
+ String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQ);
+ String path = p + "/" + requestId;
+
+ RestObject<String> restObjStr = new RestObject<String>();
+ String str = new String();
+ restObjStr.set(str);
+
+ restController.<String>Get(str, "", path, restObjStr);
+
+ w = MsoUtil.wrapResponse (restObjStr);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
+ // always return OK, the MSO status code is embedded in the body
+
+ } catch (Exception e) {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ throw e;
+ }
+ // always return OK, the MSO status code is embedded in the body
+ return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
+ }
+
+
+ /**
+ * Gets the orchestration requests.
+ *
+ * @param filterString the filter string
+ * @param request the request
+ * @return the orchestration requests
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_get_orch_reqs/{filterString}", method = RequestMethod.GET)
+ public ResponseEntity<String> getOrchestrationRequests(@PathVariable("filterString") String filterString,
+ HttpServletRequest request) throws Exception {
+
+ String methodName = "getOrchestrationRequests";
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+ MsoResponseWrapper w = null;
+ try {
+ MsoRestInterfaceIfc restController = MsoRestInterfaceFactory.getInstance();
+ String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQS);
+ String path = p + filterString;
+
+ RestObject<String> restObjStr = new RestObject<String>();
+ String str = new String();
+ restObjStr.set(str);
+
+ restController.<String>Get(str, "", path, restObjStr);
+
+ w = MsoUtil.wrapResponse (restObjStr);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
+ } catch (Exception e) {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ throw e;
+ }
+ // always return OK, the MSO status code is embedded in the body
+ return ( new ResponseEntity<String>(w.getResponse(), HttpStatus.OK) );
+ }
+
+ /**
+ * Gets the orchestration requests for svc instance.
+ *
+ * @param svc_instance_id the svc instance id
+ * @return the orchestration requests for svc instance
+ * @throws Exception the exception
+ */
+ public MsoResponseWrapper getOrchestrationRequestsForSvcInstance (String svc_instance_id) throws Exception {
+
+ String methodName = "getOrchestrationRequestsForSvcInstance";
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+ MsoResponseWrapper w = null;
+
+ try {
+ MsoRestInterfaceIfc restController = MsoRestInterfaceFactory.getInstance();
+ String p = SystemProperties.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQS);
+ String path = p + svc_instance_id;
+
+ RestObject<String> restObjStr = new RestObject<String>();
+ String str = new String();
+ restObjStr.set(str);
+
+ restController.<String>Get(str, "", path, restObjStr);
+ w = MsoUtil.wrapResponse (restObjStr);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " w=" + w.getResponse());
+
+ } catch (Exception e) {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ throw e;
+ }
+ return w;
+ }
+
+ /**
+ * Exception handler.
+ *
+ * @param e the e
+ * @param response the response
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ @ExceptionHandler(Exception.class)
+ private void exceptionHandler(Exception e, HttpServletResponse response) throws IOException {
+
+ /*
+ * The following "logger.error" lines "should" be sufficient for logging the exception.
+ * However, the console output in my Eclipse environment is NOT showing ANY of the
+ * logger statements in this class. Thus the temporary "e.printStackTrace" statement
+ * is also included.
+ */
+
+ String methodName = "exceptionHandler";
+ logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ StringWriter sw = new StringWriter();
+ e.printStackTrace(new PrintWriter(sw));
+ logger.error(EELFLoggerDelegate.errorLogger, sw.toString());
+
+ /*
+ * Temporary - IF the above mentioned "logger.error" glitch is resolved ...
+ * this statement could be removed since it would then likely result in duplicate
+ * trace output.
+ */
+ e.printStackTrace(System.err);
+
+ response.setContentType("application/json; charset=UTF-8");
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+
+ ExceptionResponse exceptionResponse = new ExceptionResponse();
+ exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", ""));
+ exceptionResponse.setMessage(e.getMessage());
+
+ response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));
+
+ response.flushBuffer();
+
+ }
+
+ /**
+ * Parses the orchestration requests for svc instance.
+ *
+ * @param resp the resp
+ * @return the list
+ * @throws ParseException the parse exception
+ * @throws Exception the exception
+ */
+ @SuppressWarnings("unchecked")
+ public List<JSONObject> parseOrchestrationRequestsForSvcInstance ( ClientResponse resp ) throws org.json.simple.parser.ParseException, Exception {
+
+ String methodName = "parseOrchestrationRequestsForSvcInstance";
+
+ ArrayList<JSONObject> json_list = new ArrayList<JSONObject>();
+
+ String rlist_str = resp.readEntity (String.class);
+ logger.debug (EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + " Response string: " + rlist_str);
+
+ JSONParser parser = new JSONParser();
+ try {
+ Object obj = parser.parse(rlist_str);
+
+ JSONObject jsonObject = (JSONObject) obj;
+
+ JSONArray requestList = (JSONArray) jsonObject.get("requestList");
+
+ if ( requestList != null && ! (requestList.isEmpty()) )
+ for ( Object container : requestList) {
+
+ JSONObject containerJsonObj = (JSONObject) container;
+ //logger.debug(dateFormat.format(new Date()) + "<== " + "." + methodName + " reqJsonObj: " + containerJsonObj.toJSONString());
+ JSONObject reqJsonObj = (JSONObject) containerJsonObj.get("request");
+
+ //logger.debug(dateFormat.format(new Date()) + "<== " + "." + methodName + " reqJsonObj.requestId: " +
+ // reqJsonObj.get("requestId") );
+ JSONObject result = new JSONObject();
+
+ result.put("requestId", reqJsonObj.get ("requestId"));
+ if ( reqJsonObj.get("requestType") != null ) {
+ result.put("requestType", (reqJsonObj.get("requestType").toString()));
+ }
+ JSONObject req_status = (JSONObject)reqJsonObj.get("requestStatus");
+ if ( req_status != null ) {
+ result.put("timestamp", (req_status.get("timestamp")));
+ result.put("requestState", (req_status.get("requestState")));
+ result.put("statusMessage", (req_status.get("statusMessage")));
+ result.put("percentProgress", (req_status.get("percentProgress")));
+ }
+ json_list.add (result);
+ }
+ } catch (org.json.simple.parser.ParseException pe) {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + " Parse exception: " + pe.toString());
+ throw pe;
+ } catch (Exception e) {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + " Exception: " + e.toString());
+ throw e;
+ }
+ return ( json_list );
+ }
+
+ /**
+ * Retrieve request object.
+ *
+ * @param request the request
+ * @return the request details
+ * @throws Exception the exception
+ */
+ public RequestDetails retrieveRequestObject ( HttpServletRequest request, @RequestBody RequestDetails mso_request ) throws Exception {
+
+ String methodName = "retrieveRequestObject";
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start" );
+
+ ObjectMapper mapper = new ObjectMapper();
+ //JSON from String to Object
+ //RequestDetails mso_request;
+
+ try {
+ //mso_request = new RequestDetails();
+ //mso_request = mapper.readValue(request.getInputStream(), RequestDetails.class);
+ }
+ catch ( Exception e ) {
+ logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " Unable to read json object RequestDetails e=" + e.getMessage());
+ throw e;
+ }
+ if ( mso_request == null) {
+ logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " mso_request is null");
+ throw new Exception ("RequestDetails is missing");
+ }
+ try {
+ String json_req = mapper.writeValueAsString(mso_request);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " request=[" + json_req + "]");
+ }
+ catch ( Exception e ) {
+ logger.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " Unable to convert RequestDetails to json string e=" + e.getMessage());
+ throw e;
+ }
+ return (mso_request);
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/PropertyController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/PropertyController.java
new file mode 100755
index 0000000..9008076
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/controller/PropertyController.java
@@ -0,0 +1,122 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.controller;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+
+/**
+ * The Class PropertyController.
+ */
+@RestController
+public class PropertyController extends RestrictedBaseController{
+
+ /** The view name. */
+ String viewName;
+
+ /** The logger. */
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(PropertyController.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /**
+ * Welcome.
+ *
+ * @param request the request
+ * @return the model and view
+ */
+ @RequestMapping(value = {"/propertyhome" }, method = RequestMethod.GET)
+ public ModelAndView welcome(HttpServletRequest request) {
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== PropertyController welcome start");
+ return new ModelAndView(getViewName());
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#getViewName()
+ */
+ public String getViewName() {
+ return viewName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#setViewName(java.lang.String)
+ */
+ public void setViewName(String _viewName) {
+ this.viewName = _viewName;
+ }
+
+ /**
+ * Gets the property.
+ *
+ * @param name the name
+ * @param defaultvalue the defaultvalue
+ * @param request the request
+ * @return the property
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/get_property/{name}/{defaultvalue}", method = RequestMethod.GET)
+ public ResponseEntity<String> getProperty (@PathVariable("name") String name, @PathVariable("defaultvalue") String defaultvalue,
+ HttpServletRequest request) throws Exception {
+
+ String methodName = "getProperty";
+ ResponseEntity<String> resp = null;
+ String pvalue = null;
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ try {
+ // convert "_" to "." in the property name
+ if (name == null || name.length() == 0 ) {
+ return ( new ResponseEntity<String> (defaultvalue, HttpStatus.OK));
+ }
+ // convert "_" to "." in the property name
+ String propertyName = name.replace('_', '.');
+ pvalue = SystemProperties.getProperty(propertyName);
+ if ( ( pvalue == null ) || ( pvalue.length() == 0 ) ) {
+ pvalue = defaultvalue;
+ }
+ resp = new ResponseEntity<String>(pvalue, HttpStatus.OK);
+ }
+ catch (Exception e) {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + "." + methodName + e.toString());
+ throw e;
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " returning " + pvalue);
+ return ( resp );
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java
new file mode 100755
index 0000000..e22448a
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/controller/VidController.java
@@ -0,0 +1,351 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.controller;
+
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.UUID;
+
+import javax.net.ssl.SSLContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.client.Client;
+
+import org.json.JSONObject;
+import org.json.JSONTokener;
+import org.openecomp.vid.exceptions.VidServiceUnavailableException;
+import org.openecomp.vid.model.ModelConstants;
+import org.openecomp.vid.model.Network;
+import org.openecomp.vid.model.ServiceModel;
+import org.openecomp.vid.model.VNF;
+import org.openecomp.vid.model.VfModule;
+import org.openecomp.vid.model.VolumeGroup;
+//import org.openecomp.vid.model.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.annotation.Bean;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.vid.asdc.AsdcCatalogException;
+import org.openecomp.vid.asdc.AsdcClient;
+import org.openecomp.vid.asdc.beans.Resource;
+import org.openecomp.vid.asdc.beans.Service;
+import org.openecomp.vid.asdc.beans.tosca.Group;
+import org.openecomp.vid.asdc.beans.tosca.NodeTemplate;
+import org.openecomp.vid.asdc.beans.tosca.ToscaCsar;
+import org.openecomp.vid.asdc.beans.tosca.ToscaModel;
+import org.openecomp.vid.asdc.memory.InMemoryAsdcClient;
+import org.openecomp.vid.asdc.rest.RestfulAsdcClient;
+import org.openecomp.vid.properties.AsdcClientConfiguration;
+import org.openecomp.vid.properties.AsdcClientConfiguration.AsdcClientType;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.openecomp.vid.properties.VidProperties;
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * The Class VidController.
+ */
+@RestController
+public class VidController extends RestrictedBaseController {
+
+ /** The Constant LOG. */
+ private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(VidController.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The app context. */
+ @Autowired
+ private ApplicationContext appContext;
+
+ /**
+ * Gets the object mapper.
+ *
+ * @return the object mapper
+ */
+ @Bean
+ public ObjectMapper getObjectMapper() {
+ return new ObjectMapper();
+ }
+
+ /**
+ * Gets the asdc client.
+ *
+ * @return the asdc client
+ */
+ @Bean
+ public AsdcClient getAsdcClient() {
+
+ final AsdcClientConfiguration asdcClientConfig = appContext.getBean(AsdcClientConfiguration.class);
+
+ switch (asdcClientConfig.getAsdcClientType()) {
+ case IN_MEMORY:
+ final InputStream asdcCatalogFile = VidController.class.getClassLoader().getResourceAsStream("catalog.json");
+ final JSONTokener tokener = new JSONTokener(asdcCatalogFile);
+ final JSONObject catalog = new JSONObject(tokener);
+
+ return new InMemoryAsdcClient.Builder().catalog(catalog).build();
+ case REST:
+
+ final String protocol = asdcClientConfig.getAsdcClientProtocol();
+ final String host = asdcClientConfig.getAsdcClientHost();
+ final int port = asdcClientConfig.getAsdcClientPort();
+ final String auth = asdcClientConfig.getAsdcClientAuth();
+ Client cl = null;
+ if ( protocol.equalsIgnoreCase("https") ) {
+ try {
+ SSLContext ctx = SSLContext.getInstance("TLSv1.2");
+ ctx.init(null, null, null);
+ cl = ClientBuilder.newBuilder().sslContext(ctx).build();
+ }
+ catch ( NoSuchAlgorithmException n ) {
+ throw new RuntimeException("SDC Client could not be instantiated due to unsupported protocol TLSv1.2", n);
+ }
+ catch ( KeyManagementException k ) {
+ throw new RuntimeException("SDC Client could not be instantiated due to a key management exception", k);
+ }
+ }
+ else {
+ cl = ClientBuilder.newBuilder().build();
+ }
+
+ try {
+ final URI uri = new URI(protocol + "://" + host + ":" + port + "/");
+ return new RestfulAsdcClient.Builder(cl, uri)
+ .auth(auth)
+ .build();
+ } catch (URISyntaxException e) {
+ throw new RuntimeException("SDC Client could not be instantiated due to a syntax error in the URI", e);
+ }
+
+ default:
+ throw new RuntimeException(asdcClientConfig.getAsdcClientType() + " is invalid; must be one of " + Arrays.toString(AsdcClientType.values()));
+ }
+ }
+
+ /**
+ * Gets the services.
+ *
+ * @param request the request
+ * @return the services
+ * @throws VidServiceUnavailableException the vid service unavailable exception
+ */
+ @RequestMapping(value={"/rest/models/services"}, method = RequestMethod.GET)
+ public Collection<org.openecomp.vid.asdc.beans.Service> getServices(HttpServletRequest request) throws VidServiceUnavailableException {
+ try {
+ return getAsdcClient().getServices(request.getParameterMap());
+ } catch (AsdcCatalogException e) {
+ LOG.error("Failed to retrieve service definitions from SDC", e);
+ throw new VidServiceUnavailableException("Failed to retrieve service definitions from SDC", e);
+ } catch (Throwable t) {
+ LOG.debug("Unexpected error while retrieving service definitions from SDC: " + t.getMessage() + ":", t);
+ t.printStackTrace();
+ throw new VidServiceUnavailableException("Unexpected error while retrieving service definitions from SDC: " + t.getMessage(), t);
+ }
+ }
+
+ /**
+ * Gets the services.
+ *
+ * @param uuid the uuid
+ * @return the services
+ * @throws VidServiceUnavailableException the vid service unavailable exception
+ */
+ @RequestMapping(value={"/rest/models/services/{uuid}"}, method = RequestMethod.GET)
+ public ServiceModel getServices(@PathVariable("uuid") String uuid) throws VidServiceUnavailableException {
+ String methodName = "getServices";
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " start");
+ boolean isNewFlow = false;
+
+ String asdcModelNamespace = VidProperties.getAsdcModelNamespace();
+
+ String vnfTag = asdcModelNamespace + ModelConstants.VNF;
+ String networkTag = asdcModelNamespace + ModelConstants.NETWORK;
+ String vfModuleTag = asdcModelNamespace + ModelConstants.VF_MODULE;
+
+ try {
+ final ServiceModel serviceModel = new ServiceModel();
+ final Map<String, VNF> vnfs = new HashMap<String, VNF> ();
+ final Map<String, Network> networks = new HashMap<String, Network> ();
+
+ final ToscaCsar serviceCsar = getAsdcClient().getServiceToscaModel(UUID.fromString(uuid));
+ final Service asdcServiceMetadata = getAsdcClient().getService(UUID.fromString(uuid));
+ final ToscaModel asdcServiceToscaModel = serviceCsar.getParent();
+
+ serviceModel.setService(ServiceModel.extractService(asdcServiceToscaModel, asdcServiceMetadata));
+
+ for (Entry<String, NodeTemplate> component: asdcServiceToscaModel.gettopology_template().getnode_templates().entrySet()) {
+ final String modelCustomizationName = component.getKey();
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " model customization name: " + modelCustomizationName);
+ final NodeTemplate nodeTemplate = component.getValue();
+ final String type = nodeTemplate.getType();
+
+ if (type.startsWith(vnfTag)) {
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " found node template type: " + type);
+
+ final UUID vnfUuid = UUID.fromString(nodeTemplate.getMetadata().getUUID());
+ final VNF vnf = new VNF();
+ vnf.extractVnf(modelCustomizationName, nodeTemplate);
+
+ if (vnf.getVersion() == null) {
+ // vnf version should always be populated. The call below may not return the correct metadata since
+ // uuid is not unique
+ final Resource vnfMetadata = getAsdcClient().getResource(UUID.fromString(nodeTemplate.getMetadata().getUUID()));
+ vnf.setVersion(vnfMetadata.getVersion());
+ }
+
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " VNF commands: " + vnf.getCommands());
+ vnfs.put(modelCustomizationName, vnf);
+ if ( (vnf.getCustomizationUuid() != null) && (vnf.getCustomizationUuid().length() > 0 ) ) {
+ isNewFlow = true;
+ }
+ }
+ // Networks
+ if (type.startsWith(networkTag)) {
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " found node template type: " + type);
+ final UUID networkUuid = UUID.fromString(nodeTemplate.getMetadata().getUUID());
+ final Network network = new Network();
+ network.extractNetwork(modelCustomizationName, nodeTemplate);
+
+ if (network.getVersion() == null) {
+ // network version should always be populated. The call below may not return the correct metadata since
+ // uuid is not unique
+ final Resource networkMetadata = getAsdcClient().getResource(UUID.fromString(nodeTemplate.getMetadata().getUUID()));
+ network.setVersion(networkMetadata.getVersion());
+ }
+ if ( (network.getCustomizationUuid() != null) && (network.getCustomizationUuid().length() > 0 ) ) {
+ isNewFlow = true;
+ }
+ networks.put(modelCustomizationName, network);
+
+ }
+ }
+ serviceModel.setVnfs(vnfs);
+ serviceModel.setNetworks(networks);
+ // If we see customization uuid under vnf or network, follow 1702 flow
+ if ( isNewFlow ) {
+ return ( getCustomizedServices(asdcServiceToscaModel, serviceModel) );
+ }
+ VNF vnf = null;
+ for (ToscaModel vnfModel : serviceCsar.getChildren()) {
+
+ // using uuid to match should only be valid for 1610 models
+
+ final String vnfUuid = (vnfModel.getMetadata().getUUID());
+ // find the VNF with that uuid, uuid is not the key anymore
+ for ( Entry<String, VNF> vnfComp : vnfs.entrySet() ) {
+ if ( ( ( vnfComp.getValue().getUuid() ).equalsIgnoreCase(vnfUuid) ) ) {
+ // found the vnf
+ vnf = vnfComp.getValue();
+ }
+ }
+ final Map<String, VfModule> vfModules = new HashMap<String, VfModule> ();
+ final Map<String, VolumeGroup> volumeGroups = new HashMap<String, VolumeGroup> ();
+
+ if (vnf == null) {
+ LOG.warn("Couldn't find VNF object " + vnfUuid + ". Problem with Tosca model?");
+ continue;
+ }
+
+ vnf.setInputs(vnfModel.gettopology_template().getInputs());
+
+ for (Entry<String, Group> component1 : vnfModel.gettopology_template().getGroups().entrySet()) {
+ final Group group = component1.getValue();
+ final String type = group.getType();
+ final String modelCustomizationName = component1.getKey();
+
+ // VF Module Customization UUID: We may have the complete set of all VF Modules for all VNFs under service and VF Modules under each VNF.
+ // Keep using the VF Modules under VNFs but we need to get the customization uuid from the service level and put them
+ // under each VF module at the VNF level
+
+ if (type.startsWith(vfModuleTag)) {
+
+ VfModule vfMod = VfModule.extractVfModule(modelCustomizationName, group);
+
+ // Add the vf module customization uuid from the service model
+ // The key of the VF Module in the service level will be the VF instance name appended to the VF Module name:
+ // <VF instance name>..<VF Module name>
+ /* String normalizedVnfCustomizationName = VNF.normalizeName (vnf.getModelCustomizationName());
+ org.openecomp.vid.model.Service.extractVfModuleCustomizationUUID (serviceModel.getService(), normalizedVnfCustomizationName, vfMod);*/
+
+ vfModules.put(modelCustomizationName, vfMod);
+
+ if ( vfMod.isVolumeGroupAllowed() ) {
+ volumeGroups.put(modelCustomizationName, VolumeGroup.extractVolumeGroup(modelCustomizationName, group));
+ }
+
+ }
+ }
+
+ vnf.setVfModules(vfModules);
+ vnf.setVolumeGroups(volumeGroups);
+ }
+
+ serviceModel.setVnfs(vnfs);
+ serviceModel.setNetworks(networks);
+
+ return serviceModel;
+ } catch (AsdcCatalogException e) {
+ LOG.error("Failed to retrieve service definitions from SDC", e);
+ throw new VidServiceUnavailableException("Failed to retrieve service definitions from SDC", e);
+ }
+ }
+
+ public ServiceModel getCustomizedServices(ToscaModel asdcServiceToscaModel, ServiceModel serviceModel) {
+ String methodName = "asdcServiceToscaModel";
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " start");
+
+ // asdcServiceToscaModel should have vf modules and vol groups populated at this point but
+ // they are not associated with the VNFs
+ serviceModel.extractGroups(asdcServiceToscaModel);
+ // Now put the vf modules and volume groups under the VNF they belong too
+ serviceModel.associateGroups();
+ return (serviceModel);
+ }
+
+ /**
+ * Gets the services view.
+ *
+ * @param request the request
+ * @return the services view
+ * @throws VidServiceUnavailableException the vid service unavailable exception
+ */
+ @RequestMapping(value={"/serviceModels"}, method=RequestMethod.GET)
+ public ModelAndView getServicesView(HttpServletRequest request) throws VidServiceUnavailableException {
+ return new ModelAndView("serviceModels");
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/VidHomeController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/VidHomeController.java
new file mode 100755
index 0000000..cfb915b
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/controller/VidHomeController.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.controller;
+
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
+
+import org.springframework.beans.factory.annotation.Autowired;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+
+
+/**
+ * The Class VidHomeController.
+ */
+@RestController
+public class VidHomeController extends RestrictedBaseController{
+
+ /** The view name. */
+ String viewName;
+
+
+ /** The servlet context. */
+ private @Autowired ServletContext servletContext;
+
+ /**
+ * Welcome.
+ *
+ * @param request the request
+ * @return the model and view
+ */
+ @RequestMapping(value = {"/vidhome" }, method = RequestMethod.GET)
+ public ModelAndView welcome(HttpServletRequest request) {
+
+ return new ModelAndView(getViewName());
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#getViewName()
+ */
+ public String getViewName() {
+ return viewName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#setViewName(java.lang.String)
+ */
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+
+
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/ViewEditSubController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/ViewEditSubController.java
new file mode 100755
index 0000000..e23b99b
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/controller/ViewEditSubController.java
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.controller;
+
+
+import java.io.File;
+import java.text.DateFormat;
+import java.util.HashMap;
+import java.util.Map;
+
+
+
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+
+
+/**
+ * The Class ViewEditSubController.
+ */
+@RestController
+public class ViewEditSubController extends RestrictedBaseController{
+
+ /** The view name. */
+ String viewName;
+
+ /** The logger. */
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ViewEditSubController.class);
+
+ /** The model. */
+ private Map<String, Object> model = new HashMap<String, Object>();
+
+ /** The servlet context. */
+ private @Autowired ServletContext servletContext;
+
+ /**
+ * Welcome.
+ *
+ * @param request the request
+ * @return the model and view
+ */
+ @RequestMapping(value = {"/vieweditsub" }, method = RequestMethod.GET)
+ public ModelAndView welcome(HttpServletRequest request) {
+ return new ModelAndView("vieweditsub","model", model);
+ // return new ModelAndView(getViewName());
+ }
+
+ /**
+ * Post subscriber.
+ *
+ * @param request the request
+ */
+ @RequestMapping(value="/vieweditsub/subedit", method = RequestMethod.POST)
+ public void PostSubscriber(HttpServletRequest request) {
+
+ String subID = request.getParameter("subscriberID");
+ model.put("subInfo", subID);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#getViewName()
+ */
+ public String getViewName() {
+ return viewName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#setViewName(java.lang.String)
+ */
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+
+
+
+
+}
+
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/ViewLogController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/ViewLogController.java
new file mode 100755
index 0000000..31e6498
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/controller/ViewLogController.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.controller;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.servlet.ModelAndView;
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+
+
+/**
+ * The Class ViewLogController.
+ */
+@RestController
+public class ViewLogController extends RestrictedBaseController{
+
+ /** The view name. */
+ String viewName;
+
+ /** The logger. */
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ViewLogController.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The servlet context. */
+ private @Autowired ServletContext servletContext;
+
+ /**
+ * Welcome.
+ *
+ * @param request the request
+ * @return the model and view
+ */
+ @RequestMapping(value = {"/viewlog" }, method = RequestMethod.GET)
+ public ModelAndView welcome(HttpServletRequest request) {
+
+ return new ModelAndView(getViewName());
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#getViewName()
+ */
+ public String getViewName() {
+ return viewName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.portalsdk.core.controller.RestrictedBaseController#setViewName(java.lang.String)
+ */
+ public void setViewName(String viewName) {
+ this.viewName = viewName;
+ }
+
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestAaiController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestAaiController.java
new file mode 100755
index 0000000..7901741
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestAaiController.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.controller.test;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.codehaus.jackson.map.ObjectMapper;
+import org.openecomp.vid.model.ExceptionResponse;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+
+/**
+ * The Class TestAaiController.
+ */
+@RestController
+@RequestMapping("testaai")
+public class TestAaiController extends RestrictedBaseController {
+
+ /**
+ * Gets the subscription service type list.
+ *
+ * @param globalCustomerId the global customer id
+ * @param request the request
+ * @return the subscription service type list
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/getSubscriptionServiceTypeList/{globalCustomerId}", method = RequestMethod.GET)
+ public String getSubscriptionServiceTypeList(@PathVariable("globalCustomerId") String globalCustomerId, HttpServletRequest request)
+ throws Exception {
+
+ System.err.println("GET SUBSCRIPTION SERVICE TYPE LIST: globalCustomerId: " + globalCustomerId);
+
+ return "[\"vMOG\", \"sevice type 2\", \"sevice type 3\", \"sevice type 4\"]";
+ }
+
+ /**
+ * Exception.
+ *
+ * @param e the e
+ * @param response the response
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ @ExceptionHandler(Exception.class)
+ private void exception(Exception e, HttpServletResponse response) throws IOException {
+
+ /*
+ * This logging step should preferably be replaced with an appropriate
+ * logging method consistent whatever logging mechanism the rest of the
+ * application code uses.
+ */
+
+ e.printStackTrace(System.err);
+
+ response.setContentType("application/json; charset=UTF-8");
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+
+ ExceptionResponse exceptionResponse = new ExceptionResponse();
+ exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", ""));
+ exceptionResponse.setMessage(e.getMessage());
+
+ response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));
+
+ response.flushBuffer();
+
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestAsdcController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestAsdcController.java
new file mode 100755
index 0000000..84a56b3
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestAsdcController.java
@@ -0,0 +1,112 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.controller.test;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.codehaus.jackson.map.ObjectMapper;
+import org.openecomp.vid.model.ExceptionResponse;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+
+/**
+ * The Class TestAsdcController.
+ */
+@RestController
+@RequestMapping("testasdc")
+public class TestAsdcController extends RestrictedBaseController {
+
+ /**
+ * Gets the model.
+ *
+ * @param modelId the model id
+ * @param request the request
+ * @return the model
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/getModel/{modelId}", method = RequestMethod.GET)
+ public String getModel(@PathVariable("modelId") String modelId, HttpServletRequest request) throws Exception {
+
+ System.err.println("SDC: GET MODEL: modelId: " + modelId);
+
+ // @formatter:off
+ return
+ "{" +
+ "\"uuid\": \"5be686dc-fdca-4d54-8548-5d0ed23e962b\"," +
+ "\"invariantUUID\": \"e5962da9-fe4f-433a-bc99-b43e0d88a9a1\"," +
+ "\"name\": \"DE220127\"," +
+ "\"version\": \"0.1\"," +
+ "\"inputs\": {" +
+ "\"defaultGateway\": {" +
+ "\"type\": \"String\"," +
+ "\"default\": \"192.168.1.1\"," +
+ "\"description\": \"Router default gateway - use any valid IPv4 address\"" +
+ "}," +
+ "\"subnetMask\": {" +
+ "\"type\": \"String\"," +
+ "\"default\": \"255.255.255.0\"," +
+ "\"description\": \"Router subnet mask - example (255.255.255.0)\"" +
+ "}" +
+ "}" +
+ "}";
+ // @formatter:on
+ }
+
+ /**
+ * Exception.
+ *
+ * @param e the e
+ * @param response the response
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ @ExceptionHandler(Exception.class)
+ private void exception(Exception e, HttpServletResponse response) throws IOException {
+
+ /*
+ * This logging step should preferably be replaced with an appropriate
+ * logging method consistent whatever logging mechanism the rest of the
+ * application code uses.
+ */
+
+ e.printStackTrace(System.err);
+
+ response.setContentType("application/json; charset=UTF-8");
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+
+ ExceptionResponse exceptionResponse = new ExceptionResponse();
+ exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", ""));
+ exceptionResponse.setMessage(e.getMessage());
+
+ response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));
+
+ response.flushBuffer();
+
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestMsoController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestMsoController.java
new file mode 100755
index 0000000..02c29f6
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestMsoController.java
@@ -0,0 +1,729 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.controller.test;
+
+import java.io.IOException;
+import java.util.stream.Collectors;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.codehaus.jackson.map.ObjectMapper;
+import org.openecomp.vid.model.ExceptionResponse;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+
+/*
+ * The "TestMsoController" class is primarily designed to help test "msoCommitController.js"
+ *
+ * This class expects and receives JSON data in the same format as expected
+ * in the "real" application version of this code. However, string versions of JSON are
+ * maintained internally here instead of marshalled / unmarshalled JSON objects.
+ * The primary reasons for this were to encapsulate all the test code in this single file and
+ * minimize the time required to support initial test cases.
+ *
+ * The non-test equivalent of this controller could alternatively incorporate POJO objects
+ * instead of strings. However, the same data format sent to / received from the browser
+ * JavaScript code would still be expected.
+ *
+ * Two specific mechanisms used in this test class may be useful to the application version:
+ *
+ * 1) The use of "{variable}" elements in @RequestMappings along with the corresponding
+ * @PathVariable declarations.
+ *
+ * 2) The use of @ExceptionHandler for general purpose exception handler.
+ * (See @ExceptionHandler comments)
+ *
+ * This class is intended to be used in either:
+ *
+ * A) Eclipse environments
+ * OR
+ * B) Linux environments with ONLY a single user running tests.
+ * The "quick and dirty" error simulation approach used here makes use of static states for some
+ * scenarios. Thus multiple users simultaneously testing in Linux environments
+ * may have contention issues.
+ */
+
+/**
+ * The Class TestMsoController.
+ */
+@RestController
+@RequestMapping("testmso")
+public class TestMsoController extends RestrictedBaseController {
+
+ /*
+ * Artificial delay (in milliseconds) added before responding to create /
+ * delete requests
+ */
+
+ /** The Constant TEST_DELAY_SHORT_MSEC. */
+ private final static int TEST_DELAY_SHORT_MSEC = 1000;
+
+ /*
+ * Long delay to simulate non-responsive server test
+ */
+
+ /** The Constant TEST_DELAY_LONG_MSEC. */
+ private final static int TEST_DELAY_LONG_MSEC = 15000;
+
+ /*
+ * Default number of polls expected before transaction complete.
+ */
+
+ /** The Constant MAXIMUM_POLLS_DEFAULT. */
+ private final static int MAXIMUM_POLLS_DEFAULT = 4;
+
+ /*
+ * Number of polls to simulate "maximum polls exceeded" test.
+ */
+
+ /** The Constant MAXIMUM_POLLS_LARGE. */
+ private final static int MAXIMUM_POLLS_LARGE = 10;
+
+ /*
+ * Simulated error types. The GUI front end is expected to set these values
+ * in the "modelName" field of the "mso_create_svc_instance" request.
+ */
+
+ /** The Constant ERROR_POLICY_EXCEPTION. */
+ private final static String ERROR_POLICY_EXCEPTION = "ERROR_POLICY_EXCEPTION";
+
+ /** The Constant ERROR_SERVICE_EXCEPTION. */
+ private final static String ERROR_SERVICE_EXCEPTION = "ERROR_SERVICE_EXCEPTION";
+
+ /** The Constant ERROR_POLL_FAILURE. */
+ private final static String ERROR_POLL_FAILURE = "ERROR_POLL_FAILURE";
+
+ /** The Constant ERROR_INVALID_FIELD_INITIAL. */
+ private final static String ERROR_INVALID_FIELD_INITIAL = "ERROR_INVALID_FIELD_INITIAL";
+
+ /** The Constant ERROR_INVALID_FIELD_POLL. */
+ private final static String ERROR_INVALID_FIELD_POLL = "ERROR_INVALID_FIELD_POLL";
+
+ /** The Constant ERROR_GENERAL_SERVER_EXCEPTION. */
+ private final static String ERROR_GENERAL_SERVER_EXCEPTION = "ERROR_GENERAL_SERVER_EXCEPTION";
+
+ /** The Constant ERROR_MAX_POLLS. */
+ private final static String ERROR_MAX_POLLS = "ERROR_MAX_POLLS";
+
+ /** The Constant ERROR_SERVER_TIMEOUT_INITIAL. */
+ private final static String ERROR_SERVER_TIMEOUT_INITIAL = "ERROR_SERVER_TIMEOUT_INITIAL";
+
+ /** The Constant ERROR_SERVER_TIMEOUT_POLL. */
+ private final static String ERROR_SERVER_TIMEOUT_POLL = "ERROR_SERVER_TIMEOUT_POLL";
+
+ /** The simulated error. */
+ private String simulatedError = "";
+
+ /** The maximum polls. */
+ private int maximumPolls = 0;
+
+ /** The attempt count. */
+ private int attemptCount = 0;
+
+ /**
+ * Creates the svc instance.
+ *
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_create_svc_instance", method = RequestMethod.POST)
+ public ResponseEntity<String> createSvcInstance(HttpServletRequest request) throws Exception {
+ readAndLogRequest("CREATE SERVICE INSTANCE", request);
+ Thread.sleep(TEST_DELAY_SHORT_MSEC);
+ maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
+ attemptCount = 0;
+
+ /*
+ * This block of code simulates various errors and would NOT be expected
+ * in a non-test method
+ */
+ System.err.println("simulatedError: " + simulatedError);
+
+ if (simulatedError.equals(ERROR_POLICY_EXCEPTION)) {
+ return new ResponseEntity<String>(policyExceptionResponse, HttpStatus.OK);
+ }
+ if (simulatedError.equals(ERROR_SERVICE_EXCEPTION)) {
+ return new ResponseEntity<String>(serviceExceptionResponse, HttpStatus.OK);
+ }
+ if (simulatedError.equals(ERROR_INVALID_FIELD_INITIAL)) {
+ /*
+ * Force invalid response field name. Return
+ * "XXXXXrequestReferences" instead of "requestReferences"
+ */
+ return new ResponseEntity<String>(acceptResponse.replace("requestReferences", "XXXXXrequestReferences"),
+ HttpStatus.OK);
+ }
+
+ if (simulatedError.equals(ERROR_GENERAL_SERVER_EXCEPTION)) {
+ throw new IOException("an example of an IO exception");
+ }
+
+ if (simulatedError.equals(ERROR_SERVER_TIMEOUT_INITIAL)) {
+ Thread.sleep(TEST_DELAY_LONG_MSEC);
+ }
+
+ if (simulatedError.equals(ERROR_MAX_POLLS)) {
+ maximumPolls = MAXIMUM_POLLS_LARGE;
+ }
+
+ /*
+ * End of block of simulated error code.
+ */
+
+ return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
+ }
+
+ /**
+ * Delete svc instance.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_delete_svc_instance/{serviceInstanceId}", method = RequestMethod.POST)
+ public ResponseEntity<String> deleteSvcInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
+ HttpServletRequest request) throws Exception {
+ readAndLogRequest("DELETE SERVICE INSTANCE: serviceInstanceId: " + serviceInstanceId, request);
+ Thread.sleep(TEST_DELAY_SHORT_MSEC);
+ maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
+ attemptCount = 0;
+ return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
+ }
+
+ /**
+ * Creates the vnf instance.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_create_vnf_instance/{serviceInstanceId}", method = RequestMethod.POST)
+ public ResponseEntity<String> createVnfInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
+ HttpServletRequest request) throws Exception {
+ readAndLogRequest("CREATE VNF INSTANCE: serviceInstanceId: " + serviceInstanceId, request);
+ Thread.sleep(TEST_DELAY_SHORT_MSEC);
+ maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
+ attemptCount = 0;
+ return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
+ }
+
+ /**
+ * Delete vnf instance.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param vnfInstanceId the vnf instance id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_delete_vnf_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
+ public ResponseEntity<String> deleteVnfInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
+ @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request) throws Exception {
+ readAndLogRequest(
+ "DELETE VNF INSTANCE: serviceInstanceId: " + serviceInstanceId + " vnfInstanceId: " + vnfInstanceId,
+ request);
+ Thread.sleep(TEST_DELAY_SHORT_MSEC);
+ maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
+ attemptCount = 0;
+ return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
+ }
+
+ /**
+ * Creates the vf module instance.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param vnfInstanceId the vnf instance id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ // /serviceInstances/v2/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-ff1b-adb2-eb6b9e5460ff/vfModules
+ @RequestMapping(value = "/mso_create_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
+ public ResponseEntity<String> createVfModuleInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
+ @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request) throws Exception {
+ readAndLogRequest("CREATE VF MODULE INSTANCE: serviceInstanceId: " + serviceInstanceId + " vnfInstanceId: "
+ + vnfInstanceId, request);
+ Thread.sleep(TEST_DELAY_SHORT_MSEC);
+ maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
+ attemptCount = 0;
+ return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
+ }
+
+ /**
+ * Delete vf module instance.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param vnfInstanceId the vnf instance id
+ * @param vfModuleInstanceId the vf module instance id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ // /serviceInstances/v2/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-ff1b-adb2-eb6b9e5460ff/vfModules/ff305d54-75b4-ff1b-bdb2-eb6b9e5460ff
+ @RequestMapping(value = "/mso_delete_vfmodule_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfModuleInstanceId}", method = RequestMethod.POST)
+ public ResponseEntity<String> deleteVfModuleInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
+ @PathVariable("vnfInstanceId") String vnfInstanceId,
+ @PathVariable("vfModuleInstanceId") String vfModuleInstanceId, HttpServletRequest request)
+ throws Exception {
+ readAndLogRequest("DELETE VF MODULE INSTANCE: serviceInstanceId: " + serviceInstanceId + " vnfInstanceId: "
+ + vnfInstanceId + " vfModuleInstanceId: " + vfModuleInstanceId, request);
+ Thread.sleep(TEST_DELAY_SHORT_MSEC);
+ maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
+ attemptCount = 0;
+ return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
+ }
+
+ // POST
+ /**
+ * Creates the volume group instance.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param vnfInstanceId the vnf instance id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ // /serviceInstances/v2/ff305d54-75b4-431b-adb2-eb6b9e5ff000/volumeGroups
+ @RequestMapping(value = "/mso_create_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}", method = RequestMethod.POST)
+ public ResponseEntity<String> createVolumeGroupInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
+ @PathVariable("vnfInstanceId") String vnfInstanceId, HttpServletRequest request) throws Exception {
+ readAndLogRequest("CREATE VOLUME GROUP INSTANCE: seviceInstanceId: " + serviceInstanceId + " vnfInstanceId: "
+ + vnfInstanceId, request);
+ Thread.sleep(TEST_DELAY_SHORT_MSEC);
+ maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
+ attemptCount = 0;
+ return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
+ }
+
+ /**
+ * Delete volume group instance.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param vnfInstanceId the vnf instance id
+ * @param volumeGroupInstanceId the volume group instance id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ // /serviceInstances/v2/ff305d54-75b4-431b-adb2-eb6b9e5ff000/volumeGroups/ff305d54-75b4-ff1b-cdb2-eb6b9e5460ff
+ @RequestMapping(value = "/mso_delete_volumegroup_instance/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}", method = RequestMethod.POST)
+ public ResponseEntity<String> deleteVolumeGroupInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
+ @PathVariable("vnfInstanceId") String vnfInstanceId,
+ @PathVariable("volumeGroupInstanceId") String volumeGroupInstanceId, HttpServletRequest request)
+ throws Exception {
+ readAndLogRequest("DELETE NW INSTANCE: serviceInstanceId: " + serviceInstanceId + " vnfInstanceId: "
+ + vnfInstanceId + " volumeGroupInstanceId: " + volumeGroupInstanceId, request);
+ Thread.sleep(TEST_DELAY_SHORT_MSEC);
+ maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
+ attemptCount = 0;
+ return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
+ }
+
+ /**
+ * Creates the nw instance.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_create_nw_instance/{serviceInstanceId}", method = RequestMethod.POST)
+ public ResponseEntity<String> createNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
+ HttpServletRequest request) throws Exception {
+ readAndLogRequest("CREATE NW INSTANCE: serviceInstanceId: " + serviceInstanceId, request);
+ Thread.sleep(TEST_DELAY_SHORT_MSEC);
+ maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
+ attemptCount = 0;
+ return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
+ }
+
+ /**
+ * Delete nw instance.
+ *
+ * @param serviceInstanceId the service instance id
+ * @param networkInstanceId the network instance id
+ * @param request the request
+ * @return the response entity
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_delete_nw_instance/{serviceInstanceId}/networks/{networkInstanceId}", method = RequestMethod.POST)
+ public ResponseEntity<String> deleteNwInstance(@PathVariable("serviceInstanceId") String serviceInstanceId,
+ @PathVariable("networkInstanceId") String networkInstanceId, HttpServletRequest request) throws Exception {
+ readAndLogRequest("DELETE NW INSTANCE: serviceInstanceId: " + serviceInstanceId + " networkInstanceId: "
+ + networkInstanceId, request);
+ Thread.sleep(TEST_DELAY_SHORT_MSEC);
+ maximumPolls = MAXIMUM_POLLS_DEFAULT; // Simulates MSO polling behavior
+ attemptCount = 0;
+ return new ResponseEntity<String>(acceptResponse, HttpStatus.OK);
+ }
+
+ /**
+ * Gets the orchestration request.
+ *
+ * @param requestId the request id
+ * @param request the request
+ * @return the orchestration request
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_get_orch_req/{requestId}", method = RequestMethod.GET)
+ public ResponseEntity<String> getOrchestrationRequest(@PathVariable("requestId") String requestId,
+ HttpServletRequest request) throws Exception {
+
+ System.err.println("GET ORCHESTRATION REQUEST: requestId: " + requestId);
+
+ /*
+ * This block of code simulates various errors and would NOT be expected
+ * in a non-test method
+ */
+
+ if (simulatedError.equals(ERROR_INVALID_FIELD_POLL)) {
+ /*
+ * Force invalid response field name. Return "XXXXXrequestStatus"
+ * instead of "requestStatus"
+ */
+ return new ResponseEntity<String>(inProgressResponse.replace("requestStatus", "XXXXXrequestStatus"),
+ HttpStatus.OK);
+ }
+
+ if (simulatedError.equals(ERROR_POLL_FAILURE)) {
+ /*
+ * Force status field with "Failure"
+ */
+ return new ResponseEntity<String>(inProgressResponse.replace("InProgress", "Failure"), HttpStatus.OK);
+ }
+
+ if (simulatedError.equals(ERROR_SERVER_TIMEOUT_POLL)) {
+ Thread.sleep(TEST_DELAY_LONG_MSEC);
+ }
+
+ /*
+ * End of block of simulated error code.
+ */
+
+ /*
+ * This logic simulates how MSO might behave ... i.e. return different
+ * results depending on the value of 'maximumPolls'.
+ *
+ */
+ int percentProgress = (++attemptCount * 100) / maximumPolls;
+
+ System.err.println("attempts: " + attemptCount + " max: " + maximumPolls + " percent: " + percentProgress);
+
+ String response = inProgressResponse.replace("\"50\"", "\"" + Integer.toString(percentProgress) + "\"");
+
+ if (attemptCount < maximumPolls) {
+ if (attemptCount > 1) {
+ response = response.replace("vLan setup", "setup step " + Integer.toString(attemptCount));
+ }
+ return new ResponseEntity<String>(response, HttpStatus.OK);
+ } else {
+ return new ResponseEntity<String>(
+ response.replace("InProgress", "Complete").replace("vLan setup complete", ""), HttpStatus.OK);
+ }
+ }
+
+ /**
+ * Gets the orchestration requests.
+ *
+ * @param filterString the filter string
+ * @param request the request
+ * @return the orchestration requests
+ * @throws Exception the exception
+ */
+ @RequestMapping(value = "/mso_get_orch_reqs/{filterString}", method = RequestMethod.GET)
+ public ResponseEntity<String> getOrchestrationRequests(@PathVariable("filterString") String filterString,
+ HttpServletRequest request) throws Exception {
+
+ System.err.println("GET ORCHESTRATION REQUESTS: filterString: " + filterString);
+
+ return new ResponseEntity<String>(getOrchestrationRequestsResponse, HttpStatus.OK);
+
+ }
+
+ /*
+ * General purpose exception handler that could be used in application code.
+ *
+ * The method returns exceptions as error code 500. Both the exception type
+ * and message are written as a JSON object.
+ *
+ * See the following references:
+ *
+ * 1) The ExceptionResponse POJO.
+ *
+ * 2) The "getHttpErrorMessage" function in "utilityService.js" - an example
+ * of how the browser JavaScript code can interpret this response.
+ */
+
+ /**
+ * Exception.
+ *
+ * @param e the e
+ * @param response the response
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ @ExceptionHandler(Exception.class)
+ private void exception(Exception e, HttpServletResponse response) throws IOException {
+
+ /*
+ * This logging step should preferably be replaced with an appropriate
+ * logging method consistent whatever logging mechanism the rest of the
+ * application code uses.
+ */
+
+ e.printStackTrace(System.err);
+
+ response.setContentType("application/json; charset=UTF-8");
+ response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+
+ ExceptionResponse exceptionResponse = new ExceptionResponse();
+ exceptionResponse.setException(e.getClass().toString().replaceFirst("^.*\\.", ""));
+ exceptionResponse.setMessage(e.getMessage());
+
+ response.getWriter().write(new ObjectMapper().writeValueAsString(exceptionResponse));
+
+ response.flushBuffer();
+
+ }
+
+ /*
+ * 'readAndLogRequest' only intended to be used for testing.
+ *
+ * The method reads JSON from the input stream and thus prevents other
+ * mechanisms from reading the input.
+ */
+
+ /**
+ * Read and log request.
+ *
+ * @param label the label
+ * @param request the request
+ * @throws Exception the exception
+ */
+ private void readAndLogRequest(String label, HttpServletRequest request) throws Exception {
+ String input = request.getReader().lines().collect(Collectors.joining(System.lineSeparator()));
+
+ ObjectMapper mapper = new ObjectMapper();
+ Object json = mapper.readValue(input, Object.class);
+
+ System.err.println(label + "\n" + mapper.writerWithDefaultPrettyPrinter().writeValueAsString(json));
+
+ /*
+ * Only needed for error simulation ...
+ */
+ if (input.matches("^.*modelName.*$")) {
+ simulatedError = input.replaceAll("^.*\"modelName\":\"", "").replaceAll("\".*$", "");
+ }
+ }
+
+ /*
+ * Various test responses:
+ */
+
+ // @formatter:off
+
+ /** The accept response. */
+ /*
+ * Sample responses to initial create / delete transaction
+ */
+ private String acceptResponse =
+ "{" +
+ " \"status\": 202," +
+ " \"entity\": {" +
+ " \"requestReferences\": {" +
+ " \"instanceId\": \"bc305d54-75b4-431b-adb2-eb6b9e546014\"," +
+ " \"requestId\": \"rq1234d1-5a33-55df-13ab-12abad84e331\"" +
+ " }" +
+ " }" +
+ "}";
+
+ /** The policy exception response. */
+ private String policyExceptionResponse =
+ "{" +
+ " \"status\": 400," +
+ " \"entity\": { " +
+ " \"requestError\": {" +
+ " \"policyException\": {" +
+ " \"messageId\": \"POL9003\"," +
+ " \"text\": \"Message content size exceeds the allowable limit\"" +
+ " }" +
+ " }" +
+ " }" +
+ "}";
+
+ /** The service exception response. */
+ private String serviceExceptionResponse =
+ "{" +
+ " \"status\": 400," +
+ " \"entity\": { " +
+ " \"requestError\": {" +
+ " \"serviceException\": {" +
+ " \"messageId\": \"SVC2000\"," +
+ " \"text\": \"Missing Parameter: %1. Error code is %2\"," +
+ " \"variables\": [" +
+ " \"severity\"," +
+ " \"400\"" +
+ " ]" +
+ " }" +
+ " }" +
+ " }" +
+ "}" +
+ "";
+
+ /** The in progress response. */
+ /*
+ * Sample response to subsequent getOrchestrationRequest
+ */
+ private String inProgressResponse =
+ "{" +
+ " \"status\": 200," +
+ " \"entity\": {" +
+ " \"request\": {" +
+ " \"requestId\": \"rq1234d1-5a33-55df-13ab-12abad84e333\"," +
+ " \"startTime\": \"Thu, 04 Jun 2009 02:51:59 GMT\"," +
+ " \"instanceIds\": {" +
+ " \"serviceInstanceId\": \"bc305d54-75b4-431b-adb2-eb6b9e546014\"" +
+ " }," +
+ " \"requestScope\": \"service\"," +
+ " \"requestType\": \"createInstance\"," +
+ " \"requestDetails\": {" +
+ " \"modelInfo\": {" +
+ " \"modelType\": \"service\"," +
+ " \"modelId\": \"sn5256d1-5a33-55df-13ab-12abad84e764\"," +
+ " \"modelNameVersionId\": \"ab6478e4-ea33-3346-ac12-ab121484a333\"," +
+ " \"modelName\": \"WanBonding\"," +
+ " \"modelVersion\": \"1\"" +
+ " }," +
+ " \"subscriberInfo\": {" +
+ " \"globalSubscriberId\": \"C12345\"," +
+ " \"subscriberName\": \"General Electric Division 12\"" +
+ " }," +
+ " \"requestParameters\": {" +
+ " \"vpnId\": \"1a2b3c4d5e6f\"," +
+ " \"productName\": \"Trinity\"," +
+ " \"customerId\": \"icore9883749\"" +
+ " }" +
+ " }," +
+ " \"requestStatus\": {" +
+ " \"timestamp\": \"Thu, 04 Jun 2009 02:53:39 GMT\"," +
+ " \"requestState\": \"InProgress\"," +
+ " \"statusMessage\": \"vLan setup complete\"," +
+ " \"percentProgress\": \"50\"" +
+ " }" +
+ " }" +
+ " }" +
+ "}";
+
+ /*
+ * Sample response to subsequent getOrchestrationRequests
+ */
+
+ /** The get orchestration requests response. */
+ private String getOrchestrationRequestsResponse =
+ "{" +
+ " \"status\": 200," +
+ " \"entity\": {" +
+ " \"requestList\": [" +
+ " {" +
+ " \"request\": {" +
+ " \"requestId\": \"rq1234d1-5a33-55df-13ab-12abad84e333\"," +
+ " \"startTime\": \"Thu, 04 Jun 2009 02:51:59 GMT\"," +
+ " \"finishTime\": \"Thu, 04 Jun 2009 02:55:59 GMT\"," +
+ " \"instanceReferences\": {" +
+ " \"serviceInstanceId\": \"bc305d54-75b4-431b-adb2-eb6b9e546014\"" +
+ " }," +
+ " \"requestScope\": \"service\"," +
+ " \"requestType\": \"createInstance\"," +
+ " \"requestDetails\": {" +
+ " \"modelInfo\": {" +
+ " \"modelType\": \"service\"," +
+ " \"modelId\": \"sn5256d1-5a33-55df-13ab-12abad84e764\"," +
+ " \"modelNameVersionId\": \"ab6478e4-ea33-3346-ac12-ab121484a333\"," +
+ " \"modelName\": \"WanBonding\"," +
+ " \"modelVersion\": \"1\"" +
+ " }," +
+ " \"subscriberInfo\": {" +
+ " \"globalSubscriberId\": \"C12345\"," +
+ " \"subscriberName\": \"General Electric Division 12\"" +
+ " }," +
+ " \"requestParameters\": {" +
+ " \"vpnId\": \"1a2b3c4d5e6f\"," +
+ " \"productName\": \"Trinity\"," +
+ " \"customerId\": \"icore9883749\"" +
+ " }" +
+ " }," +
+ " \"requestStatus\": {" +
+ " \"timestamp\": \"Thu, 04 Jun 2009 02:54:49 GMT\"," +
+ " \"requestState\": \"complete\"," +
+ " \"statusMessage\": \"Resource Created\"," +
+ " \"percentProgress\": \"100\"" +
+ " }" +
+ " }" +
+ " }," +
+ " {" +
+ " \"request\": {" +
+ " \"requestId\": \"rq1234d1-5a33-55df-13ab-12abad84e334\"," +
+ " \"startTime\": \"Thu, 04 Jun 2009 03:52:59 GMT\"," +
+ " \"instanceReferences\": {" +
+ " \"serviceInstanceId\": \"bc305d54-75b4-431b-adb2-eb6b9e546014\"" +
+ " }," +
+ " \"requestScope\": \"service\"," +
+ " \"requestType\": \"updateInstance\"," +
+ " \"requestDetails\": {" +
+ " \"modelInfo\": {" +
+ " \"modelType\": \"service\"," +
+ " \"modelId\": \"sn5256d1-5a33-55df-13ab-12abad84e764\"," +
+ " \"modelNameVersionId\": \"ab6478e4-ea33-3346-ac12-ab121484a333\"," +
+ " \"modelName\": \"WanBonding\"," +
+ " \"modelVersion\": \"1\"" +
+ " }," +
+ " \"subscriberInfo\": {" +
+ " \"globalSubscriberId\": \"C12345\"," +
+ " \"subscriberName\": \"General Electric Division 12\"" +
+ " }," +
+ " \"requestParameters\": {" +
+ " \"vpnId\": \"1a2b3c4d5e70\"," +
+ " \"productName\": \"Trinity\"," +
+ " \"customerId\": \"icore9883749\"" +
+ " }" +
+ " }," +
+ " \"requestStatus\": {" +
+ " \"timestamp\": \"Thu, 04 Jun 2009 03:53:39 GMT\"," +
+ " \"requestState\": \"InProgress\"," +
+ " \"statusMessage\": \"vLan setup complete\"," +
+ " \"percentProgress\": \"50\"" +
+ " }" +
+ " }" +
+ " }" +
+ " ]" +
+ " }" +
+ "}";
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestPageController.java b/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestPageController.java
new file mode 100755
index 0000000..92f86f0
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/controller/test/TestPageController.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.controller.test;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.servlet.ModelAndView;
+
+import org.openecomp.portalsdk.core.controller.RestrictedBaseController;
+
+/**
+ * The Class TestPageController.
+ */
+@Controller
+public class TestPageController extends RestrictedBaseController {
+
+ /**
+ * Test mso page.
+ *
+ * @return the model and view
+ */
+ @RequestMapping(value = { "testMso.htm" }, method = RequestMethod.GET)
+ public ModelAndView testMsoPage() {
+ return new ModelAndView(getViewName());
+ }
+
+ /**
+ * Test view edit page.
+ *
+ * @return the model and view
+ */
+ @RequestMapping(value = { "testViewEdit" }, method = RequestMethod.GET)
+ public ModelAndView testViewEditPage() {
+ return new ModelAndView(getViewName());
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/dao/FnAppDoaImpl.java b/vid-app-common/src/main/java/org/openecomp/vid/dao/FnAppDoaImpl.java
new file mode 100755
index 0000000..6d2810a
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/dao/FnAppDoaImpl.java
@@ -0,0 +1,112 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.dao;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URL;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Properties;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+
+public class FnAppDoaImpl {
+
+ /** The logger. */
+ static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(FnAppDoaImpl.class);
+
+ public int getProfileCount(String driver, String URL, String username, String password) {
+ Connection dbc = null;
+ PreparedStatement pst = null;
+ ResultSet rs = null;
+ String q = null;
+ int count = 0;
+ try {
+ dbc = getConnection(driver,URL,username,password);
+ logger.debug(EELFLoggerDelegate.debugLogger, "getConnection:::"+ dbc);
+ q = "select count(*) from fn_app";
+ pst = dbc.prepareStatement(q);
+ rs = pst.executeQuery();
+
+ if (rs.next())
+ count = rs.getInt(1);
+ } catch(Exception ex) {
+ logger.error(EELFLoggerDelegate.errorLogger, "Failed to perform health check", ex);
+ } finally {
+ cleanup(rs,pst,dbc);
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger, "count:::"+ count);
+ return count;
+ }
+
+ public static Connection getConnection(String driver2, String url, String username, String password) throws IOException, SQLException, ClassNotFoundException{
+ java.sql.Connection con=null;
+
+ if( url!=null && username!=null && password!=null ){
+ con = DriverManager.getConnection(url, username, password);
+ }
+
+ System.out.println("Connection Successful");
+ return con;
+
+ }
+
+ public static void cleanup(ResultSet rs, PreparedStatement st, Connection c) {
+ if (rs != null) {
+ try {
+ rs.close();
+ } catch (Exception e) {
+ if (logger != null)
+ logger.error("Error when trying to close result set", e);
+ }
+ }
+ if (st != null) {
+ try {
+ st.close();
+ } catch (Exception e) {
+ if (logger != null)
+ logger.error("Error when trying to close statement", e);
+ }
+ }
+ if (c != null) {
+ try {
+ c.rollback();
+ } catch (Exception e) {
+ if (logger != null)
+ logger.error("Error when trying to rollback connection", e);
+ }
+ try {
+ c.close();
+ } catch (Exception e) {
+ if (logger != null)
+ logger.error("Error when trying to close connection", e);
+ }
+ }
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/dao/ProfileDao.java b/vid-app-common/src/main/java/org/openecomp/vid/dao/ProfileDao.java
new file mode 100755
index 0000000..256a4bd
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/dao/ProfileDao.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.dao;
+
+import java.util.List;
+import org.openecomp.portalsdk.core.domain.Profile;
+
+/**
+ * The Interface ProfileDao.
+ */
+public interface ProfileDao {
+
+ /**
+ * Find all.
+ *
+ * @return the list
+ */
+ List<Profile> findAll();
+
+ /**
+ * Gets the profile.
+ *
+ * @param id the id
+ * @return the profile
+ */
+ Profile getProfile(int id);
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/exceptions/VidServiceUnavailableException.java b/vid-app-common/src/main/java/org/openecomp/vid/exceptions/VidServiceUnavailableException.java
new file mode 100755
index 0000000..fcd897f
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/exceptions/VidServiceUnavailableException.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.exceptions;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.web.bind.annotation.ResponseStatus;
+
+/**
+ * The Class VidServiceUnavailableException.
+ */
+@ResponseStatus(value=HttpStatus.SERVICE_UNAVAILABLE)
+public class VidServiceUnavailableException extends Exception {
+
+ /** The Constant serialVersionUID. */
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Instantiates a new vid service unavailable exception.
+ */
+ public VidServiceUnavailableException() {
+ super();
+ }
+
+ /**
+ * Instantiates a new vid service unavailable exception.
+ *
+ * @param msg the msg
+ */
+ public VidServiceUnavailableException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Instantiates a new vid service unavailable exception.
+ *
+ * @param t the t
+ */
+ public VidServiceUnavailableException(Throwable t) {
+ super(t);
+ }
+
+ /**
+ * Instantiates a new vid service unavailable exception.
+ *
+ * @param msg the msg
+ * @param t the t
+ */
+ public VidServiceUnavailableException(String msg, Throwable t) {
+ super(msg, t);
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/model/CommandProperty.java b/vid-app-common/src/main/java/org/openecomp/vid/model/CommandProperty.java
new file mode 100755
index 0000000..fe114c3
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/model/CommandProperty.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.model;
+
+import java.util.Map;
+
+/**
+ * The Class Command Property.
+ */
+public class CommandProperty {
+
+ /** The display name for this input */
+ private String displayName;
+
+ /** The command, "get_input" */
+ private String command;
+
+ /** The input name we refer to back under the inputs section */
+ private String inputName;
+
+ /**
+ * Gets the display name.
+ *
+ * @return the displayName
+ */
+ public String getDisplayName() {
+ return displayName;
+ }
+ /**
+ * Gets the command.
+ *
+ * @return the command
+ */
+ public String getCommand() {
+ return command;
+ }
+ /**
+ * Gets the inputName.
+ *
+ * @return the inputName
+ */
+ public String getInputName() {
+ return inputName;
+ }
+ /**
+ * Sets the display name value.
+ *
+ * @param i the new get_input value
+ */
+ public void setDisplayName(String i) {
+ this.displayName = i;
+ }
+ /**
+ * Sets the command value.
+ *
+ * @param i the new command value
+ */
+ public void setCommand(String i) {
+ this.command = i;
+ }
+
+ /**
+ * Sets the input name value.
+ *
+ * @param i the new input name value
+ */
+ public void setInputName(String i) {
+ this.inputName=i;
+ }
+
+ public String toString () {
+ String result = "displayName=" + displayName + " command=" + command + " inputName" + inputName;
+ return result;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/model/ExceptionResponse.java b/vid-app-common/src/main/java/org/openecomp/vid/model/ExceptionResponse.java
new file mode 100755
index 0000000..686971d
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/model/ExceptionResponse.java
@@ -0,0 +1,70 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.model;
+
+/**
+ * The Class ExceptionResponse.
+ */
+public class ExceptionResponse {
+
+ /** The exception. */
+ private String exception;
+
+ /** The message. */
+ private String message;
+
+ /**
+ * Gets the exception.
+ *
+ * @return the exception
+ */
+ public String getException() {
+ return exception;
+ }
+
+ /**
+ * Sets the exception.
+ *
+ * @param exception the new exception
+ */
+ public void setException(String exception) {
+ this.exception = exception;
+ }
+
+ /**
+ * Gets the message.
+ *
+ * @return the message
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Sets the message.
+ *
+ * @param message the new message
+ */
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/model/ModelConstants.java b/vid-app-common/src/main/java/org/openecomp/vid/model/ModelConstants.java
new file mode 100755
index 0000000..f4e4270
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/model/ModelConstants.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.model;
+/**
+ * The Class ModelConstants
+ */
+public class ModelConstants {
+
+ /** The Constant GET_INPUT_TAG. */
+ public final static String GET_INPUT_TAG = "get_input";
+
+ public static final String ASDC_MODEL_NAMESPACE = "asdc.model.namespace";
+ public static final String ASDC_SVC_API_PATH = "sdc.svc.api.path";
+ public static final String ASDC_RESOURCE_API_PATH = "sdc.resource.api.path";
+
+ public static final String DEFAULT_ASDC_MODEL_NAMESPACE = "org.onap.";
+ public static final String DEFAULT_ASDC_SVC_API_PATH = "sdc/v1/catalog/services";
+ public static final String DEFAULT_ASDC_RESOURCE_API_PATH = "sdc/v1/catalog/resources";
+
+ public final static String VF_MODULE = "groups.VfModule";
+ public final static String VNF = "resource.vf";
+ public final static String NETWORK = "resource.vl";
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/model/Network.java b/vid-app-common/src/main/java/org/openecomp/vid/model/Network.java
new file mode 100755
index 0000000..5ab5588
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/model/Network.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.model;
+
+import org.openecomp.vid.asdc.beans.tosca.NodeTemplate;
+
+/**
+ * The Class Network.
+ */
+public class Network extends Node {
+
+ /** The model customization name. */
+ private String modelCustomizationName;
+
+ /**
+ * Instantiates a new network.
+ */
+ public Network() {
+ super();
+ }
+ /**
+ * Gets the model customization name.
+ *
+ * @return the model customization name
+ */
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+ /**
+ * Sets the model customization name.
+ *
+ * @param modelCustomizationName the new model customization name
+ */
+ private void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+
+ public void extractNetwork(String modelCustomizationName, NodeTemplate nodeTemplate) {
+
+ super.extractNode(nodeTemplate);
+ setModelCustomizationName(modelCustomizationName);
+
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/model/Node.java b/vid-app-common/src/main/java/org/openecomp/vid/model/Node.java
new file mode 100755
index 0000000..1352653
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/model/Node.java
@@ -0,0 +1,301 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.model;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.openecomp.vid.asdc.beans.tosca.Input;
+import org.openecomp.vid.asdc.beans.tosca.NodeTemplate;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+/**
+ * The Class Node.
+ */
+public class Node {
+ /** The Constant LOG. */
+ private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(Node.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The uuid. */
+ private String uuid;
+
+ /** The invariant uuid. */
+ private String invariantUuid;
+
+ /** The description. */
+ private String description;
+
+ /** The name. */
+ private String name;
+
+ /** The version. */
+ private String version;
+
+ /** The model customization uuid. */
+ private String customizationUuid;
+
+ /** The inputs. */
+ private Map<String, Input> inputs;
+
+ /** The get_input or other constructs from node template properties. */
+ private Map<String, CommandProperty> commands;
+
+ /** The get_input or other constructs from node template properties. */
+ private Map<String, String> properties;
+ /**
+ * Instantiates a new node.
+ */
+ public Node() {
+ this.commands = new HashMap<String, CommandProperty>();
+ this.properties = new HashMap<String, String>();
+ }
+
+ /**
+ * Gets the uuid.
+ *
+ * @return the uuid
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * Gets the invariant uuid.
+ *
+ * @return the invariant uuid
+ */
+ public String getInvariantUuid() {
+ return invariantUuid;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Gets the customization uuid.
+ *
+ * @return the model customization uuid
+ */
+ public String getCustomizationUuid() {
+ return customizationUuid;
+ }
+ /**
+ * Gets the inputs.
+ *
+ * @return the inputs
+ */
+ public Map<String, Input> getInputs() {
+ return inputs;
+ }
+ /**
+ * Gets the commands.
+ *
+ * @return the commands
+ */
+ public Map<String, CommandProperty> getCommands() {
+ return commands;
+ }
+ /**
+ * Gets the properties.
+ *
+ * @return the properties
+ */
+ public Map<String, String> getProperties() {
+ return properties;
+ }
+ /**
+ * Sets the uuid.
+ *
+ * @param uuid the new uuid
+ */
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * Sets the invariant uuid.
+ *
+ * @param invariantUuid the new invariant uuid
+ */
+ public void setInvariantUuid(String invariantUuid) {
+ this.invariantUuid = invariantUuid;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the version.
+ *
+ * @param version the new version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+ /**
+ * Sets the customization uuid.
+ *
+ * @param u the new customization uuid
+ */
+ public void setCustomizationUuid(String u) {
+ this.customizationUuid = u;
+ }
+
+ /**
+ * Sets the inputs.
+ *
+ * @param inputs the inputs
+ */
+ public void setInputs(Map<String, Input> inputs) {
+ this.inputs = inputs;
+ }
+ /**
+ * Sets the commands.
+ *
+ * @param m the commands
+ */
+ public void setCommands( Map<String, CommandProperty>m ) {
+ commands = m;
+ }
+ /**
+ * Sets the properties.
+ *
+ * @param p the properties
+ */
+ public void setProperties( Map<String, String>p) {
+ properties = p;
+ }
+ /**
+ * Extract node.
+ *
+ * @param modelCustomizationName the model customization name
+ * @param nodeTemplate the node template
+ * @return the node
+ */
+ public void extractNode (NodeTemplate nodeTemplate) {
+
+ String methodName = "extractNode";
+
+ setUuid(nodeTemplate.getMetadata().getUUID());
+ setInvariantUuid(nodeTemplate.getMetadata().getInvariantUUID());
+ setDescription(nodeTemplate.getMetadata().getDescription());
+ setName(nodeTemplate.getMetadata().getName());
+ setVersion(nodeTemplate.getMetadata().getVersion());
+ // add customizationUUID
+ setCustomizationUuid(nodeTemplate.getMetadata().getCustomizationUUID());
+
+ try {
+ // nodeTemplate.getProperties() map of String->Object
+ for (Entry<String, Object> e : nodeTemplate.getProperties().entrySet()) {
+
+ String k = e.getKey();
+
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " node template property: " + k );
+
+ if ( e.getValue() != null ) {
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " property: " +
+ k + "=" + e.getValue());
+ //LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " V class name: " +
+ // e.getValue().getClass().getName());
+ Class<?> c = e.getValue().getClass();
+ if ( c.getName().equalsIgnoreCase(java.lang.String.class.getName())) {
+ getProperties().put (k, (String)e.getValue());
+ }
+ else {
+ Class<?>[] interfaces = e.getValue().getClass().getInterfaces();
+
+ for(Class<?> ifc: interfaces ) {
+ //LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " ifc name: " +
+ // ifc.getName());
+ if ( ifc.getName().equalsIgnoreCase(java.util.Map.class.getName()) ) {
+ // only extract get_input for now
+ @SuppressWarnings("unchecked")
+ HashMap<String,String> v = (HashMap<String,String>)e.getValue();
+ for (Entry<String, String> entry : v.entrySet()) {
+ // only include get_input for now
+ if ( ModelConstants.GET_INPUT_TAG.equalsIgnoreCase ( entry.getKey() ) ) {
+ CommandProperty cp = new CommandProperty();
+ cp.setCommand(entry.getKey());
+ cp.setInputName(entry.getValue());
+ cp.setDisplayName(k);
+ getCommands().put(k,cp);
+ }
+ }
+ }
+ }
+
+ }
+ }
+ }
+ }
+ catch ( Exception e ) {
+ LOG.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodName + " Unable to parse node properties: e=" +
+ e.toString());
+ }
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/model/Resource.java b/vid-app-common/src/main/java/org/openecomp/vid/model/Resource.java
new file mode 100755
index 0000000..4dcc975
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/model/Resource.java
@@ -0,0 +1,28 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.model;
+
+/**
+ * The Class Resource.
+ */
+public class Resource {
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/model/Result.java b/vid-app-common/src/main/java/org/openecomp/vid/model/Result.java
new file mode 100755
index 0000000..d8bf6eb
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/model/Result.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.model;
+
+/**
+ * The Class Result.
+ */
+public class Result {
+
+ /** The result. */
+ private String result;
+
+ /**
+ * Instantiates a new result.
+ *
+ * @param result the result
+ */
+ public Result(String result) {
+ this.result = result;
+ }
+
+ /**
+ * Gets the result.
+ *
+ * @return the result
+ */
+ public String getResult() {
+ return result;
+ }
+
+ /**
+ * Sets the result.
+ *
+ * @param result the new result
+ */
+ public void setResult(String result) {
+ this.result = result;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/model/Service.java b/vid-app-common/src/main/java/org/openecomp/vid/model/Service.java
new file mode 100755
index 0000000..f3c6e4d
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/model/Service.java
@@ -0,0 +1,253 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.model;
+
+import java.util.Map;
+import java.util.UUID;
+import java.util.Map.Entry;
+
+import org.openecomp.vid.asdc.beans.tosca.Input;
+
+/**
+ * The Class Service.
+ */
+public class Service {
+
+ /** The uuid. */
+ private String uuid;
+
+ /** The invariant uuid. */
+ private String invariantUuid;
+
+ /** The name. */
+ private String name;
+
+ /** The version. */
+ private String version;
+
+ /** The tosca model URL. */
+ private String toscaModelURL;
+
+ /** The category. */
+ private String category;
+
+ /** The description. */
+ private String description;
+
+ /** The service ecomp naming flag */
+ private String serviceEcompNaming;
+
+ /** The inputs. */
+ private Map<String, Input> inputs;
+
+ /**
+ * Gets the uuid.
+ *
+ * @return the uuid
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * Gets the invariant uuid.
+ *
+ * @return the invariant uuid
+ */
+ public String getInvariantUuid() {
+ return invariantUuid;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Gets the tosca model URL.
+ *
+ * @return the tosca model URL
+ */
+ public String getToscaModelURL() {
+ return toscaModelURL;
+ }
+
+ /**
+ * Gets the category.
+ *
+ * @return the category
+ */
+ public String getCategory() {
+ return category;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the inputs.
+ *
+ * @return the inputs
+ */
+ public Map<String, Input> getInputs() {
+ return inputs;
+ }
+ /**
+ * Get the serviceEcompNaming value
+ *
+ * @return serviceEcompNaming
+ */
+ public String getServiceEcompNaming() {
+ return serviceEcompNaming;
+ }
+ /**
+ * Sets the uuid.
+ *
+ * @param uuid the new uuid
+ */
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * Sets the invariant uuid.
+ *
+ * @param invariantUuid the new invariant uuid
+ */
+ public void setInvariantUuid(String invariantUuid) {
+ this.invariantUuid = invariantUuid;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the version.
+ *
+ * @param version the new version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * Sets the tosca model URL.
+ *
+ * @param toscaModelURL the new tosca model URL
+ */
+ public void setToscaModelURL(String toscaModelURL) {
+ this.toscaModelURL = toscaModelURL;
+ }
+
+ /**
+ * Sets the category.
+ *
+ * @param category the new category
+ */
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the inputs.
+ *
+ * @param inputs the inputs
+ */
+ public void setInputs(Map<String, Input> inputs) {
+ this.inputs = inputs;
+ }
+ /**
+ * Sets the service ecomp naming.
+ *
+ * @param serviceEcompNaming the new service ecomp naming
+ */
+ public void setServiceEcompNaming(String serviceEcompNaming) {
+ this.serviceEcompNaming = serviceEcompNaming;
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ final UUID uuid = UUID.fromString(getUuid());
+
+ return uuid.hashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) return true;
+ if (!(o instanceof Service)) return false;
+
+ final Service service = (Service) o;
+
+ return (service.getUuid().equals(getUuid()));
+ }
+ /*public static void extractVfModuleCustomizationUUID (Service s, String vnfCustomizationName, VfModule vfMod ) {
+
+ //Look for vnfCustomizationName..vfModuleCustomizationName
+ String nameToFind = vnfCustomizationName + ".." + vfMod.getModelCustomizationName();
+ for (Entry<UUID, VfModule> vfModuleComponent : s.getVfModules().entrySet()) {
+ VfModule xMod = vfModuleComponent.getValue();
+ if ( (xMod.getModelCustomizationName() != null) && (xMod.getModelCustomizationName().equalsIgnoreCase(nameToFind)) ) {
+ vfMod.setCustomizationUuid( xMod.getCustomizationUuid());
+ return;
+ }
+ }
+ }*/
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/model/ServiceModel.java b/vid-app-common/src/main/java/org/openecomp/vid/model/ServiceModel.java
new file mode 100755
index 0000000..140e9ed
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/model/ServiceModel.java
@@ -0,0 +1,261 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.model;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.openecomp.vid.asdc.beans.tosca.Group;
+import org.openecomp.vid.asdc.beans.tosca.ToscaModel;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.vid.controller.VidController;
+import org.openecomp.vid.properties.VidProperties;
+/**
+ * The Class ServiceModel.
+ */
+public class ServiceModel {
+
+ /** The Constant LOG. */
+ private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(ServiceModel.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+ /** The service. */
+ private Service service;
+
+ /** The vnfs. */
+ private Map<String, VNF> vnfs;
+
+ /** The networks. */
+ private Map<String, Network> networks;
+
+ /**
+ * The vf modules. The VNF also has vfmodules but the vfmodules at the service level may have additional info
+ * that is not present in the VNF, like the vf module customization String
+ */
+ private Map<String, VfModule> vfModules;
+ /**
+ * The volume groups. The VNF also has volume groups but the volume groups will be populated at the service level
+ * for newer models
+ */
+ private Map<String, VolumeGroup> volumeGroups;
+ /**
+ * Instantiates a new service model.
+ */
+ public ServiceModel() {}
+
+ /**
+ * Gets the service.
+ *
+ * @return the service
+ */
+ public Service getService() {
+ return service;
+ }
+
+ /**
+ * Gets the vnfs.
+ *
+ * @return the vnfs
+ */
+ public Map<String, VNF> getVnfs() {
+ return vnfs;
+ }
+
+ /**
+ * Gets the networks.
+ *
+ * @return the networks
+ */
+ public Map<String, Network> getNetworks() {
+ return networks;
+ }
+
+ /**
+ * Sets the service.
+ *
+ * @param service the new service
+ */
+ public void setService(Service service) {
+ this.service = service;
+ }
+
+ /**
+ * Sets the vnfs.
+ *
+ * @param vnfs the vnfs
+ */
+ public void setVnfs(Map<String, VNF> vnfs) {
+ this.vnfs = vnfs;
+ }
+
+ /**
+ * Sets the networks.
+ *
+ * @param networks the networks
+ */
+ public void setNetworks(Map<String, Network> networks) {
+ this.networks = networks;
+ }
+ /**
+ * Gets the vf modules.
+ *
+ * @return the vf modules
+ */
+ public Map<String, VfModule> getVfModules() {
+ return vfModules;
+ }
+ /**
+ * Gets the volume groups.
+ *
+ * @return the volume groups
+ */
+ public Map<String, VolumeGroup> getVolumeGroups() {
+ return volumeGroups;
+ }
+ /**
+ * Sets the vf modules.
+ *
+ * @param vfModules the vf modules
+ */
+ public void setVfModules(Map<String, VfModule> vfModules) {
+ this.vfModules = vfModules;
+ }
+ /**
+ * Sets the volume groups.
+ *
+ * @param volumeGroups the volume groups
+ */
+ public void setVolumeGroups(Map<String, VolumeGroup> volumeGroups) {
+ this.volumeGroups = volumeGroups;
+ }
+ /**
+ * Extract service.
+ *
+ * @param serviceToscaModel the service tosca model
+ * @param asdcServiceMetadata the asdc service metadata
+ * @return the service
+ */
+ public static Service extractService(ToscaModel serviceToscaModel, org.openecomp.vid.asdc.beans.Service asdcServiceMetadata) {
+
+ final Service service = new Service();
+
+ service.setCategory(serviceToscaModel.getMetadata().getCategory());
+ service.setInvariantUuid(serviceToscaModel.getMetadata().getInvariantUUID());
+ service.setName(serviceToscaModel.getMetadata().getName());
+ service.setUuid(serviceToscaModel.getMetadata().getUUID());
+ service.setDescription(serviceToscaModel.getMetadata().getDescription());
+ service.setServiceEcompNaming(serviceToscaModel.getMetadata().getServiceEcompNaming());
+ service.setInputs(serviceToscaModel.gettopology_template().getInputs());
+ //FIXME: SDC is not sending the Version with the Tosca Model for 1610 - they should send it in 1702
+ //THIS IS A TEMPORARY FIX, AT SOME POINT UNCOMMENT ME
+ //service.setVersion(serviceToscaModel.getMetadata().getVersion());
+ service.setVersion(asdcServiceMetadata.getVersion());
+
+ return service;
+ }
+ public void extractGroups (ToscaModel serviceToscaModel) {
+ // Get the groups. The groups may duplicate the groups that are in the VNF model and have
+ // additional data like the VF module customization String>
+
+ final Map<String, VfModule> vfModules = new HashMap<String, VfModule> ();
+ final Map<String, VolumeGroup> volumeGroups = new HashMap<String, VolumeGroup> ();
+
+ String asdcModelNamespace = VidProperties.getAsdcModelNamespace();
+ String vfModuleTag = asdcModelNamespace + ModelConstants.VF_MODULE;
+
+ for (Entry<String, Group> component : serviceToscaModel.gettopology_template().getGroups().entrySet()) {
+ final Group group = component.getValue();
+ final String type = group.getType();
+ final String customizationName = component.getKey();
+
+ if (type.startsWith(vfModuleTag)) {
+ VfModule vfMod = VfModule.extractVfModule(customizationName, group);
+ vfModules.put(customizationName, vfMod);
+ if ( vfMod.isVolumeGroupAllowed() ) {
+ //volume groups have the same customization name as the vf module
+ volumeGroups.put(customizationName, VolumeGroup.extractVolumeGroup(customizationName,group));
+ }
+ }
+ }
+ // add this point vfModules and volume groups are disconnected from VNF
+ this.setVfModules (vfModules);
+ this.setVolumeGroups (volumeGroups);
+
+ }
+ /**
+ * Populate the vf modules and volume groups that we may have under the service level under each VNF.
+ */
+ public void associateGroups() {
+ String methodName = "associateGroups()";
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " start");
+ // go through the vnfs, get the vnf normalized name and look for a vf module with a customization name that starts
+ // with vnf + ".."
+ String vnfCustomizationName = null;
+ String normalizedVnfCustomizationName = null;
+ String vfModuleCustomizationName = null;
+ VNF tmpVnf = null;
+
+ if ( ( getVnfs() != null ) && (!(getVnfs().isEmpty())) ) {
+ for (Entry<String, VNF> vnfComponent : getVnfs().entrySet()) {
+ vnfCustomizationName = vnfComponent.getValue().getModelCustomizationName();
+ normalizedVnfCustomizationName = VNF.normalizeName(vnfCustomizationName);
+
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName +
+ " VNF customizationName=" + vnfCustomizationName + "normalized customization name=" + normalizedVnfCustomizationName);
+
+ // now check to see if there is a vf module with customization name that starts with normalizedVnfCustomizationName
+
+ if (( getVfModules() != null ) && (!(getVfModules().isEmpty()))) {
+ for (Entry<String, VfModule> vfModuleComponent : getVfModules().entrySet()) {
+ vfModuleCustomizationName = vfModuleComponent.getValue().getModelCustomizationName();
+
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName +
+ " VF Module customizationName=" + vfModuleCustomizationName );
+ if ( vfModuleCustomizationName.startsWith(normalizedVnfCustomizationName + ".." )) {
+
+ // this vf module belongs to the VNF
+ tmpVnf = vnfComponent.getValue();
+ (tmpVnf.getVfModules()).put(vfModuleComponent.getKey(), vfModuleComponent.getValue());
+
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName +
+ " Associated VF Module customizationName=" + vfModuleComponent.getKey() + " with VNF customization name=" + vnfCustomizationName);
+
+ // now find if this vf module has volume groups, if so, find the volume group with the same customization name and put it under the VNF
+ if ( vfModuleComponent.getValue().isVolumeGroupAllowed() ) {
+ if (( getVolumeGroups() != null ) && (!(getVolumeGroups().isEmpty()))) {
+ if (getVolumeGroups().containsKey((vfModuleCustomizationName))) {
+ (vnfComponent.getValue().getVolumeGroups()).put(vfModuleCustomizationName, (getVolumeGroups()).get(vfModuleCustomizationName));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/model/VNF.java b/vid-app-common/src/main/java/org/openecomp/vid/model/VNF.java
new file mode 100755
index 0000000..be37c94
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/model/VNF.java
@@ -0,0 +1,165 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.model;
+
+import java.util.Map;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map.Entry;
+import java.util.regex.Pattern;
+
+import org.openecomp.vid.asdc.beans.tosca.NodeTemplate;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.vid.controller.VidController;
+
+import org.openecomp.vid.asdc.beans.tosca.Group;
+import org.openecomp.vid.asdc.beans.tosca.Input;
+
+/**
+ * The Class VNF.
+ */
+public class VNF extends Node {
+
+ /** The Constant LOG. */
+ private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(VNF.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The pattern used to normalize VNF names */
+ final static Pattern COMPONENT_INSTANCE_NAME_DELIMETER_PATTERN = Pattern.compile("[\\.\\-]+");
+
+ /** The model customization name. */
+ private String modelCustomizationName;
+
+ /** The vf modules. */
+ private Map<String, VfModule> vfModules = new HashMap<String, VfModule>();
+
+ /** The volume groups. */
+ private Map<String, VolumeGroup> volumeGroups = new HashMap<String, VolumeGroup>();
+
+ /**
+ * Instantiates a new vnf.
+ */
+ public VNF() {
+ super();
+ }
+
+ /**
+ * Gets the model customization name.
+ *
+ * @return the model customization name
+ */
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+
+ /**
+ * Gets the vf modules.
+ *
+ * @return the vf modules
+ */
+ public Map<String, VfModule> getVfModules() {
+ return vfModules;
+ }
+
+ /**
+ * Sets the vf modules.
+ *
+ * @param vfModules the vf modules
+ */
+ public void setVfModules(Map<String, VfModule> vfModules) {
+ this.vfModules = vfModules;
+ }
+
+ /**
+ * Gets the volume groups.
+ *
+ * @return the volume groups
+ */
+ public Map<String, VolumeGroup> getVolumeGroups() {
+ return volumeGroups;
+ }
+
+ /**
+ * Sets the volume groups.
+ *
+ * @param volumeGroups the volume groups
+ */
+ public void setVolumeGroups(Map<String, VolumeGroup> volumeGroups) {
+ this.volumeGroups = volumeGroups;
+ }
+
+ /**
+ * Extract vnf.
+ *
+ * @param modelCustomizationName the model customization name
+ * @param nodeTemplate the node template
+ * @return the vnf
+ */
+ public void extractVnf(String modelCustomizationName, NodeTemplate nodeTemplate) {
+
+ super.extractNode(nodeTemplate);
+ setModelCustomizationName(modelCustomizationName);
+
+ }
+
+ /**
+ * Sets the model customization name.
+ *
+ * @param modelCustomizationName the new model customization name
+ */
+ private void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+ /**
+ * Normalize the VNF name
+ * @param originalName
+ * @return the normalized name
+ */
+ public static String normalizeName (String originalName) {
+
+ String normalizedName = originalName.toLowerCase();
+ normalizedName = COMPONENT_INSTANCE_NAME_DELIMETER_PATTERN.matcher(normalizedName).replaceAll(" ");
+ String[] splitArr = null;
+
+ try {
+ splitArr = normalizedName.split(" ");
+ }
+ catch (Exception ex ) {
+ return (normalizedName);
+ }
+ StringBuffer sb = new StringBuffer();
+ if ( splitArr != null ) {
+ for (String splitElement : splitArr) {
+ sb.append(splitElement);
+ }
+ return (sb.toString());
+ }
+ else {
+ return (normalizedName);
+ }
+
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/model/VfModule.java b/vid-app-common/src/main/java/org/openecomp/vid/model/VfModule.java
new file mode 100755
index 0000000..4a031a6
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/model/VfModule.java
@@ -0,0 +1,308 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.model;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.openecomp.vid.asdc.beans.tosca.Group;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+/**
+ * The Class VfModule.
+ */
+public class VfModule {
+
+ /** The Constant LOG. */
+ private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(VfModule.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The uuid. */
+ private String uuid;
+
+ /** The invariant uuid. */
+ private String invariantUuid;
+
+ /** The customization uuid. */
+ private String customizationUuid;
+
+ /** The description. */
+ private String description;
+
+ /** The name. */
+ private String name;
+
+ /** The version. */
+ private String version;
+
+ /** The volume group allowed. */
+ private boolean volumeGroupAllowed;
+
+ /** The get_input or other constructs for VF Module. */
+ private Map<String, CommandProperty> commands;
+
+ /** The model customization name. */
+ private String modelCustomizationName;
+
+ /**
+ * Instantiates a new vf module.
+ */
+ public VfModule() {
+ commands = new HashMap<String, CommandProperty>();
+ }
+ /**
+ * Gets the model customization name.
+ *
+ * @return the model customization name
+ */
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+ /**
+ * Gets the uuid.
+ *
+ * @return the uuid
+ */
+ public String getUuid() {
+ return uuid;
+ }
+
+ /**
+ * Gets the invariant uuid.
+ *
+ * @return the invariant uuid
+ */
+ public String getInvariantUuid() {
+ return invariantUuid;
+ }
+ /**
+ * Gets the customization uuid.
+ *
+ * @return the invariant uuid
+ */
+ public String getCustomizationUuid() {
+ return customizationUuid;
+ }
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+ /**
+ * Gets the commands.
+ *
+ * @return the commands
+ */
+ public Map<String, CommandProperty> getCommands() {
+ return commands;
+ }
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Checks if is volume group allowed.
+ *
+ * @return true, if is volume group allowed
+ */
+ public boolean isVolumeGroupAllowed() {
+ return volumeGroupAllowed;
+ }
+
+ /**
+ * Sets the uuid.
+ *
+ * @param uuid the new uuid
+ */
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * Sets the invariant uuid.
+ *
+ * @param invariantUuid the new invariant uuid
+ */
+ public void setInvariantUuid(String invariantUuid) {
+ this.invariantUuid = invariantUuid;
+ }
+ /**
+ * Sets the customization uuid.
+ *
+ * @param customizationUuid the new customization uuid
+ */
+ public void setCustomizationUuid(String customizationUuid) {
+ this.customizationUuid = customizationUuid;
+ }
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the version.
+ *
+ * @param version the new version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * Sets the volume group allowed.
+ *
+ * @param volumeGroupAllowed the new volume group allowed
+ */
+ private void setVolumeGroupAllowed(boolean volumeGroupAllowed) {
+ this.volumeGroupAllowed = volumeGroupAllowed;
+ }
+ /**
+ * Sets the commands.
+ *
+ * @param m the commands
+ */
+ public void setCommands( Map<String, CommandProperty>m ) {
+ commands = m;
+ }
+ /**
+ * Sets the model customization name.
+ *
+ * @param modelCustomizationName the new model customization name
+ */
+ private void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
+ /**
+ * Extract vf module.
+ *
+ * @param group the group
+ * @return the vf module
+ */
+ public static VfModule extractVfModule(String modelCustomizationName, Group group) {
+
+ String methodName = "extractVfModule";
+
+ final VfModule vfModule = new VfModule();
+
+ try {
+ vfModule.setUuid(group.getMetadata().getVfModuleModelUUID());
+ vfModule.setInvariantUuid(group.getMetadata().getVfModuleModelInvariantUUID());
+ vfModule.setDescription(group.getMetadata().getDescription());
+ vfModule.setName(group.getMetadata().getVfModuleModelName());
+ vfModule.setVersion(group.getMetadata().getVfModuleModelVersion());
+ vfModule.setCustomizationUuid(group.getMetadata().getVfModuleModelCustomizationUUID());
+ vfModule.setModelCustomizationName (modelCustomizationName);
+
+ if (group.getProperties().containsKey("volume_group")) {
+ if (group.getProperties().get("volume_group") != null) {
+
+ Class<?> c = group.getProperties().get("volume_group").getClass();
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " class name=" +
+ c.getName());
+
+ if ( c.getName().equalsIgnoreCase(Boolean.class.getName()) ) {
+ Boolean b = (Boolean)group.getProperties().get("volume_group");
+ vfModule.setVolumeGroupAllowed( b.booleanValue() );
+ }
+ }
+ } else {
+ vfModule.setVolumeGroupAllowed(false);
+ }
+ }
+ catch ( Exception e ) {
+ LOG.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodName + " Unable to parse VF Module from group: e=" +
+ e.toString());
+ }
+ /* Not extracting other types of properties for 1702
+ try {
+
+ for (Entry<String, Object> e : group.getProperties().entrySet()) {
+
+ String k = e.getKey();
+ if ( e.getValue() != null ) {
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " property: " +
+ k + "=" + e.getValue());
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " V class name: " +
+ e.getValue().getClass().getName());
+ Class<?>[] interfaces = e.getValue().getClass().getInterfaces();
+
+ for(Class<?> ifc: interfaces ){
+ LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " ifc name: " +
+ ifc.getName());
+ }
+
+ // only extract get_input for now
+ for (Entry<String, String> entry : v.entrySet()) {
+ // only include get_input for now
+ if ( ModelConstants.GET_INPUT_TAG.equalsIgnoreCase ( entry.getKey() ) ) {
+ CommandProperty cp = new CommandProperty();
+ cp.setDisplayName(entry.getValue());
+ cp.setCommand(entry.getKey());
+ cp.setInputName(k);
+ (vfModule.getCommands()).put(k,cp);
+ }
+ }
+ }
+ }
+ }
+ catch ( Exception e ) {
+ LOG.error(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodName + " Unable to parse VF Module properties: e=" +
+ e.toString());
+ }*/
+ return vfModule;
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/model/VolumeGroup.java b/vid-app-common/src/main/java/org/openecomp/vid/model/VolumeGroup.java
new file mode 100755
index 0000000..ea8e151
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/model/VolumeGroup.java
@@ -0,0 +1,196 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.model;
+
+import org.openecomp.vid.asdc.beans.tosca.Group;
+
+/**
+ * The Class VolumeGroup.
+ */
+public class VolumeGroup {
+
+ /** The uuid. */
+ private String uuid;
+
+ /** The invariant uuid. */
+ private String invariantUuid;
+
+ /** The description. */
+ private String description;
+
+ /** The name. */
+ private String name;
+
+ /** The version. */
+ private String version;
+
+ /** The customization uuid. */
+ private String customizationUuid;
+
+ /** The customization uuid. */
+ private String modelCustomizationName;
+ /**
+ * Instantiates a new volume group.
+ */
+ public VolumeGroup() {}
+
+ /**
+ * Gets the uuid.
+ *
+ * @return the uuid
+ */
+ public String getUuid() {
+ return uuid;
+ }
+ /**
+ * Gets the customization uuid.
+ *
+ * @return the customization uuid
+ */
+ public String getCustomizationUuid() {
+ return customizationUuid;
+ }
+ /**
+ * Gets the customization name.
+ *
+ * @return the customization name
+ */
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+ /**
+ * Gets the invariant uuid.
+ *
+ * @return the invariant uuid
+ */
+ public String getInvariantUuid() {
+ return invariantUuid;
+ }
+
+ /**
+ * Gets the description.
+ *
+ * @return the description
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Gets the name.
+ *
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Gets the version.
+ *
+ * @return the version
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Sets the uuid.
+ *
+ * @param uuid the new uuid
+ */
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ /**
+ * Sets the invariant uuid.
+ *
+ * @param invariantUuid the new invariant uuid
+ */
+ public void setInvariantUuid(String invariantUuid) {
+ this.invariantUuid = invariantUuid;
+ }
+
+ /**
+ * Sets the description.
+ *
+ * @param description the new description
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the name.
+ *
+ * @param name the new name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the version.
+ *
+ * @param version the new version
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+ /**
+ * Sets the customization uuid.
+ *
+ * @param u the new customization uuid
+ */
+ private void setCustomizationUuid(String u) {
+ this.customizationUuid = u;
+
+ }
+ /**
+ * Sets the customization name.
+ *
+ * @param u the new customization name
+ */
+ private void setModelCustomizationName(String u) {
+ this.modelCustomizationName = u;
+
+ }
+ /**
+ * Extract volume group.
+ *
+ * @param group the group
+ * @return the volume group
+ */
+ public static VolumeGroup extractVolumeGroup(String modelCustomizationName, Group group) {
+ final VolumeGroup volumeGroup = new VolumeGroup();
+
+ volumeGroup.setUuid(group.getMetadata().getVfModuleModelUUID());
+ volumeGroup.setInvariantUuid(group.getMetadata().getVfModuleModelInvariantUUID());
+ volumeGroup.setDescription(group.getMetadata().getDescription());
+ volumeGroup.setName(group.getMetadata().getVfModuleModelName());
+ volumeGroup.setVersion(group.getMetadata().getVfModuleModelVersion());
+ volumeGroup.setCustomizationUuid(group.getMetadata().getVfModuleModelCustomizationUUID());
+ volumeGroup.setModelCustomizationName(modelCustomizationName);
+ return volumeGroup;
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoProperties.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoProperties.java
new file mode 100755
index 0000000..272a2a2
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoProperties.java
@@ -0,0 +1,100 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.mso;
+
+import org.openecomp.portalsdk.core.util.SystemProperties;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+/**
+ * The Class MsoProperties.
+ */
+public class MsoProperties extends SystemProperties {
+
+ /** The Constant MSO_SERVER_URL. */
+ //VID Properties related to MSO
+ public static final String MSO_SERVER_URL = "mso.server.url";
+
+ /** The Constant MSO_DME2_SERVER_URL. */
+ public static final String MSO_DME2_SERVER_URL = "mso.dme2.server.url";
+
+ /** The Constant MSO_DME2_CLIENT_TIMEOUT. */
+ public static final String MSO_DME2_CLIENT_TIMEOUT = "mso.dme2.client.timeout";
+
+ /** The Constant MSO_DME2_CLIENT_READ_TIMEOUT. */
+ public static final String MSO_DME2_CLIENT_READ_TIMEOUT = "mso.dme2.client.read.timeout";
+
+ /** The Constant MSO_SERVER_URL_DEFAULT. */
+ public static final String MSO_SERVER_URL_DEFAULT= "";
+
+ /** The Constant MSO_POLLING_INTERVAL_MSECS. */
+ // number of msecs to wait between polling requests
+ public static final String MSO_POLLING_INTERVAL_MSECS = "mso.polling.interval.msecs";
+
+ /** The Constant MSO_POLLING_INTERVAL_MSECS_DEFAULT. */
+ public static final String MSO_POLLING_INTERVAL_MSECS_DEFAULT = "60000";
+
+ /** The Constant MSO_DME2_ENABLED. */
+ public static final String MSO_DME2_ENABLED = "mso.dme2.enabled";
+
+ /** The Constant MSO_MAX_POLLS. */
+ public static final String MSO_MAX_POLLS = "mso.max.polls";
+
+ /** The Constant MSO_MAX_POLLS_DEFAULT. */
+ public static final String MSO_MAX_POLLS_DEFAULT = "10"; //10
+
+ /** The Constant MSO_USER_NAME. */
+ public static final String MSO_USER_NAME = "mso.user.name"; //m03346
+
+ /** The Constant MSO_PASSWORD. */
+ public static final String MSO_PASSWORD = "mso.password.x";
+
+ /** The Constant MSO_REST_API_SVC_INSTANCE. */
+ public static final String MSO_REST_API_SVC_INSTANCE = "mso.restapi.svc.instance"; // /serviceInstances/v2
+
+ /** The Constant MSO_REST_API_VNF_INSTANCE. */
+ public static final String MSO_REST_API_VNF_INSTANCE = "mso.restapi.vnf.instance"; // /serviceInstances/v2/{service_instance_id}/vnfs
+
+ /** The Constant MSO_REST_API_NETWORK_INSTANCE. */
+ public static final String MSO_REST_API_NETWORK_INSTANCE = "mso.restapi.network.instance"; // /serviceInstances/v2/{serviceInstanceId}/networks
+
+ /** The Constant MSO_REST_API_GET_ORC_REQ. */
+ public static final String MSO_REST_API_GET_ORC_REQ = "mso.restapi.get.orc.req";
+
+ /** The Constant MSO_REST_API_GET_ORC_REQS. */
+ public static final String MSO_REST_API_GET_ORC_REQS = "mso.restapi.get.orc.reqs";
+
+ /** The Constant MSO_REST_API_VF_MODULE_INSTANCE. */
+ public static final String MSO_REST_API_VF_MODULE_INSTANCE = "mso.restapi.vf.module.instance";
+
+ /** The Constant MSO_REST_API_VOLUME_GROUP_INSTANCE. */
+ public static final String MSO_REST_API_VOLUME_GROUP_INSTANCE = "mso.restapi.volume.group.instance"; //serviceInstances/v2/{serviceInstanceId}/volumeGroups
+
+ /** The logger. */
+ public EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoProperties.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoResponseWrapper.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoResponseWrapper.java
new file mode 100755
index 0000000..d5a4a87
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoResponseWrapper.java
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.mso;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+/**
+ * This wrapper encapsulates the MSO response in the format expected by the pages.
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "status",
+ "entity"
+})
+
+public class MsoResponseWrapper {
+
+ /** The status. */
+ @JsonProperty("status")
+ private int status;
+
+ /** The entity. */
+ @JsonProperty("entity")
+ private String entity;
+
+ /**
+ * Gets the entity.
+ *
+ * @return the entity
+ */
+ @JsonProperty("entity")
+ public String getEntity() {
+ return entity;
+ }
+
+ /**
+ * Gets the status.
+ *
+ * @return the status
+ */
+ @JsonProperty("status")
+ public int getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets the status.
+ *
+ * @param v the new status
+ */
+ @JsonProperty("status")
+ public void setStatus(int v) {
+ this.status = v;
+ }
+
+ /**
+ * Sets the entity.
+ *
+ * @param v the new entity
+ */
+ @JsonProperty("entity")
+ public void setEntity(String v) {
+ this.entity = v;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ /**
+ * Gets the response.
+ *
+ * @return the response
+ */
+ public String getResponse () {
+
+ StringBuilder b = new StringBuilder ("{ \"status\": ");
+ b.append(getStatus()).append(", \"entity\": " ).append(this.getEntity()).append("}");
+ return (b.toString());
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInt.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInt.java
new file mode 100755
index 0000000..b9f2dbc
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInt.java
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.mso;
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * The Class MsoRestInt.
+ */
+public class MsoRestInt {
+
+ /** The logger. */
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoRestInterface.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The request date format. */
+ public DateFormat requestDateFormat = new SimpleDateFormat("EEE, dd MMM YYYY HH:mm:ss z");
+
+ /**
+ * Instantiates a new mso rest int.
+ */
+ public MsoRestInt() {
+ requestDateFormat.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
+ }
+
+ /**
+ * Log request.
+ *
+ * @param r the r
+ */
+ public void logRequest ( org.openecomp.vid.mso.rest.RequestDetails r ) {
+ String methodName = "logRequest";
+ ObjectMapper mapper = new ObjectMapper();
+ String r_json_str = "";
+ if ( r != null ) {
+ r_json_str = r.toString();
+ try {
+ r_json_str = mapper.writeValueAsString(r);
+ }
+ catch ( com.fasterxml.jackson.core.JsonProcessingException j ) {
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Unable to parse request as json");
+ }
+ }
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Request=(" + r_json_str + ")");
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterface.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterface.java
new file mode 100755
index 0000000..31a762e
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterface.java
@@ -0,0 +1,290 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.mso;
+
+
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Collections;
+import java.util.Date;
+
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.Entity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.Response;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+
+import org.apache.commons.codec.binary.Base64;
+import org.eclipse.jetty.util.security.Password;
+import org.openecomp.vid.client.HttpBasicClient;
+import org.openecomp.vid.client.HttpsBasicClient;
+import org.openecomp.vid.mso.rest.RequestDetails;
+
+/**
+ * The Class MsoRestInterface.
+ */
+public class MsoRestInterface extends MsoRestInt implements MsoRestInterfaceIfc {
+
+ /** The logger. */
+ EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoRestInterface.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /** The client. */
+ private static Client client = null;
+
+ /** The common headers. */
+ private MultivaluedHashMap<String, Object> commonHeaders;
+
+ /**
+ * Instantiates a new mso rest interface.
+ */
+ public MsoRestInterface() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.mso.MsoRestInterfaceIfc#initRestClient()
+ */
+ public void initRestClient()
+ {
+ final String methodname = "initRestClient()";
+
+ final String username = SystemProperties.getProperty(MsoProperties.MSO_USER_NAME);
+ final String password = SystemProperties.getProperty(MsoProperties.MSO_PASSWORD);
+ final String mso_url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL);
+ final String decrypted_password = Password.deobfuscate(password);
+
+ String authString = username + ":" + decrypted_password;
+
+ byte[] authEncBytes = Base64.encodeBase64(authString.getBytes());
+ String authStringEnc = new String(authEncBytes);
+
+ commonHeaders = new MultivaluedHashMap<String, Object> ();
+ commonHeaders.put("Authorization", Collections.singletonList((Object) ("Basic " + authStringEnc)));
+
+ boolean use_ssl = true;
+ if ( (mso_url != null) && ( !(mso_url.isEmpty()) ) ) {
+ if ( mso_url.startsWith("https")) {
+ use_ssl = true;
+ }
+ else {
+ use_ssl = false;
+ }
+ }
+ if (client == null) {
+
+ try {
+ if ( use_ssl ) {
+ //logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodname + " getting HttpsBasicClient with username=" + username
+ // + " password=" + password);
+ client = HttpsBasicClient.getClient();
+ }
+ else {
+ //logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodname + " getting HttpsBasicClient with username=" + username
+ // + " password=" + password);
+ client = HttpBasicClient.getClient();
+ }
+ } catch (Exception e) {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodname + " Unable to get the SSL client");
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.mso.MsoRestInterfaceIfc#Get(java.lang.Object, java.lang.String, java.lang.String, org.openecomp.vid.mso.RestObject)
+ */
+ @SuppressWarnings("unchecked")
+ public <T> void Get (T t, String sourceId, String path, RestObject<T> restObject ) throws Exception {
+ String methodName = "Get";
+
+ logger.debug(EELFLoggerDelegate.debugLogger, methodName + " start");
+
+ String url="";
+ restObject.set(t);
+
+ url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + "<== " + methodName + " sending request to url= " + url);
+
+ initRestClient();
+
+ final Response cres = client.target(url)
+ .request()
+ .accept("application/json")
+ .headers(commonHeaders)
+ .get();
+
+ int status = cres.getStatus();
+ restObject.setStatusCode (status);
+
+ if (status == 200) {
+ t = (T) cres.readEntity(t.getClass());
+ restObject.set(t);
+ logger.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " REST api was successfull!");
+
+ } else {
+ throw new Exception(methodName + " with status="+ status + ", url= " + url );
+ }
+
+ logger.debug(EELFLoggerDelegate.debugLogger,methodName + " received status=" + status );
+
+ return;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.mso.MsoRestInterfaceIfc#Delete(java.lang.Object, org.openecomp.vid.mso.rest.RequestDetails, java.lang.String, java.lang.String, org.openecomp.vid.mso.RestObject)
+ */
+ @SuppressWarnings("unchecked")
+ public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) {
+
+ String methodName = "Delete";
+ String url="";
+ Response cres = null;
+
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " start");
+ logRequest (r);
+
+ try {
+ initRestClient();
+
+ url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + " methodName sending request to: " + url);
+
+ cres = client.target(url)
+ .request()
+ .accept("application/json")
+ .headers(commonHeaders)
+ //.entity(r)
+ .build("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON)).invoke();
+ // .method("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON));
+ //.delete(Entity.entity(r, MediaType.APPLICATION_JSON));
+
+ int status = cres.getStatus();
+ restObject.setStatusCode (status);
+
+ if (status == 404) { // resource not found
+ String msg = "Resource does not exist...: " + cres.getStatus();
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);
+ } else if (status == 200 || status == 204){
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + "Resource " + url + " deleted");
+ } else if (status == 202) {
+ String msg = "Delete in progress: " + status;
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);
+ }
+ else {
+ String msg = "Deleting Resource failed: " + status;
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + msg);
+ }
+
+ try {
+ t = (T) cres.readEntity(t.getClass());
+ restObject.set(t);
+ }
+ catch ( Exception e ) {
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " No response entity, this is probably ok, e="
+ + e.getMessage());
+ }
+
+ }
+ catch (Exception e)
+ {
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with url="+url+ ", Exception: " + e.toString());
+ throw e;
+
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.mso.MsoRestInterfaceIfc#Post(java.lang.Object, org.openecomp.vid.mso.rest.RequestDetails, java.lang.String, java.lang.String, org.openecomp.vid.mso.RestObject)
+ */
+ @SuppressWarnings("unchecked")
+ public <T> void Post(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) throws Exception {
+
+ String methodName = "Post";
+ String url="";
+
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " start");
+
+ logRequest (r);
+ try {
+
+ initRestClient();
+
+ url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL) + path;
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " sending request to url= " + url);
+ // Change the content length
+ final Response cres = client.target(url)
+ .request()
+ .accept("application/json")
+ .headers(commonHeaders)
+ //.header("content-length", 201)
+ //.header("X-FromAppId", sourceID)
+ .post(Entity.entity(r, MediaType.APPLICATION_JSON));
+
+ try {
+ t = (T) cres.readEntity(t.getClass());
+ restObject.set(t);
+ }
+ catch ( Exception e ) {
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " No response entity, this is probably ok, e="
+ + e.getMessage());
+ }
+
+ int status = cres.getStatus();
+ restObject.setStatusCode (status);
+
+ if ( status >= 200 && status <= 299 ) {
+ logger.info(EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!");
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " REST api POST was successful!");
+
+ } else {
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with status="+status+", url="+url);
+ }
+
+ } catch (Exception e)
+ {
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " with url="+url+ ", Exception: " + e.toString());
+ throw e;
+
+ }
+ }
+
+
+ /**
+ * Gets the single instance of MsoRestInterface.
+ *
+ * @param <T> the generic type
+ * @param clazz the clazz
+ * @return single instance of MsoRestInterface
+ * @throws IllegalAccessException the illegal access exception
+ * @throws InstantiationException the instantiation exception
+ */
+ public <T> T getInstance(Class<T> clazz) throws IllegalAccessException, InstantiationException
+ {
+ return clazz.newInstance();
+ }
+
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceFactory.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceFactory.java
new file mode 100755
index 0000000..8bb3093
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceFactory.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.mso;
+
+import org.openecomp.portalsdk.core.util.SystemProperties;
+
+/**
+ * A factory for creating MsoRestInterface objects.
+ */
+public class MsoRestInterfaceFactory {
+
+ /**
+ * Gets the single instance of MsoRestInterfaceFactory.
+ *
+ * @return single instance of MsoRestInterfaceFactory
+ */
+ public static MsoRestInterfaceIfc getInstance () {
+ MsoRestInterfaceIfc obj = null;
+
+// String mso_dme2_enabled = SystemProperties.getProperty(MsoProperties.MSO_DME2_ENABLED);
+// if ( (mso_dme2_enabled != null) && (mso_dme2_enabled.equalsIgnoreCase("true") ) ) {
+// obj = new MsoDme2RestInterface();
+// }
+// else {
+ obj = new MsoRestInterface();
+// }
+ return ( obj );
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceIfc.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceIfc.java
new file mode 100755
index 0000000..b0dc906
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoRestInterfaceIfc.java
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.mso;
+
+import org.openecomp.vid.mso.rest.RequestDetails;
+
+/**
+ * The Interface MsoRestInterfaceIfc.
+ */
+public interface MsoRestInterfaceIfc {
+
+ /**
+ * Inits the rest client.
+ */
+ public void initRestClient();
+
+ /**
+ * Gets the.
+ *
+ * @param <T> the generic type
+ * @param t the t
+ * @param sourceId the source id
+ * @param path the path
+ * @param restObject the rest object
+ * @throws Exception the exception
+ */
+ public <T> void Get (T t, String sourceId, String path, RestObject<T> restObject ) throws Exception;
+
+ /**
+ * Delete.
+ *
+ * @param <T> the generic type
+ * @param t the t
+ * @param r the r
+ * @param sourceID the source ID
+ * @param path the path
+ * @param restObject the rest object
+ * @throws Exception the exception
+ */
+ public <T> void Delete(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) throws Exception;
+
+ /**
+ * Post.
+ *
+ * @param <T> the generic type
+ * @param t the t
+ * @param r the r
+ * @param sourceID the source ID
+ * @param path the path
+ * @param restObject the rest object
+ * @throws Exception the exception
+ */
+ public <T> void Post(T t, RequestDetails r, String sourceID, String path, RestObject<T> restObject) throws Exception;
+
+ /**
+ * Log request.
+ *
+ * @param r the r
+ */
+ public void logRequest ( RequestDetails r );
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoUtil.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoUtil.java
new file mode 100755
index 0000000..2c0148b
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/mso/MsoUtil.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.mso;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.glassfish.jersey.client.ClientResponse;
+
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+import org.openecomp.vid.controller.MsoController;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/**
+ * The Class MsoUtil.
+ */
+public class MsoUtil {
+
+ /** The logger. */
+ private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MsoController.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+
+ /**
+ * Wrap response.
+ *
+ * @param body the body
+ * @param statusCode the status code
+ * @return the mso response wrapper
+ */
+ public static MsoResponseWrapper wrapResponse ( String body, int statusCode ) {
+
+ MsoResponseWrapper w = new MsoResponseWrapper();
+ w.setStatus (statusCode);
+ w.setEntity(body);
+
+ return w;
+ }
+
+ /**
+ * Wrap response.
+ *
+ * @param cres the cres
+ * @return the mso response wrapper
+ */
+ public static MsoResponseWrapper wrapResponse (ClientResponse cres) {
+ String resp_str = "";
+ if ( cres != null ) {
+ resp_str = cres.readEntity(String.class);
+ }
+ int statuscode = cres.getStatus();
+ MsoResponseWrapper w = MsoUtil.wrapResponse ( resp_str, statuscode );
+ return (w);
+ }
+
+ /**
+ * Wrap response.
+ *
+ * @param rs the rs
+ * @return the mso response wrapper
+ */
+ public static MsoResponseWrapper wrapResponse (RestObject<String> rs) {
+ String resp_str = "";
+ int status = 0;
+ if ( rs != null ) {
+ resp_str = rs.get();
+ status = rs.getStatusCode();
+ }
+ MsoResponseWrapper w = MsoUtil.wrapResponse ( resp_str, status );
+ return (w);
+ }
+
+ /**
+ * Convert pojo to string.
+ *
+ * @param <T> the generic type
+ * @param t the t
+ * @return the string
+ * @throws JsonProcessingException the json processing exception
+ */
+ public static <T> String convertPojoToString ( T t ) throws com.fasterxml.jackson.core.JsonProcessingException {
+
+ String methodName = "convertPojoToString";
+ ObjectMapper mapper = new ObjectMapper();
+ String r_json_str = "";
+ if ( t != null ) {
+ try {
+ r_json_str = mapper.writeValueAsString(t);
+ }
+ catch ( com.fasterxml.jackson.core.JsonProcessingException j ) {
+ logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Unable to parse object as json");
+ }
+ }
+ return (r_json_str);
+ }
+
+ /**
+ * The main method.
+ *
+ * @param args the arguments
+ */
+ public static void main(String[] args) {
+ // TODO Auto-generated method stub
+
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/RestObject.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/RestObject.java
new file mode 100755
index 0000000..881409e
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/mso/RestObject.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.mso;
+
+/**
+ * The Class RestObject.
+ *
+ * @param <T> the generic type
+ */
+public class RestObject<T> {
+
+ /**
+ * Generic version of the RestObject class.
+ *
+ */
+ // T stands for "Type"
+ private T t;
+
+ /** The status code. */
+ private int statusCode= 0;
+
+ /**
+ * Sets the.
+ *
+ * @param t the t
+ */
+ public void set(T t) { this.t = t; }
+
+ /**
+ * Gets the.
+ *
+ * @return the t
+ */
+ public T get() { return t; }
+
+ /**
+ * Sets the status code.
+ *
+ * @param v the new status code
+ */
+ public void setStatusCode(int v) { this.statusCode = v; }
+
+ /**
+ * Gets the status code.
+ *
+ * @return the status code
+ */
+ public int getStatusCode() { return this.statusCode; }
+}
+
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/AsyncRequestStatus.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/AsyncRequestStatus.java
new file mode 100755
index 0000000..1395f9a
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/AsyncRequestStatus.java
@@ -0,0 +1,123 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.mso.rest;
+
+//import java.util.HashMap;
+//import java.util.Map;
+//import javax.annotation.Generated;
+
+import org.openecomp.vid.domain.mso.InstanceIds;
+import org.openecomp.vid.domain.mso.RequestStatus;
+//import com.fasterxml.jackson.annotation.JsonAnyGetter;
+//import com.fasterxml.jackson.annotation.JsonAnySetter;
+//import com.fasterxml.jackson.annotation.JsonCreator;
+//import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+//import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+//import com.fasterxml.jackson.annotation.JsonValue;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+
+/**
+ * request structure.
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+
+public class AsyncRequestStatus extends org.openecomp.vid.domain.mso.AsyncRequestStatus {
+
+
+ /** The instance ids. */
+ private InstanceIds instanceIds;
+
+ /** The request status. */
+ private RequestStatus requestStatus;
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.AsyncRequestStatus#getInstanceIds()
+ */
+ public InstanceIds getInstanceIds() {
+ return instanceIds;
+ }
+
+ /**
+ * Sets the instance ids.
+ *
+ * @param instanceIds the new instance ids
+ */
+ public void setInstanceIds(InstanceIds instanceIds) {
+ this.instanceIds = instanceIds;
+ }
+
+
+ /**
+ * (Required).
+ *
+ * @return The requestStatus
+ */
+ @JsonProperty("requestStatus")
+ public RequestStatus getRequestStatus() {
+ return requestStatus;
+ }
+
+ /**
+ * (Required).
+ *
+ * @param requestStatus The requestStatus
+ */
+ @JsonProperty("requestStatus")
+ public void setRequestStatus(RequestStatus requestStatus) {
+ this.requestStatus = requestStatus;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.AsyncRequestStatus#toString()
+ */
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.AsyncRequestStatus#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(getCorrelator()).append(getFinishTime()).append(instanceIds).append(getRequestId()).append(getRequestScope()).append(getRequestStatus()).append(getRequestType()).append(getStartTime()).append(getAdditionalProperties()).toHashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.AsyncRequestStatus#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof AsyncRequestStatus) == false) {
+ return false;
+ }
+ AsyncRequestStatus rhs = ((AsyncRequestStatus) other);
+ return new EqualsBuilder().append(getCorrelator(), rhs.getCorrelator()).append(getFinishTime(), rhs.getFinishTime()).append(instanceIds, rhs.instanceIds).append(getRequestId(), rhs.getRequestId()).append(getRequestScope(), rhs.getRequestScope()).append(getRequestStatus(), rhs.getRequestStatus()).append(getRequestType(), rhs.getRequestType()).append(getStartTime(), rhs.getStartTime()).append(getAdditionalProperties(), rhs.getAdditionalProperties()).isEquals();
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RelatedInstance.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RelatedInstance.java
new file mode 100755
index 0000000..b68f7c1
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RelatedInstance.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.mso.rest;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.annotation.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+
+/**
+ * modelInfo and optional instanceId and instanceName for a model related to the modelInfo being operated on.
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@Generated("org.jsonschema2pojo")
+@JsonPropertyOrder({
+ "instanceName",
+ "instanceId",
+ "modelInfo"
+})
+public class RelatedInstance extends org.openecomp.vid.domain.mso.RelatedInstance{
+
+
+ /** The model info. */
+ @JsonProperty("modelInfo")
+ private org.openecomp.vid.domain.mso.ModelInfo modelInfo;
+
+ /** The additional properties. */
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+ /**
+ * (Required).
+ *
+ * @return The modelInfo
+ */
+ @JsonProperty("modelInfo")
+ public org.openecomp.vid.domain.mso.ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ /**
+ * (Required).
+ *
+ * @param modelInfo The modelInfo
+ */
+ @JsonProperty("modelInfo")
+ public void setModelInfo(org.openecomp.vid.domain.mso.ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.RelatedInstance#toString()
+ */
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.RelatedInstance#getAdditionalProperties()
+ */
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.RelatedInstance#setAdditionalProperty(java.lang.String, java.lang.Object)
+ */
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.RelatedInstance#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(getInstanceName()).append(getInstanceId()).append(modelInfo).append(additionalProperties).toHashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.RelatedInstance#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof RelatedInstance) == false) {
+ return false;
+ }
+ RelatedInstance rhs = ((RelatedInstance) other);
+ return new EqualsBuilder().append(getInstanceName(), rhs.getInstanceName()).append(getInstanceId(), rhs.getInstanceId()).append(modelInfo, rhs.getModelInfo()).append(additionalProperties, rhs.additionalProperties).isEquals();
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RelatedModel.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RelatedModel.java
new file mode 100755
index 0000000..dc67a94
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RelatedModel.java
@@ -0,0 +1,121 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.mso.rest;
+
+import java.util.HashMap;
+import java.util.Map;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+
+/**
+ * modelInfo and optional instance id for a model related to the modelInfo being operated on.
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "instanceId",
+ "modelInfo"
+})
+public class RelatedModel extends org.openecomp.vid.domain.mso.RelatedModel {
+
+ /** (Required). */
+ @JsonProperty("modelInfo")
+ private org.openecomp.vid.domain.mso.ModelInfo modelInfo;
+
+ /** The additional properties. */
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+ /**
+ * (Required).
+ *
+ * @return The modelInfo
+ */
+ @JsonProperty("modelInfo")
+ public org.openecomp.vid.domain.mso.ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ /**
+ * (Required).
+ *
+ * @param modelInfo The modelInfo
+ */
+ @JsonProperty("modelInfo")
+ public void setModelInfo(org.openecomp.vid.domain.mso.ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.RelatedModel#toString()
+ */
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.RelatedModel#getAdditionalProperties()
+ */
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.RelatedModel#setAdditionalProperty(java.lang.String, java.lang.Object)
+ */
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.RelatedModel#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(getInstanceId()).append(modelInfo).append(additionalProperties).toHashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.RelatedModel#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof RelatedModel) == false) {
+ return false;
+ }
+ RelatedModel rhs = ((RelatedModel) other);
+ return new EqualsBuilder().append(getInstanceId(), rhs.getInstanceId()).append(modelInfo, rhs.modelInfo).append(additionalProperties, rhs.additionalProperties).isEquals();
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/Request.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/Request.java
new file mode 100755
index 0000000..c8f7b8b
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/Request.java
@@ -0,0 +1,140 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.mso.rest;
+
+//import java.util.HashMap;
+//import java.util.Map;
+//import javax.annotation.Generated;
+
+import org.openecomp.vid.domain.mso.InstanceIds;
+import org.openecomp.vid.domain.mso.RequestStatus;
+//import com.fasterxml.jackson.annotation.JsonAnyGetter;
+//import com.fasterxml.jackson.annotation.JsonAnySetter;
+//import com.fasterxml.jackson.annotation.JsonCreator;
+//import com.fasterxml.jackson.annotation.JsonIgnore;
+//import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+//import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+//import com.fasterxml.jackson.annotation.JsonValue;
+import org.apache.commons.lang.builder.EqualsBuilder;
+//import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+
+/**
+ * request structure.
+ */
+public class Request extends org.openecomp.vid.domain.mso.Request {
+
+
+ /** The instance ids. */
+ private InstanceIds instanceIds;
+
+ /** The request details. */
+ private RequestDetails requestDetails;
+
+ /** The request status. */
+ private RequestStatus requestStatus;
+
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.Request#getInstanceIds()
+ */
+ @JsonProperty("instanceIds")
+ public InstanceIds getInstanceIds() {
+ return instanceIds;
+ }
+
+ /**
+ * Sets the instance ids.
+ *
+ * @param instanceIds The instanceIds
+ */
+ @JsonProperty("instanceIds")
+ public void setInstanceIds(InstanceIds instanceIds) {
+ this.instanceIds = instanceIds;
+ }
+
+ /**
+ * (Required).
+ *
+ * @return The requestDetails
+ */
+ @JsonProperty("requestDetails")
+ public RequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+
+ /**
+ * (Required).
+ *
+ * @param requestDetails The requestDetails
+ */
+ @JsonProperty("requestDetails")
+ public void setRequestDetails(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+
+
+ /**
+ * Gets the request status.
+ *
+ * @return The requestStatus
+ */
+ @JsonProperty("requestStatus")
+ public RequestStatus getRequestStatus() {
+ return requestStatus;
+ }
+
+ /**
+ * Sets the request status.
+ *
+ * @param requestStatus The requestStatus
+ */
+ @JsonProperty("requestStatus")
+ public void setRequestStatus(RequestStatus requestStatus) {
+ this.requestStatus = requestStatus;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.Request#toString()
+ */
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.Request#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof Request) == false) {
+ return false;
+ }
+ Request rhs = ((Request) other);
+ return new EqualsBuilder().append(getFinishTime(), rhs.getFinishTime()).append(getInstanceIds(), rhs.getInstanceIds()).append(getRequestDetails(), rhs.getRequestDetails()).append(getRequestId(), rhs.getRequestId()).append(getRequestScope(), rhs.getRequestScope()).append(getRequestStatus(), rhs.getRequestStatus()).append(getRequestType(), rhs.getRequestType()).append(getStartTime(), rhs.getStartTime()).append(getAdditionalProperties(), rhs.getAdditionalProperties()).isEquals();
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RequestDetails.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RequestDetails.java
new file mode 100755
index 0000000..6e7c5af
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RequestDetails.java
@@ -0,0 +1,233 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.mso.rest;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.List;
+//import javax.annotation.Generated;
+
+import org.openecomp.vid.domain.mso.CloudConfiguration;
+import org.openecomp.vid.domain.mso.ModelInfo;
+import org.openecomp.vid.domain.mso.RequestInfo;
+import org.openecomp.vid.domain.mso.RequestParameters;
+import org.openecomp.vid.domain.mso.SubscriberInfo;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+
+
+/**
+ * aggregates the context, configuraiton and detailed parameters associated with the request into a single structure.
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "cloudConfiguration",
+ "modelInfo",
+ "relatedModelList",
+ "requestInfo",
+ "subscriberInfo",
+ "requestParameters"
+})
+public class RequestDetails extends org.openecomp.vid.domain.mso.RequestDetails {
+
+ /** The cloud configuration. */
+ @JsonProperty("cloudConfiguration")
+ private CloudConfiguration cloudConfiguration;
+
+ /** The model info. */
+ @JsonProperty("modelInfo")
+ private ModelInfo modelInfo;
+
+ /** The related model list. */
+ @JsonProperty("relatedModelList")
+ private List<RelatedModel> relatedModelList;
+
+ /** The request info. */
+ @JsonProperty("requestInfo")
+ private RequestInfo requestInfo;
+
+ /** The subscriber info. */
+ @JsonProperty("subscriberInfo")
+ private SubscriberInfo subscriberInfo;
+
+ /** The request parameters. */
+ @JsonProperty("requestParameters")
+ private RequestParameters requestParameters;
+
+ /** The additional properties. */
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+ /**
+ * Gets the cloud configuration.
+ *
+ * @return The cloudConfiguration
+ */
+ @JsonProperty("cloudConfiguration")
+ public CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+ /**
+ * Sets the cloud configuration.
+ *
+ * @param cloudConfiguration The cloudConfiguration
+ */
+ @JsonProperty("cloudConfiguration")
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+ /**
+ * Gets the model info.
+ *
+ * @return The modelInfo
+ */
+ @JsonProperty("modelInfo")
+ public ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+ /**
+ * Sets the model info.
+ *
+ * @param modelInfo The modelInfo
+ */
+ @JsonProperty("modelInfo")
+ public void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+ /**
+ * Gets the related model list.
+ *
+ * @return The relatedModelList
+ */
+ @JsonProperty("relatedModelList")
+ public List<RelatedModel> getRelatedModelList() {
+ return relatedModelList;
+ }
+
+ /**
+ * Sets the related model list.
+ *
+ * @param relatedModelList The relatedModelList
+ */
+ @JsonProperty("relatedModelList")
+ public void setRelatedModelList( List<RelatedModel> relatedModelList) {
+ this.relatedModelList = relatedModelList;
+ }
+
+ /**
+ * Gets the request info.
+ *
+ * @return The requestInfo
+ */
+ @JsonProperty("requestInfo")
+ public RequestInfo getRequestInfo() {
+ return requestInfo;
+ }
+
+ /**
+ * Sets the request info.
+ *
+ * @param requestInfo The requestInfo
+ */
+ @JsonProperty("requestInfo")
+ public void setRequestInfo(RequestInfo requestInfo) {
+ this.requestInfo = requestInfo;
+ }
+
+ /**
+ * Gets the subscriber info.
+ *
+ * @return The subscriberInfo
+ */
+ @JsonProperty("subscriberInfo")
+ public SubscriberInfo getSubscriberInfo() {
+ return subscriberInfo;
+ }
+
+ /**
+ * Sets the subscriber info.
+ *
+ * @param subscriberInfo The subscriberInfo
+ */
+ @JsonProperty("subscriberInfo")
+ public void setSubscriberInfo(SubscriberInfo subscriberInfo) {
+ this.subscriberInfo = subscriberInfo;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.RequestDetails#toString()
+ */
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.RequestDetails#getAdditionalProperties()
+ */
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.RequestDetails#setAdditionalProperty(java.lang.String, java.lang.Object)
+ */
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.RequestDetails#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(cloudConfiguration).append(modelInfo).append(relatedModelList).append(requestInfo).append(getRequestParameters()).append(subscriberInfo).append(additionalProperties).toHashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see org.openecomp.vid.domain.mso.RequestDetails#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof RequestDetails) == false) {
+ return false;
+ }
+ RequestDetails rhs = ((RequestDetails) other);
+ return new EqualsBuilder().append(cloudConfiguration, rhs.cloudConfiguration).append(modelInfo, rhs.modelInfo).append(relatedModelList, rhs.relatedModelList).append(requestInfo, rhs.requestInfo).append(getRequestParameters(), rhs.getRequestParameters()).append(subscriberInfo, rhs.subscriberInfo).append(additionalProperties, rhs.additionalProperties).isEquals();
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RequestList.java b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RequestList.java
new file mode 100755
index 0000000..7c366ac
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/mso/rest/RequestList.java
@@ -0,0 +1,137 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.mso.rest;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.annotation.Generated;
+
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+//import com.fasterxml.jackson.annotation.JsonInclude;
+//import com.fasterxml.jackson.annotation.JsonProperty;
+//import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+import org.apache.commons.lang.builder.ToStringBuilder;
+import java.util.List;
+
+/**
+ * List of relatedModel structures that are related to a modelInfo being operated on.
+ */
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@Generated("org.jsonschema2pojo")
+@JsonPropertyOrder({
+ "finishTime",
+ "instanceIds",
+ "requestDetails",
+ "requestId",
+ "requestScope",
+ "requestStatus",
+ "requestType",
+ "startTime"
+})
+
+public class RequestList {
+
+ /** The request list. */
+ private List<Request> requestList;
+
+ /** The additional properties. */
+ @JsonIgnore
+ private Map<String, Object> additionalProperties = new HashMap<String, Object>();
+
+ /**
+ * (Required).
+ *
+ * @return The RelatedModel List
+ */
+ public List<Request> getRequestList() {
+ return requestList;
+ }
+
+ /**
+ * Sets the request list.
+ *
+ * @param l the new request list
+ */
+ public void setRequestList(List<Request> l) {
+ this.requestList = l;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return ToStringBuilder.reflectionToString(this);
+ }
+
+ /**
+ * Gets the additional properties.
+ *
+ * @return the additional properties
+ */
+ @JsonAnyGetter
+ public Map<String, Object> getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ /**
+ * Sets the additional property.
+ *
+ * @param name the name
+ * @param value the value
+ */
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(getRequestList()).append(additionalProperties).toHashCode();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof RequestList) == false) {
+ return false;
+ }
+ RequestList rhs = ((RequestList) other);
+ return new EqualsBuilder().append(getRequestList(), rhs.getRequestList()).append(additionalProperties, rhs.additionalProperties).isEquals();
+ }
+
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/properties/AsdcClientConfiguration.java b/vid-app-common/src/main/java/org/openecomp/vid/properties/AsdcClientConfiguration.java
new file mode 100755
index 0000000..6d5f952
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/properties/AsdcClientConfiguration.java
@@ -0,0 +1,116 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.properties;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
+
+/**
+ * The Class AsdcClientConfiguration.
+ */
+@Configuration
+@PropertySource(value="${container.classpath:}/WEB-INF/conf/asdc.properties")
+public class AsdcClientConfiguration {
+
+ @Bean
+ public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
+ return new PropertySourcesPlaceholderConfigurer();
+ }
+
+ @Value("${asdc.client.type}")
+ private AsdcClientType asdcClientType;
+
+ /** The asdc client host. */
+ @Value("${asdc.client.rest.host}")
+ private String asdcClientHost;
+
+ /** The asdc client port. */
+ @Value("${asdc.client.rest.port}")
+ private int asdcClientPort;
+
+ /** The asdc client auth. */
+ @Value("${asdc.client.rest.auth}")
+ public String asdcClientAuth;
+
+ /** The asdc client protocol. */
+ @Value("${asdc.client.rest.protocol}")
+ public String asdcClientProtocol;
+
+ /**
+ * Gets the asdc client type.
+ *
+ * @return the asdc client type
+ */
+ public AsdcClientType getAsdcClientType() {
+ return asdcClientType;
+ }
+
+ /**
+ * Gets the asdc client host.
+ *
+ * @return the asdc client host
+ */
+ public String getAsdcClientHost() {
+ return asdcClientHost;
+ }
+
+ /**
+ * Gets the asdc client port.
+ *
+ * @return the asdc client port
+ */
+ public int getAsdcClientPort() {
+ return asdcClientPort;
+ }
+
+ /**
+ * Gets the asdc client auth.
+ *
+ * @return the asdc client auth
+ */
+ public String getAsdcClientAuth() {
+ return asdcClientAuth;
+ }
+
+ /**
+ * Gets the asdc client protocol.
+ *
+ * @return the asdc client protocol
+ */
+ public String getAsdcClientProtocol() {
+ return asdcClientProtocol;
+ }
+
+ /**
+ * The Enum AsdcClientType.
+ */
+ public enum AsdcClientType {
+
+ /** The in memory. */
+ IN_MEMORY,
+
+ /** The rest. */
+ REST
+ }
+}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/properties/VidProperties.java b/vid-app-common/src/main/java/org/openecomp/vid/properties/VidProperties.java
new file mode 100755
index 0000000..141b9b2
--- /dev/null
+++ b/vid-app-common/src/main/java/org/openecomp/vid/properties/VidProperties.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.vid.properties;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import org.openecomp.vid.model.ModelConstants;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
+
+import org.openecomp.vid.controller.VidController;
+/**
+ * The Class VidProperties.
+ */
+public class VidProperties extends SystemProperties {
+
+ //VID General Properties
+
+ /** The Constant VID_TRUSTSTORE_FILENAME. */
+ public static final String VID_TRUSTSTORE_FILENAME = "vid.truststore.filename";
+
+ /** The Constant VID_TRUSTSTORE_PASSWD_X. */
+ public static final String VID_TRUSTSTORE_PASSWD_X = "vid.truststore.passwd.x";
+
+ /** The Constant FILESEPARATOR. */
+ public static final String FILESEPARATOR = (System.getProperty("file.separator") == null) ? "/" : System.getProperty("file.separator");
+
+ /** The Constant LOG. */
+ private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(VidController.class);
+
+ /** The Constant dateFormat. */
+ final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
+ /**
+ * Gets the asdc model namespace prefix property
+ *
+ * @return the property value or a default value
+ */
+ public static String getAsdcModelNamespace() {
+ String methodName = "getAsdcModelNamespace ";
+ String asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;
+ try {
+ asdcModelNamespace = SystemProperties.getProperty(ModelConstants.ASDC_MODEL_NAMESPACE);
+ if ( asdcModelNamespace == null || asdcModelNamespace.isEmpty()) {
+ asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;
+ }
+ }
+ catch ( Exception e ) {
+ LOG.error (EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodName + "unable to find the value, using the default "
+ + ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE);
+ asdcModelNamespace = ModelConstants.DEFAULT_ASDC_MODEL_NAMESPACE;
+ }
+ return (asdcModelNamespace);
+ }
+ /**
+ * Gets the specified property value. If the property is not defined, returns a default value.
+ *
+ * @return the property value or a default value
+ */
+ public static String getPropertyWithDefault ( String propName, String defaultValue ) {
+ String methodName = "getPropertyWithDefault ";
+ String propValue = defaultValue;
+ try {
+ propValue = SystemProperties.getProperty(propName);
+ if ( propValue == null || propValue.isEmpty()) {
+ propValue = defaultValue;
+ }
+ }
+ catch ( Exception e ) {
+ LOG.error (EELFLoggerDelegate.errorLogger, dateFormat.format(new Date()) + methodName + "unable to find the value, using the default "
+ + defaultValue);
+ propValue = defaultValue;
+ }
+ return (propValue);
+ }
+}
diff --git a/vid-app-common/src/main/resources/json/mso/asyncRequestStatus b/vid-app-common/src/main/resources/json/mso/asyncRequestStatus
new file mode 100755
index 0000000..23d2c28
--- /dev/null
+++ b/vid-app-common/src/main/resources/json/mso/asyncRequestStatus
@@ -0,0 +1,54 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "description": "request structure",
+ "properties": {
+ "correlator": {
+ "description": "Optional correlation Id originally provided with the request in requestInfo",
+ "type": "string"
+ },
+ "finishTime": {
+ "description": "Date and time the request was finished in GMT with the following sample format: Wed, 15 Oct 2014 13:01:52 GMT",
+ "type": "string"
+ },
+ "instanceIds": {},
+ "requestId": {
+ "description": "UUID for the request generated by the instantiation service",
+ "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
+ "type": "string"
+ },
+ "requestScope": {
+ "description": "short description of the entity being operated on",
+ "enum": [
+ "network",
+ "service",
+ "vfModule",
+ "vnf",
+ "volumeGroup"
+ ],
+ "type": "string"
+ },
+ "requestStatus": {},
+ "requestType": {
+ "description": "short description of the action being performed on the requestScope",
+ "enum": [
+ "createInstance",
+ "deleteInstance",
+ "replaceInstance",
+ "updateInstance"
+ ],
+ "type": "string"
+ },
+ "startTime": {
+ "description": "Date and time the request was created in GMT with the following sample format: Wed, 15 Oct 2014 13:01:52 GMT",
+ "type": "string"
+ }
+ },
+ "required": [
+ "requestId",
+ "requestScope",
+ "requestStatus",
+ "requestType",
+ "startTime"
+ ],
+ "type": "object"
+}
diff --git a/vid-app-common/src/main/resources/json/mso/cloudConfiguration b/vid-app-common/src/main/resources/json/mso/cloudConfiguration
new file mode 100755
index 0000000..eb62779
--- /dev/null
+++ b/vid-app-common/src/main/resources/json/mso/cloudConfiguration
@@ -0,0 +1,19 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "description": "fields communicating the cloud configuration in a standard way",
+ "type": "object",
+ "properties": {
+ "nodeLocation": {
+ "description": "Location identifier for the node",
+ "type": "string"
+ },
+ "lcpCloudRegionId": {
+ "description": "LCP Node Location identifier",
+ "type": "string"
+ },
+ "tenantId": {
+ "description": "Openstack tenant id",
+ "type": "string"
+ }
+ }
+}
\ No newline at end of file
diff --git a/vid-app-common/src/main/resources/json/mso/instanceIds b/vid-app-common/src/main/resources/json/mso/instanceIds
new file mode 100755
index 0000000..c20ea9a
--- /dev/null
+++ b/vid-app-common/src/main/resources/json/mso/instanceIds
@@ -0,0 +1,29 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "description": "instanceIds that may be associated with a particular request",
+ "type": "object",
+ "properties": {
+ "networkInstanceId": {
+ "description": "UUID for the network instance (if any)",
+ "type": "string"
+ },
+ "serviceInstanceId": {
+ "description": "UUID for the service instance",
+ "type": "string"
+ },
+ "vfModuleInstanceId": {
+ "description": "UUID for the vfModule instance (if any)",
+ "type": "string"
+ },
+ "vnfInstanceId": {
+ "description": "UUID for the vnf instance (if any)",
+ "type": "string"
+ },
+ "volumeGroupInstanceId": {
+ "description": "UUID for the volume group instance (if any)",
+ "type": "string"
+ }
+ }
+}
+
+
\ No newline at end of file
diff --git a/vid-app-common/src/main/resources/json/mso/modelInfo b/vid-app-common/src/main/resources/json/mso/modelInfo
new file mode 100755
index 0000000..2504d51
--- /dev/null
+++ b/vid-app-common/src/main/resources/json/mso/modelInfo
@@ -0,0 +1,41 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "description": "fields describing the SDC entity being operated on by the request",
+ "type": "object",
+ "properties": {
+ "modelCustomizationName": {
+ "description": "reference to the customized set of parameters associated with a model in a given service context",
+ "type": "string"
+ },
+ "modelInvariantId": {
+ "description": "Invariant UUID for the model name, irrespective of the version, as defined in SDC--authoritative",
+ "type": "string",
+ "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
+ },
+ "modelName": {
+ "description": "name of the model as defined in SDC--not authoritative",
+ "type": "string"
+ },
+ "modelNameVersionId": {
+ "description": "UUID for the model name and version combination as defined in SDC--authoritative",
+ "type": "string",
+ "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
+ },
+ "modelType": {
+ "description": "short description of the entity being operated on",
+ "type": "string",
+ "enum": [
+ "network",
+ "service",
+ "vfModule",
+ "vnf",
+ "volumeGroup"
+ ]
+ },
+ "modelVersion": {
+ "description": "the version of the model as defined in SDC--not authoritative",
+ "type": "number"
+ }
+ },
+ "required": ["modelType"]
+}
\ No newline at end of file
diff --git a/vid-app-common/src/main/resources/json/mso/relatedInstance b/vid-app-common/src/main/resources/json/mso/relatedInstance
new file mode 100755
index 0000000..89554a5
--- /dev/null
+++ b/vid-app-common/src/main/resources/json/mso/relatedInstance
@@ -0,0 +1,16 @@
+{
+ "description": "modelInfo and optional instanceId and instanceName for a model related to the modelInfo being operated on",
+ "type": "object",
+ "properties": {
+ "instanceName": {
+ "description": "optional name for the instance Id of the related model",
+ "type": "string"
+ },
+ "instanceId": {
+ "description": "instance Id for the related model",
+ "type": "string"
+ },
+ "modelInfo": {}
+ },
+ "required": ["modelInfo"]
+}
\ No newline at end of file
diff --git a/vid-app-common/src/main/resources/json/mso/relatedModel b/vid-app-common/src/main/resources/json/mso/relatedModel
new file mode 100755
index 0000000..a70a171
--- /dev/null
+++ b/vid-app-common/src/main/resources/json/mso/relatedModel
@@ -0,0 +1,15 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "description": "modelInfo and optional instance id for a model related to the modelInfo being operated on",
+ "type": "object",
+ "properties": {
+ "instanceId": {
+ "description": "instance Id for the related model",
+ "type": "string"
+ },
+ "modelInfo": {}
+ },
+ "required": [ "modelInfo" ]
+}
+
+
diff --git a/vid-app-common/src/main/resources/json/mso/request b/vid-app-common/src/main/resources/json/mso/request
new file mode 100755
index 0000000..3aaadbf
--- /dev/null
+++ b/vid-app-common/src/main/resources/json/mso/request
@@ -0,0 +1,45 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "description": "request structure",
+ "type": "object",
+ "properties": {
+ "finishTime": {
+ "description": "Date and time the request was finished in GMT with the following sample format: Wed, 15 Oct 2014 13:01:52 GMT",
+ "type": "string"
+ },
+ "instanceIds": {},
+ "requestDetails": {},
+ "requestId": {
+ "description": "UUID for the request generated by the instantiation service",
+ "type": "string",
+ "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
+ },
+ "requestScope": {
+ "description": "short description of the entity being operated on",
+ "type": "string",
+ "enum": [
+ "network",
+ "service",
+ "vfModule",
+ "vnf",
+ "volumeGroup"
+ ]
+ },
+ "requestStatus": {},
+ "requestType": {
+ "description": "short description of the action being performed on the requestScope",
+ "type": "string",
+ "enum": [
+ "createInstance",
+ "deleteInstance",
+ "replaceInstance",
+ "updateInstance"
+ ]
+ },
+ "startTime": {
+ "description": "Date and time the request was created in GMT with the following sample format: Wed, 15 Oct 2014 13:01:52 GMT",
+ "type": "string"
+ }
+ },
+ "required": ["requestDetails", "requestId", "requestScope", "requestType", "startTime"]
+}
\ No newline at end of file
diff --git a/vid-app-common/src/main/resources/json/mso/requestDetails b/vid-app-common/src/main/resources/json/mso/requestDetails
new file mode 100755
index 0000000..c0ef530
--- /dev/null
+++ b/vid-app-common/src/main/resources/json/mso/requestDetails
@@ -0,0 +1,13 @@
+{
+ "description": "aggregates the context, configuraiton and detailed parameters associated with the request into a single structure",
+ "properties": {
+ "cloudConfiguration": {},
+ "modelInfo": {},
+ "relatedModelList": {},
+ "requestInfo": {},
+ "requestParameters": {},
+ "subscriberInfo": {}
+ },
+ "type": "object"
+}
+
diff --git a/vid-app-common/src/main/resources/json/mso/requestError b/vid-app-common/src/main/resources/json/mso/requestError
new file mode 100755
index 0000000..497f671
--- /dev/null
+++ b/vid-app-common/src/main/resources/json/mso/requestError
@@ -0,0 +1,27 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "description": "standard request error data structure",
+ "properties": {
+ "messageId": {
+ "description": "Unique message identifier of the format ABCnnnn where ABC is either SVC for Service Exceptions or POL for Policy Exception",
+ "type": "string"
+ },
+ "text": {
+ "description": "Message text, with replacement variables marked with %n, where n is an index into the list of <variables> elements, starting at 1",
+ "type": "string"
+ },
+ "url": {
+ "description": "Hyperlink to a detailed error resource e.g., an HTML page for browser user agents",
+ "type": "string"
+ },
+ "variables": {
+ "description": "List of zero or more strings that represent the contents of the variables used by the message text",
+ "type": "string"
+ }
+ },
+ "required": [
+ "messageId",
+ "text"
+ ],
+ "type": "object"
+}
diff --git a/vid-app-common/src/main/resources/json/mso/requestInfo b/vid-app-common/src/main/resources/json/mso/requestInfo
new file mode 100755
index 0000000..56db42f
--- /dev/null
+++ b/vid-app-common/src/main/resources/json/mso/requestInfo
@@ -0,0 +1,44 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "description": "fields providing general context information for the request",
+ "properties": {
+ "billingAccountNumber": {
+ "description": "billing account associated with the model being operated on",
+ "type": "string"
+ },
+ "callbackUrl": {
+ "description": "client URL to use for asynchronous responses",
+ "type": "string"
+ },
+ "correlator": {
+ "description": "Optional correlationId for async callback requests",
+ "type": "string"
+ },
+ "instanceName": {
+ "description": "Client provided name for the instance being operated on by the operation (note: not guaranteed to be unique)",
+ "type": "string"
+ },
+ "orderNumber": {
+ "description": "reference to an order",
+ "type": "string"
+ },
+ "orderVersion": {
+ "description": "order version number",
+ "type": "number"
+ },
+ "productFamilyId": {
+ "description": "UUID for the product family associated with the model being operated on",
+ "type": "string"
+ },
+ "source": {
+ "description": "source of the request--not authoritative--actual source revealed via authentication",
+ "type": "string"
+ },
+ "suppressRollback": {
+ "description": "true or false boolean indicating whether rollbacks should be suppressed on failures",
+ "type": "boolean"
+ }
+ },
+
+ "type": "object"
+}
\ No newline at end of file
diff --git a/vid-app-common/src/main/resources/json/mso/requestParameters b/vid-app-common/src/main/resources/json/mso/requestParameters
new file mode 100755
index 0000000..010d787
--- /dev/null
+++ b/vid-app-common/src/main/resources/json/mso/requestParameters
@@ -0,0 +1,23 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "subscriptionServiceType": {
+ "type": "string"
+ },
+ "userParams": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": {
+ "type": "string"
+ },
+ "value": {
+ "type": "string"
+ }
+ }
+ }
+ }
+ }
+ }
\ No newline at end of file
diff --git a/vid-app-common/src/main/resources/json/mso/requestReferences b/vid-app-common/src/main/resources/json/mso/requestReferences
new file mode 100755
index 0000000..30f6411
--- /dev/null
+++ b/vid-app-common/src/main/resources/json/mso/requestReferences
@@ -0,0 +1,18 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "description": "provides the instanceId and requestId associated with the request",
+ "type": "object",
+ "properties": {
+ "instanceId": {
+ "description": "UUID for the service instance",
+ "type": "string",
+ "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
+ },
+ "requestId": {
+ "description": "UUID for the request",
+ "type": "string",
+ "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
+ }
+ },
+ "required": [ "instanceId", "requestId" ]
+}
diff --git a/vid-app-common/src/main/resources/json/mso/requestStatus b/vid-app-common/src/main/resources/json/mso/requestStatus
new file mode 100755
index 0000000..9eacb6b
--- /dev/null
+++ b/vid-app-common/src/main/resources/json/mso/requestStatus
@@ -0,0 +1,37 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "description": "fields describing the status of a request",
+ "properties": {
+ "percentProgress": {
+ "description": "percentage complete estimate from 0 to 100",
+ "type": "number"
+ },
+ "requestState": {
+ "description": "short description of the instantiation state",
+ "enum": [
+ "complete",
+ "failed",
+ "inProgress"
+ ],
+ "type": "string"
+ },
+ "statusMessage": {
+ "description": "additional descriptive information about the status",
+ "type": "string"
+ },
+ "timestamp": {
+ "description": "GMT Datetime the requestStatus was created e.g.: Wed, 15 Oct 2014 13:01:52 GMT",
+ "type": "string"
+ },
+ "wasRolledBack": {
+ "description": "true or false boolean indicating whether the request was rolled back",
+ "type": "boolean"
+ }
+
+ },
+ "required": [
+ "requestState",
+ "timestamp"
+ ],
+ "type": "object"
+}
diff --git a/vid-app-common/src/main/resources/json/mso/response b/vid-app-common/src/main/resources/json/mso/response
new file mode 100755
index 0000000..fa37d2d
--- /dev/null
+++ b/vid-app-common/src/main/resources/json/mso/response
@@ -0,0 +1,13 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "description": "response structure",
+ "type": "object",
+ "code": {
+ "description": "Return code",
+ "type": "string"
+ },
+ "message": {
+ "description": "Result message",
+ "type": "string"
+ }
+}
\ No newline at end of file
diff --git a/vid-app-common/src/main/resources/json/mso/subscriberInfo b/vid-app-common/src/main/resources/json/mso/subscriberInfo
new file mode 100755
index 0000000..df78737
--- /dev/null
+++ b/vid-app-common/src/main/resources/json/mso/subscriberInfo
@@ -0,0 +1,19 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "description": "fields providing information about the subscriber associated with the request",
+ "type": "object",
+ "properties": {
+ "globalSubscriberId": {
+ "description": "global Customer Id understood by A&AI",
+ "type": "string"
+ },
+ "subscriberCommonSiteId": {
+ "description": "id representing the location of the subscriber",
+ "type": "string"
+ },
+ "subscriberName": {
+ "description": "name of the customer or subscriber",
+ "type": "string"
+ }
+ }
+}
\ No newline at end of file
diff --git a/vid-app-common/src/main/webapp/META-INF/MANIFEST.MF b/vid-app-common/src/main/webapp/META-INF/MANIFEST.MF
new file mode 100755
index 0000000..5e94951
--- /dev/null
+++ b/vid-app-common/src/main/webapp/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
diff --git a/vid-app-common/src/main/webapp/WEB-INF/defs/definitions.xml b/vid-app-common/src/main/webapp/WEB-INF/defs/definitions.xml
new file mode 100755
index 0000000..0355f66
--- /dev/null
+++ b/vid-app-common/src/main/webapp/WEB-INF/defs/definitions.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE tiles-definitions PUBLIC
+ "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
+ "http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
+<tiles-definitions>
+
+ <definition extends="ebz_template" name="viewlog">
+ <put-attribute name="body" value="/WEB-INF/jsp/viewlog.jsp"></put-attribute>
+ <put-attribute name="viewName" value="viewlog"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="serviceModels">
+ <put-attribute name="body" value="/WEB-INF/jsp/serviceModels.jsp"></put-attribute>
+ <put-attribute name="viewName" value="serviceModels"></put-attribute>
+ </definition>
+
+
+ <definition extends="ebz_template" name="createnewserviceinstance">
+ <put-attribute name="body" value="/WEB-INF/jsp/createnewserviceinstance.jsp"></put-attribute>
+ <put-attribute name="viewName" value="createnewserviceinstance"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="welcome">
+ <put-attribute name="body" value="/WEB-INF/jsp/welcome.jsp"></put-attribute>
+ <put-attribute name="viewName" value="welcome"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="searchexistingsi">
+ <put-attribute name="body" value="/WEB-INF/jsp/searchexistingsi.jsp"></put-attribute>
+ <put-attribute name="viewName" value="searchexistingsi"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="subscriberdetails">
+ <put-attribute name="body" value="/WEB-INF/jsp/subscriberdetails.jsp"></put-attribute>
+ <put-attribute name="viewName" value="subscriberdetails"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="testMso">
+ <put-attribute name="body" value="/WEB-INF/jsp/testMso.jsp"></put-attribute>
+ <put-attribute name="viewName" value="testMso"></put-attribute>
+ </definition>
+ <definition extends="ebz_template" name="testViewEdit">
+ <put-attribute name="body" value="/WEB-INF/jsp/testViewEdit.jsp"></put-attribute>
+ <put-attribute name="viewName" value="testViewEdit"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="subscriberSearch">
+ <put-attribute name="body" value="/WEB-INF/jsp/subscriberSearch.jsp"></put-attribute>
+ <put-attribute name="viewName" value="subscriberSearch"></put-attribute>
+ </definition>
+
+
+</tiles-definitions>
diff --git a/vid-app-common/src/main/webapp/WEB-INF/fusion/defs/definitions.xml b/vid-app-common/src/main/webapp/WEB-INF/fusion/defs/definitions.xml
new file mode 100755
index 0000000..3d4c701
--- /dev/null
+++ b/vid-app-common/src/main/webapp/WEB-INF/fusion/defs/definitions.xml
@@ -0,0 +1,279 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE tiles-definitions PUBLIC
+ "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
+ "http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
+
+<!-- This tiles definitions file is fusion/defs/definitions.xml. It maps
+ tokens used by SDK-core controllers to JSP file paths. To minimize upgrade
+ effort, this file should not be changed by on-boarding applications. -->
+
+<tiles-definitions>
+
+ <definition name="ebz_template" template="/WEB-INF/fusion/jsp/ebz_template.jsp">
+ <put-attribute name="title" value=""></put-attribute>
+ <put-attribute name="header"
+ value="/WEB-INF/fusion/jsp/ebz/ebz_header.jsp"></put-attribute>
+ <put-attribute name="body" value=""></put-attribute>
+ <put-attribute name="footer"
+ value="/WEB-INF/fusion/jsp/ebz/ebz_footer.jsp"></put-attribute>
+ </definition>
+
+ <definition name="ebz_template_noheader_nofooter"
+ template="/WEB-INF/fusion/jsp/ebz_template_noheader_nofooter.jsp">
+ <put-attribute name="body" value=""></put-attribute>
+ </definition>
+
+ <definition name="ebz_template_report_embedded"
+ template="/WEB-INF/fusion/jsp/ebz_template_report_embedded.jsp">
+ <put-attribute name="body" value=""></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="es_search_demo">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/es_search_demo.jsp"></put-attribute>
+ <put-attribute name="viewName" value="elastic_search"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="es_suggest_demo">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/es_suggest_demo.jsp"></put-attribute>
+ <put-attribute name="viewName" value="elastic_search"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="user_profile">
+ <put-attribute name="body" value="/WEB-INF/jsp/user_profile.jsp"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="profile_search">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/profile_search.jsp"></put-attribute>
+ <put-attribute name="viewName" value="profile_search"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="profile">
+ <put-attribute name="body" value="/WEB-INF/fusion/jsp/profile.jsp"></put-attribute>
+ <put-attribute name="viewName" value="profile"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="menu">
+ <put-attribute name="body" value="/WEB-INF/jsp/menu.jsp"></put-attribute>
+ <put-attribute name="viewName" value="menu"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="viewlog">
+ <put-attribute name="body" value="/WEB-INF/jsp/viewlog.jsp"></put-attribute>
+ <put-attribute name="viewName" value="viewlog"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="serviceModels">
+ <put-attribute name="body" value="/WEB-INF/jsp/serviceModels.jsp"></put-attribute>
+ <put-attribute name="viewName" value="serviceModels"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="createnewserviceinstance">
+ <put-attribute name="body" value="/WEB-INF/jsp/createnewserviceinstance.jsp"></put-attribute>
+ <put-attribute name="viewName" value="createnewserviceinstance"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="searchexistingsi">
+ <put-attribute name="body" value="/WEB-INF/jsp/searchexistingsi.jsp"></put-attribute>
+ <put-attribute name="viewName" value="searchexistingsi"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="subscriberdetails">
+ <put-attribute name="body" value="/WEB-INF/jsp/subscriberdetails.jsp"></put-attribute>
+ <put-attribute name="viewName" value="subscriberdetails"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="testMso">
+ <put-attribute name="body" value="/WEB-INF/jsp/testMso.jsp"></put-attribute>
+ <put-attribute name="viewName" value="testMso"></put-attribute>
+ </definition>
+ <definition extends="ebz_template" name="testViewEdit">
+ <put-attribute name="body" value="/WEB-INF/jsp/testViewEdit.jsp"></put-attribute>
+ <put-attribute name="viewName" value="testViewEdit"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="subscriberSearch">
+ <put-attribute name="body" value="/WEB-INF/jsp/subscriberSearch.jsp"></put-attribute>
+ <put-attribute name="viewName" value="subscriberSearch"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="role_list">
+ <put-attribute name="body" value="/WEB-INF/fusion/jsp/role_list.jsp"></put-attribute>
+ <put-attribute name="viewName" value="role_list"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="role">
+ <put-attribute name="body" value="/WEB-INF/fusion/jsp/role.jsp"></put-attribute>
+ <put-attribute name="viewName" value="role"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="role_function_list">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/role_function_list.jsp"></put-attribute>
+ <put-attribute name="viewName" value="role_function_list"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="post_search">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/post_search.jsp"></put-attribute>
+ <put-attribute name="viewName" value="post_search"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="error">
+ <put-attribute name="body" value="/WEB-INF/jsp/error.jsp"></put-attribute>
+ <put-attribute name="viewName" value="error"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="collaborate_list">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/collaborateList.jsp"></put-attribute>
+ </definition>
+
+ <!-- <definition extends="ebz_template" name="notebook">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/notebook.jsp"></put-attribute>
+ </definition> -->
+
+ <definition name="notebook"
+ template="app/fusion/notebook-integration/scripts/view-models/notebook.htm" />
+
+
+ <definition name="nbooktest"
+ template="app/fusion/notebook-integration/scripts/view-models/notebook-frame.html"/>
+
+
+ <definition extends="ebz_template" name="jcs_admin">
+ <put-attribute name="body" value="/WEB-INF/fusion/jsp/jcs_admin.jsp"></put-attribute>
+ <put-attribute name="viewName" value="jcs_admin"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="usage_list">
+ <put-attribute name="body" value="/WEB-INF/fusion/jsp/usage_list.jsp"></put-attribute>
+ <put-attribute name="viewName" value="usage_list"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="broadcast_list">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/broadcast_list.jsp"></put-attribute>
+ <put-attribute name="viewName" value="broadcast_list"></put-attribute>
+ </definition>
+ <definition extends="ebz_template" name="broadcast">
+ <put-attribute name="body" value="/WEB-INF/fusion/jsp/broadcast.jsp"></put-attribute>
+ <put-attribute name="viewName" value="broadcast"></put-attribute>
+ </definition>
+
+
+ <definition extends="ebz_template" name="chart_wizard">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/chart_wizard.jsp"></put-attribute>
+ <put-attribute name="viewName" value="chart_wizard"></put-attribute>
+ </definition>
+
+ <!-- <definition extends="ebz_template_noheader_nofooter" name="collaboration">
+ <put-attribute name="body" value="/WEB-INF/fusion/jsp/webrtc/collaboration.jsp"></put-attribute>
+ </definition> -->
+ <definition name="collaboration"
+ template="/WEB-INF/fusion/jsp/webrtc/collaboration.jsp" />
+ <definition name="user_profile_list"
+ template="/app/fusion/scripts/view-models/admin-page/profile.html" />
+ <definition name="admin"
+ template="/app/fusion/scripts/view-models/admin-page/admin.html" />
+ <definition name="workflows"
+ template="/app/fusion/scripts/view-models/workflows/workflow-landing.html" />
+ <definition name="report_dashboard"
+ template="/app/fusion/scripts/view-models/reportdashboard-page/src/report-dashboard.html" />
+
+ <definition name="ds2_sample" template="/app/fusionapp/scripts/DS2-view-models/sampleDS2.html" />
+
+
+ <definition extends="ebz_template" name="report_wizard">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/report_wizard.jsp"></put-attribute>
+ <put-attribute name="viewName" value="report_wizard"></put-attribute>
+ </definition>
+ <definition extends="ebz_template" name="wizard_schedule_only">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/wizard_schedule_only.jsp"></put-attribute>
+ <put-attribute name="viewName" value="wizard_schedule_only"></put-attribute>
+ </definition>
+
+ <definition extends="ebz_template" name="report_import">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/report_import.jsp"></put-attribute>
+ <put-attribute name="viewName" value="report_import"></put-attribute>
+ </definition>
+
+
+ <definition extends="ebz_template" name="report">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/report_ebz.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_report_embedded" name="report_embedded">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/report_ebz.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template" name="report_sample">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/report_sample.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="test_run_sql">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/test_run_sql.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="date_start_field_run_sql">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/date_start_field_run_sql.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="date_end_field_run_sql">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/date_end_field_run_sql.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="test_field_run_sql">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/test_field_run_sql.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="default_field_run_sql">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/default_field_run_sql.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="popup_testrun_sql">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/popup_testrun_sql.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="popup_semaphore">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/popup_semaphore.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="popup_import_semaphore">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/popup_import_semaphore.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="popup_table_cols">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/popup_table_cols.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="popup_drill_down_report">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/popup_drill_down_report.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template_noheader_nofooter" name="popup_sql">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/popup_sql.jsp"></put-attribute>
+ </definition>
+ <definition extends="ebz_template" name="error_page">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/raptor/error_page.jsp"></put-attribute>
+ </definition>
+ <definition name="data_out" template="/WEB-INF/fusion/jsp/data_out.jsp" />
+
+ <definition extends="ebz_template" name="frame_insert">
+ <put-attribute name="body"
+ value="/WEB-INF/fusion/jsp/frame_insert.jsp"></put-attribute>
+ </definition>
+
+ <!-- <definition name="test_field_run_sql" template="/WEB-INF/fusion/raptor/test_field_run_sql.jsp"/>
+ <definition name="popup_testrun_sql" template="/WEB-INF/fusion/raptor/popup_testrun_sql.jsp"/> -->
+
+</tiles-definitions>
diff --git a/vid-app-common/src/main/webapp/WEB-INF/web.xml b/vid-app-common/src/main/webapp/WEB-INF/web.xml
new file mode 100755
index 0000000..7f0a40e
--- /dev/null
+++ b/vid-app-common/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:web="http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
+ version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee">
+
+ <display-name>vid-common</display-name>
+
+ <!-- The app can function on a HA cluster -->
+ <distributable />
+
+ <session-config>
+ <session-timeout>7</session-timeout>
+ <tracking-mode>COOKIE</tracking-mode>
+ </session-config>
+
+</web-app>
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/7450-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/7450-icon.png
new file mode 100755
index 0000000..52ab2b5
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/7450-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/7450-text.png b/vid-app-common/src/main/webapp/app/vid/icons/7450-text.png
new file mode 100755
index 0000000..9b3c332
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/7450-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/7750-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/7750-icon.png
new file mode 100755
index 0000000..9ee5499
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/7750-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/7750-text.png b/vid-app-common/src/main/webapp/app/vid/icons/7750-text.png
new file mode 100755
index 0000000..aeb2dd0
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/7750-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/apn-dns-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/apn-dns-icon.png
new file mode 100755
index 0000000..0ba5c52
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/apn-dns-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/apn-dns-text.png b/vid-app-common/src/main/webapp/app/vid/icons/apn-dns-text.png
new file mode 100755
index 0000000..4663116
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/apn-dns-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/atcf-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/atcf-icon.png
new file mode 100755
index 0000000..2904d27
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/atcf-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/atcf-text.png b/vid-app-common/src/main/webapp/app/vid/icons/atcf-text.png
new file mode 100755
index 0000000..1566d5b
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/atcf-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/atgw-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/atgw-icon.png
new file mode 100755
index 0000000..2904d27
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/atgw-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/atgw-text.png b/vid-app-common/src/main/webapp/app/vid/icons/atgw-text.png
new file mode 100755
index 0000000..f7c50c6
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/atgw-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/bgcf-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/bgcf-icon.png
new file mode 100755
index 0000000..2904d27
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/bgcf-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/bgcf-text.png b/vid-app-common/src/main/webapp/app/vid/icons/bgcf-text.png
new file mode 100755
index 0000000..b1e0869
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/bgcf-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/com-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/com-icon.png
new file mode 100755
index 0000000..59463a9
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/com-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/cpm-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/cpm-icon.png
new file mode 100755
index 0000000..9176a0d
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/cpm-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/cpm-text.png b/vid-app-common/src/main/webapp/app/vid/icons/cpm-text.png
new file mode 100755
index 0000000..5b35e77
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/cpm-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/default-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/default-icon.png
new file mode 100755
index 0000000..296a6f5
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/default-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/dra-epc-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/dra-epc-icon.png
new file mode 100755
index 0000000..74bfcfc
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/dra-epc-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/dra-epc-text.png b/vid-app-common/src/main/webapp/app/vid/icons/dra-epc-text.png
new file mode 100755
index 0000000..00f2a2e
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/dra-epc-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/dra-ims-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/dra-ims-icon.png
new file mode 100755
index 0000000..74bfcfc
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/dra-ims-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/dra-ims-text.png b/vid-app-common/src/main/webapp/app/vid/icons/dra-ims-text.png
new file mode 100755
index 0000000..1d54d9a
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/dra-ims-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/dslam-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/dslam-icon.png
new file mode 100755
index 0000000..b2a0585
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/dslam-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/dslam-text.png b/vid-app-common/src/main/webapp/app/vid/icons/dslam-text.png
new file mode 100755
index 0000000..1452d2e
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/dslam-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/eatf-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/eatf-icon.png
new file mode 100755
index 0000000..59463a9
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/eatf-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/eatf-text.png b/vid-app-common/src/main/webapp/app/vid/icons/eatf-text.png
new file mode 100755
index 0000000..ba9b216
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/eatf-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/ecscf-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/ecscf-icon.png
new file mode 100755
index 0000000..dafbe9e
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/ecscf-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/ecscf-text.png b/vid-app-common/src/main/webapp/app/vid/icons/ecscf-text.png
new file mode 100755
index 0000000..ca98a51
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/ecscf-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/emsc-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/emsc-icon.png
new file mode 100755
index 0000000..2904d27
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/emsc-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/enb-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/enb-icon.png
new file mode 100755
index 0000000..e03be51
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/enb-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/enb-text.png b/vid-app-common/src/main/webapp/app/vid/icons/enb-text.png
new file mode 100755
index 0000000..9fbf8c2
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/enb-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/enum-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/enum-icon.png
new file mode 100755
index 0000000..daee75a
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/enum-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/enum-text.png b/vid-app-common/src/main/webapp/app/vid/icons/enum-text.png
new file mode 100755
index 0000000..f04e3d5
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/enum-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/esmlc-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/esmlc-icon.png
new file mode 100755
index 0000000..2904d27
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/esmlc-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/esmlc-text.png b/vid-app-common/src/main/webapp/app/vid/icons/esmlc-text.png
new file mode 100755
index 0000000..0a29e73
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/esmlc-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/ettcs-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/ettcs-icon.png
new file mode 100755
index 0000000..6f15bdb
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/ettcs-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/ettcs-text.png b/vid-app-common/src/main/webapp/app/vid/icons/ettcs-text.png
new file mode 100755
index 0000000..6f15bdb
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/ettcs-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/gmlc-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/gmlc-icon.png
new file mode 100755
index 0000000..2904d27
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/gmlc-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/gmlc-text.png b/vid-app-common/src/main/webapp/app/vid/icons/gmlc-text.png
new file mode 100755
index 0000000..43cf74d
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/gmlc-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/hlr-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/hlr-icon.png
new file mode 100755
index 0000000..daee75a
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/hlr-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/hlr-text.png b/vid-app-common/src/main/webapp/app/vid/icons/hlr-text.png
new file mode 100755
index 0000000..b276250
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/hlr-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/hss-epc-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/hss-epc-icon.png
new file mode 100755
index 0000000..daee75a
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/hss-epc-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/hss-epc-text.png b/vid-app-common/src/main/webapp/app/vid/icons/hss-epc-text.png
new file mode 100755
index 0000000..9739214
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/hss-epc-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/hss-ims-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/hss-ims-icon.png
new file mode 100755
index 0000000..daee75a
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/hss-ims-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/hss-ims-text.png b/vid-app-common/src/main/webapp/app/vid/icons/hss-ims-text.png
new file mode 100755
index 0000000..ec69f25
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/hss-ims-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/icscf-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/icscf-icon.png
new file mode 100755
index 0000000..dafbe9e
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/icscf-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/icscf-text.png b/vid-app-common/src/main/webapp/app/vid/icons/icscf-text.png
new file mode 100755
index 0000000..6dbfc81
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/icscf-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/ipag-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/ipag-icon.png
new file mode 100755
index 0000000..6f15bdb
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/ipag-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/ipag-text.png b/vid-app-common/src/main/webapp/app/vid/icons/ipag-text.png
new file mode 100755
index 0000000..6f15bdb
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/ipag-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/isbc-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/isbc-icon.png
new file mode 100755
index 0000000..dafbe9e
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/isbc-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/isbc-text.png b/vid-app-common/src/main/webapp/app/vid/icons/isbc-text.png
new file mode 100755
index 0000000..a842e9f
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/isbc-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/iwf-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/iwf-icon.png
new file mode 100755
index 0000000..a82e73c
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/iwf-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/iwf-text.png b/vid-app-common/src/main/webapp/app/vid/icons/iwf-text.png
new file mode 100755
index 0000000..4d0092e
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/iwf-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/lrf-rdf-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/lrf-rdf-icon.png
new file mode 100755
index 0000000..82b5c47
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/lrf-rdf-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/lrf-rdf-text.png b/vid-app-common/src/main/webapp/app/vid/icons/lrf-rdf-text.png
new file mode 100755
index 0000000..14daba8
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/lrf-rdf-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/lrg-rdf-text.png b/vid-app-common/src/main/webapp/app/vid/icons/lrg-rdf-text.png
new file mode 100755
index 0000000..3f7e224
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/lrg-rdf-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/mgc8-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/mgc8-icon.png
new file mode 100755
index 0000000..2904d27
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/mgc8-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/mgc8-text.png b/vid-app-common/src/main/webapp/app/vid/icons/mgc8-text.png
new file mode 100755
index 0000000..2ba933a
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/mgc8-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/mgcf-emsc-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/mgcf-emsc-icon.png
new file mode 100755
index 0000000..2904d27
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/mgcf-emsc-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/mgcf-emsc-text.png b/vid-app-common/src/main/webapp/app/vid/icons/mgcf-emsc-text.png
new file mode 100755
index 0000000..74bf8f2
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/mgcf-emsc-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/mgw-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/mgw-icon.png
new file mode 100755
index 0000000..2904d27
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/mgw-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/mgw-text.png b/vid-app-common/src/main/webapp/app/vid/icons/mgw-text.png
new file mode 100755
index 0000000..a2470f5
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/mgw-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/mind-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/mind-icon.png
new file mode 100755
index 0000000..daee75a
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/mind-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/mind-text.png b/vid-app-common/src/main/webapp/app/vid/icons/mind-text.png
new file mode 100755
index 0000000..84f9d86
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/mind-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/mme-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/mme-icon.png
new file mode 100755
index 0000000..58ab86c
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/mme-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/mme-text.png b/vid-app-common/src/main/webapp/app/vid/icons/mme-text.png
new file mode 100755
index 0000000..e524f19
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/mme-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/mrf-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/mrf-icon.png
new file mode 100755
index 0000000..59463a9
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/mrf-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/mrf-text.png b/vid-app-common/src/main/webapp/app/vid/icons/mrf-text.png
new file mode 100755
index 0000000..fa9a61c
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/mrf-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/msc-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/msc-icon.png
new file mode 100755
index 0000000..2904d27
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/msc-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/msn-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/msn-icon.png
new file mode 100755
index 0000000..8386fcb
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/msn-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/msn-text.png b/vid-app-common/src/main/webapp/app/vid/icons/msn-text.png
new file mode 100755
index 0000000..954982f
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/msn-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/multi-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/multi-icon.png
new file mode 100755
index 0000000..296a6f5
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/multi-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/n7450-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/n7450-icon.png
new file mode 100755
index 0000000..1ed07db
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/n7450-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/n7450-text.png b/vid-app-common/src/main/webapp/app/vid/icons/n7450-text.png
new file mode 100755
index 0000000..9b3c332
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/n7450-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/n7750a-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/n7750a-icon.png
new file mode 100755
index 0000000..79ba2fc
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/n7750a-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/n7750a-text.png b/vid-app-common/src/main/webapp/app/vid/icons/n7750a-text.png
new file mode 100755
index 0000000..afad34d
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/n7750a-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/n7750b-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/n7750b-icon.png
new file mode 100755
index 0000000..bfce0b1
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/n7750b-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/n7750b-text.png b/vid-app-common/src/main/webapp/app/vid/icons/n7750b-text.png
new file mode 100755
index 0000000..afad34d
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/n7750b-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/n7750c-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/n7750c-icon.png
new file mode 100755
index 0000000..47870bc
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/n7750c-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/n7750c-text.png b/vid-app-common/src/main/webapp/app/vid/icons/n7750c-text.png
new file mode 100755
index 0000000..afad34d
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/n7750c-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/n7750d-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/n7750d-icon.png
new file mode 100755
index 0000000..f407a0f
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/n7750d-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/n7750d-text.png b/vid-app-common/src/main/webapp/app/vid/icons/n7750d-text.png
new file mode 100755
index 0000000..6e25a26
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/n7750d-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/nb-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/nb-icon.png
new file mode 100755
index 0000000..e03be51
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/nb-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/nb-text.png b/vid-app-common/src/main/webapp/app/vid/icons/nb-text.png
new file mode 100755
index 0000000..bbc1357
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/nb-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/pas-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/pas-icon.png
new file mode 100755
index 0000000..74bfcfc
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/pas-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/pas-text.png b/vid-app-common/src/main/webapp/app/vid/icons/pas-text.png
new file mode 100755
index 0000000..48b1e27
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/pas-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/pcef-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/pcef-icon.png
new file mode 100755
index 0000000..17ed4a4
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/pcef-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/pcef-text.png b/vid-app-common/src/main/webapp/app/vid/icons/pcef-text.png
new file mode 100755
index 0000000..23faa7d
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/pcef-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/pcrf-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/pcrf-icon.png
new file mode 100755
index 0000000..17ed4a4
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/pcrf-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/pcrf-text.png b/vid-app-common/src/main/webapp/app/vid/icons/pcrf-text.png
new file mode 100755
index 0000000..e48c305
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/pcrf-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/pcscf-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/pcscf-icon.png
new file mode 100755
index 0000000..dafbe9e
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/pcscf-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/pcscf-text.png b/vid-app-common/src/main/webapp/app/vid/icons/pcscf-text.png
new file mode 100755
index 0000000..b8d2c3d
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/pcscf-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/pgw-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/pgw-icon.png
new file mode 100755
index 0000000..2904d27
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/pgw-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/pgw-text.png b/vid-app-common/src/main/webapp/app/vid/icons/pgw-text.png
new file mode 100755
index 0000000..d5f86b5
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/pgw-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/plrf-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/plrf-icon.png
new file mode 100755
index 0000000..82b5c47
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/plrf-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/plrf-text.png b/vid-app-common/src/main/webapp/app/vid/icons/plrf-text.png
new file mode 100755
index 0000000..72662ef
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/plrf-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/psap-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/psap-icon.png
new file mode 100755
index 0000000..2145c5f
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/psap-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/pstn-tdm-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/pstn-tdm-icon.png
new file mode 100755
index 0000000..6f15bdb
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/pstn-tdm-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/pstn-tdm-text.png b/vid-app-common/src/main/webapp/app/vid/icons/pstn-tdm-text.png
new file mode 100755
index 0000000..6f15bdb
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/pstn-tdm-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/rg-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/rg-icon.png
new file mode 100755
index 0000000..2904d27
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/rg-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/rg-text.png b/vid-app-common/src/main/webapp/app/vid/icons/rg-text.png
new file mode 100755
index 0000000..ab93224
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/rg-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/rnc-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/rnc-icon.png
new file mode 100755
index 0000000..733d3da
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/rnc-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/rnc-text.png b/vid-app-common/src/main/webapp/app/vid/icons/rnc-text.png
new file mode 100755
index 0000000..24cab75
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/rnc-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/sbc-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/sbc-icon.png
new file mode 100755
index 0000000..dafbe9e
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/sbc-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/sbc-text.png b/vid-app-common/src/main/webapp/app/vid/icons/sbc-text.png
new file mode 100755
index 0000000..f71bfba
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/sbc-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/sccas-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/sccas-icon.png
new file mode 100755
index 0000000..59463a9
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/sccas-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/sccas-text.png b/vid-app-common/src/main/webapp/app/vid/icons/sccas-text.png
new file mode 100755
index 0000000..1ca4e1d
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/sccas-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/scscf-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/scscf-icon.png
new file mode 100755
index 0000000..dafbe9e
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/scscf-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/scscf-text.png b/vid-app-common/src/main/webapp/app/vid/icons/scscf-text.png
new file mode 100755
index 0000000..fd3cab5
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/scscf-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/sdg-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/sdg-icon.png
new file mode 100755
index 0000000..b4c0288
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/sdg-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/sdg-text.png b/vid-app-common/src/main/webapp/app/vid/icons/sdg-text.png
new file mode 100755
index 0000000..3881e66
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/sdg-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/sgsns4-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/sgsns4-icon.png
new file mode 100755
index 0000000..8df1aac
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/sgsns4-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/sgsns4-text.png b/vid-app-common/src/main/webapp/app/vid/icons/sgsns4-text.png
new file mode 100755
index 0000000..92cbd29
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/sgsns4-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/sgw-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/sgw-icon.png
new file mode 100755
index 0000000..2904d27
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/sgw-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/sgw-text.png b/vid-app-common/src/main/webapp/app/vid/icons/sgw-text.png
new file mode 100755
index 0000000..0801d79
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/sgw-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/siad-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/siad-icon.png
new file mode 100755
index 0000000..b2a0585
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/siad-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/siad-text.png b/vid-app-common/src/main/webapp/app/vid/icons/siad-text.png
new file mode 100755
index 0000000..323c125
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/siad-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/ss7-gport-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/ss7-gport-icon.png
new file mode 100755
index 0000000..319bb37
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/ss7-gport-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/ss7-gport-text.png b/vid-app-common/src/main/webapp/app/vid/icons/ss7-gport-text.png
new file mode 100755
index 0000000..1ba8a76
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/ss7-gport-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/ss7gport-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/ss7gport-icon.png
new file mode 100755
index 0000000..daee75a
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/ss7gport-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/ss7gport-text.png b/vid-app-common/src/main/webapp/app/vid/icons/ss7gport-text.png
new file mode 100755
index 0000000..8656f9f
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/ss7gport-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/switch-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/switch-icon.png
new file mode 100755
index 0000000..6e51271
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/switch-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/tas-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/tas-icon.png
new file mode 100755
index 0000000..59463a9
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/tas-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/tas-text.png b/vid-app-common/src/main/webapp/app/vid/icons/tas-text.png
new file mode 100755
index 0000000..7a843e8
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/tas-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/transcoder-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/transcoder-icon.png
new file mode 100755
index 0000000..b2a0585
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/transcoder-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/transcoder-text.png b/vid-app-common/src/main/webapp/app/vid/icons/transcoder-text.png
new file mode 100755
index 0000000..975dd30
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/transcoder-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/ue-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/ue-icon.png
new file mode 100755
index 0000000..e23dfd3
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/ue-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/uephone-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/uephone-icon.png
new file mode 100755
index 0000000..50182db
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/uephone-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/usp-dns-icon.png b/vid-app-common/src/main/webapp/app/vid/icons/usp-dns-icon.png
new file mode 100755
index 0000000..0ba5c52
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/usp-dns-icon.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/icons/usp-dns-text.png b/vid-app-common/src/main/webapp/app/vid/icons/usp-dns-text.png
new file mode 100755
index 0000000..46de0c2
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/icons/usp-dns-text.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/images/asterisk.png b/vid-app-common/src/main/webapp/app/vid/images/asterisk.png
new file mode 100755
index 0000000..2e02da8
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/images/asterisk.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/images/dummy.txt b/vid-app-common/src/main/webapp/app/vid/images/dummy.txt
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/images/dummy.txt
diff --git a/vid-app-common/src/main/webapp/app/vid/images/error.png b/vid-app-common/src/main/webapp/app/vid/images/error.png
new file mode 100755
index 0000000..4fad985
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/images/error.png
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/images/spinner.gif b/vid-app-common/src/main/webapp/app/vid/images/spinner.gif
new file mode 100755
index 0000000..8ed30cb
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/images/spinner.gif
Binary files differ
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/angular-ui-tree.js b/vid-app-common/src/main/webapp/app/vid/scripts/angular-ui-tree.js
new file mode 100755
index 0000000..6ec9079
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/angular-ui-tree.js
@@ -0,0 +1,1656 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+/**
+ * @license Angular UI Tree v2.17.0
+ * (c) 2010-2016. https://github.com/angular-ui-tree/angular-ui-tree
+ * License: MIT
+ */
+(function () {
+ 'use strict';
+
+ angular.module('ui.tree', [])
+ .constant('treeConfig', {
+ treeClass: 'angular-ui-tree',
+ emptyTreeClass: 'angular-ui-tree-empty',
+ hiddenClass: 'angular-ui-tree-hidden',
+ nodesClass: 'angular-ui-tree-nodes',
+ nodeClass: 'angular-ui-tree-node',
+ handleClass: 'angular-ui-tree-handle',
+ placeholderClass: 'angular-ui-tree-placeholder',
+ dragClass: 'angular-ui-tree-drag',
+ dragThreshold: 3,
+ levelThreshold: 30,
+ defaultCollapsed: false
+ });
+
+})();
+
+(function () {
+ 'use strict';
+
+ angular.module('ui.tree')
+
+ .controller('TreeHandleController', ['$scope', '$element',
+ function ($scope, $element) {
+ this.scope = $scope;
+
+ $scope.$element = $element;
+ $scope.$nodeScope = null;
+ $scope.$type = 'uiTreeHandle';
+
+ }
+ ]);
+})();
+
+(function () {
+ 'use strict';
+
+ angular.module('ui.tree')
+ .controller('TreeNodeController', ['$scope', '$element',
+ function ($scope, $element) {
+ this.scope = $scope;
+
+ $scope.$element = $element;
+ $scope.$modelValue = null; // Model value for node;
+ $scope.$parentNodeScope = null; // uiTreeNode Scope of parent node;
+ $scope.$childNodesScope = null; // uiTreeNodes Scope of child nodes.
+ $scope.$parentNodesScope = null; // uiTreeNodes Scope of parent nodes.
+ $scope.$treeScope = null; // uiTree scope
+ $scope.$handleScope = null; // it's handle scope
+ $scope.$type = 'uiTreeNode';
+ $scope.$$allowNodeDrop = false;
+ $scope.collapsed = false;
+ $scope.expandOnHover = false;
+
+ $scope.init = function (controllersArr) {
+ var treeNodesCtrl = controllersArr[0];
+ $scope.$treeScope = controllersArr[1] ? controllersArr[1].scope : null;
+
+ // find the scope of it's parent node
+ $scope.$parentNodeScope = treeNodesCtrl.scope.$nodeScope;
+ // modelValue for current node
+ $scope.$modelValue = treeNodesCtrl.scope.$modelValue[$scope.$index];
+ $scope.$parentNodesScope = treeNodesCtrl.scope;
+ treeNodesCtrl.scope.initSubNode($scope); // init sub nodes
+
+ $element.on('$destroy', function () {
+ treeNodesCtrl.scope.destroySubNode($scope); // destroy sub nodes
+ });
+ };
+
+ $scope.index = function () {
+ return $scope.$parentNodesScope.$modelValue.indexOf($scope.$modelValue);
+ };
+
+ $scope.dragEnabled = function () {
+ return !($scope.$treeScope && !$scope.$treeScope.dragEnabled);
+ };
+
+ $scope.isSibling = function (targetNode) {
+ return $scope.$parentNodesScope == targetNode.$parentNodesScope;
+ };
+
+ $scope.isChild = function (targetNode) {
+ var nodes = $scope.childNodes();
+ return nodes && nodes.indexOf(targetNode) > -1;
+ };
+
+ $scope.prev = function () {
+ var index = $scope.index();
+ if (index > 0) {
+ return $scope.siblings()[index - 1];
+ }
+ return null;
+ };
+
+ $scope.siblings = function () {
+ return $scope.$parentNodesScope.childNodes();
+ };
+
+ $scope.childNodesCount = function () {
+ return $scope.childNodes() ? $scope.childNodes().length : 0;
+ };
+
+ $scope.hasChild = function () {
+ return $scope.childNodesCount() > 0;
+ };
+
+ $scope.childNodes = function () {
+ return $scope.$childNodesScope && $scope.$childNodesScope.$modelValue ?
+ $scope.$childNodesScope.childNodes() :
+ null;
+ };
+
+ $scope.accept = function (sourceNode, destIndex) {
+ return $scope.$childNodesScope &&
+ $scope.$childNodesScope.$modelValue &&
+ $scope.$childNodesScope.accept(sourceNode, destIndex);
+ };
+
+ $scope.remove = function () {
+ return $scope.$parentNodesScope.removeNode($scope);
+ };
+
+ $scope.toggle = function () {
+ $scope.collapsed = !$scope.collapsed;
+ $scope.$treeScope.$callbacks.toggle($scope.collapsed, $scope);
+ };
+
+ $scope.collapse = function () {
+ $scope.collapsed = true;
+ };
+
+ $scope.expand = function () {
+ $scope.collapsed = false;
+ };
+
+ $scope.depth = function () {
+ var parentNode = $scope.$parentNodeScope;
+ if (parentNode) {
+ return parentNode.depth() + 1;
+ }
+ return 1;
+ };
+
+ /**
+ * Returns the depth of the deepest subtree under this node
+ * @param scope a TreeNodesController scope object
+ * @returns Depth of all nodes *beneath* this node. If scope belongs to a leaf node, the
+ * result is 0 (it has no subtree).
+ */
+ function countSubTreeDepth(scope) {
+ var thisLevelDepth = 0,
+ childNodes = scope.childNodes(),
+ childNode,
+ childDepth,
+ i;
+ if (!childNodes || childNodes.length === 0) {
+ return 0;
+ }
+ for (i = childNodes.length - 1; i >= 0 ; i--) {
+ childNode = childNodes[i],
+ childDepth = 1 + countSubTreeDepth(childNode);
+ thisLevelDepth = Math.max(thisLevelDepth, childDepth);
+ }
+ return thisLevelDepth;
+ }
+
+ $scope.maxSubDepth = function () {
+ return $scope.$childNodesScope ? countSubTreeDepth($scope.$childNodesScope) : 0;
+ };
+ }
+ ]);
+})();
+
+(function () {
+ 'use strict';
+
+ angular.module('ui.tree')
+
+ .controller('TreeNodesController', ['$scope', '$element',
+ function ($scope, $element) {
+ this.scope = $scope;
+
+ $scope.$element = $element;
+ $scope.$modelValue = null;
+ $scope.$nodeScope = null; // the scope of node which the nodes belongs to
+ $scope.$treeScope = null;
+ $scope.$type = 'uiTreeNodes';
+ $scope.$nodesMap = {};
+
+ $scope.nodropEnabled = false;
+ $scope.maxDepth = 0;
+ $scope.cloneEnabled = false;
+
+ $scope.initSubNode = function (subNode) {
+ if (!subNode.$modelValue) {
+ return null;
+ }
+ $scope.$nodesMap[subNode.$modelValue.$$hashKey] = subNode;
+ };
+
+ $scope.destroySubNode = function (subNode) {
+ if (!subNode.$modelValue) {
+ return null;
+ }
+ $scope.$nodesMap[subNode.$modelValue.$$hashKey] = null;
+ };
+
+ $scope.accept = function (sourceNode, destIndex) {
+ return $scope.$treeScope.$callbacks.accept(sourceNode, $scope, destIndex);
+ };
+
+ $scope.beforeDrag = function (sourceNode) {
+ return $scope.$treeScope.$callbacks.beforeDrag(sourceNode);
+ };
+
+ $scope.isParent = function (node) {
+ return node.$parentNodesScope == $scope;
+ };
+
+ $scope.hasChild = function () {
+ return $scope.$modelValue.length > 0;
+ };
+
+ $scope.safeApply = function (fn) {
+ var phase = this.$root.$$phase;
+ if (phase == '$apply' || phase == '$digest') {
+ if (fn && (typeof (fn) === 'function')) {
+ fn();
+ }
+ } else {
+ this.$apply(fn);
+ }
+ };
+
+ $scope.removeNode = function (node) {
+ var index = $scope.$modelValue.indexOf(node.$modelValue);
+ if (index > -1) {
+ $scope.safeApply(function () {
+ $scope.$modelValue.splice(index, 1)[0];
+ });
+ return $scope.$treeScope.$callbacks.removed(node);
+ }
+ return null;
+ };
+
+ $scope.insertNode = function (index, nodeData) {
+ $scope.safeApply(function () {
+ $scope.$modelValue.splice(index, 0, nodeData);
+ });
+ };
+
+ $scope.childNodes = function () {
+ var i, nodes = [];
+ if ($scope.$modelValue) {
+ for (i = 0; i < $scope.$modelValue.length; i++) {
+ nodes.push($scope.$nodesMap[$scope.$modelValue[i].$$hashKey]);
+ }
+ }
+ return nodes;
+ };
+
+ $scope.depth = function () {
+ if ($scope.$nodeScope) {
+ return $scope.$nodeScope.depth();
+ }
+ return 0; // if it has no $nodeScope, it's root
+ };
+
+ // check if depth limit has reached
+ $scope.outOfDepth = function (sourceNode) {
+ var maxDepth = $scope.maxDepth || $scope.$treeScope.maxDepth;
+ if (maxDepth > 0) {
+ return $scope.depth() + sourceNode.maxSubDepth() + 1 > maxDepth;
+ }
+ return false;
+ };
+
+ }
+ ]);
+})();
+
+(function () {
+ 'use strict';
+
+ angular.module('ui.tree')
+
+ .controller('TreeController', ['$scope', '$element',
+ function ($scope, $element) {
+ this.scope = $scope;
+
+ $scope.$element = $element;
+ $scope.$nodesScope = null; // root nodes
+ $scope.$type = 'uiTree';
+ $scope.$emptyElm = null;
+ $scope.$callbacks = null;
+
+ $scope.dragEnabled = true;
+ $scope.emptyPlaceholderEnabled = true;
+ $scope.maxDepth = 0;
+ $scope.dragDelay = 0;
+ $scope.cloneEnabled = false;
+ $scope.nodropEnabled = false;
+
+ // Check if it's a empty tree
+ $scope.isEmpty = function () {
+ return ($scope.$nodesScope && $scope.$nodesScope.$modelValue
+ && $scope.$nodesScope.$modelValue.length === 0);
+ };
+
+ // add placeholder to empty tree
+ $scope.place = function (placeElm) {
+ $scope.$nodesScope.$element.append(placeElm);
+ $scope.$emptyElm.remove();
+ };
+
+ this.resetEmptyElement = function () {
+ if ((!$scope.$nodesScope.$modelValue || $scope.$nodesScope.$modelValue.length === 0) &&
+ $scope.emptyPlaceholderEnabled) {
+ $element.append($scope.$emptyElm);
+ } else {
+ $scope.$emptyElm.remove();
+ }
+ };
+
+ $scope.resetEmptyElement = this.resetEmptyElement;
+ }
+ ]);
+})();
+
+(function () {
+ 'use strict';
+
+ angular.module('ui.tree')
+ .directive('uiTree', ['treeConfig', '$window',
+ function (treeConfig, $window) {
+ return {
+ restrict: 'A',
+ scope: true,
+ controller: 'TreeController',
+ link: function (scope, element, attrs, ctrl) {
+ var callbacks = {
+ accept: null,
+ beforeDrag: null
+ },
+ config = {},
+ tdElm,
+ $trElm,
+ emptyElmColspan;
+
+ angular.extend(config, treeConfig);
+ if (config.treeClass) {
+ element.addClass(config.treeClass);
+ }
+
+ if (element.prop('tagName').toLowerCase() === 'table') {
+ scope.$emptyElm = angular.element($window.document.createElement('tr'));
+ $trElm = element.find('tr');
+ // If we can find a tr, then we can use its td children as the empty element colspan.
+ if ($trElm.length > 0) {
+ emptyElmColspan = angular.element($trElm).children().length;
+ } else {
+ // If not, by setting a huge colspan we make sure it takes full width.
+ emptyElmColspan = 1000000;
+ }
+ tdElm = angular.element($window.document.createElement('td'))
+ .attr('colspan', emptyElmColspan);
+ scope.$emptyElm.append(tdElm);
+ } else {
+ scope.$emptyElm = angular.element($window.document.createElement('div'));
+ }
+
+ if (config.emptyTreeClass) {
+ scope.$emptyElm.addClass(config.emptyTreeClass);
+ }
+
+ scope.$watch('$nodesScope.$modelValue.length', function (val) {
+ if (!angular.isNumber(val)) {
+ return;
+ }
+
+ ctrl.resetEmptyElement();
+ }, true);
+
+ scope.$watch(attrs.dragEnabled, function (val) {
+ if ((typeof val) == 'boolean') {
+ scope.dragEnabled = val;
+ }
+ });
+
+ scope.$watch(attrs.emptyPlaceholderEnabled, function (val) {
+ if ((typeof val) == 'boolean') {
+ scope.emptyPlaceholderEnabled = val;
+ ctrl.resetEmptyElement();
+ }
+ });
+
+ scope.$watch(attrs.nodropEnabled, function (val) {
+ if ((typeof val) == 'boolean') {
+ scope.nodropEnabled = val;
+ }
+ });
+
+ scope.$watch(attrs.cloneEnabled, function (val) {
+ if ((typeof val) == 'boolean') {
+ scope.cloneEnabled = val;
+ }
+ });
+
+ scope.$watch(attrs.maxDepth, function (val) {
+ if ((typeof val) == 'number') {
+ scope.maxDepth = val;
+ }
+ });
+
+ scope.$watch(attrs.dragDelay, function (val) {
+ if ((typeof val) == 'number') {
+ scope.dragDelay = val;
+ }
+ });
+
+ /**
+ * Callback checks if the destination node can accept the dragged node.
+ * By default, ui-tree will check that 'data-nodrop-enabled' is not set for the
+ * destination ui-tree-nodes, and that the 'max-depth' attribute will not be exceeded
+ * if it is set on the ui-tree or ui-tree-nodes.
+ * This callback can be overridden, but callers must manually enforce nodrop and max-depth
+ * themselves if they need those to be enforced.
+ * @param sourceNodeScope Scope of the ui-tree-node being dragged
+ * @param destNodesScope Scope of the ui-tree-nodes where the node is hovering
+ * @param destIndex Index in the destination nodes array where the source node will drop
+ * @returns {boolean} True if the node is permitted to be dropped here
+ */
+ callbacks.accept = function (sourceNodeScope, destNodesScope, destIndex) {
+ return !(destNodesScope.nodropEnabled || destNodesScope.$treeScope.nodropEnabled || destNodesScope.outOfDepth(sourceNodeScope));
+ };
+
+ callbacks.beforeDrag = function (sourceNodeScope) {
+ return true;
+ };
+
+ callbacks.expandTimeoutStart = function()
+ {
+
+ };
+
+ callbacks.expandTimeoutCancel = function()
+ {
+
+ };
+
+ callbacks.expandTimeoutEnd = function()
+ {
+
+ };
+
+ callbacks.removed = function (node) {
+
+ };
+
+ /**
+ * Callback is fired when a node is successfully dropped in a new location
+ * @param event
+ */
+ callbacks.dropped = function (event) {
+
+ };
+
+ /**
+ * Callback is fired each time the user starts dragging a node
+ * @param event
+ */
+ callbacks.dragStart = function (event) {
+
+ };
+
+ /**
+ * Callback is fired each time a dragged node is moved with the mouse/touch.
+ * @param event
+ */
+ callbacks.dragMove = function (event) {
+
+ };
+
+ /**
+ * Callback is fired when the tree exits drag mode. If the user dropped a node, the drop may have been
+ * accepted or reverted.
+ * @param event
+ */
+ callbacks.dragStop = function (event) {
+
+ };
+
+ /**
+ * Callback is fired when a user drops a node (but prior to processing the drop action)
+ * beforeDrop can return a Promise, truthy, or falsy (returning nothing is falsy).
+ * If it returns falsy, or a resolve Promise, the node move is accepted
+ * If it returns truthy, or a rejected Promise, the node move is reverted
+ * @param event
+ * @returns {Boolean|Promise} Truthy (or rejected Promise) to cancel node move; falsy (or resolved promise)
+ */
+ callbacks.beforeDrop = function (event) {
+
+ };
+
+ /**
+ * Callback is fired when a user toggles node (but after processing the toggle action)
+ * @param sourceNodeScope
+ * @param collapsed
+ */
+ callbacks.toggle = function (collapsed, sourceNodeScope) {
+
+ };
+
+ scope.$watch(attrs.uiTree, function (newVal, oldVal) {
+ angular.forEach(newVal, function (value, key) {
+ if (callbacks[key]) {
+ if (typeof value === 'function') {
+ callbacks[key] = value;
+ }
+ }
+ });
+
+ scope.$callbacks = callbacks;
+ }, true);
+
+
+ }
+ };
+ }
+ ]);
+})();
+
+(function () {
+ 'use strict';
+
+ angular.module('ui.tree')
+ .directive('uiTreeHandle', ['treeConfig',
+ function (treeConfig) {
+ return {
+ require: '^uiTreeNode',
+ restrict: 'A',
+ scope: true,
+ controller: 'TreeHandleController',
+ link: function (scope, element, attrs, treeNodeCtrl) {
+ var config = {};
+ angular.extend(config, treeConfig);
+ if (config.handleClass) {
+ element.addClass(config.handleClass);
+ }
+ // connect with the tree node.
+ if (scope != treeNodeCtrl.scope) {
+ scope.$nodeScope = treeNodeCtrl.scope;
+ treeNodeCtrl.scope.$handleScope = scope;
+ }
+ }
+ };
+ }
+ ]);
+})();
+
+(function () {
+ 'use strict';
+
+ angular.module('ui.tree')
+
+ .directive('uiTreeNode', ['treeConfig', 'UiTreeHelper', '$window', '$document', '$timeout', '$q',
+ function (treeConfig, UiTreeHelper, $window, $document, $timeout, $q) {
+ return {
+ require: ['^uiTreeNodes', '^uiTree'],
+ restrict: 'A',
+ controller: 'TreeNodeController',
+ link: function (scope, element, attrs, controllersArr) {
+ // todo startPos is unused
+ var config = {},
+ hasTouch = 'ontouchstart' in window,
+ startPos, firstMoving, dragInfo, pos,
+ placeElm, hiddenPlaceElm, dragElm,
+ treeScope = null,
+ elements, // As a parameter for callbacks
+ dragDelaying = true,
+ dragStarted = false,
+ dragTimer = null,
+ body = document.body,
+ html = document.documentElement,
+ document_height,
+ document_width,
+ dragStart,
+ tagName,
+ dragMove,
+ dragEnd,
+ dragStartEvent,
+ dragMoveEvent,
+ dragEndEvent,
+ dragCancelEvent,
+ dragDelay,
+ bindDragStartEvents,
+ bindDragMoveEvents,
+ unbindDragMoveEvents,
+ keydownHandler,
+ outOfBounds,
+ isHandleChild,
+ el;
+
+ angular.extend(config, treeConfig);
+ if (config.nodeClass) {
+ element.addClass(config.nodeClass);
+ }
+ scope.init(controllersArr);
+
+ scope.collapsed = !!UiTreeHelper.getNodeAttribute(scope, 'collapsed') || treeConfig.defaultCollapsed;
+ scope.expandOnHover = !!UiTreeHelper.getNodeAttribute(scope, 'expandOnHover');
+ scope.sourceOnly = scope.nodropEnabled || scope.$treeScope.nodropEnabled;
+
+ scope.$watch(attrs.collapsed, function (val) {
+ if ((typeof val) == 'boolean') {
+ scope.collapsed = val;
+ }
+ });
+
+ scope.$watch('collapsed', function (val) {
+ UiTreeHelper.setNodeAttribute(scope, 'collapsed', val);
+ attrs.$set('collapsed', val);
+ });
+
+ scope.$watch(attrs.expandOnHover, function(val) {
+ if ((typeof val) == 'boolean') {
+ scope.expandOnHover = val;
+ }
+ });
+
+ scope.$watch('expandOnHover', function (val) {
+ UiTreeHelper.setNodeAttribute(scope, 'expandOnHover', val);
+ attrs.$set('expandOnHover', val);
+ });
+
+ scope.$on('angular-ui-tree:collapse-all', function () {
+ scope.collapsed = true;
+ });
+
+ scope.$on('angular-ui-tree:expand-all', function () {
+ scope.collapsed = false;
+ });
+
+ /**
+ * Called when the user has grabbed a node and started dragging it
+ * @param e
+ */
+ dragStart = function (e) {
+ // disable right click
+ if (!hasTouch && (e.button === 2 || e.which === 3)) {
+ return;
+ }
+
+ // event has already fired in other scope
+ if (e.uiTreeDragging || (e.originalEvent && e.originalEvent.uiTreeDragging)) {
+ return;
+ }
+
+ // the node being dragged
+ var eventElm = angular.element(e.target),
+ isHandleChild, cloneElm, eventElmTagName, tagName,
+ eventObj, tdElm, hStyle,
+ isTreeNode,
+ isTreeNodeHandle;
+
+ // if the target element is a child element of a ui-tree-handle,
+ // use the containing handle element as target element
+ isHandleChild = UiTreeHelper.treeNodeHandlerContainerOfElement(eventElm);
+ if (isHandleChild) {
+ eventElm = angular.element(isHandleChild);
+ }
+
+ cloneElm = element.clone();
+ isTreeNode = UiTreeHelper.elementIsTreeNode(eventElm);
+ isTreeNodeHandle = UiTreeHelper.elementIsTreeNodeHandle(eventElm);
+
+ if (!isTreeNode && !isTreeNodeHandle) {
+ return;
+ }
+
+ if (isTreeNode && UiTreeHelper.elementContainsTreeNodeHandler(eventElm)) {
+ return;
+ }
+
+ eventElmTagName = eventElm.prop('tagName').toLowerCase();
+ if (eventElmTagName == 'input' ||
+ eventElmTagName == 'textarea' ||
+ eventElmTagName == 'button' ||
+ eventElmTagName == 'select') { // if it's a input or button, ignore it
+ return;
+ }
+
+ // check if it or it's parents has a 'data-nodrag' attribute
+ el = angular.element(e.target);
+ while (el && el[0] && el[0] !== element) {
+ if (UiTreeHelper.nodrag(el)) { // if the node mark as `nodrag`, DONOT drag it.
+ return;
+ }
+ el = el.parent();
+ }
+
+ if (!scope.beforeDrag(scope)) {
+ return;
+ }
+
+ e.uiTreeDragging = true; // stop event bubbling
+ if (e.originalEvent) {
+ e.originalEvent.uiTreeDragging = true;
+ }
+ e.preventDefault();
+ eventObj = UiTreeHelper.eventObj(e);
+
+ firstMoving = true;
+ dragInfo = UiTreeHelper.dragInfo(scope);
+
+ tagName = element.prop('tagName');
+
+ if (tagName.toLowerCase() === 'tr') {
+ placeElm = angular.element($window.document.createElement(tagName));
+ tdElm = angular.element($window.document.createElement('td'))
+ .addClass(config.placeholderClass)
+ .attr('colspan', element[0].children.length);
+ placeElm.append(tdElm);
+ } else {
+ placeElm = angular.element($window.document.createElement(tagName))
+ .addClass(config.placeholderClass);
+ }
+ hiddenPlaceElm = angular.element($window.document.createElement(tagName));
+ if (config.hiddenClass) {
+ hiddenPlaceElm.addClass(config.hiddenClass);
+ }
+
+ pos = UiTreeHelper.positionStarted(eventObj, element);
+ placeElm.css('height', UiTreeHelper.height(element) + 'px');
+
+ dragElm = angular.element($window.document.createElement(scope.$parentNodesScope.$element.prop('tagName')))
+ .addClass(scope.$parentNodesScope.$element.attr('class')).addClass(config.dragClass);
+ dragElm.css('width', UiTreeHelper.width(element) + 'px');
+ dragElm.css('z-index', 9999);
+
+ // Prevents cursor to change rapidly in Opera 12.16 and IE when dragging an element
+ hStyle = (element[0].querySelector('.angular-ui-tree-handle') || element[0]).currentStyle;
+ if (hStyle) {
+ document.body.setAttribute('ui-tree-cursor', $document.find('body').css('cursor') || '');
+ $document.find('body').css({'cursor': hStyle.cursor + '!important'});
+ }
+
+ if (scope.sourceOnly) {
+ placeElm.css('display', 'none');
+ }
+ element.after(placeElm);
+ element.after(hiddenPlaceElm);
+ if (dragInfo.isClone() && scope.sourceOnly) {
+ dragElm.append(cloneElm);
+ } else {
+ dragElm.append(element);
+ }
+
+ $document.find('body').append(dragElm);
+
+ dragElm.css({
+ 'left': eventObj.pageX - pos.offsetX + 'px',
+ 'top': eventObj.pageY - pos.offsetY + 'px'
+ });
+ elements = {
+ placeholder: placeElm,
+ dragging: dragElm
+ };
+
+ bindDragMoveEvents();
+ // Fire dragStart callback
+ scope.$apply(function () {
+ scope.$treeScope.$callbacks.dragStart(dragInfo.eventArgs(elements, pos));
+ });
+
+ document_height = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
+ document_width = Math.max(body.scrollWidth, body.offsetWidth, html.clientWidth, html.scrollWidth, html.offsetWidth);
+ };
+
+ dragMove = function (e) {
+ var eventObj = UiTreeHelper.eventObj(e),
+ prev,
+ next,
+ leftElmPos,
+ topElmPos,
+ top_scroll,
+ bottom_scroll,
+ target,
+ decrease,
+ targetX,
+ targetY,
+ displayElm,
+ targetNode,
+ targetElm,
+ isEmpty,
+ scrollDownBy,
+ targetOffset,
+ targetBefore;
+
+ if (dragElm) {
+ e.preventDefault();
+
+ if ($window.getSelection) {
+ $window.getSelection().removeAllRanges();
+ } else if ($window.document.selection) {
+ $window.document.selection.empty();
+ }
+
+ leftElmPos = eventObj.pageX - pos.offsetX;
+ topElmPos = eventObj.pageY - pos.offsetY;
+
+ //dragElm can't leave the screen on the left
+ if (leftElmPos < 0) {
+ leftElmPos = 0;
+ }
+
+ //dragElm can't leave the screen on the top
+ if (topElmPos < 0) {
+ topElmPos = 0;
+ }
+
+ //dragElm can't leave the screen on the bottom
+ if ((topElmPos + 10) > document_height) {
+ topElmPos = document_height - 10;
+ }
+
+ //dragElm can't leave the screen on the right
+ if ((leftElmPos + 10) > document_width) {
+ leftElmPos = document_width - 10;
+ }
+
+ dragElm.css({
+ 'left': leftElmPos + 'px',
+ 'top': topElmPos + 'px'
+ });
+
+ top_scroll = window.pageYOffset || $window.document.documentElement.scrollTop;
+ bottom_scroll = top_scroll + (window.innerHeight || $window.document.clientHeight || $window.document.clientHeight);
+
+ // to scroll down if cursor y-position is greater than the bottom position the vertical scroll
+ if (bottom_scroll < eventObj.pageY && bottom_scroll < document_height) {
+ scrollDownBy = Math.min(document_height - bottom_scroll, 10);
+ window.scrollBy(0, scrollDownBy);
+ }
+
+ // to scroll top if cursor y-position is less than the top position the vertical scroll
+ if (top_scroll > eventObj.pageY) {
+ window.scrollBy(0, -10);
+ }
+
+ UiTreeHelper.positionMoved(e, pos, firstMoving);
+ if (firstMoving) {
+ firstMoving = false;
+ return;
+ }
+
+ // check if add it as a child node first
+ // todo decrease is unused
+ decrease = (UiTreeHelper.offset(dragElm).left - UiTreeHelper.offset(placeElm).left) >= config.threshold;
+
+ targetX = eventObj.pageX - ($window.pageXOffset ||
+ $window.document.body.scrollLeft ||
+ $window.document.documentElement.scrollLeft) -
+ ($window.document.documentElement.clientLeft || 0);
+
+ targetY = eventObj.pageY - ($window.pageYOffset ||
+ $window.document.body.scrollTop ||
+ $window.document.documentElement.scrollTop) -
+ ($window.document.documentElement.clientTop || 0);
+
+ // Select the drag target. Because IE does not support CSS 'pointer-events: none', it will always
+ // pick the drag element itself as the target. To prevent this, we hide the drag element while
+ // selecting the target.
+ if (angular.isFunction(dragElm.hide)) {
+ dragElm.hide();
+ } else {
+ displayElm = dragElm[0].style.display;
+ dragElm[0].style.display = 'none';
+ }
+
+ // when using elementFromPoint() inside an iframe, you have to call
+ // elementFromPoint() twice to make sure IE8 returns the correct value
+ $window.document.elementFromPoint(targetX, targetY);
+
+ targetElm = angular.element($window.document.elementFromPoint(targetX, targetY));
+
+ // if the target element is a child element of a ui-tree-handle,
+ // use the containing handle element as target element
+ isHandleChild = UiTreeHelper.treeNodeHandlerContainerOfElement(targetElm);
+ if (isHandleChild) {
+ targetElm = angular.element(isHandleChild);
+ }
+
+ if (angular.isFunction(dragElm.show)) {
+ dragElm.show();
+ } else {
+ dragElm[0].style.display = displayElm;
+ }
+
+ outOfBounds = !UiTreeHelper.elementIsTreeNodeHandle(targetElm) &&
+ !UiTreeHelper.elementIsTreeNode(targetElm) &&
+ !UiTreeHelper.elementIsTreeNodes(targetElm) &&
+ !UiTreeHelper.elementIsTree(targetElm) &&
+ !UiTreeHelper.elementIsPlaceholder(targetElm);
+
+ // Detect out of bounds condition, update drop target display, and prevent drop
+ if (outOfBounds) {
+
+ // Remove the placeholder
+ placeElm.remove();
+
+ // If the target was an empty tree, replace the empty element placeholder
+ if (treeScope) {
+ treeScope.resetEmptyElement();
+ treeScope = null;
+ }
+ }
+
+ // move horizontal
+ if (pos.dirAx && pos.distAxX >= config.levelThreshold) {
+ pos.distAxX = 0;
+
+ // increase horizontal level if previous sibling exists and is not collapsed
+ if (pos.distX > 0) {
+ prev = dragInfo.prev();
+ if (prev && !prev.collapsed
+ && prev.accept(scope, prev.childNodesCount())) {
+ prev.$childNodesScope.$element.append(placeElm);
+ dragInfo.moveTo(prev.$childNodesScope, prev.childNodes(), prev.childNodesCount());
+ }
+ }
+
+ // decrease horizontal level
+ if (pos.distX < 0) {
+ // we can't decrease a level if an item preceeds the current one
+ next = dragInfo.next();
+ if (!next) {
+ target = dragInfo.parentNode(); // As a sibling of it's parent node
+ if (target
+ && target.$parentNodesScope.accept(scope, target.index() + 1)) {
+ target.$element.after(placeElm);
+ dragInfo.moveTo(target.$parentNodesScope, target.siblings(), target.index() + 1);
+ }
+ }
+ }
+ }
+
+ // move vertical
+ if (!pos.dirAx) {
+ if (UiTreeHelper.elementIsTree(targetElm)) {
+ targetNode = targetElm.controller('uiTree').scope;
+ } else if (UiTreeHelper.elementIsTreeNodeHandle(targetElm)) {
+ targetNode = targetElm.controller('uiTreeHandle').scope;
+ } else if (UiTreeHelper.elementIsTreeNode(targetElm)) {
+ targetNode = targetElm.controller('uiTreeNode').scope;
+ } else if (UiTreeHelper.elementIsTreeNodes(targetElm)) {
+ targetNode = targetElm.controller('uiTreeNodes').scope;
+ } else if (UiTreeHelper.elementIsPlaceholder(targetElm)) {
+ targetNode = targetElm.controller('uiTreeNodes').scope;
+ } else if (targetElm.controller('uiTreeNode')) {
+ // is a child element of a node
+ targetNode = targetElm.controller('uiTreeNode').scope;
+ }
+
+ // check it's new position
+ isEmpty = false;
+ if (!targetNode) {
+ return;
+ }
+
+ // Show the placeholder if it was hidden for nodrop-enabled and this is a new tree
+ if (targetNode.$treeScope && !targetNode.$parent.nodropEnabled && !targetNode.$treeScope.nodropEnabled) {
+ placeElm.css('display', '');
+ }
+
+ if (targetNode.$type == 'uiTree' && targetNode.dragEnabled) {
+ isEmpty = targetNode.isEmpty(); // Check if it's empty tree
+ }
+
+ if (targetNode.$type == 'uiTreeHandle') {
+ targetNode = targetNode.$nodeScope;
+ }
+
+ if (targetNode.$type != 'uiTreeNode'
+ && !isEmpty) { // Check if it is a uiTreeNode or it's an empty tree
+ return;
+ }
+
+ // if placeholder move from empty tree, reset it.
+ if (treeScope && placeElm.parent()[0] != treeScope.$element[0]) {
+ treeScope.resetEmptyElement();
+ treeScope = null;
+ }
+
+ if (isEmpty) { // it's an empty tree
+ treeScope = targetNode;
+ if (targetNode.$nodesScope.accept(scope, 0)) {
+ targetNode.place(placeElm);
+ dragInfo.moveTo(targetNode.$nodesScope, targetNode.$nodesScope.childNodes(), 0);
+ }
+ } else if (targetNode.dragEnabled()) { // drag enabled
+ if (angular.isDefined(scope.expandTimeoutOn) && scope.expandTimeoutOn !== targetNode.id) {
+ $timeout.cancel(scope.expandTimeout);
+ delete scope.expandTimeout;
+ delete scope.expandTimeoutOn;
+
+ scope.$callbacks.expandTimeoutCancel();
+ }
+
+ if (targetNode.collapsed) {
+ if (scope.expandOnHover === true || (angular.isNumber(scope.expandOnHover) && scope.expandOnHover === 0)) {
+ targetNode.collapsed = false;
+ } else if (scope.expandOnHover !== false && angular.isNumber(scope.expandOnHover) && scope.expandOnHover > 0) {
+ if (angular.isUndefined(scope.expandTimeoutOn)) {
+ scope.expandTimeoutOn = targetNode.$id;
+
+ scope.$callbacks.expandTimeoutStart();
+ scope.expandTimeout = $timeout(function()
+ {
+ scope.$callbacks.expandTimeoutEnd();
+ targetNode.collapsed = false;
+ }, scope.expandOnHover);
+ }
+ }
+ }
+
+ targetElm = targetNode.$element; // Get the element of ui-tree-node
+ targetOffset = UiTreeHelper.offset(targetElm);
+ targetBefore = targetNode.horizontal ? eventObj.pageX < (targetOffset.left + UiTreeHelper.width(targetElm) / 2)
+ : eventObj.pageY < (targetOffset.top + UiTreeHelper.height(targetElm) / 2);
+
+ if (targetNode.$parentNodesScope.accept(scope, targetNode.index())) {
+ if (targetBefore) {
+ targetElm[0].parentNode.insertBefore(placeElm[0], targetElm[0]);
+ dragInfo.moveTo(targetNode.$parentNodesScope, targetNode.siblings(), targetNode.index());
+ } else {
+ targetElm.after(placeElm);
+ dragInfo.moveTo(targetNode.$parentNodesScope, targetNode.siblings(), targetNode.index() + 1);
+ }
+ } else if (!targetBefore && targetNode.accept(scope, targetNode.childNodesCount())) { // we have to check if it can add the dragging node as a child
+ targetNode.$childNodesScope.$element.append(placeElm);
+ dragInfo.moveTo(targetNode.$childNodesScope, targetNode.childNodes(), targetNode.childNodesCount());
+ } else {
+ outOfBounds = true;
+ }
+ }
+ }
+
+ scope.$apply(function () {
+ scope.$treeScope.$callbacks.dragMove(dragInfo.eventArgs(elements, pos));
+ });
+ }
+ };
+
+ dragEnd = function (e) {
+ var dragEventArgs = dragInfo.eventArgs(elements, pos);
+ e.preventDefault();
+ unbindDragMoveEvents();
+
+ $timeout.cancel(scope.expandTimeout);
+
+ scope.$treeScope.$apply(function () {
+ $q.when(scope.$treeScope.$callbacks.beforeDrop(dragEventArgs))
+ // promise resolved (or callback didn't return false)
+ .then(function (allowDrop) {
+ if (allowDrop !== false && scope.$$allowNodeDrop && !outOfBounds) { // node drop accepted)
+ dragInfo.apply();
+ // fire the dropped callback only if the move was successful
+ scope.$treeScope.$callbacks.dropped(dragEventArgs);
+ } else { // drop canceled - revert the node to its original position
+ bindDragStartEvents();
+ }
+ })
+ // promise rejected - revert the node to its original position
+ .catch(function () {
+ bindDragStartEvents();
+ })
+ .finally(function () {
+ hiddenPlaceElm.replaceWith(scope.$element);
+ placeElm.remove();
+
+ if (dragElm) { // drag element is attached to the mouse pointer
+ dragElm.remove();
+ dragElm = null;
+ }
+ scope.$treeScope.$callbacks.dragStop(dragEventArgs);
+ scope.$$allowNodeDrop = false;
+ dragInfo = null;
+
+ // Restore cursor in Opera 12.16 and IE
+ var oldCur = document.body.getAttribute('ui-tree-cursor');
+ if (oldCur !== null) {
+ $document.find('body').css({'cursor': oldCur});
+ document.body.removeAttribute('ui-tree-cursor');
+ }
+ });
+ });
+ };
+
+ dragStartEvent = function (e) {
+ if (scope.dragEnabled()) {
+ dragStart(e);
+ }
+ };
+
+ dragMoveEvent = function (e) {
+ dragMove(e);
+ };
+
+ dragEndEvent = function (e) {
+ scope.$$allowNodeDrop = true;
+ dragEnd(e);
+ };
+
+ dragCancelEvent = function (e) {
+ dragEnd(e);
+ };
+
+ dragDelay = (function () {
+ var to;
+
+ return {
+ exec: function (fn, ms) {
+ if (!ms) {
+ ms = 0;
+ }
+ this.cancel();
+ to = $timeout(fn, ms);
+ },
+ cancel: function () {
+ $timeout.cancel(to);
+ }
+ };
+ })();
+
+ /**
+ * Binds the mouse/touch events to enable drag start for this node
+ */
+ bindDragStartEvents = function () {
+ element.bind('touchstart mousedown', function (e) {
+ dragDelay.exec(function () {
+ dragStartEvent(e);
+ }, scope.dragDelay || 0);
+ });
+ element.bind('touchend touchcancel mouseup', function () {
+ dragDelay.cancel();
+ });
+ };
+ bindDragStartEvents();
+
+ /**
+ * Binds mouse/touch events that handle moving/dropping this dragged node
+ */
+ bindDragMoveEvents = function () {
+ angular.element($document).bind('touchend', dragEndEvent);
+ angular.element($document).bind('touchcancel', dragEndEvent);
+ angular.element($document).bind('touchmove', dragMoveEvent);
+ angular.element($document).bind('mouseup', dragEndEvent);
+ angular.element($document).bind('mousemove', dragMoveEvent);
+ angular.element($document).bind('mouseleave', dragCancelEvent);
+ };
+
+ /**
+ * Unbinds mouse/touch events that handle moving/dropping this dragged node
+ */
+ unbindDragMoveEvents = function () {
+ angular.element($document).unbind('touchend', dragEndEvent);
+ angular.element($document).unbind('touchcancel', dragEndEvent);
+ angular.element($document).unbind('touchmove', dragMoveEvent);
+ angular.element($document).unbind('mouseup', dragEndEvent);
+ angular.element($document).unbind('mousemove', dragMoveEvent);
+ angular.element($document).unbind('mouseleave', dragCancelEvent);
+ };
+
+ keydownHandler = function (e) {
+ if (e.keyCode == 27) {
+ scope.$$allowNodeDrop = false;
+ dragEnd(e);
+ }
+ };
+
+ angular.element($window.document).bind('keydown', keydownHandler);
+
+ //unbind handler that retains scope
+ scope.$on('$destroy', function () {
+ angular.element($window.document).unbind('keydown', keydownHandler);
+ });
+ }
+ };
+ }
+ ]);
+
+})();
+
+(function () {
+ 'use strict';
+
+ angular.module('ui.tree')
+ .directive('uiTreeNodes', ['treeConfig', '$window',
+ function (treeConfig) {
+ return {
+ require: ['ngModel', '?^uiTreeNode', '^uiTree'],
+ restrict: 'A',
+ scope: true,
+ controller: 'TreeNodesController',
+ link: function (scope, element, attrs, controllersArr) {
+
+ var config = {},
+ ngModel = controllersArr[0],
+ treeNodeCtrl = controllersArr[1],
+ treeCtrl = controllersArr[2];
+
+ angular.extend(config, treeConfig);
+ if (config.nodesClass) {
+ element.addClass(config.nodesClass);
+ }
+
+ if (treeNodeCtrl) {
+ treeNodeCtrl.scope.$childNodesScope = scope;
+ scope.$nodeScope = treeNodeCtrl.scope;
+ } else {
+ // find the root nodes if there is no parent node and have a parent ui-tree
+ treeCtrl.scope.$nodesScope = scope;
+ }
+ scope.$treeScope = treeCtrl.scope;
+
+ if (ngModel) {
+ ngModel.$render = function () {
+ scope.$modelValue = ngModel.$modelValue;
+ };
+ }
+
+ scope.$watch(function () {
+ return attrs.maxDepth;
+ }, function (val) {
+ if ((typeof val) == 'number') {
+ scope.maxDepth = val;
+ }
+ });
+
+ scope.$watch(function () {
+ return attrs.nodropEnabled;
+ }, function (newVal) {
+ if ((typeof newVal) != 'undefined') {
+ scope.nodropEnabled = true;
+ }
+ }, true);
+
+ attrs.$observe('horizontal', function (val) {
+ scope.horizontal = ((typeof val) != 'undefined');
+ });
+
+ }
+ };
+ }
+ ]);
+})();
+
+(function () {
+ 'use strict';
+
+ angular.module('ui.tree')
+
+ /**
+ * @ngdoc service
+ * @name ui.tree.service:UiTreeHelper
+ * @requires ng.$document
+ * @requires ng.$window
+ *
+ * @description
+ * angular-ui-tree.
+ */
+ .factory('UiTreeHelper', ['$document', '$window', 'treeConfig',
+ function ($document, $window, treeConfig) {
+ return {
+
+ /**
+ * A hashtable used to storage data of nodes
+ * @type {Object}
+ */
+ nodesData: {},
+
+ setNodeAttribute: function (scope, attrName, val) {
+ if (!scope.$modelValue) {
+ return null;
+ }
+ var data = this.nodesData[scope.$modelValue.$$hashKey];
+ if (!data) {
+ data = {};
+ this.nodesData[scope.$modelValue.$$hashKey] = data;
+ }
+ data[attrName] = val;
+ },
+
+ getNodeAttribute: function (scope, attrName) {
+ if (!scope.$modelValue) {
+ return null;
+ }
+ var data = this.nodesData[scope.$modelValue.$$hashKey];
+ if (data) {
+ return data[attrName];
+ }
+ return null;
+ },
+
+ /**
+ * @ngdoc method
+ * @methodOf ui.tree.service:$nodrag
+ * @param {Object} targetElm angular element
+ * @return {Bool} check if the node can be dragged.
+ */
+ nodrag: function (targetElm) {
+ if (typeof targetElm.attr('data-nodrag') != 'undefined') {
+ return targetElm.attr('data-nodrag') !== 'false';
+ }
+ return false;
+ },
+
+ /**
+ * get the event object for touches
+ * @param {[type]} e [description]
+ * @return {[type]} [description]
+ */
+ eventObj: function (e) {
+ var obj = e;
+ if (e.targetTouches !== undefined) {
+ obj = e.targetTouches.item(0);
+ } else if (e.originalEvent !== undefined && e.originalEvent.targetTouches !== undefined) {
+ obj = e.originalEvent.targetTouches.item(0);
+ }
+ return obj;
+ },
+
+ dragInfo: function (node) {
+ return {
+ source: node,
+ sourceInfo: {
+ cloneModel: node.$treeScope.cloneEnabled === true ? angular.copy(node.$modelValue) : undefined,
+ nodeScope: node,
+ index: node.index(),
+ nodesScope: node.$parentNodesScope
+ },
+ index: node.index(),
+ siblings: node.siblings().slice(0),
+ parent: node.$parentNodesScope,
+
+ // Move the node to a new position
+ moveTo: function (parent, siblings, index) {
+ this.parent = parent;
+ this.siblings = siblings.slice(0);
+
+ // If source node is in the target nodes
+ var i = this.siblings.indexOf(this.source);
+ if (i > -1) {
+ this.siblings.splice(i, 1);
+ if (this.source.index() < index) {
+ index--;
+ }
+ }
+
+ this.siblings.splice(index, 0, this.source);
+ this.index = index;
+ },
+
+ parentNode: function () {
+ return this.parent.$nodeScope;
+ },
+
+ prev: function () {
+ if (this.index > 0) {
+ return this.siblings[this.index - 1];
+ }
+
+ return null;
+ },
+
+ next: function () {
+ if (this.index < this.siblings.length - 1) {
+ return this.siblings[this.index + 1];
+ }
+
+ return null;
+ },
+
+ isClone: function () {
+ return this.source.$treeScope.cloneEnabled === true;
+ },
+
+ clonedNode: function (node) {
+ return angular.copy(node);
+ },
+
+ isDirty: function () {
+ return this.source.$parentNodesScope != this.parent ||
+ this.source.index() != this.index;
+ },
+
+ isForeign: function () {
+ return this.source.$treeScope !== this.parent.$treeScope;
+ },
+
+ eventArgs: function (elements, pos) {
+ return {
+ source: this.sourceInfo,
+ dest: {
+ index: this.index,
+ nodesScope: this.parent
+ },
+ elements: elements,
+ pos: pos
+ };
+ },
+
+ apply: function () {
+
+ var nodeData = this.source.$modelValue;
+
+ // nodrop enabled on tree or parent
+ if (this.parent.nodropEnabled || this.parent.$treeScope.nodropEnabled) {
+ return;
+ }
+
+ // node was dropped in the same place - do nothing
+ if (!this.isDirty()) {
+ return;
+ }
+
+ // cloneEnabled and cross-tree so copy and do not remove from source
+ if (this.isClone() && this.isForeign()) {
+ this.parent.insertNode(this.index, this.sourceInfo.cloneModel);
+ } else { // Any other case, remove and reinsert
+ this.source.remove();
+ this.parent.insertNode(this.index, nodeData);
+ }
+ }
+ };
+ },
+
+ /**
+ * @ngdoc method
+ * @name ui.tree#height
+ * @methodOf ui.tree.service:UiTreeHelper
+ *
+ * @description
+ * Get the height of an element.
+ *
+ * @param {Object} element Angular element.
+ * @returns {String} Height
+ */
+ height: function (element) {
+ return element.prop('scrollHeight');
+ },
+
+ /**
+ * @ngdoc method
+ * @name ui.tree#width
+ * @methodOf ui.tree.service:UiTreeHelper
+ *
+ * @description
+ * Get the width of an element.
+ *
+ * @param {Object} element Angular element.
+ * @returns {String} Width
+ */
+ width: function (element) {
+ return element.prop('scrollWidth');
+ },
+
+ /**
+ * @ngdoc method
+ * @name ui.tree#offset
+ * @methodOf ui.nestedSortable.service:UiTreeHelper
+ *
+ * @description
+ * Get the offset values of an element.
+ *
+ * @param {Object} element Angular element.
+ * @returns {Object} Object with properties width, height, top and left
+ */
+ offset: function (element) {
+ var boundingClientRect = element[0].getBoundingClientRect();
+
+ return {
+ width: element.prop('offsetWidth'),
+ height: element.prop('offsetHeight'),
+ top: boundingClientRect.top + ($window.pageYOffset || $document[0].body.scrollTop || $document[0].documentElement.scrollTop),
+ left: boundingClientRect.left + ($window.pageXOffset || $document[0].body.scrollLeft || $document[0].documentElement.scrollLeft)
+ };
+ },
+
+ /**
+ * @ngdoc method
+ * @name ui.tree#positionStarted
+ * @methodOf ui.tree.service:UiTreeHelper
+ *
+ * @description
+ * Get the start position of the target element according to the provided event properties.
+ *
+ * @param {Object} e Event
+ * @param {Object} target Target element
+ * @returns {Object} Object with properties offsetX, offsetY, startX, startY, nowX and dirX.
+ */
+ positionStarted: function (e, target) {
+ var pos = {},
+ pageX = e.pageX,
+ pageY = e.pageY;
+
+ if (e.originalEvent && e.originalEvent.touches && (e.originalEvent.touches.length > 0)) {
+ pageX = e.originalEvent.touches[0].pageX;
+ pageY = e.originalEvent.touches[0].pageY;
+ }
+ pos.offsetX = pageX - this.offset(target).left;
+ pos.offsetY = pageY - this.offset(target).top;
+ pos.startX = pos.lastX = pageX;
+ pos.startY = pos.lastY = pageY;
+ pos.nowX = pos.nowY = pos.distX = pos.distY = pos.dirAx = 0;
+ pos.dirX = pos.dirY = pos.lastDirX = pos.lastDirY = pos.distAxX = pos.distAxY = 0;
+ return pos;
+ },
+
+ positionMoved: function (e, pos, firstMoving) {
+ var pageX = e.pageX,
+ pageY = e.pageY,
+ newAx;
+ if (e.originalEvent && e.originalEvent.touches && (e.originalEvent.touches.length > 0)) {
+ pageX = e.originalEvent.touches[0].pageX;
+ pageY = e.originalEvent.touches[0].pageY;
+ }
+ // mouse position last events
+ pos.lastX = pos.nowX;
+ pos.lastY = pos.nowY;
+
+ // mouse position this events
+ pos.nowX = pageX;
+ pos.nowY = pageY;
+
+ // distance mouse moved between events
+ pos.distX = pos.nowX - pos.lastX;
+ pos.distY = pos.nowY - pos.lastY;
+
+ // direction mouse was moving
+ pos.lastDirX = pos.dirX;
+ pos.lastDirY = pos.dirY;
+
+ // direction mouse is now moving (on both axis)
+ pos.dirX = pos.distX === 0 ? 0 : pos.distX > 0 ? 1 : -1;
+ pos.dirY = pos.distY === 0 ? 0 : pos.distY > 0 ? 1 : -1;
+
+ // axis mouse is now moving on
+ newAx = Math.abs(pos.distX) > Math.abs(pos.distY) ? 1 : 0;
+
+ // do nothing on first move
+ if (firstMoving) {
+ pos.dirAx = newAx;
+ pos.moving = true;
+ return;
+ }
+
+ // calc distance moved on this axis (and direction)
+ if (pos.dirAx !== newAx) {
+ pos.distAxX = 0;
+ pos.distAxY = 0;
+ } else {
+ pos.distAxX += Math.abs(pos.distX);
+ if (pos.dirX !== 0 && pos.dirX !== pos.lastDirX) {
+ pos.distAxX = 0;
+ }
+
+ pos.distAxY += Math.abs(pos.distY);
+ if (pos.dirY !== 0 && pos.dirY !== pos.lastDirY) {
+ pos.distAxY = 0;
+ }
+ }
+
+ pos.dirAx = newAx;
+ },
+
+ elementIsTreeNode: function (element) {
+ return typeof element.attr('ui-tree-node') !== 'undefined';
+ },
+
+ elementIsTreeNodeHandle: function (element) {
+ return typeof element.attr('ui-tree-handle') !== 'undefined';
+ },
+ elementIsTree: function (element) {
+ return typeof element.attr('ui-tree') !== 'undefined';
+ },
+ elementIsTreeNodes: function (element) {
+ return typeof element.attr('ui-tree-nodes') !== 'undefined';
+ },
+ elementIsPlaceholder: function (element) {
+ return element.hasClass(treeConfig.placeholderClass);
+ },
+ elementContainsTreeNodeHandler: function (element) {
+ return element[0].querySelectorAll('[ui-tree-handle]').length >= 1;
+ },
+ treeNodeHandlerContainerOfElement: function (element) {
+ return findFirstParentElementWithAttribute('ui-tree-handle', element[0]);
+ }
+ };
+ }
+ ]);
+
+ // TODO: optimize this loop
+ function findFirstParentElementWithAttribute(attributeName, childObj) {
+ // undefined if the mouse leaves the browser window
+ if (childObj === undefined) {
+ return null;
+ }
+ var testObj = childObj.parentNode,
+ count = 1,
+ // check for setAttribute due to exception thrown by Firefox when a node is dragged outside the browser window
+ res = (typeof testObj.setAttribute === 'function' && testObj.hasAttribute(attributeName)) ? testObj : null;
+ while (testObj && typeof testObj.setAttribute === 'function' && !testObj.hasAttribute(attributeName)) {
+ testObj = testObj.parentNode;
+ res = testObj;
+ if (testObj === document.documentElement) {
+ res = null;
+ break;
+ }
+ count++;
+ }
+
+ return res;
+ }
+
+})();
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js b/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
new file mode 100755
index 0000000..855f990
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/constants/componentConstants.js
@@ -0,0 +1,148 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+appDS2.constant("COMPONENT", (function() {
+ return {
+ A_LA_CARTE : "a la carte",
+ CLOUD_REGION_ID : "cloudRegionID",
+ COMPONENT_STATUS : "ComponentStatus",
+ CREATE_COMPONENT : "createComponent",
+ DELETE_COMPONENT : "deleteComponent",
+ ENTITY : "entity",
+ GET_COMPONENT_LIST : "getComponentList",
+ GET_SUBS : "getSubs",
+ GET_SUB_DETAILS : "getSubDetails",
+ GLOBAL_CUSTOMER_ID : "globalCustomerId",
+ MACRO : "Macro",
+ MODEL_VERSION_1 : "1",
+ MSO_CREATE_REQ : "createInstance",
+ MSO_DELETE_REQ : "deleteInstance",
+ NAME : "name",
+ NETWORK : "network",
+ NETWORKS : "networks",
+
+ QUERY_SERVICE_INSTANCE : "queryServiceInstance",
+ REFRESH_PROPERTIES : "refreshProperties",
+ SERVICE : "service",
+ SERVICE_TYPE : "serviceType",
+ SHOW_COMPONENT_DETAILS : "showComponentDetails",
+ STATUS : "status",
+ SUBSCRIBER_NAME : "subscriberName",
+ TENANT_ID : "tenantID",
+ TENANT_NAME : "tenantName",
+ TRUE : "true",
+
+ VF_MODULE : "vfModule",
+ VNF : "vnf",
+ VNF_CODE : "vnfCode",
+ VNF_FUNCTION : "vnfFunction",
+ VNF_ROLE : "vnfRole",
+ VNF_TYPE : "vnfType",
+ VOLUME_GROUP : "volumeGroup",
+
+
+ // IDs
+ CIDR_MASK_1 : "255.255.255.000",
+ //COMPONENT_LIST_NAMED_QUERY_ID : "ed0a0f5b-cf79-4784-88b2-911cd726cd3d",
+ CUSTOMER_ID_1 : "icore9883749",
+ DELETE_INSTANCE_ID_1 : "ff305d54-75b4-ff1b-fff1-eb6b9e5460ff",
+ GATEWAY_ADDRESS_1 : "10.10.125.1",
+ GLOBAL_SUBSCRIBER_ID_1 : "C12345",
+ INSTANCE_ID_1 : "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ INSTANCE_ID_2 : "ff305d54-75b4-ff1b-adb2-eb6b9e5460ff",
+ INSTANCE_ID_3 : "ff305d54-75b4-ff1b-bdb2-eb6b9e5460ff",
+ MODEL_ID_1 : "sn5256d1-5a33-55df-13ab-12abad84e764",
+ MODEL_ID_2 : "ff5256d1-5a33-55df-aaaa-12abad84e7ff",
+ MODEL_ID_3 : "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ MODEL_ID_4 : "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+ MODEL_ID_5 : "ff5256d1-5a33-55df-13ab-22abad84e7ff",
+ MODEL_NAME_VERSION_ID_1 : "ab6478e4-ea33-3346-ac12-ab121484a333",
+ MODEL_NAME_VERSION_ID_2 : "fe6478e4-ea33-3346-aaaa-ab121484a3fe",
+ MODEL_NAME_VERSION_ID_3 : "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ MODEL_NAME_VERSION_ID_4 : "fe6478e4-ea33-3346-ac12-ab121484a3fe",
+ MODEL_NAME_VERSION_ID_5 : "fe6478e4-ea33-3346-bc12-ab121484a3fe",
+ SERVICE_INSTANCE_ID_1 : "bc305d54-75b4-431b-adb2-eb6b9e546014",
+ SUBSCRIBER_NAME_GED12 : "General Electric Division 12",
+ VNF_INSTANCE_ID : "VNF_INSTANCE_ID_12345",
+ VPN_ID_1 : "1a2b3c4d5e6f",
+
+ // PATHS
+ ASSIGN : "?r=",
+ AAI_GET_SERVICE_INSTANCE_PATH : "aai_get_service_instance/",
+ AAI_GET_SERVICES : "aai_get_services",
+ AAI_GET_TENANTS : "aai_get_tenants/",
+ AAI_SUB_DETAILS_PATH : "aai_sub_details/",
+ AAI_SUB_VIEWEDIT_PATH : "aai_sub_viewedit",
+ ASDC_GETMODEL_PATH : "asdc/getModel/",
+ CREATE_INSTANCE_PATH : "/models/services/createInstance",
+ FORWARD_SLASH : "/",
+ GET_SYSTEM_PROP_VNF_PROV_STATUS_PATH : "get_system_prop_vnf_prov_status",
+ GET_USER_ID : "getuserID",
+ INSTANTIATE_ROOT_PATH : "#/instantiate?subscriberId=",
+ INSTANTIATE_PATH : "/instantiate",
+ INVALID_STRING : "/INVALID_STRING/",
+ INVALID_STRING_MSO_CREATE_SVC_INSTANCE : "INVALID_STRING_mso_create_svc_instance",
+ MSO_CREATE_NW_INSTANCE : "mso_create_nw_instance",
+ MSO_CREATE_NW_INSTANCE_PATH : "mso_create_nw_instance/",
+ MSO_CREATE_SVC_INSTANCE : "mso_create_svc_instance",
+ MSO_DELETE_SVC_INSTANCE_PATH : "mso_delete_svc_instance/",
+ SELECTED_SERVICE_SUB_PATH : "#/instances/subdetails?selectedServiceSubscription=",
+ SELECTED_SUB_PATH : "#/instances/subdetails?selectedSubscriber=",
+ SELECTEDSERVICEINSTANCE_SUB_PATH : "&selectedServiceInstance=",
+ SELECTEDSUBSCRIBER_SUB_PATH : "&selectedSubscriber=",
+ SERVICE_TYPE_LIST_PATH : "#/instances/serviceTypes?serviceTypeList=",
+ SERVICE_MODLES_INSTANCES_SUBSCRIBERS_PATH : 'serviceModels.htm#/instances/subscribers',
+ SERVICES_DIST_STATUS_PATH : "rest/models/services?distributionStatus=",
+ SERVICES_PATH : "rest/models/services/",
+ SERVICETYPE_SUB_PATH : "&serviceType=",
+ SERVICEINSTANCEID_SUB_PATH : "&serviceInstanceId=",
+ SERVICEMODELS_INSTANCES_SERVICES_PATH : "serviceModels.htm#/instances/services",
+ SERVICEMODELS_MODELS_SERVICES_PATH : "serviceModels.htm#/models/services",
+ SUBDETAILS_SELECTEDSUBSCRIBER : "#subdetails?selectedSubscriber=",
+ SUBSCRIBERNAME_SUB_PATH : "&subscriberName=",
+ WELCOME_PATH : "welcome.htm",
+
+ //Template Urls
+ AAI_GET_SUBS_URL : "app/vid/scripts/view-models/aaiGetSubs.htm",
+ AAI_GET_SUBSCRIBER_URL : "app/vid/scripts/view-models/aaiGetSubscriberList.htm",
+ AAI_SERVICE_TYPES_URL : "app/vid/scripts/view-models/aaiServiceTypes.htm",
+ AAI_SUB_DETAILS_URL : "app/vid/scripts/view-models/aaiSubDetails.htm",
+ CREATE_INSTANCE_SERVICE_MODELS_URL : "app/vid/scripts/view-models/createInstanceServiceModels.htm",
+ INSTANTIATE_URL : "app/vid/scripts/view-models/instantiate.htm",
+ SERVICE_MODELS : "app/vid/scripts/view-models/serviceModels.htm",
+
+
+
+ FULL_NAME_MAP : {
+ "model-invariant-id" : "Model ID",
+ "model-version-id" : "Model Version ID"
+ },
+ PARTIAL_NAME_MAP : {
+ "id" : "ID",
+ "uuid" : "UUID",
+ "vfmodule" : "VF Module",
+ "vnf" : "VNF",
+ "volumegroup" : "Volume Group"
+ }
+
+ };
+})())
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/constants/fieldConstants.js b/vid-app-common/src/main/webapp/app/vid/scripts/constants/fieldConstants.js
new file mode 100755
index 0000000..6dbcbc2
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/constants/fieldConstants.js
@@ -0,0 +1,378 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+appDS2.factory("FIELD", [ "PARAMETER", function(PARAMETER) {
+
+ /*
+ * ID values are typically used internally.
+ */
+ var ID = {
+ AVAILABLE_VOLUME_GROUP : "availableVolumeGroup",
+ INSTANCE_NAME : "instanceName",
+ LCP_REGION : "lcpRegion",
+ LCP_REGION_TEXT : "lcpRegionText",
+ PRODUCT_FAMILY : "productFamily",
+ SERVICE_TYPE : "serviceType",
+ SUBSCRIBER_NAME : "subscriberName",
+ SUPPRESS_ROLLBACK : "suppressRollback",
+ TENANT : "tenant",
+ VNF_TARGETPROVSTATUS : "target",
+
+ AAI_GET_FULL_SUBSCRIBERS : "aai_get_full_subscribers",
+ AAI_REFRESH_FULL_SUBSCRIBERS : "aai_refresh_full_subscribers",
+ AAI_GET_SERVICES : "aai_get_services",
+ AAI_GET_SUBSCRIBERS : "aai_get_subscribers",
+ AAI_GET_TENTANTS : "aai_get_tenants",
+ AAI_REFRESH_SUBSCRIBERS : "aai_refresh_subscribers",
+ AAI_SUB_DETAILS : "aai_sub_details",
+ AAI_SUB_VIEWEDIT : "aai_sub_viewedit",
+ ANGULAR_UI_TREE_COLLAPSEALL : "angular-ui-tree:collapse-all",
+ ANGULAR_UI_TREE_EXPANDALL : "angular-ui-tree:expand-all",
+ CATEGORY : "category",
+ COLOR_8F8 : "#8F8",
+ COLOR_F88 : "#F88",
+ COLOR_NONE : "none",
+ CUSTOMER : "customer",
+ CUSTOMIZATION_UUID : "customizationUuid",
+ DESCRIPTION : "description",
+ GENERIC_VNF : "generic-vnf",
+ GLOBAL_CUSTOMER_ID : "global-customer-id",
+ GLOBAL_CUST_ID : "globalCustomerId",
+ IN_MAINT : "in-maint",
+ INVENTORY_RESPONSE_ITEMS : "inventory-response-items",
+ INVENTORY_RESPONSE_ITEM : "inventory-response-item",
+ L3_NETWORK : "l3-network",
+ SUB_NET : "subnet",
+ SUBNET_NAME : "subnet-name",
+ SUBNET_ID : "subnet-id",
+ GATEWAY_ADDRESS : "gateway-address",
+ NETWORK_START_ADDRESS : "network-start-address",
+ CIDR_MASK : "cidr-mask",
+ MODEL_CUSTOMIZATION_ID : "model-customization-id",
+ MODEL_CUSTOMIZATION_NAME : "modelCustomizationName",
+ MODEL_INVARIANT_ID : "modelInvariantId",
+ MODEL_INVAR_ID : "model-invariant-id",
+ MODEL_NAME : "modelName",
+ MODEL_NAME_VERSION_ID : "modelNameVersionId",
+ MODEL_VERSION : "modelVersion",
+ MODEL_VERSION_ID : "model-version-id",
+ NETWORK_NAME : "network-name",
+ NETWORK_ID : "network-id",
+ NETWORK_TYPE : "network-type",
+ NETWORKS : "networks",
+ OPERATIONAL_STATUS : "operational-status",
+ ORCHESTRATION_STATUS : "orchestration-status",
+ PERCENT_PROGRESS : "precentProgress",
+ PERSONA_MODEL_ID : "persona-model-id",
+ PERSONA_MODEL_VERSION : "persona-model-version",
+ PERSONA_MODEL_CUSTOMIZATION_ID : "persona-model-customization-id",
+ PROV_STATUS : "prov-status",
+ REQUEST : "request",
+ REQUEST_ID : "requestId",
+ REQUEST_LIST : "requestList",
+ REQUEST_TYPE : "requestType",
+ REQUEST_REFERENCES : "requestReferences",
+ REQUEST_STATE : "requestState",
+ REQUEST_STATUS : "requestStatus",
+ RESOURCE_LINK : "resource-link",
+ RESULT_DATA : "result-data",
+ SERVICE_DESCRIPTION : "service-description",
+ SERVICE_ID : "service-id",
+ SERVICE_INSTANCE : "service-instance",
+ SERVICE_INSTANCES : "service-instances",
+ SERVICE_INSTANCE_ID : "service-instance-id",
+ SERVICE_INSTANCE_NAME : "service-instance-name",
+ SERVICE_SUBSCRIPTION : "service-subscription",
+ SERVICE_SUBSCRIPTIONS : "service-subscriptions",
+ SERVICE_TYPE : "service-type",
+ STATUS_MESSAGE : "statusMessage",
+ SUBNAME : "subscriber-name",
+ TIMESTAMP : "timestamp",
+ VF_MODULE : "vf-module",
+ VF_MODULES : "vfModules",
+ VF_MODULE_ID : "vf-module-id",
+ VF_MODULE_NAME : "vf-module-name",
+ VID : "VID",
+ VNF_ID : "vnf-id",
+ VNF_NAME : "vnf-name",
+ VNF_TYPE : "vnf-type",
+ VNFS : "vnfs",
+ AVAILABLEVOLUMEGROUPS : "availableVolumeGroups",
+ VOLUMEGROUPS : "volumeGroups",
+ VOLUME_GROUP : "volume-group",
+ VOLUME_GROUP_ID : "volume-group-id",
+ VOLUME_GROUP_NAME : "volume-group-name",
+ };
+
+ var KEY = {
+ LCP_REGION_TEXT : "LEGACYREGION"
+ };
+
+ /*
+ * NAME values are displayed on GUI pages.
+ */
+ var NAME = {
+ AVAILABLE_VOLUME_GROUP : "Available Volume Group",
+ INSTANCE_NAME : "Instance Name",
+ CUSTOMER_ID : "Customer ID",
+ LCP_REGION : "LCP Region",
+ LCP_REGION_TEXT : "Legacy Region",
+ MODEL_INVARIANT_UUID: "Model Invariant UUID",
+ MODEL_NAME: "Model Name",
+ MODEL_VERSION: "Model Version",
+ MODEL_UUID: "Model UUID",
+ MODEL_CUSTOMIZATION_UUID: "Model Customization UUID",
+ MODEL_VNF_TYPE: "NF Type",
+ MODEL_VNF_ROLE: "NF Role",
+ MODEL_VNF_FUNCTION: "NF Function",
+ MODEL_VNF_CODE: "NF Code",
+ MODEL_CUSTOMIZATION_NAME: "Resource Name",
+ PRODUCT_FAMILY : "Product Family",
+ RESOURCE_DESCRIPTION : "Resource Description",
+ RESOURCE_NAME : "Resource Name",
+ SERVICE_CATEGORY : "Service Category",
+ SERVICE_DESCRIPTION : "Service Description",
+ SERVICE_INSTANCE_ID : "Service Instance ID",
+ SERVICE_INSTANCE_Id : "Service Instance Id",
+ SERVICE_INSTANCE_NAME : "Service Instance Name",
+ SERVICE_INVARIANT_UUID : "Service Invariant UUID",
+ SERVICE_NAME : "Service Name",
+ SERVICE_TYPE : "Service Type",
+ SERVICE_UUID : "Service UUID",
+ SERVICE_VERSION : "Service Version",
+ SUBSCRIBER_NAME : "Subscriber Name",
+ SUPPRESS_ROLLBACK : "Suppress Rollback on Failure",
+ TENANT : "Tenant",
+ USER_SERVICE_INSTANCE_NAME : "User Service Instance Name",
+ VF_MODULE_DESCRIPTION : "VF Module Description",
+ VF_MODULE_LABEL : "VF Module Label",
+ VF_MODULE_TYPE : "VF Module Type",
+ VNF_ORCHESTRATION_STATUS : "Orchestration Status",
+ VNF_Operational_Status: "Operational Status",
+ VNF_Current_Prov_Status: "Current Prov_Status",
+ VNF_Target_Prov_Status: "Target Prov Status",
+ VNF_VNF_ID : "VNF ID",
+ VNF_VNF_Name: "VNF Name",
+ VNF_VNF_Type: "VNF Type",
+ VNF_Service_ID: "Service ID",
+ VNF_In_Maint: "In Maint",
+ VFMDULE_CUSTOMIZATIONUUID: "VF Module Model Customization UUID",
+ RESOURCE_CUSTOMIZATION_UUID: "Resource Model Customization UUID"
+ };
+
+ /*
+ * PROMPT values are initial values displayed in select lists.
+ */
+ var PROMPT = {
+ AVAILABLE_VOLUME_GROUP : "Select Volume Group",
+ DEFAULT_A : "A default",
+ DEFAULT_B : "B default",
+ LCP_REGION : "Select LCP Region",
+ NO_SERVICE_INSTANCE : "No Service Instance Found",
+ NO_SERVICE_SUB : "No Service Subscription Found",
+ PRODUCT_FAMILY : "Select Product Family",
+ REGION : "Please choose a region",
+ SERVICE_TYPE : "Select Service Type",
+ SUBSCRIBER_NAME : "Select Subscriber Name",
+ TARGETPROVSTATUS : "Select Target Prov Status",
+ TENANT : "Select Tenant Name",
+ TEXT_INPUT : "Enter data",
+ SELECT_SERVICE : "Select a service type",
+ SELECT_SUB : "Select a subscriber name",
+ FETCHING_SUBS : " Fetching subscriber list from A&AI",
+ REFRESH_SUB_LIST : "Refreshing subscriber list from A&AI...",
+ VAR_DESCRIPTION_A : "This variable is 'a'",
+ VAR_DESCRIPTION_B : "This variable is 'b'",
+
+ };
+
+ var STATUS = {
+ // Status
+ ALL : "ALL",
+ COMPLETE : "Complete",
+ DONE : "Done",
+ ERROR : "Error",
+ FAILED : "Failed",
+ FAILED_SERVICE_MODELS_ASDC : "Failed to get service models from SDC.",
+ FETCHING_SERVICE_TYPES : "Fetching service types list from A&AI",
+ FETCHING_SERVICE_CATALOG : "Fetching service catalog from AAI. Please wait.",
+ FETCHING_SERVICE_CATALOG_ASDC : "Fetching service catalog from SDC. Please wait.",
+ FETCHING_SUB_DETAILS : "Fetching subscriber details from A&AI for ",
+ FETCHING_SERVICE_INST_DATA : "Fetching service instance data from A&AI for service-instance-id=",
+ FETCHING_SUBSCRIBER_LIST_AAI : "Fetching subscriber list from A&AI...",
+ IN_PROGRESS : "In Progress",
+ IS_SUCCESSFUL : " isSuccessful: ",
+ MSO_FAILURE : "msoFailure",
+ NONE : "None",
+ NOT_FOUND : "Not Found",
+ NO_SERVICE_SUBSCRIPTION_FOUND : "No Service Subscription Found",
+ SUBMITTING_REQUEST : "Submitting Request",
+ SUCCESS_VNF_PROV_STATUS : "Successfully set the VNF's Prov_Status to ",
+ UNLOCKED : "Unlocked",
+
+ };
+
+ var STYLE = {
+ TABLE : "width: auto; margin: 0 auto; border-collapse: collapse; border: none;",
+ NAME : "width: 220px; text-align: left; vertical-align: middle; font-weight: bold; padding: 3px 5px; border: none;",
+ VALUE : "width: 400px; text-align: left; vertical-align: middle; padding: 3px 5px; border: none;",
+ CHECKBOX_VALUE : "width: 400px; text-align: center; vertical-align: middle; padding: 3px 5px; border: none;",
+ TEXT_INPUT : "height: 25px; padding: 2px 5px;",
+ CHECKBOX_INPUT : "height: 18px; width: 18px; padding: 2px 5px;",
+ SELECT : "height: 25px; padding: 2px; text-align: center;",
+ REQUIRED_LABEL : "width: 25px; padding: 5px 10px 10px 5px;",
+
+ DISABLED : "disabled",
+ BTN_INACTIVE : "button--inactive",
+ BTN_PRIMARY : "button--primary",
+ BTN_TYPE : "btn-type",
+ MSO_CTRL_BTN : "div[ng-controller=msoCommitController] button",
+ PRIMARY : "primary",
+ PROGRESS_BAR_INFO : "progress-bar progress-bar-info",
+ PROGRESS_BAR_SUCCESS : "progress-bar progress-bar-success",
+ }
+
+ var ERROR = {
+ AAI : "A&AI failure - see log below for details",
+ AAI_ERROR : "A&AI Error",
+ AAI_FETCHING_CUST_DATA : "Failed to fetch customer data from A&AI: Response Code: ",
+ FETCHING_SERVICE_TYPES : "Failed to fetch service types from A&AI: Response Code: ",
+ FETCHING_SERVICES : "Failed to fetch services from A&AI: Response Code: ",
+ FETCHING_SERVICE_INSTANCE_DATA : "Failed to fetch service instance data from A&AI: Response Code: ",
+ INVALID_INSTANCE_NAME : "Invalid instance name: ",
+ INSTANCE_NAME_VALIDATE : "The instance name must contain only alphanumeric or \"_-.\" characters, and must start with an alphabetic character",
+ MAX_POLLS_EXCEEDED : "Maximum number of poll attempts exceeded",
+ MISSING_DATA : "Missing data",
+ MODEL_VERSION_ID_MISSING : "Error: model-version-id is not populated in A&AI",
+ MSO : "MSO failure - see log below for details",
+ NO_MATCHING_MODEL : "No matching model found matching the persona Model Id = ",
+ NO_MATCHING_MODEL_AAI : "No matching model found matching the A&AI model version ID = ",
+ SELECT : "Please select a subscriber or enter a service instance",
+ SERVICE_INST_DNE : "That service instance does not exist. Please try again.",
+ SYSTEM_FAILURE : "System failure",
+
+ }
+
+ /*
+ * PARAMETER values indicate field configurations that are provided to
+ * parameter block directives.
+ */
+
+ var PARAMETER = {
+ AVAILABLE_VOLUME_GROUP : {
+ name : NAME.AVAILABLE_VOLUME_GROUP,
+ id : ID.AVAILABLE_VOLUME_GROUP,
+ type : PARAMETER.SELECT,
+ prompt : PROMPT.AVAILABLE_VOLUME_GROUP,
+ isRequired : true
+ },
+ INSTANCE_NAME : {
+ name : NAME.INSTANCE_NAME,
+ id : ID.INSTANCE_NAME,
+ isRequired : true
+ },
+ LCP_REGION : {
+ name : NAME.LCP_REGION,
+ id : ID.LCP_REGION,
+ type : PARAMETER.SELECT,
+ prompt : PROMPT.LCP_REGION,
+ isRequired : true
+ },
+ VNF_TARGET_PROVSTATUS : {
+ name : NAME.VNF_Target_Prov_Status,
+ id : ID.VNF_TARGETPROVSTATUS,
+ type : PARAMETER.SELECT,
+ prompt : PROMPT.TARGETPROVSTATUS,
+ isRequired : true
+ },
+ LCP_REGION_TEXT_HIDDEN : {
+ id : ID.LCP_REGION_TEXT,
+ isVisible : false
+ },
+ LCP_REGION_TEXT_VISIBLE : {
+ name : NAME.LCP_REGION_TEXT,
+ id : ID.LCP_REGION_TEXT,
+ isRequired : true,
+ isVisible : true
+ },
+ PRODUCT_FAMILY : {
+ name : NAME.PRODUCT_FAMILY,
+ id : ID.PRODUCT_FAMILY,
+ type : PARAMETER.SELECT,
+ prompt : PROMPT.PRODUCT_FAMILY,
+ isRequired : true
+ },
+ SERVICE_TYPE : {
+ name : NAME.SERVICE_TYPE,
+ id : ID.SERVICE_TYPE,
+ type : PARAMETER.SELECT,
+ prompt : PROMPT.SERVICE_TYPE,
+ isRequired : true
+ },
+ SERVICE_TYPE_DISABLED : {
+ name : NAME.SERVICE_TYPE,
+ id : ID.SERVICE_TYPE,
+ type : PARAMETER.SELECT,
+ isEnabled : false,
+ isRequired : true
+ },
+ SUPPRESS_ROLLBACK : {
+ name : NAME.SUPPRESS_ROLLBACK,
+ id : ID.SUPPRESS_ROLLBACK,
+ type : PARAMETER.BOOLEAN,
+ value : false
+ },
+ SUBSCRIBER_NAME : {
+ name : NAME.SUBSCRIBER_NAME,
+ id : ID.SUBSCRIBER_NAME,
+ type : PARAMETER.SELECT,
+ prompt : PROMPT.SUBSCRIBER_NAME,
+ isRequired : true
+ },
+ TENANT_DISABLED : {
+ name : NAME.TENANT,
+ id : ID.TENANT,
+ type : PARAMETER.SELECT,
+ isEnabled : false,
+ isRequired : true
+ },
+ TENANT_ENABLED : {
+ name : NAME.TENANT,
+ id : ID.TENANT,
+ type : PARAMETER.SELECT,
+ isEnabled : true,
+ prompt : PROMPT.TENANT,
+ isRequired : true
+ }
+ };
+
+ return {
+ ID : ID,
+ KEY : KEY,
+ NAME : NAME,
+ PARAMETER : PARAMETER,
+ PROMPT : PROMPT,
+ STATUS : STATUS,
+ STYLE : STYLE,
+ ERROR : ERROR,
+ }
+} ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/constants/parameterConstants.js b/vid-app-common/src/main/webapp/app/vid/scripts/constants/parameterConstants.js
new file mode 100755
index 0000000..4e3ad29
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/constants/parameterConstants.js
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+appDS2.constant("PARAMETER", (function() {
+ return {
+ BOOLEAN : "boolean",
+ SELECT : "select",
+ STRING : "string",
+ NUMBER : "number",
+ VALID_VALUES : "valid_values",
+ EQUAL : "equal",
+ LENGTH : "length",
+ MAX_LENGTH : "max_length",
+ MIN_LENGTH : "min_length",
+ IN_RANGE : "in_range",
+ CONSTRAINTS : "constraints",
+ OPERATOR : "operator",
+ CONSTRAINT_VALUES : "constraintValues",
+ DEFAULT : "default",
+ DESCRIPTION : "description",
+ TYPE: "type",
+ INTEGER: "integer",
+ RANGE: "range",
+ LIST: "list",
+ MAP: "map",
+ REQUIRED: "required",
+ GREATER_THAN: "greater_than",
+ LESS_THAN: "less_than",
+ GREATER_OR_EQUAL: "greater_or_equal",
+ LESS_OR_EQUAL: "less_or_equal"
+
+ };
+})())
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/constants/vidConfiguration.js b/vid-app-common/src/main/webapp/app/vid/scripts/constants/vidConfiguration.js
new file mode 100755
index 0000000..8fdfd3f
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/constants/vidConfiguration.js
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+appDS2.constant("VIDCONFIGURATION", (function() {
+ /*
+ * VNF_STATUS_CHECK_ENABLED: Determines whether VID will check the VNF valid status combination list, before allowing VNF updates.
+ * Set to false, to disable the check.
+ */
+ var VNF_STATUS_CHECK_ENABLED = false;
+ /*
+ * List of valid VNF status combinations
+ */
+ var vnfValidStatusList = [
+ {
+ "provStatus": "preprov",
+ "orchestrationStatus": "pending-create",
+ "inMaint": false,
+ "operationalStatus": null
+ },
+ {
+ "provStatus": "preprov",
+ "orchestrationStatus": "created",
+ "inMaint": false,
+ "operationalStatus": null
+ },
+ {
+ "provStatus": "preprov",
+ "orchestrationStatus": "active",
+ "inMaint": false,
+ "operationalStatus": null
+ },
+ {
+ "provStatus": "nvtprov",
+ "orchestrationStatus": "active",
+ "inMaint": false,
+ "operationalStatus": null
+ },
+ {
+ "provStatus": "prov",
+ "orchestrationStatus": "active",
+ "inMaint": false,
+ "operationalStatus": "out-of-service-path"
+ }
+ ];
+ /*
+ * The model status VID uses to query SDC for a list of models. The possible values are:
+ * DISTRIBUTION_NOT_APPROVED,
+ * DISTRIBUTION_APPROVED,
+ * DISTRIBUTED,
+ * DISTRIBUTION_REJECTED,
+ * ALL,
+ * In the production env, this should always be set to DISTRIBUTED
+ */
+ var ASDC_MODEL_STATUS = "DISTRIBUTED";
+ /*
+ * Max number of times that VID will poll MSO for a given request status
+ */
+ var MSO_MAX_POLLS = 10;
+ /*
+ * Number of msecs that VID will wait between MSO polls.
+ */
+ var MSO_POLLING_INTERVAL_MSECS = 10000;
+ /*
+ * List of all service model invariant UUIDs that need macro instantiation.
+ * Example:
+ * MACRO_SERVICES : ["3cf30cbb-5fe7-4fb3-b049-559a4997b221", "b135a703-bab5-4295-a37f-580a4f2d0961"]
+ *
+ */
+ var COMPONENT_LIST_NAMED_QUERY_ID = "0367193e-c785-4d5f-9cb8-7bc89dc9ddb7";
+ var MACRO_SERVICES = [];
+ return {
+ ASDC_MODEL_STATUS : ASDC_MODEL_STATUS,
+ MSO_MAX_POLLS : MSO_MAX_POLLS,
+ MSO_POLLING_INTERVAL_MSECS : MSO_POLLING_INTERVAL_MSECS,
+ VNF_STATUS_CHECK_ENABLED : VNF_STATUS_CHECK_ENABLED,
+ VNF_VALID_STATUS_LIST : vnfValidStatusList,
+ MACRO_SERVICES : MACRO_SERVICES,
+ COMPONENT_LIST_NAMED_QUERY_ID : COMPONENT_LIST_NAMED_QUERY_ID
+ };
+})())
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js
new file mode 100755
index 0000000..f928f4e
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/InstantiationController.js
@@ -0,0 +1,1217 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+/**
+ * The Instantiation (or View/Edit) Controller controls the instantiation/removal of
+ * deployable objects (Services, VNFs, VF-Modules, Networks, and Volume-Groups)
+ */
+(function () {
+ "use strict";
+
+ appDS2.requires.push('ui.tree');
+
+ appDS2.controller("InstantiationController", function ($scope, $route, $location, $timeout, COMPONENT, VIDCONFIGURATION, FIELD, DataService, PropertyService, UtilityService, VnfService, $http, vidService) {
+
+ $scope.popup = new Object();
+ $scope.defaultBaseUrl = "";
+ $scope.responseTimeoutMsec = 60000;
+ $scope.properties = UtilityService.getProperties();
+ $scope.init = function() {
+
+ /*
+ * These 2 statements should be included in non-test code.
+ */
+ // takes a default value, retrieves the prop value from the file system and sets it
+ var msecs = PropertyService.retrieveMsoMaxPollingIntervalMsec();
+ PropertyService.setMsoMaxPollingIntervalMsec(msecs);
+
+ // takes a default value, retrieves the prop value from the file system and sets it
+ var polls = PropertyService.retrieveMsoMaxPolls();
+ PropertyService.setMsoMaxPolls(polls);
+
+ PropertyService.setServerResponseTimeoutMsec(10000);
+
+ /*
+ * Common parameters that shows an example of how the view edit screen
+ * is expected to pass some common service instance values to the
+ * popups.
+ */
+
+// DataService.setSubscriberName("Mobility");
+// DataService.setGlobalCustomerId("CUSTID12345")
+// DataService.setServiceType("Mobility Type 1");
+// DataService.setServiceInstanceName("Example Service Instance Name");
+// DataService.setServiceName("Mobility Service 1");
+// DataService.setServiceInstanceId("mmsc-test-service-instance");
+// DataService.setServiceUuid("XXXX-YYYY-ZZZZ");
+// DataService.setUserServiceInstanceName("USER_SERVICE_INSTANCE_NAME");
+ }
+
+ //PropertyService.setMsoBaseUrl("testmso");
+
+ $scope.convertModel = function(asdcModel) {
+ if (!asdcModel) return undefined;
+ var convertedAsdcModel = UtilityService.convertModel(asdcModel);
+ return convertedAsdcModel;
+ };
+
+ $scope.service = {
+ "model": vidService.getModel(),
+ "convertedModel": $scope.convertModel(vidService.getModel()),
+ "instance": vidService.getInstance()
+ };
+
+ $scope.returnVfModules = function (vnfInstance) {
+
+ var svcModel = $scope.service.convertedModel;
+ //var vnfModelInvariantUuid = vnfInstance[FIELD.ID.MODEL_INVAR_ID];
+ var vnfModelVersionId = vnfInstance[FIELD.ID.MODEL_VERSION_ID]; // model uuid
+ var vnfModelCustomizationUuid = vnfInstance[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+
+ var vnfModel = null;
+
+ if ( (!($scope.isObjectEmpty(svcModel))) && ( !($scope.isObjectEmpty(svcModel.vnfs) ) ) ) {
+ if ( (svcModel.isNewFlow) && (vnfModelCustomizationUuid != null ) ) {
+ vnfModel = svcModel.vnfs[vnfModelCustomizationUuid];
+ if ( !($scope.isObjectEmpty(vnfModel.vfModules) ) ) {
+ //console.log ("vnfModel.vfModules: "); console.log (JSON.stringify(vnfModel.vfModules, null, 4));
+ return (vnfModel.vfModules);
+ }
+ }
+ else {
+ // old flow
+ if ( vnfModelVersionId != null ) {
+ vnfModel = svcModel.vnfs[vnfModelVersionId];
+ if ( !($scope.isObjectEmpty(vnfModel.vfModules) ) ) {
+ //console.log ("vnfModel.vfModules: "); console.log (JSON.stringify(vnfModel.vfModules, null, 4));
+ return (vnfModel.vfModules);
+ }
+ }
+ }
+
+ }
+ return null;
+ }
+ $scope.hasVfModules = function (vnfInstance) {
+ if ($scope.returnVfModules(vnfInstance) != null ){
+ return true;
+ }
+ return false;
+ }
+ $scope.returnVolumeGroups = function (vnfInstance) {
+
+ var svcModel = $scope.service.convertedModel;
+
+ //var vnfModelInvariantUuid = vnfInstance[FIELD.ID.MODEL_INVAR_ID];
+ var vnfModelVersionId = vnfInstance[FIELD.ID.MODEL_VERSION_ID];
+ var vnfModelCustomizationUuid = vnfInstance[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+
+ var vnfModel = null;
+
+ if ( (!($scope.isObjectEmpty(svcModel))) && ( !($scope.isObjectEmpty(svcModel.vnfs) ) ) ) {
+ if ( (svcModel.isNewFlow) && (vnfModelCustomizationUuid != null ) ) {
+ vnfModel = svcModel.vnfs[vnfModelCustomizationUuid];
+ if ( !($scope.isObjectEmpty(vnfModel.volumeGroups) ) ) {
+ //console.log ("vnfModel.volumeGroups: "); console.log (JSON.stringify(vnfModel.volumeGroups, null, 4));
+ return (vnfModel.volumeGroups);
+ }
+ }
+ else {
+ // old flow
+ if ( vnfModelVersionId != null ) {
+ vnfModel = svcModel.vnfs[vnfModelVersionId];
+ if ( !($scope.isObjectEmpty(vnfModel.volumeGroups) ) ) {
+ //console.log ("vnfModel.vfModules: "); console.log (JSON.stringify(vnfModel.volumeGroups, null, 4));
+ return (vnfModel.volumeGroups);
+ }
+ }
+ }
+
+ }
+ return null;
+ }
+ $scope.hasVolumeGroups = function (vnfInstance) {
+ if ($scope.returnVolumeGroups(vnfInstance) != null ){
+ return true;
+ }
+ return false;
+ }
+ $scope.deleteNetwork = function(serviceObject, network) {
+
+ console.log("Removing Network " + network.name);
+
+ //Send delete network request to MSO
+
+ //var networks = this.service.instance.networks;
+
+ //networks.splice(networks.indexOf(network), 1);
+
+ //Retrieve updated data from A&AI
+ var serviceInstance = serviceObject.object;
+ var svcModel = $scope.service.convertedModel;
+ var netModel;
+ DataService.setInventoryItem(network.object);
+ // set model default and override later if found
+ DataService.setModelInfo(COMPONENT.NETWORK, {});
+
+ if ( network.object != null ) {
+
+ //var netModelInvariantUuid = network.object[FIELD.ID.MODEL_INVAR_ID];
+ var netModelVersionId = network.object[FIELD.ID.MODEL_VERSION_ID]; // model uuid
+ var netModelCustomizationUuid = network.object[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+
+ if ( (!($scope.isObjectEmpty(svcModel))) && ( !($scope.isObjectEmpty(svcModel.networks) ) ) ) {
+ if ( (svcModel.isNewFlow) && (UtilityService.hasContents(netModelCustomizationUuid) ) ) {
+ netModel = svcModel.networks[netModelCustomizationUuid];
+ }
+ else {
+
+ if ( UtilityService.hasContents(netModelVersionId) ) {
+ netModel = svcModel.networks[netModelVersionId];
+ }
+
+ }
+ }
+ }
+ if (!($scope.isObjectEmpty(netModel) ) ) {
+ DataService.setModelInfo(COMPONENT.NETWORK, {
+ "modelInvariantId": netModel.invariantUuid,
+ "modelVersion": netModel.version,
+ "modelNameVersionId": netModel.uuid,
+ "modelCustomizationName": netModel.modelCustomizationName,
+ "customizationUuid": netModel.customizationUuid,
+ "modelName": netModel.name,
+ "inputs": ""
+ });
+ }
+
+ DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]);
+ DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]);
+ DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]);
+
+ DataService.setGlobalCustomerId(serviceObject[FIELD.ID.GLOBAL_CUST_ID]);
+ DataService.setServiceInstanceName($scope.service.instance.name);
+ DataService.setServiceName($scope.service.model.service.name);
+ DataService.setServiceUuid($scope.service.model.service.uuid);
+ DataService.setNetworkInstanceId(network.object[FIELD.ID.NETWORK_ID]);
+
+ $scope.$broadcast(COMPONENT.DELETE_COMPONENT, {
+ componentId : COMPONENT.NETWORK,
+ callbackFunction : deleteCallbackFunction
+ });
+ };
+
+ $scope.deleteService = function(serviceObject) {
+
+ var serviceInstance = serviceObject.object;
+
+ console.log("Removing Service " + $scope.service.instance.name);
+
+ DataService.setALaCarte (true);
+ DataService.setInventoryItem(serviceInstance);
+
+ DataService.setModelInfo(COMPONENT.SERVICE, {
+ "modelInvariantId": serviceInstance[FIELD.ID.MODEL_INVAR_ID],
+ "modelVersion": $scope.service.model.service.version,
+ "modelNameVersionId": $scope.service.model.service.uuid,
+ "modelName": $scope.service.model.service.name,
+ "inputs": ""
+ });
+
+ DataService.setSubscriberName(serviceObject[FIELD.ID.SUBSCRIBER_NAME]);
+ DataService.setServiceType(serviceObject[FIELD.ID.SERVICE_TYPE]);
+ DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]);
+
+ DataService.setGlobalCustomerId(serviceObject[COMPONENT.GLOBAL_CUSTOMER_ID]);
+ DataService.setServiceInstanceName($scope.service.instance.name);
+
+ DataService.setServiceName($scope.service.model.service.name);
+
+ DataService.setServiceUuid($scope.service.model.service.uuid);
+
+ $scope.$broadcast(COMPONENT.DELETE_COMPONENT, {
+ componentId : COMPONENT.SERVICE,
+ callbackFunction : deleteServiceInstanceCallbackFunction
+ });
+
+ };
+
+ $scope.deleteVfModule = function(serviceObject, vfModule, vnf) {
+
+ console.log("Removing VF-Module " + vfModule.name);
+
+ var serviceInstance = serviceObject.object;
+
+ DataService.setInventoryItem(vfModule.object);
+
+ var svcModel = $scope.service.convertedModel;
+
+ //var vnfModelInvariantUuid = vnf.object[FIELD.ID.MODEL_INVAR_ID];
+ var vnfModelVersionId = vnf.object[FIELD.ID.MODEL_VERSION_ID];
+ var vnfModelCustomizationUuid = vnf.object[FIELD.ID.MODEL_CUSTOMIZATION_ID];;
+ var vfModuleInstanceID = vfModule.object[FIELD.ID.VF_MODULE_ID];
+ if (vfModuleInstanceID == null) {
+ vfModuleInstanceID = "";
+ }
+
+ var vnfModel = null;
+ var vfModuleModel = null;
+
+ DataService.setModelInfo(COMPONENT.VF_MODULE, {
+ "modelInvariantId": "",
+ "modelVersion": "",
+ "modelNameVersionId": "",
+ "modelCustomizationName": "",
+ "customizationUuid": "",
+ "modelName": "",
+ "inputs": ""
+ });
+
+ if ( (!($scope.isObjectEmpty(svcModel))) && ( !($scope.isObjectEmpty(svcModel.vnfs) ) ) ) {
+ if ( (svcModel.isNewFlow) && (vnfModelCustomizationUuid != null ) ) {
+ vnfModel = svcModel.vnfs[vnfModelCustomizationUuid];
+
+ var vfModuleCustomizationUuid = vfModule.object[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+ if ( !($scope.isObjectEmpty(vnfModel.vfModules) ) && UtilityService.hasContents(vfModuleCustomizationUuid) ) {
+
+ vfModuleModel = vnfModel.vfModules[vfModuleCustomizationUuid];
+
+ }
+ }
+ else {
+ // old flow
+ if (vnfModelVersionId != null ) {
+ vnfModel = svcModel.vnfs[vnfModelVersionId];
+ }
+ //var vfModuleInvariantUuid = vfModule.object[FIELD.ID.MODEL_INVAR_ID];
+ var vfModuleModelVersionId = vfModule.object[FIELD.ID.MODEL_VERSION_ID];
+ if ( (!($scope.isObjectEmpty(vnfModel))) && (!($scope.isObjectEmpty(vnfModel.vfModules))) &&
+ UtilityService.hasContents(vfModuleModelVersionId) ) {
+ vfModuleModel = vnfModel.vfModules[vfModuleModelVersionId];
+ }
+ }
+ if ( !($scope.isObjectEmpty(vfModuleModel)) ) {
+ DataService.setModelInfo(COMPONENT.VF_MODULE, {
+ "modelInvariantId": vfModuleModel.invariantUuid,
+ "modelVersion": vfModuleModel.version,
+ "modelNameVersionId": vfModuleModel.uuid,
+ "modelCustomizationName": vfModuleModel.modelCustomizationName,
+ "customizationUuid": vfModuleModel.customizationUuid,
+ "modelName": vfModuleModel.name,
+ "inputs": ""
+ });
+ }
+ }
+
+ DataService.setVnfInstanceId(vnf.object[FIELD.ID.VNF_ID]);
+ DataService.setVfModuleInstanceId(vfModuleInstanceID);
+
+ DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]);
+ DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]);
+ DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]);
+
+ DataService.setGlobalCustomerId(serviceObject[FIELD.ID.GLOBAL_CUST_ID]);
+ DataService.setServiceInstanceName($scope.service.instance.name);
+
+ DataService.setServiceName($scope.service.model.service.name);
+
+ DataService.setServiceUuid($scope.service.model.service.uuid);
+
+ $scope.$broadcast(COMPONENT.DELETE_COMPONENT, {
+ componentId : COMPONENT.VF_MODULE,
+ callbackFunction : deleteCallbackFunction
+ });
+
+ return;
+
+ };
+
+ $scope.deleteVnf = function(serviceObject, vnf) {
+
+ console.log("Removing VNF " + vnf.name);
+
+ var serviceInstance = serviceObject.object;
+ var svcModel = $scope.service.convertedModel;
+ DataService.setInventoryItem(vnf.object);
+
+ /*var vnftype = vnf.object['vnf-type'];
+ if (vnftype == null)
+ vnftype = "";
+ else
+ {
+ var n = vnftype.search("/");
+ if (n >= 0)
+ vnftype = vnftype.substring(n+1);
+ }*/
+
+ var svcModel = $scope.service.convertedModel;
+ var vnfModelInvariantUuid = null;
+ var vnfModelVersion = null;
+ var vnfModelCustomizationUuid = null;
+ var vnfModel = null;
+
+ vnfModelInvariantUuid = vnf.object[FIELD.ID.MODEL_INVAR_ID];
+ vnfModelVersionId = vnf.object[FIELD.ID.MODEL_VERSION_ID];
+ vnfModelCustomizationUuid = vnf.object[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+
+ DataService.setModelInfo(COMPONENT.VNF, {
+ "modelInvariantId": vnfModelInvariantUuid,
+ "modelVersion": "",
+ "modelNameVersionId": vnfModelVersionId,
+ "modelCustomizationName": "",
+ "customizationUuid": vnfModelCustomizationUuid,
+ "modelName": "",
+ "inputs": ""
+ });
+
+ if ( (!($scope.isObjectEmpty(svcModel))) && ( !($scope.isObjectEmpty(svcModel.vnfs) ) ) ) {
+ if ( (svcModel.isNewFlow) && (vnfModelCustomizationUuid != null ) ) {
+ vnfModel = svcModel.vnfs[vnfModelCustomizationUuid];
+ }
+ else {
+ vnfModel = svcModel.vnfs[vnfModelVersionId];
+ }
+ //console.log ( "vnf models: "); console.log ( JSON.stringify ($scope.service.convertedModel.vnfs, null, 4) );
+ if ( !($scope.isObjectEmpty(vnfModel) ) ) {
+
+ DataService.setModelInfo(COMPONENT.VNF, {
+ "modelInvariantId": vnfModel.invariantUuid,
+ "modelVersion": vnfModel.version,
+ "modelNameVersionId": vnfModel.uuid,
+ "modelCustomizationName": vnfModel.modelCustomizationName,
+ "customizationUuid": vnfModel.customizationUuid,
+ "modelName": vnfModel.name,
+ "inputs": ""
+ });
+ }
+ }
+
+ DataService.setVnfInstanceId(vnf.object[FIELD.ID.VNF_ID]);
+
+ DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]);
+ DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]);
+ DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]);
+
+ DataService.setGlobalCustomerId(serviceObject[FIELD.ID.GLOBAL_CUST_ID]);
+ DataService.setServiceInstanceName($scope.service.instance.name);
+
+ DataService.setServiceName($scope.service.model.service.name);
+
+ DataService.setServiceUuid($scope.service.model.service.uuid);
+
+ $scope.$broadcast(COMPONENT.DELETE_COMPONENT, {
+ componentId : COMPONENT.VNF,
+ callbackFunction : deleteCallbackFunction
+ });
+
+ };
+
+
+
+ $scope.deleteVolumeGroup = function(serviceObject, vnf, vfModule, volumeGroup) {
+
+ console.log("Removing Volume Group " + volumeGroup.name);
+ var haveModel = false;
+ var svcModel = $scope.service.convertedModel;
+
+ var vnfModelInvariantUuid = null;
+ var vnfModelVersion = null;
+ var vnfModelCustomizationUuid = null;
+ var vnfModel = null;
+
+ vnfModelInvariantUuid = vnf.object[FIELD.ID.MODEL_INVAR_ID];
+ vnfModelVersionId = vnf.object[FIELD.ID.MODEL_VERSION_ID];
+ vnfModelCustomizationUuid = vnf.object[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+
+ DataService.setModelInfo(COMPONENT.VOLUME_GROUP, {
+ "modelInvariantId": "",
+ "modelVersion": "",
+ "modelNameVersionId": "",
+ "modelCustomizationName": "",
+ "customizationUuid": "",
+ "modelName": "",
+ "inputs": ""
+ });
+
+ if ( (!($scope.isObjectEmpty(svcModel))) && ( !($scope.isObjectEmpty(svcModel.vnfs) ) ) ) {
+ if ( (svcModel.isNewFlow) && (vnfModelCustomizationUuid != null ) ) {
+ vnfModel = svcModel.vnfs[vnfModelCustomizationUuid];
+ }
+ else {
+ vnfModel = svcModel.vnfs[vnfModelVersionId];
+ }
+ }
+
+
+ // volume groups don't have model-invariant-id/version in a&ai.
+ // Their model-invariant-id/version is the one for the associated vfModule
+
+ var vfModuleInvariantUuid = vfModule.object[FIELD.ID.MODEL_INVAR_ID];
+ var vfModuleModelVersionId = vfModule.object[FIELD.ID.MODEL_VERSION_ID];
+ var vfModuleCustomizationUuid = vfModule.object[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+ var volGroupModel = null;
+
+ if ( !($scope.isObjectEmpty(vnfModel.volumeGroups) ) ) {
+ if ( ( !($scope.isObjectEmpty(vnfModel) ) ) && ( !($scope.isObjectEmpty(vnfModel.volumeGroups) ) ) ) {
+ if ( (svcModel.isNewFlow) && (UtilityService.hasContents(vfModuleCustomizationUuid) ) ){
+ volGroupModel = vnfModel.volumeGroups[vfModuleCustomizationUuid];
+ }
+ else {
+ volGroupModel = vnfModel.volumeGroups[vfModuleModelVersionId];
+ }
+ if ( !($scope.isObjectEmpty(volGroupModel) ) ) {
+ DataService.setModelInfo(COMPONENT.VOLUME_GROUP, {
+ "modelInvariantId": volGroupModel.invariantUuid,
+ "modelVersion": volGroupModel.version,
+ "modelNameVersionId": volGroupModel.uuid,
+ "modelCustomizationName": volGroupModel.modelCustomizationName,
+ "customizationUuid": volGroupModel.customizationUuid,
+ "modelName": volGroupModel.name,
+ "inputs": ""
+ });
+
+ }
+ }
+ }
+
+ var serviceInstance = serviceObject.object;
+
+ DataService.setInventoryItem(volumeGroup.object);
+
+ DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]);
+ DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]);
+ DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]);
+
+ DataService.setGlobalCustomerId(serviceObject[FIELD.ID.GLOBAL_CUST_ID]);
+ DataService.setServiceInstanceName($scope.service.instance.name);
+
+ DataService.setServiceName($scope.service.model.service.name);
+
+ DataService.setServiceUuid($scope.service.model.service.uuid);
+ DataService.setVnfInstanceId(vnf.nodeId);
+ DataService.setVolumeGroupInstanceId(volumeGroup.nodeId);
+
+ $scope.$broadcast(COMPONENT.DELETE_COMPONENT, {
+ componentId : COMPONENT.VOLUME_GROUP,
+ });
+ };
+
+ $scope.deleteVnfVolumeGroup = function(serviceObject, vnf, volumeGroup) {
+
+ console.log("Removing Volume Group " + volumeGroup.name);
+ var serviceInstance = serviceObject.object;
+
+ DataService.setInventoryItem(volumeGroup.object);
+
+ var svcModel = $scope.service.convertedModel;
+
+ var vnfModelInvariantUuid = vnf.object[FIELD.ID.MODEL_INVAR_ID];
+ var vnfModelVersionId = vnf.object[FIELD.ID.MODEL_VERSION_ID];
+ var vnfModelCustomizationUuid = vnf.object[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+
+ var volGroupModelInvariantUuid = volumeGroup.object[FIELD.ID.MODEL_INVAR_ID];
+ var volGroupModelVersionId = volumeGroup.object[FIELD.ID.MODEL_VERSION_ID];
+ var volGroupModelCustomizationUuid = volumeGroup.object[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+
+ var vnfModel = null;
+ var volGroupModel = null;
+
+ // send an empty model by default since model is not required for deletes
+ DataService.setModelInfo(COMPONENT.VOLUME_GROUP, {});
+
+ if ( svcModel.isNewFlow ) {
+ vnfModel = svcModel.vnfs[vnfModelCustomizationUuid];
+ if ( UtilityService.hasContents (volGroupModelCustomizationUuid) ) {
+ volGroupModel = vnfModel.volumeGroups[volGroupModelCustomizationUuid];
+ }
+ }
+ else {
+
+ vnfModel = svcModel.vnfs[vnfModelVersionId];
+ if ( UtilityService.hasContents (volGroupModelVersionId) ) {
+ volGroupModel = vnfModel.volumeGroups[volGroupModelVersionId];
+ }
+ }
+ if ( !($scope.isObjectEmpty(volGroupModel) ) ) {
+ DataService.setModelInfo(COMPONENT.VOLUME_GROUP, {
+ "modelInvariantId": volGroupModel.invariantUuid,
+ "modelVersion": volGroupModel.version,
+ "modelNameVersionId": volGroupModel.uuid,
+ "modelName": volGroupModel.name,
+ "modelCustomizationName": volGroupModel.modelCustomizationName,
+ "customizationUuid": volGroupModel.customizationUuid,
+ "inputs": ""
+ });
+ }
+
+ DataService.setVnfInstanceId(vnf.object[FIELD.ID.VNF_ID]);
+
+ DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]);
+ DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]);
+ DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]);
+
+ DataService.setGlobalCustomerId(serviceObject[FIELD.ID.GLOBAL_CUST_ID]);
+ DataService.setServiceInstanceName($scope.service.instance.name);
+
+ DataService.setServiceName($scope.service.model.service.name);
+
+ DataService.setServiceUuid($scope.service.model.service.uuid);
+ DataService.setVnfInstanceId(vnf.nodeId);
+ DataService.setVolumeGroupInstanceId(volumeGroup.nodeId);
+
+ $scope.$broadcast(COMPONENT.DELETE_COMPONENT, {
+ componentId : COMPONENT.VOLUME_GROUP,
+ callbackFunction : deleteCallbackFunction
+ });
+ };
+
+ $scope.describeNetwork = function(serviceObject, networkObject) {
+ var serviceInstance = serviceObject.object;
+ var network = networkObject.object;
+ //console.log ("networkObject="); console.log (JSON.stringify(networkObject, null, 4));
+
+ DataService.setResCustomizationUuid(" ");
+
+ var svcModel = $scope.service.convertedModel;
+ var netModel = null;
+
+ if ( !($scope.isObjectEmpty(network) ) ) {
+
+ var netModelInvariantUuid = network[FIELD.ID.MODEL_INVAR_ID];
+ var netModelVersionId = network[FIELD.ID.MODEL_VERSION_ID];
+ var netModelCustomizationUuid = network[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+
+ if ( UtilityService.hasContents (netModelCustomizationUuid) ) {
+ // set it to what came from a&ai
+ DataService.setResCustomizationUuid(netModelCustomizationUuid);
+ }
+
+ if ( (!($scope.isObjectEmpty(svcModel))) && (!($scope.isObjectEmpty(svcModel.networks))) ) {
+ if ( svcModel.isNewFlow ) {
+ netModel = svcModel.networks[netModelCustomizationUuid];
+ }
+ else {
+ netModel = svcModel.networks[netModelVersionId];
+ }
+ /*
+ * The details pop-up should use a&ai info
+ * if ( !($scope.isObjectEmpty(netModel) ) ) {
+ if (UtilityService.hasContents(netModel.customizationUuid)) {
+ DataService.setResCustomizationUuid(netModel.customizationUuid);
+ }
+ }*/
+ }
+ }
+
+ DataService.setNetworkInstanceId(network[FIELD.ID.NETWORK_ID]);
+ DataService.setInventoryItem(networkObject);
+ DataService.setSubscriberName(serviceObject.subscriberName);
+ DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]);
+ DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]);
+
+ $scope.$broadcast(COMPONENT.SHOW_COMPONENT_DETAILS, {
+ componentId : COMPONENT.NETWORK
+ });
+ };
+
+ // for service instance id - no need for this!
+ $scope.describeService = function(serviceObject) {
+ var serviceInstance = serviceObject.object;
+
+ DataService.setInventoryItem(serviceInstance);
+ //DataService.setModelInfo(serviceInstance['service-instance-id'], serviceInstance);
+
+ DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]);
+ DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]);
+ DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]);
+
+ //Display popup with additional service information
+ $scope.$broadcast(COMPONENT.SHOW_COMPONENT_DETAILS, {
+ componentId : COMPONENT.SERVICE
+ });
+
+ };
+
+ $scope.describeVfModule = function(serviceObject, vfModuleObject, vnf) {
+ var serviceInstance = serviceObject.object;
+ var vfModule = vfModuleObject.object;
+
+ /*var vfModuleInvariantUuid = vfModule[FIELD.ID.MODEL_INVAR_ID];
+ var vfModuleModelVersionId = vfModule[FIELD.ID.MODEL_VERSION_ID];*/
+ var vfModuleCustomizationUuid = vfModule[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+
+ DataService.setCustomizationUuid(" ");
+ if ( UtilityService.hasContents (vfModuleCustomizationUuid) ) {
+ DataService.setCustomizationUuid(vfModuleCustomizationUuid);
+ }
+
+ //Display popup with additional VF-Module information
+ DataService.setVfModuleInstanceId(vfModule[FIELD.ID.VF_MODULE_ID]);
+ DataService.setInventoryItem(vfModule)
+
+ DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]);
+ DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]);
+ DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]);
+
+ $scope.$broadcast(COMPONENT.SHOW_COMPONENT_DETAILS, {
+ componentId : COMPONENT.VF_MODULE
+ });
+ };
+
+ $scope.getStatusOfVnf = function(serviceObject, vnfObject) {
+ var serviceInstance = serviceObject.object;
+ var vnf = vnfObject.object;
+
+ DataService.setVnfInstanceId(vnf[FIELD.ID.VNF_ID]);
+ DataService.setInventoryItem(vnf);
+
+ DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]);
+ DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]);
+ DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]);
+ DataService.setServiceInstanceName(serviceInstance[FIELD.ID.SERVICE_INSTANCE_NAME]);
+
+ $scope.$broadcast(COMPONENT.COMPONENT_STATUS, {
+ componentId : COMPONENT.VNF,
+ callbackFunction : updateProvStatusVnfCallbackFunction
+ });
+ };
+
+ $scope.describeVnf = function(serviceObject, vnfObject) {
+ var serviceInstance = serviceObject.object;
+ var vnf = vnfObject.object;
+ DataService.setResCustomizationUuid(" ");
+
+ //var vnfInvariantUuid = vnf[FIELD.ID.MODEL_INVAR_ID];
+ //var vnfVersionId = vnf[FIELD.ID.MODEL_VERSION_ID];
+ var vnfCustomizationUuid = vnf[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+
+ if ( UtilityService.hasContents (vnfCustomizationUuid) ) {
+ DataService.setResCustomizationUuid(vnfCustomizationUuid);
+ }
+ //Display popup with additional VNF information
+ DataService.setVnfInstanceId(vnf[FIELD.ID.VNF_ID]);
+ DataService.setInventoryItem(vnf);
+
+ DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]);
+ DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]);
+ DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]);
+
+ $scope.$broadcast(COMPONENT.SHOW_COMPONENT_DETAILS, {
+ componentId : COMPONENT.VNF
+ });
+ };
+
+ $scope.describeVolumeGroup = function(serviceObject, vnf, volumeGroupObject) {
+
+ var serviceInstance = serviceObject.object;
+ var volumeGroup = volumeGroupObject.object;
+
+ //var volGroupInvariantUuid = volumeGroup[FIELD.ID.MODEL_INVAR_ID];
+ //var volGroupVersionId = volumeGroup[FIELD.ID.MODEL_VERSION_ID];
+ var volGroupCustomizationUuid = volumeGroup[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+
+ DataService.setCustomizationUuid(" ");
+ if ( UtilityService.hasContents(volGroupCustomizationUuid) ) {
+ DataService.setCustomizationUuid(volGroupCustomizationUuid);
+ }
+ DataService.setVolumeGroupInstanceId(volumeGroup[FIELD.ID.VOLUME_GROUP_ID]);
+ DataService.setInventoryItem(volumeGroup);
+
+ DataService.setSubscriberName(serviceObject[COMPONENT.SUBSCRIBER_NAME]);
+ DataService.setServiceType(serviceObject[COMPONENT.SERVICE_TYPE]);
+ DataService.setServiceInstanceId(serviceInstance[FIELD.ID.SERVICE_INSTANCE_ID]);
+
+
+ $scope.$broadcast(COMPONENT.SHOW_COMPONENT_DETAILS, {
+ componentId : COMPONENT.VOLUME_GROUP
+ });
+ };
+
+ $scope.addNetworkInstance = function(netModel, existingVnfs) {
+
+ // For networks we assume that we always follow the new flow
+ console.log("Adding network to service instance" + this.service.instance.name);
+ if ( VIDCONFIGURATION.VNF_STATUS_CHECK_ENABLED && (UtilityService.hasContents(existingVnfs)) && (existingVnfs.length > 0) ) {
+ var msg = VnfService.isVnfListStatusValid (existingVnfs);
+ if ( msg != "" ) {
+ alert ( msg );
+ return;
+ }
+ }
+
+ DataService.setSubscriberName($scope.service.instance.subscriberName);
+ DataService.setGlobalCustomerId($scope.service.instance.globalCustomerId);
+ DataService.setServiceType($scope.service.instance.serviceType);
+ DataService.setServiceInstanceName($scope.service.instance.name);
+ DataService.setServiceInstanceId($scope.service.instance.id);
+ DataService.setServiceName($scope.service.model.service.name);
+
+ DataService.setModelInfo(COMPONENT.NETWORK, {
+ "modelType": "network",
+ "modelInvariantId": netModel.invariantUuid,
+ "modelVersion": netModel.version,
+ "modelNameVersionId": netModel.uuid,
+ "modelName": netModel.name,
+ "modelCustomizationName": netModel.modelCustomizationName,
+ "customizationUuid": netModel.customizationUuid,
+ "inputs": "",
+ "displayInputs": netModel.displayInputs
+ });
+
+ DataService.setModelInfo(COMPONENT.SERVICE, {
+ "modelInvariantId": $scope.service.model.service.invariantUuid,
+ "modelVersion": $scope.service.model.service.version,
+ "modelNameVersionId": $scope.service.model.service.uuid,
+ "modelName": $scope.service.model.service.name,
+ "inputs": ""
+ });
+
+ $scope.$broadcast(COMPONENT.CREATE_COMPONENT, {
+ componentId : COMPONENT.NETWORK,
+ callbackFunction : createVnfCallbackFunction
+ });
+ };
+
+ $scope.addVnfInstance = function(vnf, existingVnfs) {
+
+ if ( VIDCONFIGURATION.VNF_STATUS_CHECK_ENABLED && (UtilityService.hasContents(existingVnfs)) && (existingVnfs.length > 0) ) {
+ var msg = VnfService.isVnfListStatusValid (existingVnfs);
+ if ( msg != "" ) {
+ alert ( msg );
+ return;
+ }
+ }
+ DataService.setSubscriberName($scope.service.instance.subscriberName);
+ DataService.setGlobalCustomerId($scope.service.instance.globalCustomerId);
+ DataService.setServiceType($scope.service.instance.serviceType);
+ DataService.setServiceInstanceName($scope.service.instance.name);
+ DataService.setServiceInstanceId($scope.service.instance.id);
+ DataService.setServiceName($scope.service.model.service.name);
+
+ console.log ( "existingVnfs: " ); console.log (JSON.stringify ( existingVnfs, null, 4));
+ var vnf_type = "";
+ var vnf_role = "";
+ var vnf_function = "";
+ var vnf_code = "";
+
+ if (UtilityService.hasContents (vnf.nfType) ) {
+ vnf_type = vnf.nfType;
+ }
+ if (UtilityService.hasContents (vnf.nfRole) ) {
+ vnf_role = vnf.nfRole;
+ }
+ if (UtilityService.hasContents (vnf.nfFunction) ) {
+ vnf_function = vnf.nfFunction;
+ }
+ if (UtilityService.hasContents (vnf.nfCode) ) {
+ vnf_code = vnf.nfCode;
+ }
+ DataService.setModelInfo(COMPONENT.VNF, {
+ "modelType": "vnf",
+ "modelInvariantId": vnf.invariantUuid,
+ "modelVersion": vnf.version,
+ "modelNameVersionId": vnf.uuid,
+ "modelName": vnf.name,
+ "modelCustomizationName": vnf.modelCustomizationName,
+ "customizationUuid": vnf.customizationUuid,
+ "inputs": "",
+ "displayInputs": vnf.displayInputs,
+ "vnfType": vnf_type,
+ "vnfRole": vnf_role,
+ "vnfFunction": vnf_function,
+ "vnfCode": vnf_code
+ });
+
+ DataService.setModelInstanceName($scope.service.model.service.name);
+
+ DataService.setModelInfo(COMPONENT.SERVICE, {
+ "modelInvariantId": $scope.service.model.service.invariantUuid,
+ "modelVersion": $scope.service.model.service.version,
+ "modelNameVersionId": $scope.service.model.service.uuid,
+ "modelName": $scope.service.model.service.name,
+ "inputs": ""
+ });
+
+ $scope.$broadcast(COMPONENT.CREATE_COMPONENT, {
+ componentId : COMPONENT.VNF,
+ callbackFunction : createVnfCallbackFunction
+ });
+ };
+
+ $scope.addVfModuleInstance = function(vnfInstance, vfModuleModel) {
+
+ if ( VIDCONFIGURATION.VNF_STATUS_CHECK_ENABLED ) {
+ var msg = VnfService.isVnfStatusValid (vnfInstance);
+ if ( msg != "" ) {
+ alert ( msg );
+ return;
+ }
+
+ }
+ var svcModel = $scope.service.convertedModel;
+ DataService.setSubscriberName($scope.service.instance.subscriberName);
+ DataService.setGlobalCustomerId($scope.service.instance.globalCustomerId);
+ DataService.setServiceType($scope.service.instance.serviceType);
+ DataService.setServiceInstanceName($scope.service.instance.name);
+ DataService.setServiceInstanceId($scope.service.instance.id);
+ DataService.setServiceName($scope.service.model.service.name);
+
+ var vnfModelInvariantUuid = vnfInstance.object[FIELD.ID.MODEL_INVAR_ID];
+ var vnfModelVersionId = vnfInstance.object[FIELD.ID.MODEL_VERSION_ID];
+ var vnfModelCustomizationUuid = vnfInstance.object[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+ var vnfModel = null;
+ if ( svcModel.isNewFlow ) {
+ vnfModel = svcModel.vnfs[vnfModelCustomizationUuid];
+ }
+ else {
+ vnfModel = svcModel.vnfs[vnfModelVersionId];
+ }
+
+ var availableVolumeGroupList = [];
+ angular.forEach(vnfInstance[FIELD.ID.AVAILABLEVOLUMEGROUPS], function(volumeGroupInstance, key) {
+ availableVolumeGroupList.push({"instance": volumeGroupInstance});
+ });
+
+ if (vfModuleModel.volumeGroupAllowed) {
+ DataService.setAvailableVolumeGroupList(availableVolumeGroupList);
+ }
+
+ DataService.setModelInfo(COMPONENT.SERVICE, {
+ "modelInvariantId": $scope.service.model.service.invariantUuid,
+ "modelVersion": $scope.service.model.service.version,
+ "modelNameVersionId": $scope.service.model.service.uuid,
+ "modelName": $scope.service.model.service.name,
+ "inputs": ""
+ });
+
+ DataService.setVnfInstanceId(vnfInstance.object[FIELD.ID.VNF_ID]);
+
+ DataService.setModelInfo(COMPONENT.VNF, {
+ "modelInvariantId": vnfModel.invariantUuid,
+ "modelVersion": vnfModel.version,
+ "modelNameVersionId": vnfModel.uuid,
+ "modelName": vnfModel.name,
+ "modelCustomizationName": vnfModel.modelCustomizationName,
+ "customizationUuid": vnfModel.customizationUuid,
+ "inputs": ""
+ });
+
+ DataService.setModelInfo(COMPONENT.VF_MODULE, {
+ "modelInvariantId": vfModuleModel.invariantUuid,
+ "modelVersion": vfModuleModel.version,
+ "modelNameVersionId": vfModuleModel.uuid,
+ "customizationUuid": vfModuleModel.customizationUuid,
+ "modelCustomizationName": vfModuleModel.modelCustomizationName,
+ "modelName": vfModuleModel.name,
+ "inputs": ""
+ });
+
+ $scope.$broadcast(COMPONENT.CREATE_COMPONENT, {
+ componentId : COMPONENT.VF_MODULE,
+ callbackFunction : createVfModuleCallbackFunction
+ });
+
+ };
+
+ $scope.addVolumeGroupInstance = function(vnfInstance, volumeGroupModel) {
+ if ( VIDCONFIGURATION.VNF_STATUS_CHECK_ENABLED ) {
+ var msg = VnfService.isVnfStatusValid (vnfInstance);
+ if ( msg != "" ) {
+ alert ( msg );
+ return;
+ }
+ }
+ var svcModel = $scope.service.convertedModel;
+ DataService.setSubscriberName($scope.service.instance.subscriberName);
+ DataService.setGlobalCustomerId($scope.service.instance.globalCustomerId);
+ DataService.setServiceType($scope.service.instance.serviceType);
+ DataService.setServiceInstanceName($scope.service.instance.name);
+ DataService.setServiceInstanceId($scope.service.instance.id);
+ DataService.setServiceName($scope.service.model.service.name);
+
+ DataService.setModelInfo(COMPONENT.SERVICE, {
+ "modelInvariantId": $scope.service.model.service.invariantUuid,
+ "modelVersion": $scope.service.model.service.version,
+ "modelNameVersionId": $scope.service.model.service.uuid,
+ "modelName": $scope.service.model.service.name,
+ "inputs": ""
+ });
+
+ DataService.setVnfInstanceId(vnfInstance.object[FIELD.ID.VNF_ID]);
+
+ var vnfModelInvariantUuid = vnfInstance.object[FIELD.ID.MODEL_INVAR_ID];
+ var vnfModelVersionId = vnfInstance.object[FIELD.ID.MODEL_VERSION_ID];
+ var vnfCustomizationUuid = vnfInstance.object[FIELD.ID.MODEL_CUSTOMIZATION_ID];
+ var vnfModel = null;
+
+ if ( svcModel.isNewFlow ) {
+ vnfModel = svcModel.vnfs[vnfCustomizationUuid];
+ }
+ else {
+ vnfModel = svcModel.vnfs[vnfModelVersionId];
+ }
+
+ DataService.setModelInfo(COMPONENT.VNF, {
+ "modelInvariantId": vnfModel.invariantUuid,
+ "modelVersion": vnfModel.version,
+ "modelNameVersionId": vnfModel.uuid,
+ "modelName": vnfModel.name,
+ "modelCustomizationName": vnfModel.modelCustomizationName,
+ "customizationUuid": vnfModel.customizationUuid,
+ "inputs": ""
+ });
+
+ DataService.setModelInfo(COMPONENT.VOLUME_GROUP, {
+ "modelInvariantId": volumeGroupModel.invariantUuid,
+ "modelVersion": volumeGroupModel.version,
+ "modelNameVersionId": volumeGroupModel.uuid,
+ "modelName": volumeGroupModel.name,
+ "modelCustomizationName": volumeGroupModel.modelCustomizationName,
+ "customizationUuid": volumeGroupModel.customizationUuid,
+ "inputs": ""
+ });
+
+ $scope.$broadcast(COMPONENT.CREATE_COMPONENT, {
+ componentId : COMPONENT.VOLUME_GROUP,
+ callbackFunction : createVolumeGroupCallbackFunction
+ });
+ };
+
+ $scope.resetProgress = function() {
+ $scope.percentProgress = 0;
+ $scope.progressClass = FIELD.STYLE.PROGRESS_BAR_INFO;
+ };
+
+ $scope.setProgress = function(percentProgress) {
+ percentProgress = parseInt(percentProgress);
+ if (percentProgress >= 100) {
+ $scope.progressClass = FIELD.STYLE.PROGRESS_BAR_SUCCESS;
+ }
+
+ if (percentProgress < $scope.percentProgress) {
+ return;
+ }
+
+ $scope.percentProgress = percentProgress;
+ $scope.progressWidth = {width: percentProgress + "%"};
+ if (percentProgress >= 5) {
+ $scope.progressText = percentProgress + " %";
+ } else {
+ // Hidden since color combination is barely visible when progress portion is narrow.
+ $scope.progressText = "";
+ }
+ };
+ $scope.isObjectEmpty = function(o) {
+ var len = 0;
+ if (UtilityService.hasContents(o)){
+ var keys = Object.keys(o);
+ len = keys.length;
+ if ( len == 0 ) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ return true;
+ }
+ }
+ $scope.isMacro = function() {
+ if (UtilityService.arrayContains (VIDCONFIGURATION.MACRO_SERVICES, $scope.service.model.service.invariantUuid )) {
+ return(true);
+
+ }
+ else {
+ return (false);
+ }
+ }
+ $scope.reloadRoute = function() {
+ $route.reload();
+ }
+
+ var updateProvStatusVnfCallbackFunction = function(response) {
+ $scope.callbackResults = "";
+ var color = FIELD.ID.COLOR_NONE;
+ $scope.callbackStyle = {
+ "background-color" : color
+ };
+ $scope.reloadRoute();
+ /*
+ * This 1/2 delay was only added to visually highlight the status
+ * change. Probably not needed in the real application code.
+ */
+ $timeout(function() {
+ $scope.callbackResults = UtilityService.getCurrentTime()
+ + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful;
+ if (response.isSuccessful) {
+ color = FIELD.ID.COLOR_8F8;
+
+ } else {
+ color = FIELD.ID.COLOR_F88;
+ }
+ $scope.callbackStyle = {
+ "background-color" : color
+ };
+ }, 500);
+
+ };
+
+ var createVnfCallbackFunction = function(response) {
+ $scope.callbackResults = "";
+ var color = FIELD.ID.COLOR_NONE;
+ $scope.callbackStyle = {
+ "background-color" : color
+ };
+
+ /*
+ * This 1/2 delay was only added to visually highlight the status
+ * change. Probably not needed in the real application code.
+ */
+ $timeout(function() {
+ $scope.callbackResults = UtilityService.getCurrentTime()
+ + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful;
+ if (response.isSuccessful) {
+ color = FIELD.ID.COLOR_8F8;
+ $scope.reloadRoute();
+ } else {
+ color = FIELD.ID.COLOR_F88;
+ }
+ $scope.callbackStyle = {
+ "background-color" : color
+ };
+ }, 500);
+
+
+
+ };
+
+ var deleteCallbackFunction = function(response) {
+ $scope.callbackResults = "";
+ var color = FIELD.ID.COLOR_NONE;
+ $scope.callbackStyle = {
+ "background-color" : color
+ };
+
+ /*
+ * This 1/2 delay was only added to visually highlight the status
+ * change. Probably not needed in the real application code.
+ */
+ $timeout(function() {
+ $scope.callbackResults = UtilityService.getCurrentTime()
+ + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful;
+ if (response.isSuccessful) {
+ color = FIELD.ID.COLOR_8F8;
+ $scope.reloadRoute();
+ } else {
+ color = FIELD.ID.COLOR_F88;
+ }
+ $scope.callbackStyle = {
+ "background-color" : color
+ };
+ }, 500);
+
+ };
+
+ var createVfModuleCallbackFunction = function(response) {
+ $scope.callbackResults = "";
+ var color = FIELD.ID.COLOR_NONE;
+ $scope.callbackStyle = {
+ "background-color" : color
+ };
+
+ /*
+ * This 1/2 delay was only added to visually highlight the status
+ * change. Probably not needed in the real application code.
+ */
+ $timeout(function() {
+ $scope.callbackResults = UtilityService.getCurrentTime()
+ + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful;
+ if (response.isSuccessful) {
+ color = FIELD.ID.COLOR_8F8;
+ $scope.reloadRoute();
+ } else {
+ color = FIELD.ID.COLOR_F88;
+ }
+ $scope.callbackStyle = {
+ "background-color" : color
+ };
+ }, 500);
+
+ };
+
+ var deleteServiceInstanceCallbackFunction = function(response) {
+ $scope.callbackResults = "";
+ var color = FIELD.ID.COLOR_NONE;
+ $scope.callbackStyle = {
+ "background-color" : color
+ };
+
+ /*
+ * This 1/2 delay was only added to visually highlight the status
+ * change. Probably not needed in the real application code.
+ */
+ $timeout(function() {
+ $scope.callbackResults = UtilityService.getCurrentTime()
+ + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful;
+ if (response.isSuccessful) {
+ color = FIELD.ID.COLOR_8F8;
+ $location.path(COMPONENT.SERVICEMODELS_MODELS_SERVICES_PATH)
+ } else {
+ color = FIELD.ID.COLOR_F88;
+ }
+ $scope.callbackStyle = {
+ "background-color" : color
+ };
+ }, 500);
+
+ };
+
+ var createVolumeGroupCallbackFunction = function(response) {
+ $scope.callbackResults = "";
+ var color = FIELD.ID.COLOR_NONE;
+ $scope.callbackStyle = {
+ "background-color" : color
+ };
+
+ /*
+ * This 1/2 delay was only added to visually highlight the status
+ * change. Probably not needed in the real application code.
+ */
+ $timeout(function() {
+ $scope.callbackResults = UtilityService.getCurrentTime()
+ + FIELD.STATUS.IS_SUCCESSFUL + response.isSuccessful;
+ if (response.isSuccessful) {
+ color = FIELD.ID.COLOR_8F8;
+ $scope.reloadRoute();
+ } else {
+ color = FIELD.ID.COLOR_F88;
+ }
+ $scope.callbackStyle = {
+ "background-color" : color
+ };
+ }, 500);
+
+
+
+ };
+
+ });
+})();
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js
new file mode 100755
index 0000000..5d382e9
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/ServiceModelController.js
@@ -0,0 +1,227 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+(function () {
+ 'use strict';
+
+ appDS2.controller("ServiceModelController", function ($scope, $http, $location, COMPONENT, VIDCONFIGURATION, FIELD, DataService, vidService,
+ PropertyService, UtilityService) {
+
+ $scope.popup = {};
+
+ // var baseEndpoint = "vid";
+ var pathQuery = COMPONENT.SERVICES_DIST_STATUS_PATH + VIDCONFIGURATION.ASDC_MODEL_STATUS;
+
+ if ( VIDCONFIGURATION.ASDC_MODEL_STATUS === FIELD.STATUS.ALL) {
+ pathQuery = COMPONENT.SERVICES_PATH;
+ }
+
+ $scope.getServiceModels = function() {
+ $scope.status = FIELD.STATUS.FETCHING_SERVICE_CATALOG_ASDC;
+
+ $http.get(pathQuery)
+ .then(function successCallback(response) {
+ $scope.services = [];
+ if (angular.isArray(response.data)) {
+ $scope.services = response.data;
+ $scope.viewPerPage=10;
+ $scope.totalPage=$scope.services.length/$scope.viewPerPage;
+ $scope.sortBy=COMPONENT.NAME;
+ $scope.scrollViewPerPage=2;
+ $scope.currentPage=1;
+ $scope.searchCategory;
+ $scope.searchString="";
+ $scope.currentPageNum=1;
+ $scope.isSpinnerVisible = false;
+ $scope.isProgressVisible = false;
+ } else {
+ $scope.status = FIELD.STATUS.FAILED_SERVICE_MODELS_ASDC;
+ $scope.error = true;
+ $scope.isSpinnerVisible = false;
+ }
+ }, function errorCallback(response) {
+ console.log("Error: " + response);
+ });
+ }
+
+ $scope.init = function() {
+ var msecs = PropertyService.retrieveMsoMaxPollingIntervalMsec();
+ PropertyService.setMsoMaxPollingIntervalMsec(msecs);
+
+ var polls = PropertyService.retrieveMsoMaxPolls();
+ PropertyService.setMsoMaxPolls(polls);
+
+ //PropertyService.setMsoBaseUrl("testmso");
+ PropertyService.setServerResponseTimeoutMsec(10000);
+ }
+
+ $scope.prevPage = function() {
+ $scope.currentPage--;
+ }
+
+ $scope.nextPage = function() {
+ $scope.currentPage++;
+ }
+
+ $scope.createType = COMPONENT.A_LA_CARTE;
+ $scope.deployService = function(service) {
+
+
+ console.log("Instantiating SDC service " + service.uuid);
+
+ $http.get(COMPONENT.SERVICES_PATH + service.uuid)
+ .then(function successCallback(getServiceResponse) {
+
+ var serviceModel = getServiceResponse.data;
+ DataService.setServiceName(serviceModel.service.name);
+
+ DataService.setModelInfo(COMPONENT.SERVICE, {
+ "modelInvariantId": serviceModel.service.invariantUuid,
+ "modelVersion": serviceModel.service.version,
+ "modelNameVersionId": serviceModel.service.uuid,
+ "modelName": serviceModel.service.name,
+ "description": serviceModel.service.description,
+ "category":serviceModel.service.category
+ });
+ DataService.setALaCarte (true);
+ $scope.createType = COMPONENT.A_LA_CARTE;
+ var broadcastType = COMPONENT.CREATE_COMPONENT;
+
+ if (UtilityService.arrayContains (VIDCONFIGURATION.MACRO_SERVICES, serviceModel.service.invariantUuid )) {
+ DataService.setALaCarte (false);
+ $scope.createType = COMPONENT.MACRO;
+ var convertedAsdcModel = UtilityService.convertModel(serviceModel);
+
+ //console.log ("display inputs ");
+ //console.log (JSON.stringify ( convertedAsdcModel.completeDisplayInputs));
+
+ DataService.setModelInfo(COMPONENT.SERVICE, {
+ "modelInvariantId": serviceModel.service.invariantUuid,
+ "modelVersion": serviceModel.service.version,
+ "modelNameVersionId": serviceModel.service.uuid,
+ "modelName": serviceModel.service.name,
+ "description": serviceModel.service.description,
+ "category":serviceModel.service.category,
+ "serviceEcompNaming": serviceModel.service.serviceEcompNaming,
+ "inputs": serviceModel.service.inputs,
+ "displayInputs": convertedAsdcModel.completeDisplayInputs
+ });
+ };
+
+ $scope.$broadcast(broadcastType, {
+ componentId : COMPONENT.SERVICE,
+ callbackFunction : function(response) {
+ if (response.isSuccessful) {
+ vidService.setModel(serviceModel);
+
+ var subscriberId = FIELD.STATUS.NOT_FOUND;
+ var serviceType = FIELD.STATUS.NOT_FOUND;
+
+ var serviceInstanceId = response.instanceId;
+
+ for (var i = 0; i < response.control.length; i++) {
+ if (response.control[i].id == COMPONENT.SUBSCRIBER_NAME) {
+ subscriberId = response.control[i].value;
+ } else if (response.control[i].id == "service-type") {
+ serviceType = response.control[i].value;
+ }
+ }
+
+
+ $scope.refreshSubs(subscriberId,serviceType,serviceInstanceId);
+
+ }
+ }
+ });
+
+ }, function errorCallback(response) {
+ console.log("Error: " + response);
+ });
+ };
+
+ $scope.refreshSubs = function(subscriberId, serviceType, serviceInstanceId) {
+ $scope.status = FIELD.STATUS.FETCHING_SUBSCRIBER_LIST_AAI;
+ $scope.init();
+ $http.get( FIELD.ID.AAI_REFRESH_FULL_SUBSCRIBERS, {
+
+ },{
+ timeout: $scope.responseTimeoutMsec
+ }).then(function(response){
+
+ if (response.data.status < 200 || response.data.status > 202) {
+ $scope.showError(FIELD.ERROR.MSO)
+ return;
+ }
+
+ $scope.customer = response.data.customer; // get data from json
+
+ $scope.customerList = [];
+
+ $scope.serviceInstanceToCustomer = [];
+
+ angular.forEach($scope.customer, function(subVal, subKey) {
+ var cust = { "globalCustomerId": subVal[FIELD.ID.GLOBAL_CUSTOMER_ID], "subscriberName": subVal[FIELD.ID.SUBNAME] };
+ $scope.customerList.push(cust);
+ if (subVal[FIELD.ID.SERVICE_SUBSCRIPTIONS] != null) {
+ angular.forEach(subVal[FIELD.ID.SERVICE_SUBSCRIPTIONS][FIELD.ID.SERVICE_SUBSCRIPTION], function(serviceSubscription, key) {
+ $scope.serviceInstanceId = [];
+ if (serviceSubscription[FIELD.ID.SERVICE_TYPE] != null) {
+ $scope.serviceType = serviceSubscription[FIELD.ID.SERVICE_TYPE];
+ } else {
+ $scope.serviceType = FIELD.STATUS.NO_SERVICE_SUBSCRIPTION_FOUND;
+ }
+ if (serviceSubscription[FIELD.ID.SERVICE_INSTANCES] != null) {
+ angular.forEach(serviceSubscription[FIELD.ID.SERVICE_INSTANCES][FIELD.ID.SERVICE_INSTANCE], function(instValue, instKey) {
+ var foo = { "serviceInstanceId": instValue[FIELD.ID.SERVICE_INSTANCE_ID],
+ "globalCustomerId": subVal[FIELD.ID.GLOBAL_CUSTOMER_ID],
+ "subscriberName": subVal[FIELD.ID.SUBNAME] };
+ $scope.serviceInstanceToCustomer.push(foo);
+ });
+ }
+ });
+ }
+ });
+ DataService.setServiceInstanceToCustomer($scope.serviceInstanceToCustomer);
+ var serviceIdList = [];
+ $http.get( FIELD.ID.AAI_GET_SERVICES, {
+ },{
+ timeout: $scope.responseTimeoutMsec
+ }).then(function(response) {
+ angular.forEach(response.data, function(value, key) {
+ angular.forEach(value, function(subVal, key) {
+ var newVal = { "id" : subVal[FIELD.ID.SERVICE_ID], "description" : subVal[FIELD.ID.SERVICE_DESCRIPTION] };
+ serviceIdList.push(newVal);
+ DataService.setServiceIdList(serviceIdList);
+
+ $location.search({
+ "subscriberId": subscriberId,
+ "serviceType": serviceType,
+ "serviceInstanceId": serviceInstanceId
+ });
+
+ $location.path(COMPONENT.INSTANTIATE_PATH);
+ });
+ });
+ });
+ })
+ ["catch"]($scope.handleServerError);
+ };
+ });
+})();
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/VidApp.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/VidApp.js
new file mode 100755
index 0000000..dcde2ec
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/VidApp.js
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+(function () {
+ 'use strict';
+
+ appDS2.config(['$routeProvider', '$locationProvider', function ($routeProvider) {
+ $routeProvider
+ .when('/models/services', {
+ controller: 'ServiceModelController',
+ templateUrl: 'app/vid/scripts/view-models/serviceModels.htm'
+ })
+ .when('/models/services/createInstance', {
+ controller: 'aaiSubscriberController',
+ templateUrl: 'app/vid/scripts/view-models/createInstanceServiceModels.htm'
+ })
+ .when('/instances/services', {
+ templateUrl : "app/vid/scripts/view-models/aaiGetSubs.htm",
+ controller : "aaiSubscriberController"
+ })
+ .when('/instances/subscribers', {
+ templateUrl : "app/vid/scripts/view-models/aaiGetSubscriberList.htm",
+ controller : "aaiSubscriberController"
+ })
+ .when('/instances/serviceTypes', {
+ templateUrl : "app/vid/scripts/view-models/aaiServiceTypes.htm",
+ controller : "aaiSubscriberController"
+ })
+ .when('/instances/subdetails', {
+ templateUrl : "app/vid/scripts/view-models/aaiSubDetails.htm",
+ controller : "aaiSubscriberController"
+ })
+ .when('/instantiate', {
+ controller: 'InstantiationController',
+ templateUrl: 'app/vid/scripts/view-models/instantiate.htm'
+ })
+ .otherwise({
+ redirectTo: '/models/services'
+ });
+ }]);
+
+ appDS2.service('vidService', function() {
+ var _model = undefined;
+ var _instance = undefined;
+
+ this.setModel = function(model) {
+ _model = model;
+ };
+
+ this.getModel = function() {
+ return _model;
+ };
+
+ this.setInstance = function(instance) {
+ _instance = instance;
+ };
+
+ this.getInstance = function() {
+ return _instance;
+ };
+ });
+})();
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js
new file mode 100755
index 0000000..5caa329
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/aaiSubscriberController.js
@@ -0,0 +1,821 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+appDS2.controller("aaiSubscriberController", [ "COMPONENT", "FIELD", "PARAMETER", "DataService", "PropertyService", "$scope", "$http", "$timeout", "$location", "$log", "$route", "VIDCONFIGURATION", "UtilityService", "vidService","AaiService",
+ function(COMPONENT, FIELD, PARAMETER, DataService, PropertyService, $scope, $http, $timeout, $location, $log, $route, VIDCONFIGURATION, UtilityService, vidService, AaiService) {
+
+ $scope.showVnfDetails = function(vnf) {
+ console.log("showVnfDetails");
+ DataService.setVnfInstanceId(COMPONENT.VNF_INSTANCE_ID);
+ DataService
+ .setInventoryItem(aaiResult[FIELD.ID.INVENTORY_RESPONSE_ITEMS][FIELD.ID.INVENTORY_RESPONSE_ITEM][0]);
+
+ $scope.$broadcast(COMPONENT.SHOW_COMPONENT_DETAILS, {
+ componentId : COMPONENT.VNF,
+ callbackFunction : callbackFunction
+ });
+ }
+ $scope.popup = new Object();
+
+
+ $scope.isPopupVisible = false;
+ $scope.defaultBaseUrl = "";
+ $scope.responseTimeoutMsec = 60000;
+
+ $scope.serviceTypes=[ FIELD.PROMPT.SELECT_SERVICE ];
+ $scope.defaultSubscriberName=[ FIELD.PROMPT.SELECT_SUB ];
+
+ var callbackFunction = function(response) {
+ alert(response);
+ };
+
+ $scope.getSubs = function() {
+ $scope.init();
+ $scope.fetchSubs(FIELD.PROMPT.FETCHING_SUBS);
+ $scope.fetchServices();
+
+ };
+
+ $scope.cancelCreateSI = function(){
+
+ window.location.href = COMPONENT.WELCOME_PATH;
+
+ };
+
+ $scope.getServiceTypes = function(globalCustomerId){
+ DataService.setGlobalCustomerId(globalCustomerId);
+ DataService.setServiceIdList($scope.customerList)
+
+ if (globalCustomerId !== "" && globalCustomerId !== undefined ) {
+ window.location.href = COMPONENT.SERVICE_TYPE_LIST_PATH + $scope.serviceTypeList;
+ }
+ }
+
+ $scope.refreshServiceTypes = function(globalCustomerId){
+ DataService.setGlobalCustomerId(globalCustomerId);
+
+ $scope.getServiceTypesList();
+ }
+
+ $scope.subId="";
+ $scope.createSubscriberName="";
+ $scope.serviceTypeList={};
+ $scope.custSubList=[];
+ $scope.getServiceTypesList = function(){
+ var notFound = true;
+ var globalCustomerId = DataService.getGlobalCustomerId();
+ $scope.custSubList = DataService.getServiceIdList();
+ if(globalCustomerId !== "" && globalCustomerId !== undefined ){
+ $scope.subId=globalCustomerId;
+ $scope.init();
+ $scope.status = FIELD.PROMPT.FETCHING_SERVICE_TYPES;
+ DataService.setGlobalCustomerId(globalCustomerId);
+
+ AaiService.getSubscriptionServiceTypeList(DataService
+ .getGlobalCustomerId(), function(response) {
+ notFound = false;
+ $scope.setProgress(100); // done
+ $scope.status = FIELD.STATUS.DONE;
+ $scope.isSpinnerVisible = false;
+ $scope.serviceTypeList = response;
+ for(var i=0; i<$scope.custSubList.length;i++){
+ if(globalCustomerId === $scope.custSubList[i].globalCustomerId){
+ $scope.createSubscriberName = $scope.custSubList[i].subscriberName;
+ }
+ }
+ }, function(response) { // failure
+ $scope.showError(FIELD.ERROR.AAI);
+ $scope.errorMsg = FIELD.ERROR.FETCHING_SERVICE_TYPES + response.status;
+ $scope.errorDetails = response.data;
+ });
+ } else {
+ alert(FIELD.ERROR.SELECT);
+ }
+
+ };
+
+ $scope.subList = [];
+ $scope.getAaiServiceModels = function(selectedServicetype,subName){
+ DataService.setGlobalCustomerId(selectedServicetype);
+ DataService.setServiceIdList($scope.serviceTypeList)
+ DataService.setSubscriberName(subName);
+
+ DataService.setSubscribers($scope.custSubList);
+
+ if (selectedServicetype !== "" && selectedServicetype !== 'undefined') {
+ $location.path(COMPONENT.CREATE_INSTANCE_PATH);
+ }
+ };
+
+ $scope.serviceTypeName="";
+ $scope.getAaiServiceModelsList = function(){
+ var globalCustomerId="";
+ var serviceTypeId = DataService.getGlobalCustomerId();
+ $scope.serviceTypeList = DataService.getServiceIdList();
+ $scope.createSubscriberName = DataService.getSubscriberName();
+ $scope.status = FIELD.STATUS.FETCHING_SERVICE_CATALOG;
+ $scope.custSubList = DataService.getSubscribers();
+ for(var i=0; i<$scope.serviceTypeList.length;i++){
+ if(parseInt(serviceTypeId) === i ){
+ $scope.serviceTypeName = $scope.serviceTypeList[i];
+ }
+ };
+ for(var i=0; i<$scope.custSubList.length;i++){
+ if($scope.createSubscriberName === $scope.custSubList[i].subscriberName){
+ globalCustomerId = $scope.custSubList[i].globalCustomerId;
+ }
+ };
+
+ var pathQuery ="";
+
+ if(null !== globalCustomerId && "" !== globalCustomerId && undefined !== globalCustomerId
+ && null !== serviceTypeId && "" !== serviceTypeId && undefined !== serviceTypeId){
+ pathQuery = COMPONENT.SERVICES_PATH +globalCustomerId+"/"+$scope.serviceTypeName;
+ }
+
+ AaiService.getServiceModels(globalCustomerId,$scope.serviceTypeName,function(response) { // success
+ console.log("service models : "+response.data);
+ DataService.setServiceIdList(response);
+ }, function(response) { // failure
+ $scope.showError(FIELD.ERROR.AAI);
+ $scope.errorMsg = FIELD.ERROR.FETCHING_SERVICES+ response.status;
+ $scope.errorDetails = response.data;
+ });
+
+ /*$http.get('/aai_get_services/'+globalCustomerId+''+$scope.serviceTypeName)
+ .then(function successCallback(response) {
+ $scope.services = [];
+ if (angular.isArray(response.data)) {
+ $scope.services = response.data;
+ $scope.viewPerPage=10;
+ $scope.totalPage=$scope.services.length/$scope.viewPerPage;
+ $scope.sortBy="name";
+ $scope.scrollViewPerPage=2;
+ $scope.currentPage=1;
+ $scope.searchCategory;
+ $scope.searchString="";
+ $scope.currentPageNum=1;
+ $scope.isSpinnerVisible = false;
+ $scope.isProgressVisible = false;
+ } else {
+ $scope.status = "Failed to get service models from SDC.";
+ $scope.error = true;
+ $scope.isSpinnerVisible = false;
+ }
+ }, function errorCallback(response) {
+ console.log("Error: " + response);
+ }); */
+
+
+ };
+
+ $scope.cancelCreateSIType = function(){
+
+ window.location.href = COMPONENT.SERVICE_MODLES_INSTANCES_SUBSCRIBERS_PATH;
+
+ }
+
+ $scope.fetchServices = function() {
+ var serviceIdList = [];
+
+ AaiService.getServices2(function(response) { // success
+ DataService.setServiceIdList(response);
+ }, function(response) { // failure
+ $scope.showError(FIELD.ERROR.AAI);
+ $scope.errorMsg = FIELD.ERROR.FETCHING_SERVICES + response.status;
+ $scope.errorDetails = response.data;
+ });
+ }
+
+ $scope.refreshSubs = function() {
+ $scope.fetchSubs(FIELD.PROMPT.REFRESH_SUB_LIST);
+ $scope.fetchServices();
+ };
+
+ $scope.fetchSubs = function(status) {
+ $scope.status = status;
+
+ AaiService.getSubList(function(response) { // sucesss
+ $scope.setProgress(100); // done
+ $scope.status = FIELD.STATUS.DONE;
+ $scope.isSpinnerVisible = false;
+ $scope.customerList = response;
+ }, function(response) { // failure
+ $scope.showError(FIELD.ERROR.AAI);
+ $scope.errorMsg = FIELD.ERROR.AAI_FETCHING_CUST_DATA + response.status;
+ $scope.errorDetails = response.data;
+ });
+ }
+
+
+ $scope.getSubDetails = function(request) {
+
+ $scope.init();
+ $scope.selectedSubscriber = $location.search().selectedSubscriber;
+ $scope.selectedServiceInstance = $location.search().selectedServiceInstance;
+ $scope.status = FIELD.STATUS.FETCHING_SUB_DETAILS + $scope.selectedSubscriber;
+
+ $scope.displayData = [];
+ AaiService.getSubDetails($scope.selectedSubscriber, $scope.selectedServiceInstance, function(displayData, subscriberName) {
+ $scope.displayData = displayData;
+ $scope.viewPerPage=10;
+ $scope.totalPage=$scope.displayData.length/$scope.viewPerPage;
+ $scope.scrollViewPerPage=2;
+ $scope.currentPage=1;
+ $scope.searchCategory;
+ $scope.searchString="";
+ $scope.currentPageNum=1;
+ $scope.defaultSort=COMPONENT.SUBSCRIBER_NAME;
+ $scope.setProgress(100); // done
+ $scope.status = FIELD.STATUS.DONE;
+ $scope.isSpinnerVisible = false;
+ $scope.subscriberName = subscriberName;
+ }, function(response) {
+ $scope.showError(FIELD.ERROR.AAI);
+ $scope.errorMsg = FIELD.ERROR.AAI_FETCHING_CUST_DATA + response.status;
+ $scope.errorDetails = response.data;
+ });
+ }
+
+
+ $scope.$on(COMPONENT.MSO_DELETE_REQ, function(event, request) {
+ // $log.debug("deleteInstance: request:");
+ // $log.debug(request);
+ $scope.init();
+
+ $http.post($scope.baseUrl + request.url, {
+ requestDetails: request.requestDetails
+ },{
+ timeout: $scope.responseTimeoutMsec
+ }).then($scope.handleInitialResponse)
+ ["catch"]($scope.handleServerError);
+ });
+
+ $scope.init = function() {
+
+ //PropertyService.setAaiBaseUrl("testaai");
+ //PropertyService.setAsdcBaseUrl("testasdc");
+
+ // takes a default value, retrieves the prop value from the file system and sets it
+ var msecs = PropertyService.retrieveMsoMaxPollingIntervalMsec();
+ PropertyService.setMsoMaxPollingIntervalMsec(msecs);
+
+ // takes a default value, retrieves the prop value from the file system and sets it
+ var polls = PropertyService.retrieveMsoMaxPolls();
+ PropertyService.setMsoMaxPolls(polls);
+
+ //PropertyService.setMsoBaseUrl("testmso");
+ PropertyService.setServerResponseTimeoutMsec();
+
+ /*
+ * Common parameters that would typically be set when the page is
+ * displayed for a specific service instance id.
+ */
+
+ $scope.baseUrl = $scope.defaultBaseUrl;
+
+ $scope.isSpinnerVisible = true;
+ $scope.isProgressVisible = true;
+ $scope.isPopupVisible = true;
+ $scope.requestId = "";
+ $scope.error = "";
+ $scope.pollAttempts = 0;
+ $scope.log = "";
+ $scope.enableCloseButton(false);
+ $scope.resetProgress();
+ $scope.setProgress(2); // Show "a little" progress
+ }
+
+ $scope.getComponentList = function(event, request) {
+
+ $scope.isSpinnerVisible = true;
+ $scope.isProgressVisible = true;
+ $scope.isPopupVisible = true;
+ $scope.requestId = "";
+ $scope.error = "";
+ $scope.pollAttempts = 0;
+ $scope.log = "";
+
+ $scope.resetProgress();
+ $scope.setProgress(2); // Show "a little" progress
+
+ $scope.globalCustomerId = $location.search().subscriberId;
+ $scope.serviceType = $location.search().serviceType;
+ $scope.serviceInstanceId = $location.search().serviceInstanceId;
+ $scope.subscriberName = $location.search().subscriberName;
+
+ //$scope.getAsdcModel($location.search().modelUuid);
+
+ $scope.namedQueryId = VIDCONFIGURATION.COMPONENT_LIST_NAMED_QUERY_ID;
+ $scope.status = FIELD.STATUS.FETCHING_SERVICE_INST_DATA + $scope.serviceInstanceId;
+
+ AaiService.runNamedQuery($scope.namedQueryId, $scope.globalCustomerId, $scope.serviceType, $scope.serviceInstanceId,
+ function(response) { //success
+ $scope.handleInitialResponseInventoryItems(response);
+ $scope.setProgress(100); // done
+ $scope.status = FIELD.STATUS.DONE;
+ $scope.isSpinnerVisible = false;
+ },
+ function(response){ //failure
+ $scope.showError(FIELD.ERROR.AAI);
+ $scope.errorMsg = FIELD.ERROR.FETCHING_SERVICE_INSTANCE_DATA + response.status;
+ $scope.errorDetails = response.data;
+ }
+ );
+
+ }
+
+ $scope.handleServerError = function(response, status) {
+ alert(response.statusText);
+ }
+
+ $scope.getAsdcModel = function(disData) {
+
+ console.log ("disData"); console.log (JSON.stringify (disData, null, 4));
+
+ if ( !(UtilityService.hasContents (disData.aaiModelVersionId)) ) {
+ $scope.errorMsg = FIELD.ERROR.MODEL_VERSION_ID_MISSING;
+ alert($scope.errorMsg);
+ return;
+ }
+
+ // aaiModelVersionId is the model uuid
+ var pathQuery = COMPONENT.SERVICES_PATH + disData.aaiModelVersionId;
+ $http({
+ method: 'GET',
+ url: pathQuery
+ }).then(function successCallback(response) {
+ vidService.setModel(response.data);
+ window.location.href = COMPONENT.INSTANTIATE_ROOT_PATH + disData.globalCustomerId + COMPONENT.SUBSCRIBERNAME_SUB_PATH + disData.subscriberName + COMPONENT.SERVICETYPE_SUB_PATH + disData.serviceType + COMPONENT.SERVICEINSTANCEID_SUB_PATH + disData.serviceInstanceId;
+ console.log("aaiSubscriber getAsdcModel DONE!!!!");
+ }, function errorCallback(response) {
+ console.log("aaiSubscriber getAsdcModel - No matching model found matching the A&AI model version ID = " + disData.aaiModelVersionId);
+ $scope.errorMsg = FIELD.ERROR.NO_MATCHING_MODEL_AAI + disData.aaiModelVersionId;
+ alert($scope.errorMsg);
+ });
+
+ }
+
+ $scope.getTenants = function(globalCustomerId) {
+ $http.get(FIELD.ID.AAI_GET_TENTANTS + globalCustomerId)
+ .then(function successCallback(response) {
+ return response.data;
+ //$location.path("/instantiate");
+ }, function errorCallback(response) {
+ //TODO
+ });
+ }
+
+ $scope.handleInitialResponseInventoryItems = function(response) {
+
+ $scope.inventoryResponseItemList = response.data[FIELD.ID.INVENTORY_RESPONSE_ITEM]; // get data from json
+ console.log($scope.inventoryResponseItemList.toString());
+
+ $scope.displayData = [];
+ $scope.vnfs = [];
+
+ $scope.counter = 100;
+
+ $scope.subscriberName = "";
+ // just look up the subscriber name in A&AI here...
+ AaiService.getSubscriberName($scope.globalCustomerId, function(response) {
+ $scope.subscriberName = response;
+ DataService.setSubscriberName($scope.subscriberName);
+
+ angular.forEach($scope.inventoryResponseItemList, function(inventoryResponseItem, key) {
+
+ $scope.inventoryResponseItem = inventoryResponseItem;
+
+ $scope.service.instance = {
+ "name": $scope.inventoryResponseItem[FIELD.ID.SERVICE_INSTANCE][FIELD.ID.SERVICE_INSTANCE_NAME],
+ "serviceInstanceId": $scope.serviceInstanceId,
+ "serviceType": $scope.serviceType,
+ "globalCustomerId": $scope.globalCustomerId,
+ "subscriberName": $scope.subscriberName,
+ "id": $scope.serviceInstanceId,
+ "inputs": {
+ "a": {
+ "type": PARAMETER.STRING,
+ "description": FIELD.PROMPT.VAR_DESCRIPTION_A,
+ "default": FIELD.PROMPT.DEFAULT_A
+ },
+ "b": {
+ "type": PARAMETER.STRING,
+ "description": FIELD.PROMPT.VAR_DESCRIPTION_B,
+ "default": FIELD.PROMPT.DEFAULT_B
+ },
+ },
+ "object": $scope.inventoryResponseItem[FIELD.ID.SERVICE_INSTANCE],
+ "vnfs": [],
+ "networks": []
+ }
+
+ if (inventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS] != null) {
+
+ angular.forEach(inventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS][FIELD.ID.INVENTORY_RESPONSE_ITEM], function(subInventoryResponseItem, key) {
+ // i expect to find vnfs now
+
+ if (subInventoryResponseItem[FIELD.ID.L3_NETWORK] != null) {
+ var l3NetworkObject = subInventoryResponseItem[FIELD.ID.L3_NETWORK];
+ var l3Network = { "id": $scope.counter++,
+ "name": l3NetworkObject[FIELD.ID.NETWORK_NAME],
+ "itemType": FIELD.ID.L3_NETWORK,
+ "nodeId": l3NetworkObject[FIELD.ID.NETWORK_ID],
+ "nodeType": l3NetworkObject[FIELD.ID.NETWORK_TYPE],
+ "nodeStatus": l3NetworkObject[FIELD.ID.ORCHESTRATION_STATUS],
+ "object": l3NetworkObject,
+ "nodes": [],
+ "subnets": []
+ };
+ if (subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS] != null) {
+ //console.log ("subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS]=");
+ //console.log (JSON.stringify (subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS], null, 4 ));
+ angular.forEach(subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS][FIELD.ID.INVENTORY_RESPONSE_ITEM], function(subSubInventoryResponseItem, key) {
+ //console.log (JSON.stringify (subSubInventoryResponseItem, null, 4 ));
+ var subnet = {};
+ var subnetObject;
+ if (subSubInventoryResponseItem[FIELD.ID.SUB_NET] != null) {
+ subnetObject = subSubInventoryResponseItem[FIELD.ID.SUB_NET];
+ subnet = {
+ "subnet-id": subnetObject[FIELD.ID.SUBNET_ID],
+ "subnet-name": subnetObject[FIELD.ID.SUBNET_NAME],
+ "gateway-address": subnetObject[FIELD.ID.GATEWAY_ADDRESS],
+ "network-start-address": subnetObject[FIELD.ID.NETWORK_START_ADDRESS],
+ "cidr-mask": subnetObject[FIELD.ID.CIDR_MASK]
+ };
+ l3Network.subnets.push(subnet);
+ }
+ });
+ }
+ $scope.service.instance[FIELD.ID.NETWORKS].push(l3Network);
+ }
+
+ if (subInventoryResponseItem[FIELD.ID.GENERIC_VNF] != null) {
+ var genericVnfObject = subInventoryResponseItem[FIELD.ID.GENERIC_VNF];
+
+ var genericVnf = {
+ "name": genericVnfObject[FIELD.ID.VNF_NAME],
+ "id": $scope.counter++,
+ "itemType": COMPONENT.VNF,
+ "nodeType": genericVnfObject[FIELD.ID.VNF_TYPE],
+ "nodeId": genericVnfObject[FIELD.ID.VNF_ID],
+ "nodeStatus": genericVnfObject[FIELD.ID.ORCHESTRATION_STATUS],
+ "object": genericVnfObject,
+ "vfModules": [],
+ "volumeGroups": [],
+ "availableVolumeGroups": []
+ };
+ $scope.service.instance[FIELD.ID.VNFS].push(genericVnf);
+
+ // look for volume-groups
+ if (subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS] != null) {
+ angular.forEach(subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS][FIELD.ID.INVENTORY_RESPONSE_ITEM], function(vfmodules, key) {
+
+ if (vfmodules[FIELD.ID.VOLUME_GROUP] != null) {
+ var volumeGroupObject = vfmodules[FIELD.ID.VOLUME_GROUP];
+ var volumeGroup = { "id": $scope.counter++,
+ "name": volumeGroupObject[FIELD.ID.VOLUME_GROUP_NAME],
+ "itemType": FIELD.ID.VOLUME_GROUP,
+ "nodeId": volumeGroupObject[FIELD.ID.VOLUME_GROUP_ID],
+ "nodeType": volumeGroupObject[FIELD.ID.VNF_TYPE],
+ "nodeStatus": volumeGroupObject[FIELD.ID.ORCHESTRATION_STATUS],
+ "object": volumeGroupObject,
+ "nodes": []
+ };
+ genericVnf[FIELD.ID.VOLUMEGROUPS].push(volumeGroup);
+ genericVnf[FIELD.ID.AVAILABLEVOLUMEGROUPS].push(volumeGroup);
+ }
+ });
+ }
+ // now we've loaded up the availableVolumeGroups, we can use it
+ if (subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS] != null) {
+ angular.forEach(subInventoryResponseItem[FIELD.ID.INVENTORY_RESPONSE_ITEMS][FIELD.ID.INVENTORY_RESPONSE_ITEM], function(vfmodules, key) {
+
+ if (vfmodules[FIELD.ID.VF_MODULE] != null) {
+ var vfModuleObject = vfmodules[FIELD.ID.VF_MODULE];
+ var vfModule = { "id": $scope.counter++,
+ "name": vfModuleObject[FIELD.ID.VF_MODULE_NAME],
+ "itemType": FIELD.ID.VF_MODULE,
+ "nodeType": FIELD.ID.VF_MODULE,
+ "nodeStatus": vfModuleObject[FIELD.ID.ORCHESTRATION_STATUS],
+ "volumeGroups": [],
+ "object": vfModuleObject,
+ "networks": []
+ };
+ genericVnf[FIELD.ID.VF_MODULES].push(vfModule);
+ if (vfmodules[FIELD.ID.INVENTORY_RESPONSE_ITEMS] != null) {
+ angular.forEach(vfmodules[FIELD.ID.INVENTORY_RESPONSE_ITEMS][FIELD.ID.INVENTORY_RESPONSE_ITEM], function(networks, key) {
+ if (networks[FIELD.ID.L3_NETWORK] != null) {
+ var l3NetworkObject = networks[FIELD.ID.L3_NETWORK];
+ var l3Network = { "id": $scope.counter++,
+ "name": l3NetworkObject[FIELD.ID.NETWORK_NAME],
+ "itemType": FIELD.ID.L3_NETWORK,
+ "nodeId": l3NetworkObject[FIELD.ID.NETWORK_ID],
+ "nodeType": l3NetworkObject[FIELD.ID.NETWORK_TYPE],
+ "nodeStatus": l3NetworkObject[FIELD.ID.ORCHESTRATION_STATUS],
+ "object": l3NetworkObject,
+ "nodes": []
+ };
+ vfModule[FIELD.ID.NETWORKS].push(l3Network);
+ }
+ if (networks[FIELD.ID.VOLUME_GROUP] != null) {
+ var volumeGroupObject = networks[FIELD.ID.VOLUME_GROUP];
+
+ var volumeGroup = { "id": $scope.counter++,
+ "name": volumeGroupObject[FIELD.ID.VOLUME_GROUP_NAME],
+ "itemType": FIELD.ID.VOLUME_GROUP,
+ "nodeId": volumeGroupObject[FIELD.ID.VOLUME_GROUP_ID],
+ "nodeType": volumeGroupObject[FIELD.ID.VNF_TYPE],
+ "nodeStatus": volumeGroupObject[FIELD.ID.ORCHESTRATION_STATUS],
+ "object": volumeGroupObject,
+ "nodes": []
+ };
+ var tmpVolGroup = [];
+
+ angular.forEach(genericVnf[FIELD.ID.AVAILABLEVOLUMEGROUPS], function(avgroup, key) {
+ if (avgroup.name != volumeGroup.name) {
+ tmpVolGroup.push(avgroup);
+ }
+ });
+
+ genericVnf[FIELD.ID.AVAILABLEVOLUMEGROUPS] = tmpVolGroup;
+
+ vfModule[FIELD.ID.VOLUMEGROUPS].push(volumeGroup);
+ }
+
+ });
+ }
+ }
+ });
+ }
+ }
+ });
+ }
+ });
+ });
+ }
+
+ $scope.handleInitialResponse = function(response) {
+ try {
+ $scope.enableCloseButton(true);
+ $scope.updateLog(response);
+ if (response.data.status < 200 || response.data.status > 202) {
+ $scope.showError(FIELD.ERROR.MSO);
+ $scope.status = FIELD.ERROR.AAI_FETCHING_CUST_DATA + response.data.status;
+
+ return;
+ }
+
+ $scope.setProgress(100); // done
+ $scope.status = FIELD.STATUS.DONE;
+ $scope.isSpinnerVisible = false;
+
+ $scope.customer = response.data.customer; // get data from json
+
+ $scope.customerList = [];
+
+ angular.forEach($scope.customer, function(subVal, subKey) {
+ var cust = { "globalCustomerId": subVal[FIELD.ID.GLOBAL_CUSTOMER_ID], "subscriberName": subVal[FIELD.ID.SUBNAME] };
+ $scope.customerList.push(cust);
+ });
+
+ } catch (error) {
+ $scope.showContentError(error);
+ }
+ }
+
+ $scope.autoGetSubs = function() {
+ /*
+ * Optionally comment in / out one of these method calls (or add a similar
+ * entry) to auto-invoke an entry when the test screen is redrawn.
+ */
+ $scope.getSubs();
+
+ }
+
+ $scope.updateLog = function(response) {
+// $scope.log = UtilityService.getCurrentTime() + " HTTP Status: " +
+// UtilityService.getHttpStatusText(response.data.status) + "\n" +
+// angular.toJson(response.data.entity, true) + "\n\n" + $scope.log;
+// UtilityService.checkUndefined("entity", response.data.entity);
+// UtilityService.checkUndefined("status", response.data.status);
+ }
+
+ $scope.handleServerError = function(response, status) {
+ $scope.enableCloseButton(true);
+ var message = UtilityService.getHttpErrorMessage(response);
+ if (message != ""){
+ message = " (" + message + ")";
+ }
+ $scope.showError(FIELD.ERROR.SYSTEM_ERROR + message);
+ }
+
+ $scope.showContentError = function(message) {
+ // $log.debug(message);
+ console.log(message);
+ if (UtilityService.hasContents(message)) {
+ $scope.showError("System failure (" + message + ")");
+ } else {
+ $scope.showError(FIELD.ERROR.SYSTEM_ERROR);
+ }
+ }
+
+ $scope.showError = function(message) {
+ $scope.isSpinnerVisible = false;
+ $scope.isProgressVisible = false;
+ $scope.error = message;
+ $scope.status = FIELD.STATUS.ERROR;
+ }
+
+ $scope.close = function() {
+ if ($scope.timer != undefined) {
+ $timeout.cancel($scope.timer);
+ }
+ $scope.isPopupVisible = false;
+ }
+
+
+
+ /*
+ * Consider converting the progress bar mechanism, the disabled button handling
+ * and the following methods to generic Angular directive(s) and/or approach.
+ */
+
+ $scope.enableCloseButton = function(isEnabled) {
+ var selector = FIELD.STYLE.MSO_CTRL_BTN;
+
+ $scope.isCloseEnabled = isEnabled;
+
+ if (isEnabled) {
+ $(selector).addClass(FIELD.STYLE.BTN_PRIMARY).removeClass(FIELD.STYLE.BTN_INACTIVE).attr(FIELD.STYLE.BTN_TYPE, FIELD.STYLE.PRIMARY);
+ } else {
+ $(selector).removeClass(FIELD.STYLE.BTN_PRIMARY).addClass(FIELD.STYLE.BTN_INACTIVE).attr(FIELD.STYLE.BTN_TYPE, FIELD.STYLE.DISABLED);
+ }
+ }
+
+ $scope.resetProgress = function() {
+ $scope.percentProgress = 0;
+ $scope.progressClass = FIELD.STYLE.PROGRESS_BAR_INFO;
+ }
+
+ $scope.setProgress = function(percentProgress) {
+ percentProgress = parseInt(percentProgress);
+ if (percentProgress >= 100) {
+ $scope.progressClass = FIELD.STYLE.PROGRESS_BAR_SUCCESS;
+ }
+
+ if (percentProgress < $scope.percentProgress) {
+ return;
+ }
+
+ $scope.percentProgress = percentProgress;
+ $scope.progressWidth = {width: percentProgress + "%"};
+ if (percentProgress >= 5) {
+ $scope.progressText = percentProgress + " %";
+ } else {
+ // Hidden since color combination is barely visible when progress portion is narrow.
+ $scope.progressText = "";
+ }
+ }
+
+ $scope.reloadRoute = function() {
+ $route.reload();
+ }
+
+ $scope.prevPage = function() {
+ $scope.currentPage--;
+ }
+
+ $scope.nextPage = function() {
+ $scope.currentPage++;
+ }
+ $scope.serviceInstanceses = [{"sinstance":FIELD.NAME.SERVICE_INSTANCE_Id},{"sinstance":FIELD.NAME.SERVICE_INSTANCE_NAME}]
+ $scope.getSubscriberDet = function(selectedCustomer,selectedserviceinstancetype,selectedServiceInstance){
+
+ var sintype =selectedserviceinstancetype;
+ if (selectedServiceInstance != "" && selectedServiceInstance != undefined) {
+ selectedServiceInstance.trim();
+
+ // check with A&AI
+ $http.get(COMPONENT.AAI_GET_SERVICE_INSTANCE_PATH + selectedServiceInstance+"/"+sintype + "?r=" + Math.random(), {
+
+ },{
+ timeout: $scope.responseTimeoutMsec
+ }).then(function(response) {
+ var notFound = true;
+ if (angular.isArray(response.data[FIELD.ID.RESULT_DATA])) {
+ var item = [];
+ var urlParts = [];
+ item = response.data[FIELD.ID.RESULT_DATA][0];
+ var url = item[FIELD.ID.RESOURCE_LINK];
+ var globalCustomerId = "";
+ var serviceSubscription = "";
+ // split it and find the customer Id and service-subscription
+ urlParts = url.split("/");
+ if (urlParts[7] === FIELD.ID.CUSTOMER) {
+ globalCustomerId = urlParts[8];
+ }
+ if (urlParts[10] === FIELD.ID.SERVICE_SUBSCRIPTION) {
+ serviceSubscription = urlParts[11];
+ }
+
+ if (globalCustomerId !== "") {
+ notFound = false;
+ window.location.href = COMPONENT.SELECTED_SERVICE_SUB_PATH + serviceSubscription + COMPONENT.SELECTEDSUBSCRIBER_SUB_PATH + globalCustomerId + COMPONENT.SELECTEDSERVICEINSTANCE_SUB_PATH + selectedServiceInstance;
+ }
+ }
+ if (notFound) {
+ alert(FIELD.ERROR.SERVICE_INST_DNE);
+ }
+ }); // add a failure callback...
+ } else if (selectedCustomer != null) {
+ window.location.href = COMPONENT.SELECTED_SUB_PATH + selectedCustomer;
+ } else {
+ alert(FIELD.ERROR.SELECT);
+ }
+ };
+ }]).directive('restrictInput', function(){
+
+ return {
+
+ restrict: 'A',
+ require: 'ngModel',
+ link: function($scope, element, attr, ctrl){
+ ctrl.$parsers.unshift(function(viewValue){
+
+ var types = $scope.$eval(attr.restrictInput);
+ if(!types.regex && types.type){
+
+ switch(types.type){
+ case 'Service Instance Name' : types.regex = '^[a-zA-Z0-9-_]*$'; break;
+ default: types.regex= '';
+ }
+ }
+ var reg = new RegExp(types.regex);
+ if(reg.test(viewValue)){
+ return viewValue;
+ } else {
+ var overrideValue = (reg.test(viewValue) ? viewValue : '');
+ element.val(overrideValue);
+ return overrideValue;
+ }
+ });
+ }
+ };
+
+ });
+appDS2.controller('TreeCtrl', ['$scope', function ($scope) {
+ $scope.remove = function (scope) {
+ scope.remove();
+ };
+
+ $scope.toggle = function (scope) {
+ scope.toggle();
+ };
+
+ $scope.moveLastToTheBeginning = function () {
+ var a = $scope.data.pop();
+ $scope.data.splice(0, 0, a);
+ };
+
+ $scope.newSubItem = function (scope) {
+ var nodeData = scope.$modelValue;
+ nodeData.nodes.push({
+ id: nodeData.id * 10 + nodeData.nodes.length,
+ title: nodeData.title + '.' + (nodeData.nodes.length + 1),
+ nodes: []
+ });
+ };
+
+ $scope.collapseAll = function () {
+ $scope.$broadcast(FIELD.ID.ANGULAR_UI_TREE_COLLAPSEALL);
+ };
+
+ $scope.expandAll = function () {
+ $scope.$broadcast(FIELD.ID.ANGULAR_UI_TREE_EXPANDALL);
+ };
+
+
+}]);
+
+
+
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/creationDialogController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/creationDialogController.js
new file mode 100755
index 0000000..6a1c14c
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/creationDialogController.js
@@ -0,0 +1,163 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+var creationDialogController = function( COMPONENT, FIELD, $scope, $http, $timeout, $log,
+ CreationService, UtilityService, DataService) {
+
+ $scope.isDialogVisible = false;
+ $scope.summaryControl = {};
+ $scope.userProvidedControl = {};
+
+ var callbackFunction = undefined;
+ var componentId = undefined;
+
+ $scope.$on(COMPONENT.CREATE_COMPONENT, function(event, request) {
+
+ $scope.isSpinnerVisible = true;
+ $scope.isErrorVisible = false;
+ $scope.isDataVisible = false;
+ $scope.isConfirmEnabled = false;
+ $scope.isDialogVisible = true;
+ $scope.popup.isVisible = true;
+
+ callbackFunction = request.callbackFunction;
+ componentId = request.componentId;
+ CreationService.initializeComponent(request.componentId);
+
+ CreationService.setHttpErrorHandler(function(response) {
+ showError(FIELD.ERROR.SYSTEM_FAILURE, UtilityService
+ .getHttpErrorMessage(response));
+ });
+
+ $scope.componentName = CreationService.getComponentDisplayName();
+
+ CreationService.getParameters(handleGetParametersResponse);
+
+ });
+
+ var handleGetParametersResponse = function(parameters) {
+ $scope.summaryControl.setList(parameters.summaryList);
+ $scope.userProvidedControl.setList(parameters.userProvidedList);
+
+ $scope.isSpinnerVisible = false;
+ $scope.isDataVisible = true;
+ $scope.isConfirmEnabled = true;
+ };
+
+ var validateInstanceName = function(iname) {
+ var patt1 = /^([a-z])+([0-9a-z\-_\.]*)$/i;
+
+ if ( iname == null ){
+ return false;
+ }
+ if ( !iname.match(patt1) ) {
+ return false;
+ }
+ return true;
+ }
+
+ $scope.userParameterChanged = function(id) {
+ CreationService.updateUserParameterList(id, $scope.userProvidedControl);
+ }
+
+ $scope.confirm = function() {
+
+ var requiredFields = $scope.userProvidedControl.getRequiredFields();
+ if (requiredFields !== "") {
+ showError(FIELD.ERROR.MISSING_DATA, requiredFields);
+ return;
+ }
+
+ var paramList = $scope.userProvidedControl.getList();
+ var instanceName = "";
+
+ if ( DataService.getALaCarte() ) {
+ if ( paramList != null ) {
+ for (var i = 0; i < paramList.length; i++) {
+ if (paramList[i].id === FIELD.ID.INSTANCE_NAME) {
+ instanceName = paramList[i].value;
+ break;
+ }
+ }
+ }
+ var isValid = validateInstanceName (instanceName);
+ if ( isValid ) {
+ $scope.isErrorVisible = false;
+ } else {
+ showError(FIELD.ERROR.INVALID_INSTANCE_NAME + instanceName,
+ FIELD.ERROR.INSTANCE_NAME_VALIDATE);
+ return;
+ }
+ }
+
+ var requestDetails = CreationService
+ .getMsoRequestDetails($scope.userProvidedControl.getList());
+
+ $scope.isDialogVisible = false;
+
+ $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, {
+ url : CreationService.getMsoUrl(),
+ requestDetails : requestDetails,
+ componentId: componentId,
+ callbackFunction : function(response) {
+ if (response.isSuccessful) {
+ $scope.popup.isVisible = false;
+ runCallback(response);
+ } else {
+ $scope.isDialogVisible = false;
+ $scope.popup.isVisible = false;
+ }
+ }
+ });
+ }
+
+ $scope.cancel = function() {
+ $scope.isDialogVisible = false;
+ $scope.popup.isVisible = false;
+ runCallback(false);
+ }
+
+ var runCallback = function(response) {
+ if (angular.isFunction(callbackFunction)) {
+ callbackFunction({
+ isSuccessful : response.isSuccessful,
+ control : $scope.userProvidedControl.getList(),
+ instanceId : response.instanceId
+ });
+ }
+ }
+
+ var showError = function(summary, details) {
+ var message = summary;
+ if (UtilityService.hasContents(details)) {
+ message += " (" + details + ")";
+ }
+ $scope.isSpinnerVisible = false;
+ $scope.isErrorVisible = true;
+ $scope.error = message;
+ }
+
+}
+
+appDS2.controller("creationDialogController", [ "COMPONENT", "FIELD", "$scope", "$http",
+ "$timeout", "$log", "CreationService", "UtilityService", "DataService",
+ creationDialogController ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/deletionDialogController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/deletionDialogController.js
new file mode 100755
index 0000000..137673d
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/deletionDialogController.js
@@ -0,0 +1,119 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+var deletionDialogController = function( COMPONENT, FIELD, $scope, $http, $timeout, $log,
+ DeletionService, UtilityService) {
+
+ $scope.isDialogVisible = false;
+ $scope.summaryControl = {};
+ $scope.userProvidedControl = {};
+
+ var callbackFunction = undefined;
+ var componentId = undefined;
+
+ $scope.$on(COMPONENT.DELETE_COMPONENT, function(event, request) {
+
+ $scope.isDataVisible = false;
+ $scope.isSpinnerVisible = false;
+ $scope.isErrorVisible = false;
+ $scope.isDialogVisible = true;
+ $scope.popup.isVisible = true;
+ $scope.isConfirmEnabled = false;
+
+ callbackFunction = request.callbackFunction;
+ componentId = request.componentId;
+
+ DeletionService.initializeComponent(request.componentId);
+
+ $scope.componentName = DeletionService.getComponentDisplayName();
+
+ $scope.summaryControl.setList(DeletionService.getSummaryList());
+
+ DeletionService.getParameters(handleGetParametersResponse);
+
+ });
+
+ var handleGetParametersResponse = function(parameters, dontshow) {
+ $scope.summaryControl.setList(parameters.summaryList);
+ $scope.userProvidedControl.setList(parameters.userProvidedList);
+
+ $scope.isSpinnerVisible = false;
+ if (dontshow)
+ $scope.isDataVisible = false;
+ else
+ $scope.isDataVisible = true;
+ $scope.isConfirmEnabled = true;
+ };
+
+ $scope.userParameterChanged = function(id) {
+ DeletionService.updateUserParameterList(id, $scope.userProvidedControl);
+ }
+
+ $scope.confirm = function() {
+
+ var requiredFields = $scope.userProvidedControl.getRequiredFields();
+ if (requiredFields === "") {
+ $scope.isErrorVisible = false;
+ } else {
+ showError(FIELD.ERROR.MISSING_DATA, requiredFields);
+ return;
+ }
+
+
+ var requestDetails = DeletionService.getMsoRequestDetails($scope.userProvidedControl.getList());
+
+ $scope.isDialogVisible = false;
+
+ $scope.$broadcast(COMPONENT.MSO_DELETE_REQ, {
+ url : DeletionService.getMsoUrl(),
+ requestDetails : requestDetails,
+ componentId: componentId,
+ callbackFunction : function(isSuccessful) {
+ if (isSuccessful) {
+ $scope.popup.isVisible = false;
+ runCallback(true);
+ } else {
+ $scope.isDialogVisible = true;
+ }
+ }
+ });
+
+ }
+
+ $scope.cancel = function() {
+ $scope.isDialogVisible = false;
+ $scope.popup.isVisible = false;
+ runCallback(false);
+ }
+
+ var runCallback = function(isSuccessful) {
+ if (angular.isFunction(callbackFunction)) {
+ callbackFunction({
+ isSuccessful : isSuccessful
+ });
+ }
+ }
+}
+
+appDS2.controller("deletionDialogController", [ "COMPONENT", "FIELD", "$scope", "$http",
+ "$timeout", "$log", "DeletionService", "UtilityService",
+ deletionDialogController ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/detailsDialogController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/detailsDialogController.js
new file mode 100755
index 0000000..ddb1ac1
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/detailsDialogController.js
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+var detailsDialogController = function($scope, $http, $timeout, $log,
+ MsoService, DetailsService, UtilityService, COMPONENT, FIELD) {
+
+ $scope.isDialogVisible = false;
+ $scope.summaryControl = {};
+ $scope.detailsControl = {};
+
+ $scope.$on(COMPONENT.SHOW_COMPONENT_DETAILS, function(event, request) {
+
+ $scope.log = "";
+ $scope.isSpinnerVisible = true;
+ $scope.isErrorVisible = false;
+ $scope.isDialogVisible = true;
+ $scope.popup.isVisible = true;
+
+ DetailsService.initializeComponent(request.componentId);
+
+ $scope.componentName = DetailsService.getComponentDisplayName();
+
+ $scope.summaryControl.setList(DetailsService.getSummaryList());
+
+ $scope.detailsControl.setList(DetailsService.getDetailsList());
+
+ UtilityService.setHttpErrorHandler(function(response) {
+ showError(FIELD.ERROR.SYSTEM_FAILURE, UtilityService
+ .getHttpErrorMessage(response));
+ });
+
+ MsoService.getOrchestrationRequests(
+ DetailsService.getMsoFilterString(), handleGetResponse);
+ });
+
+ var handleGetResponse = function(response) {
+ $scope.isSpinnerVisible = false;
+ try {
+ $scope.log = MsoService
+ .getFormattedGetOrchestrationRequestsResponse(response);
+ } catch (error) {
+ $scope.log = MsoService.getFormattedCommonResponse(response);
+ MsoService.showResponseContentError(error, showError);
+ }
+ }
+
+ $scope.close = function() {
+ $scope.isDialogVisible = false;
+ $scope.popup.isVisible = false;
+ }
+
+ var showError = function(summary, details) {
+ var message = summary;
+ if (UtilityService.hasContents(details)) {
+ message += " (" + details + ")";
+ }
+ $scope.isSpinnerVisible = false;
+ $scope.isErrorVisible = true;
+ $scope.error = message;
+ }
+}
+
+appDS2.controller("detailsDialogController", [ "$scope", "$http", "$timeout",
+ "$log", "MsoService", "DetailsService", "UtilityService", "COMPONENT", "FIELD",
+ detailsDialogController ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitController.js
new file mode 100755
index 0000000..65fac28
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/msoCommitController.js
@@ -0,0 +1,300 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+/*
+ * "msoCommitController.js" provides controller code to commit MSO requests.
+ *
+ * HIGHLIGHTS:
+ *
+ * Parent HTML/JSP code is expected to include "msoCommit.htm" (via
+ * "ng-include") and this file (via "<script>"). "msoCommit.jsp" (displayed
+ * when the parent code includes "msoCommit.htm") renders a popup window, but
+ * initially hides the display.
+ *
+ * The parent controller code is expected to broadcast either the
+ * "createInstance" or "deleteInstance" events when it is ready to commit the
+ * code.
+ *
+ * This controller receives these events (via "$scope.on" declarations), calls
+ * "$scope.init()" to "unhide" and initialize the popup display and then makes a
+ * REST request to the appropriate server Java controller.
+ *
+ * The initial REST response is handled by "handleInitialResponse". This method
+ * then polls the server (via "getRequestStatus") if the request is successful.
+ *
+ * The subsequent "getRequestStatus" responses are handled by
+ * "handleGetResponse".
+ *
+ * "handleInitialResponse" and "handleGetResponse" primarily filter response
+ * data, manipulate the display and provide error handling.
+ *
+ * The mechanism has these dependencies (in addition to "msoCommit.htm"):
+ *
+ * 1) Three services: MsoService, PropertyService and UtilityService
+ *
+ * 2) The popup window directive found in "popupWindow.htm" and
+ * "popupWindowDirective.js"
+ *
+ * 2) Display styling defined in "dialogs.css"
+ *
+ * CAVEATS:
+ *
+ * The parent HTML is assumed to be the "popup-window" directive and the
+ * corresponding parent controller is assumed to define the object
+ * "$scope.popup".
+ */
+
+var msoCommitController = function(COMPONENT, FIELD, $scope, $http, $timeout, $window, $log,
+ MsoService, PropertyService, UtilityService, DataService) {
+
+ $scope.isViewVisible = false;
+ $scope.progressBarControl = {};
+ $scope.popupWindowControl = {};
+
+ var _this = this;
+
+ $scope.$on("createInstance", function(event, request) {
+ init(request, COMPONENT.MSO_CREATE_REQ );
+ MsoService.createInstance(request, handleInitialResponse);
+ });
+
+ $scope.$on("deleteInstance", function(event, request) {
+ init(request, COMPONENT.MSO_DELETE_REQ);
+ MsoService.deleteInstance(request, handleInitialResponse);
+ });
+
+ var init = function(request, msoRequestType ) {
+ $scope.status = FIELD.STATUS.SUBMITTING_REQUEST;
+ $scope.isSpinnerVisible = true;
+ $scope.isProgressVisible = true;
+ $scope.error = "";
+ $scope.log = "";
+ $scope.isCloseEnabled = false;
+ $scope.isViewVisible = true;
+ $scope.popup.isVisible = true;
+
+ _this.pollAttempts = 0;
+ _this.callbackFunction = request.callbackFunction;
+ _this.componentId = request.componentId;
+ _this.msoRequestType = msoRequestType;
+ _this.isMsoError = false;
+
+ if (angular.isFunction($scope.progressBarControl.reset)) {
+ $scope.progressBarControl.reset();
+ }
+ $scope.percentProgress = 2; // Show "a little" progress
+
+ UtilityService.setHttpErrorHandler(function(response) {
+ $scope.isCloseEnabled = true;
+ _this.isMsoError = true;
+ showError(FIELD.ERROR.SYSTEM_FAILURE, UtilityService
+ .getHttpErrorMessage(response));
+ });
+ }
+
+ var handleInitialResponse = function(response) {
+ try {
+ updateViewAfterInitialResponse(response);
+
+ _this.timer = $timeout(getRequestStatus, PropertyService
+ .getMsoMaxPollingIntervalMsec());
+
+ $scope.instanceId = response.data.entity.instanceId;
+ if ($scope.instanceId == null) {
+ $scope.instanceId = response.data.entity.requestReferences.instanceId;
+ }
+ } catch (error) {
+ if ( response.data != null && response.data.status != null ) {
+ if (response.data.status > 299 || response.data.status < 200 ) {
+ // MSO returned an error
+ _this.isMsoError = true;
+ }
+ }
+ MsoService.showResponseContentError(error, showError);
+ }
+ }
+
+ var getRequestStatus = function() {
+ MsoService.getOrchestrationRequest(_this.requestId, handleGetResponse);
+ }
+
+ var handleGetResponse = function(response) {
+ try {
+ if (isUpdateViewAfterGetResponseComplete(response)) {
+ return;
+ }
+ //console.log ( "msoCommitController _this.pollAttempts=" + _this.pollAttempts + " max polls=" + PropertyService.getMsoMaxPolls());
+ if (++_this.pollAttempts > PropertyService.getMsoMaxPolls()) {
+ _this.isMsoError = true;
+ showError(FIELD.ERROR.MAX_POLLS_EXCEEDED);
+ } else {
+ _this.timer = $timeout(getRequestStatus, PropertyService
+ .getMsoMaxPollingIntervalMsec());
+ }
+ } catch (error) {
+ _this.isMsoError = true;
+ MsoService.showResponseContentError(error, showError);
+ }
+ }
+
+ var updateViewAfterInitialResponse = function(response) {
+ $scope.isCloseEnabled = true;
+
+ updateLog(response);
+
+ _this.requestId = UtilityService.checkUndefined(FIELD.ID.REQUEST_ID,
+ UtilityService.checkUndefined(FIELD.ID.REQUEST_REFERENCES,
+ response.data.entity.requestReferences).requestId);
+
+ $scope.percentProgress = 4; // Show "a little more" progress
+ $scope.status = FIELD.STATUS.IN_PROGRESS;
+ }
+
+ /*
+ * Updates the view and returns "true" if the MSO operation has returned a
+ * "Complete" status.
+ */
+ var isUpdateViewAfterGetResponseComplete = function(response) {
+ //console.log("msoCommitController isUpdateViewAfterGetResponseComplete");
+ updateLogFinalResponse(response);
+
+ var requestStatus = UtilityService.checkUndefined(FIELD.ID.REQUEST_STATUS,
+ UtilityService.checkUndefined(FIELD.ID.REQUEST,
+ response.data.entity.request).requestStatus);
+
+ var requestState = requestStatus.requestState;
+ console.log("msoCommitController requestState=" + requestState);
+ // look for "progress" or "pending"
+ var patt1 = /progress/i;
+ var patt2 = /pending/i;
+ var result1 = patt1.test(requestState);
+ var result2 = patt2.test(requestState)
+ if (result1 || result2) {
+ requestState = FIELD.STATUS.IN_PROGRESS;
+ }
+ var statusMessage = requestStatus.statusMessage;
+ console.log("msoCommitController statusMessage=" + statusMessage);
+ if (UtilityService.hasContents(statusMessage)) {
+ $scope.status = requestState + " - " + statusMessage;
+ } else {
+ $scope.status = requestState;
+ }
+ if (UtilityService.hasContents(requestStatus.percentProgress)) {
+ $scope.percentProgress = requestStatus.percentProgress;
+ }
+
+ if ( (requestState.toLowerCase() === FIELD.STATUS.FAILED.toLowerCase()) || (requestState.toLowerCase() === FIELD.STATUS.UNLOCKED.toLowerCase())) {
+ throw {
+ type : FIELD.STATUS.MSO_FAILURE
+ };
+ }
+
+ if (requestState.toLowerCase() === FIELD.STATUS.COMPLETE.toLowerCase()) {
+ $scope.isSpinnerVisible = false;
+ return true;
+ }
+
+ return false;
+ }
+
+ var updateLog = function(response) {
+ $scope.log = MsoService.getFormattedCommonResponse(response)
+ + $scope.log;
+ UtilityService.checkUndefined("entity", response.data.entity);
+ UtilityService.checkUndefined("status", response.data.status);
+ MsoService.checkValidStatus(response);
+ }
+ var updateLogFinalResponse = function(response) {
+ $scope.log = MsoService.getFormattedSingleGetOrchestrationRequestResponse(response)
+ + $scope.log;
+ UtilityService.checkUndefined("entity", response.data.entity);
+ UtilityService.checkUndefined("status", response.data.status);
+ MsoService.checkValidStatus(response);
+ }
+ $scope.close = function() {
+ if (_this.timer !== undefined) {
+ $timeout.cancel(_this.timer);
+ }
+ $scope.isViewVisible = false;
+ if (angular.isFunction(_this.callbackFunction)) {
+ if ($scope.error === "") {
+ _this.callbackFunction({
+ isSuccessful : true,
+ instanceId : $scope.instanceId
+ });
+ } else {
+ _this.callbackFunction({
+ isSuccessful : false
+ });
+ findNextPage(_this.componentId, _this.msoRequestType, _this.isMsoError);
+ }
+ } else {
+ $scope.popup.isVisible = false;
+ }
+ }
+
+ var showError = function(summary, details) {
+ var message = summary;
+ if (UtilityService.hasContents(details)) {
+ message += " (" + details + ")";
+ }
+ $scope.isSpinnerVisible = false;
+ $scope.isProgressVisible = false;
+ $scope.error = message;
+ $scope.status = FIELD.STATUS.ERROR;
+ }
+
+ var findNextPage = function ( cid, msoRequestType, isMsoError ) {
+ //console.log ("window.location.href" + window.location.href);
+ //console.log ("component id " + cid);
+ var originalUrl = window.location.href;
+ if ( (cid === COMPONENT.SERVICE) && (msoRequestType === COMPONENT.MSO_CREATE_REQ) ) {
+ var url = originalUrl;
+ var x;
+ var count = 0;
+ var firstStr = "";
+ for ( x = 0; x < url.length; x++) {
+ if ( url.charAt(x) == '/' ) {
+ count++;
+ if ( count == 4 ) {
+ firstStr = url.substring (0,x);
+ break;
+ }
+ }
+ }
+ // By default show the search existing service instances screen
+ //var newUrl = firstStr + COMPONENT.SERVICEMODELS_INSTANCES_SERVICES_PATH;
+ var newUrl = COMPONENT.SERVICEMODELS_INSTANCES_SERVICES_PATH;
+
+ if ( isMsoError ) {
+ //Show the Browse SDC models screen
+ //newUrl = firstStr + COMPONENT.SERVICEMODELS_MODELS_SERVICES_PATH;
+ newUrl = COMPONENT.SERVICEMODELS_MODELS_SERVICES_PATH;
+ }
+ window.location.href = newUrl;
+ }
+ }
+}
+
+appDS2.controller("msoCommitController", [ "COMPONENT", "FIELD", "$scope", "$http", "$timeout",
+ "$window", "$log", "MsoService", "PropertyService", "UtilityService",
+ msoCommitController ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/statusDialogController.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/statusDialogController.js
new file mode 100755
index 0000000..de15666
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/statusDialogController.js
@@ -0,0 +1,233 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+var statusDialogController = function(COMPONENT, FIELD, $scope, $http, $timeout, $log, MsoService, StatusService, DataService, PropertyService, UtilityService) {
+
+ $scope.isDialogVisible = false;
+ $scope.summaryControl = {};
+ $scope.detailsControl = {};
+ $scope.userProvidedControl = {};
+
+ var callbackFunction = undefined;
+ var componentId = undefined;
+
+ $scope.$on("ComponentStatus", function(event, request) {
+
+ $scope.log = "";
+ $scope.isSpinnerVisible = true;
+ $scope.isErrorVisible = false;
+ $scope.isSuccessVisible = false;
+ $scope.isSubmitEnabled = false;
+ $scope.isDataVisible = false;
+ $scope.isDialogVisible = true;
+ $scope.popup.isVisible = true;
+ $scope.isCancelEnabled = true;
+ $scope.success = "";
+ $scope.error = "";
+
+ $scope.vnfid = undefined;
+ $scope.targetProvStatus = undefined;
+
+ callbackFunction = request.callbackFunction;
+ componentId = request.componentId;
+
+ StatusService.initializeComponent(request.componentId);
+
+ /*StatusService.setHttpErrorHandler(function(response) {
+ showError("System failure", UtilityService
+ .getHttpErrorMessage(response));
+ });*/
+
+ $scope.componentName = StatusService.getComponentDisplayName();
+
+ $scope.summaryControl.setList(StatusService.getSummaryList());
+
+ $scope.detailsControl.setList(StatusService.getVNFStatusList());
+
+ StatusService.getParameters(handleGetParametersResponse);
+
+ //UtilityService.setHttpErrorHandler(function(response) {
+ // showError("System failure", UtilityService
+ // .getHttpErrorMessage(response));
+ //});
+
+
+ });
+
+ var handleGetParametersResponse = function(parameters, dontshow) {
+ $scope.summaryControl.setList(parameters.summaryList);
+ $scope.userProvidedControl.setList(parameters.userProvidedList);
+
+ $scope.isSpinnerVisible = false;
+ if (dontshow)
+ $scope.isDataVisible = false;
+ else
+ $scope.isDataVisible = true;
+ $scope.isSubmitEnabled = true;
+ };
+
+ $scope.userParameterChanged = function(id) {
+ StatusService.updateUserParameterList(id, $scope.userProvidedControl);
+ }
+
+ /*$scope.submit = function() {
+
+ var requiredFields = $scope.userProvidedControl.getRequiredFields();
+ if (requiredFields === "") {
+ $scope.isErrorVisible = false;
+ } else {
+ showError("Missing data", requiredFields);
+ return;
+ }
+ var paramList = $scope.userProvidedControl.getList();
+ var targetprovstatus = "";
+
+ if ( paramList != null ) {
+ for (var i = 0; i < paramList.length; i++) {
+ if (paramList[i].id === FIELD.ID.VNF_TARGETPROVSTATUS) {
+ targetprovstatus = paramList[i].value;
+ break;
+ }
+ }
+ }
+
+ $scope.vnfid = DataService.getVnfInstanceId();
+ $scope.targetProvStatus = StatusService.getTargetProvParameterText(targetprovstatus);
+
+ $scope.setVnfProvStatus($scope.vnfid, $scope.targetProvStatus);
+
+ // $scope.isDialogVisible = false;
+
+ // $scope.popup.isVisible = false;
+
+ }*/
+
+ $scope.init = function() {
+
+ StatusService.updateVnfProvStatus = "";
+ var msecs = PropertyService.retrieveMsoMaxPollingIntervalMsec();
+ PropertyService.setMsoMaxPollingIntervalMsec(msecs);
+
+ var polls = PropertyService.retrieveMsoMaxPolls();
+ PropertyService.setMsoMaxPolls(polls);
+
+ PropertyService.setServerResponseTimeoutMsec(10000)
+
+ $scope.isSpinnerVisible = true;
+
+
+ $scope.error = "";
+ $scope.success = "";
+ $scope.pollAttempts = 0;
+ $scope.log = "";
+ $scope.isSubmitEnabled = false;
+ $scope.isCancelEnabled = false;
+
+ }
+
+
+
+ $scope.handleInitialResponse = function(response) {
+ try {
+ $scope.isCancelEnabled = true;
+
+ if (response.data.status < 200 || response.data.status > 202) {
+ showError(FIELD.ERROR.AAI_ERROR, "");
+ return;
+ }
+ else
+ {
+ DataService.setUpdatedVNFProvStatus($scope.targetProvStatus);
+ $scope.detailsControl.setList(StatusService.getVNFStatusList());
+ showSuccess(FIELD.STATUS.SUCCESS_VNF_PROV_STATUS, $scope.targetProvStatus);
+
+ }
+ $scope.status = FIELD.STATUS.DONE;
+ $scope.isSpinnerVisible = false;
+// DataService.setServiceInstanceToCustomer($scope.serviceInstanceToCustomer);
+ } catch (error) {
+ $scope.showContentError(error);
+ }
+ }
+
+ /* $scope.setVnfProvStatus = function(vnfId, targetProvStatus) {
+
+ $scope.init();
+ $log
+ .debug("AaiService:setVnfProvStatus: vnf-id: "
+ + vnfId + " Target Prov_Status: " + targetProvStatus);
+ var url = "aai_vnf_update/"
+ + vnfId + "/" + targetProvStatus + "?r=" + Math.random();
+
+ $http.get(url,
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+
+ $scope.handleInitialResponse(response);
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);
+
+ };*/
+
+
+ $scope.cancel = function() {
+ $scope.isDialogVisible = false;
+ $scope.popup.isVisible = false;
+ runCallback(false);
+ }
+
+ var runCallback = function(response) {
+ if (angular.isFunction(callbackFunction)) {
+ callbackFunction({
+ isSuccessful : response.isSuccessful,
+ control : $scope.userProvidedControl.getList(),
+ instanceId : response.instanceId
+ });
+ }
+ }
+
+ var showSuccess = function(summary, details) {
+ var message = summary;
+ if (UtilityService.hasContents(details)) {
+ message += " (" + details + ")";
+ }
+ $scope.isSpinnerVisible = false;
+ $scope.isSuccessVisible = true;
+ $scope.success = message;
+ }
+
+ var showError = function(summary, details) {
+ var message = summary;
+ if (UtilityService.hasContents(details)) {
+ message += " (" + details + ")";
+ }
+ $scope.isSpinnerVisible = false;
+ $scope.isErrorVisible = true;
+ $scope.error = message;
+ }
+}
+
+appDS2.controller("statusDialogController", [ "COMPONENT", "FIELD", "$scope", "$http", "$timeout",
+ "$log", "MsoService", "StatusService", "DataService", "PropertyService", "UtilityService",
+ statusDialogController ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/controller/subscriberSearch.js b/vid-app-common/src/main/webapp/app/vid/scripts/controller/subscriberSearch.js
new file mode 100755
index 0000000..afd7aba
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/controller/subscriberSearch.js
@@ -0,0 +1,246 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+appDS2.requires.push('ngRoute');
+appDS2.requires.push('ui.tree');
+
+appDS2.config(function($routeProvider) {
+ $routeProvider
+ .when("/subviewedit", {
+ templateUrl : "app/vid/scripts/view-models/aaiSubViewEdit.htm",
+ controller : "aaiSubscriberSearchController"
+
+ })
+ .when("/subdetails", {
+ templateUrl : "app/vid/scripts/view-models/aaiSubDetails.htm",
+ controller : "aaiSubscriberController"
+
+ })
+ .otherwise({
+ templateUrl : "app/vid/scripts/view-models/aaiGetSubs.htm",
+ controller : "aaiSubscriberSearchController"
+ });
+});
+
+appDS2.config(function(treeConfig) {
+ treeConfig.defaultCollapsed = true; // collapse nodes by default
+ });
+
+appDS2.factory("user",function(){
+ return {};
+});
+
+appDS2.controller("aaiSubscriberSearchController", [ "$scope", "$timeout", "$log", "UtilityService", "user", "PropertyService", "COMPONENT", "FIELD",
+ function($scope, $timeout, $log, UtilityService, user, PropertyService, COMPONENT, FIELD) {
+
+ $scope.baseUrl = "";
+ $scope.responseTimeoutMsec = 10000;
+ $scope.msoMaxPollingIntervalMsec = 1000;
+ $scope.msoMaxPolls = 7;
+
+ $scope.init = function(properties) {
+ var msecs = PropertyService.retrieveMsoMaxPollingIntervalMsec();
+ PropertyService.setMsoMaxPollingIntervalMsec(msecs);
+
+ var polls = PropertyService.retrieveMsoMaxPolls();
+ PropertyService.setMsoMaxPolls(polls);
+
+ PropertyService.setServerResponseTimeoutMsec(10000);
+
+ // These two properties only added for testing
+ properties.msoDefaultBaseUrl = $scope.baseUrl;
+ properties.responseTimeoutMsec = $scope.responseTimeoutMsec;
+
+ UtilityService.setProperties(properties);
+ }
+
+ $scope.autoGetSubs = function() {
+ /*
+ * Optionally comment in / out one of these method calls (or add a similar
+ * entry) to auto-invoke an entry when the test screen is redrawn.
+ */
+ $timeout(function() {
+ $scope.getSubscribers();
+ // $scope.deleteServiceInstance();
+ // $scope.generateInvalidUrl405();
+ }, 100);
+ }
+
+ $scope.autoGetSubDetails = function() {
+ /*
+ * Optionally comment in / out one of these method calls (or add a similar
+ * entry) to auto-invoke an entry when the test screen is redrawn.
+ */
+ $timeout(function() {
+ $scope.getSubDetails();
+ // $scope.deleteServiceInstance();
+ // $scope.generateInvalidUrl405();
+ }, 100);
+ }
+
+ $scope.autoPopulateViewEdit = function() {
+ /*
+ * Optionally comment in / out one of these method calls (or add a similar
+ * entry) to auto-invoke an entry when the test screen is redrawn.
+ */
+ $timeout(function() {
+ $scope.getComponentList();
+ // $scope.deleteServiceInstance();
+ // $scope.generateInvalidUrl405();
+ }, 100);
+ }
+
+ $scope.refreshSubs = function() {
+ /*
+ * Optionally comment in / out one of these method calls (or add a similar
+ * entry) to auto-invoke an entry when the test screen is redrawn.
+ */
+ $timeout(function() {
+ $scope.refreshSubscribers();
+ // $scope.deleteServiceInstance();
+ // $scope.generateInvalidUrl405();
+ }, 100);
+ }
+
+ $scope.autoStartQueryTest = function() {
+ /*
+ * Optionally comment in / out one of these method calls (or add a similar
+ * entry) to auto-invoke an entry when the test screen is redrawn.
+ */
+ $timeout(function() {
+ // $scope.queryServiceInstance();
+ }, 100);
+ }
+
+ $scope.queryServiceInstance = function() {
+ /*
+ * Example of method call needed to query a service instance.
+ */
+ $scope.$broadcast(COMPONENT.QUERY_SERVICE_INSTANCE, {
+ serviceInstanceId: COMPONENT.SERVICE_INSTANCE_ID_1
+ });
+ }
+
+ $scope.getSubscribers = function() {
+ /*
+ * Example of method call needed to commit an instance creation request.
+ */
+ $scope.$broadcast(COMPONENT.GET_SUBS, {
+ url : FIELD.ID.AAI_GET_SUBSCRIBERS,
+ requestDetails : createServiceRequestDetails
+ });
+ }
+
+ $scope.getSubDetails = function() {
+ /*
+ * Example of method call needed to commit an instance creation request.
+ */
+ $scope.$broadcast(COMPONENT.GET_SUB_DETAILS, {
+ url : FIELD.ID.AAI_SUB_DETAILS,
+ requestDetails : createServiceRequestDetails
+ });
+ }
+
+ $scope.getComponentList = function() {
+ /*
+ * Example of method call needed to commit an instance creation request.
+ */
+ $scope.$broadcast(COMPONENT.GET_COMPONENT_LIST, {
+ url : FIELD.ID.AAI_SUB_VIEWEDIT,
+ requestDetails : createServiceRequestDetails
+ });
+ }
+
+
+ $scope.refreshSubscribers = function() {
+ /*
+ * Example of method call needed to commit an instance creation request.
+ */
+ $scope.$broadcast(COMPONENT.GET_SUBS, {
+ url : FIELD.ID.AAI_REFRESH_SUBSCRIBERS,
+ requestDetails : createServiceRequestDetails
+ });
+ }
+
+ $scope.deleteServiceInstance = function() {
+ /*
+ * Example of method call needed to commit an instance deletion request.
+ */
+ $scope.$broadcast(COMPONENT.MSO_DELETE_REQ, {
+ url : COMPONENT.MSO_DELETE_SVC_INSTANCE_PATH + COMPONENT.SERVICE_INSTANCE_ID_1,
+ requestDetails : deleteServiceRequestDetails
+ });
+ }
+
+ $scope.createNetworkInstance = function() {
+ $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, {
+ url : COMPONENT.MSO_CREATE_NW_INSTANCE,
+ requestDetails : createNetworkRequestDetails
+ });
+ }
+
+ $scope.deleteNetworkInstance = function() {
+ $scope.$broadcast(COMPONENT.MSO_DELETE_REQ, {
+ url : COMPONENT.MSO_CREATE_NW_INSTANCE_PATH + COMPONENT.SERVICE_INSTANCE_ID_1 + COMPONENT.FORWARD_SLASH + COMPONENT.NETWORKS + COMPONENT.FORWARD_SLASH + COMPONENT.DELETE_INSTANCE_ID_1,
+ requestDetails : deleteNetworkRequestDetails
+ });
+ }
+
+ $scope.generateError = function(testName) {
+ // Clone example request object
+ var request = JSON.parse(JSON.stringify(createServiceRequestDetails));
+ request.modelInfo.modelName = testName;
+ $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, {
+ url : COMPONENT.MSO_CREATE_SVC_INSTANCE,
+ requestDetails : request
+ });
+ }
+
+ $scope.generateInvalidUrl404 = function() {
+ var properties = UtilityService.getProperties(properties);
+ properties.msoDefaultBaseUrl = COMPONENT.INVALID_STRING;
+ UtilityService.setProperties(properties);
+ $scope.$broadcast(COMPONENT.REFRESH_PROPERTIES);
+
+ $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, {
+ url : COMPONENT.MSO_CREATE_SVC_INSTANCE,
+ requestDetails : createServiceRequestDetails
+ });
+
+ properties.msoDefaultBaseUrl = $scope.baseUrl;
+ UtilityService.setProperties(properties);
+ $scope.$broadcast(COMPONENT.REFRESH_PROPERTIES);
+ }
+
+ $scope.generateInvalidUrl405 = function() {
+ $scope.$broadcast(COMPONENT.MSO_CREATE_REQ, {
+ url : COMPONENT.INVALID_STRING_MSO_CREATE_SVC_INSTANCE,
+ requestDetails : createServiceRequestDetails
+ });
+ }
+
+
+ $scope.getSubscriberDet = function(selectedCustomer){
+ window.location.href = COMPONENT.SUBDETAILS_SELECTEDSUBSCRIBER + selectedCustomer;
+ };
+ }
+]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/directives/extensionsDirective.js b/vid-app-common/src/main/webapp/app/vid/scripts/directives/extensionsDirective.js
new file mode 100755
index 0000000..b5497b3
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/directives/extensionsDirective.js
@@ -0,0 +1,79 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+/*
+ * Defines "extensions" to standard Angular directives. Provides attributes that
+ * can be included in HTML tags.
+ *
+ * SYNTAX: ngx-enabled="true | false"
+ *
+ * Enables / disables an element. Currently only supports button elements that
+ * include the "button" element. This extension was added since the similar
+ * standard Angular "ng-disabled" attribute does not handle buttons that use the
+ * ECOMP styling.
+ *
+ * SYNTAX: ngx-visible="true | false"
+ *
+ * Sets an element to visible / hidden. Different from ng-show / ng-hide as
+ * follows:
+ *
+ * ng-show=false or ng-hide=true - Element is completely hidden.
+ *
+ * ngx-visible=false - Element is not displayed. However, a blank area is
+ * displayed where the element would display if ngx-visible is set to true.
+ */
+
+appDS2.directive('ngxEnabled', function() {
+ return {
+ restrict : "A",
+ link : function(scope, element, attrs) {
+ attrs.$observe("ngxEnabled", function(value) {
+ if (attrs.attButton === "") {
+ if (value === "true") {
+ element.attr("btn-type", "primary").removeClass(
+ "button--inactive").addClass("button--primary")
+ .prop('disabled', false);
+ } else {
+ element.attr("btn-type", "disabled").removeClass(
+ "button--primary").addClass("button--inactive")
+ .prop('disabled', true);
+ }
+ }
+ });
+ }
+ }
+});
+
+appDS2.directive('ngxVisible', function() {
+ return {
+ restrict : "A",
+ link : function(scope, element, attrs) {
+ attrs.$observe("ngxVisible", function(value) {
+ if (value === "true") {
+ element.css("visibility", "visible");
+ } else {
+ element.css("visibility", "hidden");
+ }
+ });
+ }
+ }
+});
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/directives/parameterBlockDirective.js b/vid-app-common/src/main/webapp/app/vid/scripts/directives/parameterBlockDirective.js
new file mode 100755
index 0000000..811a51e
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/directives/parameterBlockDirective.js
@@ -0,0 +1,420 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+var parameterBlockDirective = function($log, PARAMETER, UtilityService) {
+ /*
+ * If "IS_SINGLE_OPTION_AUTO_SELECTED" is set to "true" ...
+ *
+ * IF these 3 conditions all exist:
+ *
+ * 1) The parameter type is PARAMETER.SELECT
+ *
+ * 2) AND the "prompt" attribute is set to a string.
+ *
+ * 3) AND the optionList" only contains a single entry
+ *
+ * THEN the "prompt" will not be displayed as an initial select option.
+ */
+
+ var IS_SINGLE_OPTION_AUTO_SELECTED = true;
+
+ /*
+ * Optionally remove "nameStyle" and "valueStyle" "width" entries to set
+ * dynamic sizing.
+ */
+ var tableStyle = "width: auto; margin: 0 auto; border-collapse: collapse; border: none;";
+ var nameStyle = "width: 220px; text-align: left; vertical-align: middle; font-weight: bold; padding: 3px 5px; border: none;";
+ var valueStyle = "width: 400px; text-align: left; vertical-align: middle; padding: 3px 5px; border: none;";
+ var checkboxValueStyle = "width: 400px; text-align: center; vertical-align: middle; padding: 3px 5px; border: none;"
+ var textInputStyle = "height: 25px; padding: 2px 5px;";
+ var checkboxInputStyle = "height: 18px; width: 18px; padding: 2px 5px;";
+ var selectStyle = "height: 25px; padding: 2px; text-align: center;";
+ var requiredLabelStyle = "width: 25px; padding: 5px 10px 10px 5px;";
+ var textInputPrompt = "Enter data";
+
+ var getParameterHtml = function(parameter, editable) {
+ var style = valueStyle;
+ var attributeString = "";
+ if (parameter.type === PARAMETER.BOOLEAN) {
+ style = checkboxValueStyle;
+ }
+ if (UtilityService.hasContents(parameter.description)) {
+ attributeString += " title=' " + parameter.description + " '";
+ }
+ var html = "<tr><td style='" + nameStyle + "'" + attributeString + ">"
+ + getNameHtml(parameter) + "</td><td style='" + style + "'>";
+ if (editable === undefined) {
+ if (UtilityService.hasContents(parameter.value)) {
+ html += parameter.value;
+ }
+ } else {
+ html += getValueHtml(parameter);
+ }
+ html += "</td></tr>";
+ return html;
+ };
+
+ var updateParameter = function(parameter, element, editable) {
+ $(element).parent().parent().children("td").first().html(
+ getNameHtml(parameter));
+ if (editable === undefined) {
+ $(element).html(parameter.value);
+ } else {
+ $(element).parent().html(getValueHtml(parameter));
+ }
+ };
+
+ var getNameHtml = function(parameter) {
+ if (parameter.isVisible === false) {
+ return "";
+ }
+ var name = "";
+ if (UtilityService.hasContents(parameter.name)) {
+ name = parameter.name;
+ } else {
+ name = parameter.id;
+ }
+ var requiredLabel = "";
+ if (parameter.isRequired) {
+ requiredLabel = "<img src='app/vid/images/asterisk.png' style='"
+ + requiredLabelStyle + "'></img>";
+ }
+ return name + ":" + requiredLabel;
+ };
+
+ var getValueHtml = function(parameter) {
+ var attributeString = " parameter-id='" + parameter.id + "'";
+ var additionalStyle = "";
+ if (parameter.isEnabled === false) {
+ attributeString += " disabled='disabled'";
+ }
+ if (parameter.isRequired) {
+ attributeString += " is-required='true'";
+ }
+ if (UtilityService.hasContents(parameter.description)) {
+ attributeString += " title=' " + parameter.description + " '";
+ }
+ if (UtilityService.hasContents(parameter.isReadOnly) && (parameter.isReadOnly === true)) {
+ attributeString += " readonly";
+ }
+ if ( (UtilityService.hasContents(parameter.maxLength)) && (UtilityService.hasContents(parameter.minLength)) ) {
+ attributeString += " pattern='.{" + parameter.minLength + "," + parameter.maxLength + "}' required";
+ }
+ else if (UtilityService.hasContents(parameter.maxLength)) {
+ attributeString += " maxlength='" + parameter.maxLength + "'";
+ }
+ else if (UtilityService.hasContents(parameter.minLength)) {
+ attributeString += " pattern='.{" + parameter.minLength + ",}'"
+ }
+ if (parameter.isVisible === false) {
+ additionalStyle = " visibility: hidden;";
+ }
+
+ var name = "";
+ if (UtilityService.hasContents(parameter.name)) {
+ name = parameter.name;
+ } else {
+ name = parameter.id;
+ }
+ attributeString += " parameter-name='" + name + "'";
+
+ switch (parameter.type) {
+ case PARAMETER.BOOLEAN:
+ if (parameter.value) {
+ return "<select" + attributeString + " style='" + selectStyle
+ + additionalStyle + "'>" + "<option value=true>true</option>"
+ + "<option value=false>false</option>";
+ + "</select>";
+ }else{
+ return "<select" + attributeString + " style='" + selectStyle
+ + additionalStyle + "'>" + "<option value=false>false</option>"
+ + "<option value=true>true</option>"
+ + "</select>";
+ }
+ break;
+ case PARAMETER.NUMBER:
+ var value=parameter.value;
+ var parameterSpec = "<input type='number'" + attributeString + " style='" + textInputStyle + additionalStyle + "'";
+
+ if ( UtilityService.hasContents(parameter.min) ) {
+ parameterSpec += " min='" + parameter.min + "'";
+ }
+ if ( UtilityService.hasContents(parameter.max) ) {
+ parameterSpec += " max='" + parameter.max + "'";
+ }
+ if (UtilityService.hasContents(value)) {
+ parameterSpec += " value='" + value + "'";
+ }
+ parameterSpec += ">";
+
+ /*if(!isNaN(value) && value.toString().index('.') != -1){
+ //float
+ return "<input type='text'" + attributeString + " style='"
+ + textInputStyle + additionalStyle + "' only-integers" + value
+ + "></input>";
+ } else {
+ //integer
+ return "<input type='text'" + attributeString + " style='"
+ + textInputStyle + additionalStyle + "' only-float" + value
+ + "></input>";
+ }*/
+ return (parameterSpec);
+ break;
+ case PARAMETER.SELECT:
+ if (UtilityService.hasContents(parameter.prompt)) {
+ attributeString += " prompt='" + parameter.prompt + "'";
+ }
+ return "<select" + attributeString + " style='" + selectStyle
+ + additionalStyle + "'>" + getOptionListHtml(parameter)
+ + "</select>";
+ break;
+ case PARAMETER.STRING:
+ default:
+ var value = "";
+ if (UtilityService.hasContents(parameter.value)) {
+ value = " value='" + parameter.value + "'";
+ }
+ if (UtilityService.hasContents(parameter.prompt)) {
+ attributeString += " placeholder='" + parameter.prompt + "'";
+ } else if (textInputPrompt !== "") {
+ attributeString += " placeholder='" + textInputPrompt + "'";
+ }
+ var finalString = "<input type='text'" + attributeString + " style='"
+ + textInputStyle + additionalStyle + "'" + value
+ + ">";
+ return finalString;
+ }
+ };
+
+
+ var getBooleanListHtml = function(parameter){
+ var html = "";
+
+ };
+
+ var getOptionListHtml = function(parameter) {
+
+ var html = "";
+
+ if (!angular.isArray(parameter.optionList)
+ || parameter.optionList.length === 0) {
+ return "";
+ }
+
+ if (UtilityService.hasContents(parameter.prompt)) {
+ if (!(IS_SINGLE_OPTION_AUTO_SELECTED && parameter.optionList.length === 1)) {
+ html += "<option value=''>" + parameter.prompt + "</option>";
+ }
+ }
+
+ for (var i = 0; i < parameter.optionList.length; i++) {
+ var option = parameter.optionList[i];
+ var name = option.name;
+ var value = "";
+ if (option.id === undefined) {
+ value = option.name;
+ } else {
+ if (name === undefined) {
+ name = option.id;
+ }
+ value = option.id;
+ }
+ if (option.isDefault === undefined || option.isDefault === false ) {
+ html += "<option value='" + value + "'>" + name + "</option>";
+ }
+ else {
+ html += "<option value='" + value + "' selected>" + name + "</option>";
+ }
+ }
+ return html;
+ };
+
+ var getParameter = function(element, expectedId) {
+ var id = $(element).attr("parameter-id");
+ if (expectedId !== undefined && expectedId !== id) {
+ return undefined;
+ }
+ var parameter = {
+ id : id
+ };
+ if ($(element).prop("type") === "checkbox") {
+ parameter.value = $(element).prop("checked");
+ } else {
+ if ($(element).prop("type") === "text") {
+ $(element).val($(element).val().trim());
+ }
+ parameter.value = $(element).val();
+ }
+ if ($(element).prop("selectedIndex") === undefined) {
+ parameter.selectedIndex = -1;
+ } else {
+ parameter.selectedIndex = $(element).prop("selectedIndex");
+ if (UtilityService.hasContents($(element).attr("prompt"))) {
+ parameter.selectedIndex--;
+ }
+ }
+ return parameter;
+ };
+
+ var getRequiredField = function(element) {
+ if ($(element).prop("type") === "text") {
+ $(element).val($(element).val().trim());
+ }
+ if ($(element).val() === "" || $(element).val() === null) {
+ return '"' + $(element).attr("parameter-name") + '"';
+ } else {
+ return "";
+ }
+ };
+
+ var callback = function(element, scope) {
+ scope.callback({
+ id : $(element).attr("parameter-id")
+ });
+ };
+
+ return {
+ restrict : "EA",
+ replace : true,
+ template : "<div><table style='" + tableStyle + "'></table></div>",
+ scope : {
+ control : "=",
+ callback : "&"
+ },
+ link : function(scope, element, attrs) {
+
+ var control = scope.control || {};
+
+ control.setList = function(parameterList) {
+ var html = "";
+ for (var i = 0; i < parameterList.length; i++) {
+ html += getParameterHtml(parameterList[i], attrs.editable);
+ }
+ element.html(html);
+ element.find("input, select").bind("change", function() {
+ callback(this, scope);
+ });
+ }
+
+ control.updateList = function(parameterList) {
+ element.find("input, select").each(
+ function() {
+ for (var i = 0; i < parameterList.length; i++) {
+ if (parameterList[i].id === $(this).attr(
+ "parameter-id")) {
+ updateParameter(parameterList[i], this,
+ attrs.editable);
+ }
+ }
+ });
+ element.find("input, select").bind("change", function() {
+ callback(this, scope);
+ });
+ }
+
+ control.getList = function(expectedId) {
+ var parameterList = new Array();
+ element.find("input, select").each(function() {
+ var parameter = getParameter(this, expectedId);
+ if (parameter !== undefined) {
+ parameterList.push(parameter);
+ }
+ });
+ return parameterList;
+ }
+
+ control.getRequiredFields = function() {
+ var requiredFields = "";
+ var count = 0;
+ element.find("input, select").each(function() {
+ if ($(this).attr("is-required") === "true") {
+ var requiredField = getRequiredField(this);
+ if (requiredField !== "") {
+ if (++count == 1) {
+ requiredFields = requiredField;
+ }
+ }
+ }
+ });
+ if (--count <= 0) {
+ return requiredFields;
+ } else if (count == 1) {
+ return requiredFields + " and 1 other field";
+ } else {
+ return requiredFields + " and " + count + " other fields";
+ }
+ }
+ }
+ }
+}
+
+appDS2.directive('parameterBlock', [ "$log", "PARAMETER", "UtilityService",
+ parameterBlockDirective ]);
+
+
+appDS2.directive('onlyIntegers', function () {
+ return {
+ restrict: 'A',
+ link: function (scope, elm, attrs, ctrl) {
+ elm.on('keydown', function (event) {
+ if(event.shiftKey){event.preventDefault(); return false;}
+ //console.log(event.which);
+ if ([8, 13, 27, 37, 38, 39, 40].indexOf(event.which) > -1) {
+ // backspace, enter, escape, arrows
+ return true;
+ } else if (event.which >= 49 && event.which <= 57) {
+ // numbers
+ return true;
+ } else if (event.which >= 96 && event.which <= 105) {
+ // numpad number
+ return true;
+ }
+ // else if ([110, 190].indexOf(event.which) > -1) {
+ // // dot and numpad dot
+ // return true;
+ // }
+ else {
+ event.preventDefault();
+ return false;
+ }
+ });
+ }
+ }
+});
+
+appDS2.directive('onlyFloat', function () {
+ return {
+ restrict: 'A',
+ link: function (scope, elm, attrs, ctrl) {
+ elm.on('keydown', function (event) {
+ if ([110, 190].indexOf(event.which) > -1) {
+ // dot and numpad dot
+ event.preventDefault();
+ return true;
+ }
+ else{
+ return false;
+ }
+ });
+ }
+ }
+});
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/directives/popupWindowDirective.js b/vid-app-common/src/main/webapp/app/vid/scripts/directives/popupWindowDirective.js
new file mode 100755
index 0000000..76034d5
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/directives/popupWindowDirective.js
@@ -0,0 +1,88 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+var popupWindowDirective = function($log, $window) {
+
+ function getZIndex(element) {
+ var maxZIndex = 0;
+ $(window.document).find("*").each(function() {
+ var zIndex = parseInt($(this).css("z-index"));
+ if (zIndex > maxZIndex) {
+ maxZIndex = zIndex;
+ }
+ });
+
+ return maxZIndex;
+ }
+
+ var scrollPosition = {
+ x : 0,
+ y : 0
+ };
+
+ var link = function(scope, element, attrs, controller, transcludeFn) {
+
+ var zIndex = getZIndex(element.parent()) + 1;
+
+ element.css("z-index", zIndex + 1);
+
+ var backgroundStyle = "display: none; position: fixed; z-index:"
+ + zIndex + ";" + "top: 0; left: 0; width: 100%; height: 100%;"
+ + "background-color: #000000; opacity: 0.5";
+
+ var className = attrs["class"];
+ var classString = "";
+ if (className !== undefined && className !== null && className !== "") {
+ element.children().children().children().children().addClass(
+ className);
+ element.removeClass(className);
+ }
+
+ element.before("<div style='" + backgroundStyle + "'></div>");
+
+ attrs.$observe("ngxShow", function(value) {
+ if (value === "true") {
+ scrollPosition = {
+ x : $window.pageXOffset,
+ y : $window.pageYOffset
+ }
+ $window.scrollTo(0, 0);
+ element.css("display", "table");
+ element.prev().css("display", "block");
+ } else if (value === "false") {
+ element.css("display", "none");
+ element.prev().css("display", "none");
+ $window.scrollTo(scrollPosition.x, scrollPosition.y);
+ }
+ });
+ }
+
+ return {
+ restrict : "EA",
+ transclude : true,
+ replace : true,
+ link : link,
+ template : '<table style="display: none; position: absolute; left: 0; top: 0; width: 100%; height: 100%; border-collapse: collapse; margin: 0; padding: 0"> <tr><td align="center" style="vertical-align: top; padding: 10px"><div style="display: inline-block; padding: 5px; background-color: white" ng-transclude></div></td></tr></table>'
+ };
+}
+
+appDS2.directive("popupWindow", [ "$log", "$window", popupWindowDirective ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/directives/progressBarDirective.js b/vid-app-common/src/main/webapp/app/vid/scripts/directives/progressBarDirective.js
new file mode 100755
index 0000000..ed71436
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/directives/progressBarDirective.js
@@ -0,0 +1,173 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+/*
+ * "progressBarDirective.js" provides a progress bar directive.
+ *
+ * SYNTAX:
+ *
+ * <div progress-bar value="percentProgress"></div>
+ *
+ * "percentProgress" is the numeric percent progress to be displayed (0 to 100)
+ * expressed as a number only (i.e. no trailing "%"). An "scoped" Angular value
+ * can be used (e.g. "{{percentProgress}}").
+ *
+ * Two additional attributes can also be included:
+ *
+ * increases-only="true | false"
+ *
+ * Normally, the progress bar always updates the display with whatever value is
+ * set. Alternatively, if "increases-only" is set to "true", the display will
+ * only be updated if "percentProgress" is >= the previous value.
+ *
+ * control="control"
+ *
+ * Provides a method ... $scope.control.reset()" ... that a controller can call
+ * to reset the progress to it's initial zero state. This would only expected to
+ * be needed if A) increases-only is set to true and B) there is a need to reset
+ * the controller to 0. If increases-only is set to false or not present, an
+ * alternative method of resetting the progress is to just tset percentProgress
+ * to 0.
+ *
+ * CAVEATS:
+ *
+ * 1) The extended attribute "ngx-show" should be used instead of "ng-show" if
+ * the control needs to be conditionally visible. Example:
+ * ngx-show="{{isProgressVisible}}"
+ *
+ * 2) $scope.control.reset() should be conditionally called as follows IF it is
+ * called immediately after HTML is rendered. This is due to a timing-related
+ * behavior.
+ *
+ * 3) The progress bar displays values of "0" and "100" if precentProgress is,
+ * respectively, less than 0 or greater than 100.
+ *
+ * CUSTOM STYLING:
+ *
+ * The ECOMP portal styling uses the class named "progress". The class
+ * attributes can be overridden in CSS. This example was tested:
+ *
+ * .progress { margin: 0px 10px; height: 40px }
+ *
+ * Additional styling can be applied to the progress-bar element. Example:
+ *
+ * div[progress-bar=""] { padding-top: 10px; }
+ *
+ * if (angular.isFunction($scope.control.reset)) { $scope.control.reset(); }
+ *
+ * DEPENDENCIES:
+ *
+ * This code assumes dependency files provided by the ECOMP Portal framework are
+ * included. For example, ".../app/fusion/external/ebz/sandbox/styles/base.css"
+ * is one required dependency. There may also be others.
+ */
+
+var progressBarDirective = function() {
+
+ var style = "font-weight: bold;";
+ /*
+ * The 3 "aria-*" properties were added as per an Internet reference
+ * example. These appear to have no impact on current behavior but are
+ * retained for future reference.
+ */
+ var properties = "class='progress-bar' role='progressbar' "
+ + "aria-valuenow='' aria-valuemin='0' aria-valuemax='100'";
+ var previousValue = 0;
+
+ var updateProgress = function(element, attrs, valueAsString) {
+ if (valueAsString === undefined || valueAsString === null
+ || valueAsString === "") {
+ valueAsString = "0";
+ }
+ var valueAsInteger = parseInt(valueAsString);
+ if (valueAsInteger > 100) {
+ valueAsInteger = 100;
+ valueAsString = "100";
+ }
+ if (attrs.increasesOnly === "true") {
+ if (valueAsInteger >= previousValue) {
+ previousValue = valueAsInteger;
+ } else {
+ return;
+ }
+ }
+ element.css("width", valueAsString + "%");
+ if (valueAsInteger >= 100) {
+ element.removeClass("progress-bar-info").addClass(
+ "progress-bar-success");
+ } else {
+ element.removeClass("progress-bar-success").addClass(
+ "progress-bar-info");
+ }
+ if (valueAsInteger >= 5) {
+ element.html(valueAsString + " %");
+ } else {
+ /*
+ * Hide text since color combination is barely visible when progress
+ * portion is narrow.
+ */
+ element.html("");
+ }
+ }
+
+ return {
+ restrict : "EA",
+ transclude : true,
+ replace : true,
+ template : "<div ng-transclude " + properties + " style='" + style
+ + "'></div>",
+ scope : {
+ control : "=",
+ progressBar : "@"
+ },
+ link : function(scope, element, attrs) {
+
+ /*
+ * It should be possible to alternatively add this wrapper in the
+ * template instead of using "element.wrap". Some techniques were
+ * attempted but were unsuccessful.
+ */
+ element.wrap("<div class='progress'></div");
+
+ var control = scope.control || {};
+
+ control.reset = function() {
+ previousValue = 0;
+ updateProgress(element, attrs, 0);
+ }
+
+ attrs.$observe("value", function(valueString) {
+ updateProgress(element, attrs, valueString);
+ });
+
+ attrs.$observe("ngxShow", function(valueString) {
+ if (valueString === "false") {
+ element.parent().hide();
+ } else {
+ element.parent().show();
+ }
+ });
+ }
+ }
+}
+
+appDS2.directive("progressBar", progressBarDirective);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js
new file mode 100755
index 0000000..8132e3a
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/aaiService.js
@@ -0,0 +1,339 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+var AaiService = function($http, $log, PropertyService, UtilityService, COMPONENT, FIELD) {
+ return {
+ getSubscriberName : function(globalCustomerId,
+ successCallbackFunction) {
+ $log
+ .debug("AaiService:getSubscriberName: globalCustomerId: "
+ + globalCustomerId);
+ $http.get(
+ COMPONENT.AAI_SUB_DETAILS_PATH
+ + globalCustomerId + COMPONENT.ASSIGN + Math.random(),
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ var subName = "";
+ if (response.data) {
+ subName = response.data[FIELD.ID.SUBNAME];
+ }
+ successCallbackFunction(subName);
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);
+ },
+
+
+ runNamedQuery : function (namedQueryId, globalCustomerId, serviceType, serviceInstanceId, successCallback, errorCallback) {
+
+ var url = COMPONENT.AAI_SUB_VIEWEDIT_PATH +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(namedQueryId) +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(globalCustomerId) +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceType) +
+ COMPONENT.FORWARD_SLASH + encodeURIComponent(serviceInstanceId);
+ $http.get(url, {
+
+ },{
+ timeout : PropertyService.getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data != null) {
+ successCallback(response);
+ } else {
+ errorCallback(response);
+ }
+ }, function(response) {
+ errorCallback(response);
+ });
+ },
+
+
+ getSubDetails : function(selectedSubscriber, selectedServiceInstance, successCallback, errorCallback) {
+ var subscriber;
+ var displayData;
+ $http.get( COMPONENT.AAI_SUB_DETAILS_PATH + selectedSubscriber, {
+
+ },{
+ timeout : PropertyService.getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ displayData = [];
+ subscriber = response.data;
+ var subscriberName = subscriber[FIELD.ID.SUBNAME];
+ if (subscriber[FIELD.ID.SERVICE_SUBSCRIPTIONS] != null) {
+ angular.forEach(subscriber[FIELD.ID.SERVICE_SUBSCRIPTIONS][FIELD.ID.SERVICE_SUBSCRIPTION], function(serviceSubscription, key) {
+ var serviceInstanceId = [];
+ var serviceType = "";
+ if (serviceSubscription[FIELD.ID.SERVICE_TYPE] != null) {
+ serviceType = serviceSubscription[FIELD.ID.SERVICE_TYPE];
+ } else {
+ serviceType = FIELD.PROMPT.NO_SERVICE_SUB;
+ }
+ if (serviceSubscription[FIELD.ID.SERVICE_INSTANCES] != null) {
+ angular.forEach(serviceSubscription[FIELD.ID.SERVICE_INSTANCES][FIELD.ID.SERVICE_INSTANCE], function(instValue, instKey) {
+ // put them together, i guess
+ var inst = { "serviceInstanceId": instValue[FIELD.ID.SERVICE_INSTANCE_ID],
+ "aaiModelInvariantId": instValue[FIELD.ID.MODEL_INVAR_ID],
+ "aaiModelVersionId": instValue[FIELD.ID.MODEL_VERSION_ID],
+ "serviceInstanceName": instValue[FIELD.ID.SERVICE_INSTANCE_NAME]
+ };
+ if (selectedServiceInstance != null) {
+ if ((instValue[FIELD.ID.SERVICE_INSTANCE_ID] == selectedServiceInstance ) || (instValue[FIELD.ID.SERVICE_INSTANCE_NAME] == selectedServiceInstance)) {
+ serviceInstanceId.push(inst);
+ }
+ } else {
+ serviceInstanceId.push(inst);
+ }
+ });
+ } else {
+ if (serviceInstanceId == []) {
+ serviceInstanceId = [ FIELD.PROMPT.NO_SERVICE_INSTANCE ];
+ }
+ }
+ angular.forEach(serviceInstanceId, function(subVal, subKey) {
+ displayData.push({
+ globalCustomerId : selectedSubscriber,
+ subscriberName : subscriberName,
+ serviceType : serviceType,
+ serviceInstanceId : subVal.serviceInstanceId,
+ aaiModelInvariantId : subVal.aaiModelInvariantId,
+ aaiModelVersionId : subVal.aaiModelVersionId,
+ serviceInstanceName : subVal.serviceInstanceName
+ });
+ });
+ });
+ } else {
+ displayData.push({
+ globalCustomerId : selectedSubscriber,
+ subscriberName : selectedSubscriberName,
+ serviceType : FIELD.PROMPT.NO_SERVICE_SUB,
+ serviceInstanceId : FIELD.PROMPT.NO_SERVICE_INSTANCE
+ });
+ }
+ successCallback(displayData, subscriberName);
+ }, function(response) {
+ errorCallback(response);
+ });
+ },
+ getSubList : function(successCallback, errorCallback ) {
+
+ $http.get( FIELD.ID.AAI_GET_FULL_SUBSCRIBERS, {
+
+ },{
+ timeout : PropertyService.getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ var customerList = [];
+ if (response.data.customer != null) {
+ angular.forEach(response.data.customer, function(subVal, subKey) {
+ var cust = { "globalCustomerId": subVal[FIELD.ID.GLOBAL_CUSTOMER_ID], "subscriberName": subVal[FIELD.ID.SUBNAME] };
+ customerList.push(cust);
+ });
+ successCallback(customerList);
+ } else {
+ errorCallback(response);
+ }
+ },function(response) {
+ errorCallback(response);
+ });
+ },
+
+ getServices2 : function(successCallback, errorCallback ) {
+
+ $http.get( FIELD.ID.AAI_GET_SERVICES, {
+
+ },{
+ timeout : PropertyService.getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ var customerList = [];
+ if (response.data != null) {
+ var serviceIdList = [];
+ angular.forEach(response.data, function(value, key) {
+ angular.forEach(value, function(subVal, key) {
+ var newVal = { "id" : subVal[FIELD.ID.SERVICE_ID], "description" : subVal[FIELD.ID.SERVICE_DESCRIPTION] };
+ serviceIdList.push(newVal);
+ });
+ });
+ successCallback(serviceIdList);
+ } else {
+ errorCallback(response);
+ }
+ },function(response) {
+ errorCallback(response);
+ });
+ },
+
+ getSubscriptionServiceTypeList : function(globalCustomerId,
+ successCallbackFunction) {
+ $log
+ .debug("AaiService:getSubscriptionServiceTypeList: globalCustomerId: "
+ + globalCustomerId);
+ if ( UtilityService.hasContents(globalCustomerId) ) {
+ $http.get(
+ COMPONENT.AAI_SUB_DETAILS_PATH
+ + globalCustomerId + COMPONENT.ASSIGN + Math.random(),
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data && response.data[FIELD.ID.SERVICE_SUBSCRIPTIONS]) {
+ var serviceTypes = [];
+ var serviceSubscriptions = response.data[FIELD.ID.SERVICE_SUBSCRIPTIONS][FIELD.ID.SERVICE_SUBSCRIPTION];
+
+ for (var i = 0; i < serviceSubscriptions.length; i++) {
+ serviceTypes.push(serviceSubscriptions[i][FIELD.ID.SERVICE_TYPE]);
+ }
+ successCallbackFunction(serviceTypes);
+ } else {
+ successCallbackFunction([]);
+ }
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);
+ }
+ },
+ getLcpCloudRegionTenantList : function(globalCustomerId, serviceType,
+ successCallbackFunction) {
+ $log
+ .debug("AaiService:getLcpCloudRegionTenantList: globalCustomerId: "
+ + globalCustomerId);
+ var url = COMPONENT.AAI_GET_TENANTS
+ + globalCustomerId + COMPONENT.FORWARD_SLASH + serviceType + COMPONENT.ASSIGN + Math.random();
+
+ $http.get(url,
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ var lcpCloudRegionTenants = [];
+ var aaiLcpCloudRegionTenants = response.data;
+
+ lcpCloudRegionTenants.push({
+ "cloudRegionId": "",
+ "tenantName": FIELD.PROMPT.REGION,
+ "tenantId": ""
+ });
+
+ for (var i = 0; i < aaiLcpCloudRegionTenants.length; i++) {
+ lcpCloudRegionTenants.push({
+ "cloudRegionId": aaiLcpCloudRegionTenants[i][COMPONENT.CLOUD_REGION_ID],
+ "tenantName": aaiLcpCloudRegionTenants[i][COMPONENT.TENANT_NAME],
+ "tenantId": aaiLcpCloudRegionTenants[i][COMPONENT.TENANT_ID]
+ });
+ }
+
+ successCallbackFunction(lcpCloudRegionTenants);
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);
+ },
+ getSubscribers : function(successCallbackFunction) {
+ $log
+ .debug("AaiService:getSubscribers");
+ var url = FIELD.ID.AAI_GET_SUBSCRIBERS + COMPONENT.ASSIGN + Math.random();
+
+ $http.get(url,
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data) {
+ successCallbackFunction(response.data.customer);
+ } else {
+ successCallbackFunction([]);
+ }
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);
+ },
+ getProvOptionsFromSystemProp : function(successCallbackFunction) {
+ $log
+ .debug("AaiService:getProvOptionsFromSystemProp");
+ var url = COMPONENT.GET_SYSTEM_PROP_VNF_PROV_STATUS_PATH;
+
+ $http.get(url,
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data) {
+ successCallbackFunction(response);
+ } else {
+ successCallbackFunction([]);
+ }
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);
+ },
+ getLoggedInUserID : function(successCallbackFunction) {
+ $log
+ .debug("AaiService:getLoggedInUserID");
+ var url = COMPONENT.GET_USER_ID;
+
+ $http.get(url,
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data) {
+ successCallbackFunction(response);
+ } else {
+ successCallbackFunction([]);
+ }
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);
+ },
+ getServices : function(successCallbackFunction) {
+ $log
+ .debug("AaiService:getServices");
+ var url = COMPONENT.AAI_GET_SERVICES + COMPONENT.ASSIGN + Math.random();
+
+ $http.get(url,
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data) {
+ successCallbackFunction(response);
+ } else {
+ successCallbackFunction([]);
+ }
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);
+ },
+ getServiceModels : function(globalCustomerId,serviceType,successCallbackFunction) {
+ $log
+ .debug("AaiService:getServices");
+ var url = COMPONENT.AAI_GET_SERVICES + COMPONENT.FORWARD_SLASH+globalCustomerId+ COMPONENT.FORWARD_SLASH +serviceType+COMPONENT.ASSIGN + Math.random();
+
+ $http.get(url,
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(function(response) {
+ if (response.data) {
+ successCallbackFunction(response);
+ } else {
+ successCallbackFunction([]);
+ }
+ })["catch"]
+ (UtilityService.runHttpErrorHandler);
+}
+ }
+}
+
+appDS2.factory("AaiService", [ "$http", "$log", "PropertyService",
+ "UtilityService", "COMPONENT", "FIELD", AaiService ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js
new file mode 100755
index 0000000..68fdce4
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/asdcService.js
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+var AsdcService = function($http, $log, PropertyService, UtilityService) {
+ return {
+ getModel : function(modelId, successCallbackFunction) {
+ $log.debug("AsdcService:getModel: modelId: " + modelId);
+ $http.get(
+ "asdc/getModel/" + modelId
+ + "?r=" + Math.random(),
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(successCallbackFunction)["catch"]
+ (UtilityService.runHttpErrorHandler);
+ }
+ }
+}
+
+appDS2.factory("AsdcService", [ "$http", "$log", "PropertyService",
+ "UtilityService", AsdcService ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/componentService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/componentService.js
new file mode 100755
index 0000000..391c6ba
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/componentService.js
@@ -0,0 +1,178 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+var ComponentService = function($log, COMPONENT, UtilityService) {
+
+ var _this = this;
+
+ var componentList = [ {
+ id : COMPONENT.NETWORK,
+ displayName : "Network"
+ }, {
+ id : COMPONENT.SERVICE,
+ displayName : "Service Instance"
+ }, {
+ id : COMPONENT.VNF,
+ displayName : "Virtual Network Function"
+ }, {
+ id : COMPONENT.VF_MODULE,
+ displayName : "VF Module"
+ }, {
+ id : COMPONENT.VOLUME_GROUP,
+ displayName : "Volume Group"
+ } ];
+
+ var getInventoryInfo = function(suffix, inventoryItem) {
+ var pattern = new RegExp(suffix + "-");
+ for ( var key in inventoryItem) {
+ if (pattern.exec(key)) {
+ return inventoryItem[key];
+ }
+ }
+ };
+
+ /*
+ * Converts 'id' to a user friendly version.
+ *
+ * The algorithm used is:
+ *
+ * 1) If "id" found in COMPONENT.FULL_NAME_MAP, return the name found in the
+ * map.
+ *
+ * 2) Otherwise, if camel case, add "-" between camel case words.
+ *
+ * 3) Split id into multiple "partial names" assuming "-" is the delimiter.
+ *
+ * 4) Map any partial names found in COMPONENT.PARTIAL_NAME_MAP to the name
+ * found in the map.
+ *
+ * 5) Use partial names whenever not found in map.
+ *
+ * 5) Return name by combining all partial names with " " delimiter.
+ */
+ var getDisplayName = function(id) {
+ var tmp = COMPONENT.FULL_NAME_MAP[id.toLowerCase()];
+ if (UtilityService.hasContents(tmp)) {
+ return tmp;
+ }
+ /*
+ * Add "-" if camel case found.
+ */
+ var id = id.replace(/([a-z](?=[A-Z]))/g, '$1-');
+ var name = "";
+ var arg = id.split("-");
+ for (var i = 0; i < arg.length; i++) {
+ if (i > 0) {
+ name += " ";
+ }
+ var tmp = COMPONENT.PARTIAL_NAME_MAP[arg[i].toLowerCase()];
+ if (UtilityService.hasContents(tmp)) {
+ name += tmp;
+ } else {
+ name += arg[i].slice(0, 1).toUpperCase() + arg[i].slice(1);
+ }
+ }
+ return name;
+ };
+
+ return {
+ initialize : function(componentId) {
+ for (var i = 0; i < componentList.length; i++) {
+ if (componentList[i].id === componentId) {
+ _this.componentId = componentList[i].id;
+ return componentId;
+ }
+ }
+ throw "ComponentService:initializeComponent: componentId not found: "
+ + componentId;
+ },
+ getComponentDisplayName : function() {
+ for (var i = 0; i < componentList.length; i++) {
+ if (componentList[i].id === _this.componentId) {
+ return componentList[i].displayName;
+ }
+ }
+ },
+ getInventoryInfo : getInventoryInfo,
+ getInventoryParameterList : function(suffix, inventoryItem, isPartial) {
+ console.log ("getInventoryParameterList" ); console.log ( JSON.stringify ( inventoryItem, null, 4));
+ var parameterList = new Array();
+ var pattern = new RegExp("network-id|network-name");
+ var pattern1 = new RegExp("neutron");
+
+ if ( (suffix === COMPONENT.NETWORK) && (isPartial) ) {
+ for ( var id in inventoryItem.object) {
+ if (pattern.exec(id) && (!(pattern1.exec(id))) ) {
+ parameterList.push({
+ id : id,
+ value : inventoryItem.object[id]
+ });
+ }
+ }
+ }
+ else if (suffix === COMPONENT.NETWORK) {
+ for ( var id in inventoryItem.object) {
+ parameterList.push({
+ id : id,
+ value : inventoryItem.object[id]
+ });
+ }
+ for ( var index in inventoryItem.subnets) {
+ for (var fieldId in inventoryItem.subnets[index]) {
+ parameterList.push({
+ id : fieldId,
+ value : inventoryItem.subnets[index][fieldId]
+ });
+ }
+ }
+ }
+ else {
+ for ( var id in inventoryItem) {
+ //if (pattern.exec(id)) {
+ parameterList.push({
+ id : id,
+ value : inventoryItem[id]
+ });
+ //}
+ }
+ }
+ return parameterList;
+ },
+ getDisplayNames : function(inputList) {
+ var outputList = new Array();
+ for (var i = 0; i < inputList.length; i++) {
+ var entry = angular.copy(inputList[i]);
+ if (!UtilityService.hasContents(entry.name)) {
+ entry.name = getDisplayName(entry.id);
+ }
+ outputList.push(entry);
+ }
+ return outputList;
+ },
+ getFieldDisplayName : function(name) {
+ return getDisplayName(name);
+ }
+ }
+}
+
+appDS2.factory("ComponentService", [ "$log", "COMPONENT", "UtilityService",
+ ComponentService ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js
new file mode 100755
index 0000000..f6838af
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/creationService.js
@@ -0,0 +1,924 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+/*
+ * "CreationService" isolates the "component-specific" logic required by the
+ * "CreationDialog" controller.
+ *
+ * "Components" are defined as the 5 element types managed by the dialogs: A)
+ * Service B) VNF C) VF Module D) Volume Group and E) Network.
+ *
+ */
+
+var CreationService = function($log, AaiService, AsdcService, DataService,
+ ComponentService, COMPONENT, FIELD, PARAMETER, UtilityService) {
+
+ var _this = this;
+
+ var getAsyncOperationList = function() {
+ if (DataService.getLoggedInUserId() == null)
+ getLoggedInUserID();
+ switch (_this.componentId) {
+ case COMPONENT.SERVICE:
+ return [ getSubscribers, getServices ];
+ case COMPONENT.NETWORK:
+ return [ getLcpCloudRegionTenantList ];
+ case COMPONENT.VNF:
+ return [ getLcpCloudRegionTenantList ];
+ case COMPONENT.VF_MODULE:
+ return [ getLcpCloudRegionTenantList ];
+ case COMPONENT.VOLUME_GROUP:
+ return [ getLcpCloudRegionTenantList ];
+ }
+ };
+
+ /*
+ * "getSummaryList" and "getUserProvidedList" return parameters that should
+ * be displayed in the summary and user provided sections, respectively. The
+ * functions are expected to return lists that are in the format needed by
+ * the parameter-block directive.
+ */
+
+ var getSummaryList = function() {
+
+ /*
+ * These placeholders should be removed and their usage in
+ * "getSummaryList" should be replaced by appropriate code as the
+ * requirements and interfaces firm up.
+ */
+
+ var PLACEHOLDER_RESOURCE_DESCRIPTION = "Resource Description (PLACEHOLDER)";
+ var PLACEHOLDER_SERVICE_CATEGORY = "Service Category (PLACEHOLDER)";
+ var PLACEHOLDER_VF_MODULE_DESCRIPTION = "VF Module Description (PLACEHOLDER)";
+ var PLACEHOLDER_VF_MODULE_LABEL = "VF Module Label (PLACEHOLDER)";
+ var PLACEHOLDER_VF_MODULE_TYPE = "VF Module Type (PLACEHOLDER)";
+
+ _this.parameterList = new Array();
+
+ /*
+ * Common fields displayed at the top of all create instance screens.
+ */
+ addToList(FIELD.NAME.SERVICE_NAME, DataService.getServiceName());
+
+ switch (_this.componentId) {
+ case COMPONENT.SERVICE:
+ if ( !DataService.getALaCarte() ) {
+ // for macro instantiation need to add the resource names under the node template list
+ // this field is called modelCustomizationName in the asdc client code
+ var p;
+ var rlist = DataService.getResources();
+ var res;
+ if ( rlist != null ) {
+ for (var i = 0; i < rlist.length; i++) {
+ res = rlist[i];
+
+ p = FIELD.NAME.RESOURCE_NAME.concat(" " + (i+1));
+ addToList(p, res.name );
+ p = FIELD.NAME.RESOURCE_DESCRIPTION.concat(" " + (i+1));
+ addToList(p, res.description );
+ }
+ }
+ }
+ addToList(FIELD.NAME.SERVICE_INVARIANT_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.SERVICE_VERSION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
+ addToList(FIELD.NAME.SERVICE_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
+ addToList(FIELD.NAME.SERVICE_DESCRIPTION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.DESCRIPTION]);
+ addToList(FIELD.NAME.SERVICE_CATEGORY, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.CATEGORY]);
+ break;
+ case COMPONENT.VF_MODULE:
+ addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
+ .getSubscriberName());
+ addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
+ .getServiceInstanceName());
+ addToList(FIELD.NAME.MODEL_NAME, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.MODEL_VERSION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
+ addToList(FIELD.NAME.MODEL_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
+ addToList(FIELD.NAME.MODEL_CUSTOMIZATION_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.CUSTOMIZATION_UUID]);
+ break;
+ case COMPONENT.VNF:
+ addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
+ .getSubscriberName());
+ addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
+ .getServiceInstanceName());
+ addToList(FIELD.NAME.MODEL_NAME, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.MODEL_VERSION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
+ addToList(FIELD.NAME.MODEL_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
+ addToList(FIELD.NAME.MODEL_CUSTOMIZATION_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.CUSTOMIZATION_UUID]);
+ addToList(FIELD.NAME.MODEL_CUSTOMIZATION_NAME, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_CUSTOMIZATION_NAME]);
+ addToList(FIELD.NAME.MODEL_VNF_TYPE, DataService
+ .getModelInfo(_this.componentId)[COMPONENT.VNF_TYPE]);
+ addToList(FIELD.NAME.MODEL_VNF_ROLE, DataService
+ .getModelInfo(_this.componentId)[COMPONENT.VNF_ROLE]);
+ addToList(FIELD.NAME.MODEL_VNF_FUNCTION, DataService
+ .getModelInfo(_this.componentId)[COMPONENT.VNF_FUNCTION]);
+ addToList(FIELD.NAME.MODEL_VNF_CODE, DataService
+ .getModelInfo(_this.componentId)[COMPONENT.VNF_CODE]);
+ break;
+ case COMPONENT.NETWORK:
+ case COMPONENT.VOLUME_GROUP:
+ addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
+ .getSubscriberName());
+ addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
+ .getServiceInstanceName());
+ addToList(FIELD.NAME.MODEL_NAME, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.MODEL_VERSION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
+ addToList(FIELD.NAME.MODEL_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
+ addToList(FIELD.NAME.MODEL_CUSTOMIZATION_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.CUSTOMIZATION_UUID]);
+ break;
+ }
+
+ return _this.parameterList;
+ };
+
+ var getUserProvidedList = function() {
+ parameterList = [];
+ var isUserProvidedNaming = false;
+ if ( (DataService.getModelInfo(_this.componentId).serviceEcompNaming != null)
+ && (DataService.getModelInfo(_this.componentId).serviceEcompNaming === "false") ) {
+ isUserProvidedNaming = true;
+ }
+ var parameterList;
+ if (_this.componentId === COMPONENT.SERVICE) {
+ if ( DataService.getALaCarte() ) {
+ parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ];
+ parameterList = parameterList.concat([ getSubscribersParameter(),
+ FIELD.PARAMETER.SERVICE_TYPE_DISABLED ]);
+ }
+ else {
+ // macro
+ if (isUserProvidedNaming) {
+ parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ];
+
+ }
+ parameterList = parameterList.concat([ getSubscribersParameter(),
+ FIELD.PARAMETER.SERVICE_TYPE_DISABLED ]);
+ parameterList = parameterList.concat([ getServiceId(),
+ FIELD.PARAMETER.SERVICE_TYPE,
+ FIELD.PARAMETER.LCP_REGION,
+ FIELD.PARAMETER.TENANT_DISABLED ]);
+ }
+ }
+ else {
+ parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ];
+ switch (_this.componentId) {
+ case COMPONENT.NETWORK:
+ case COMPONENT.VNF:
+ parameterList = parameterList.concat([ getServiceId(),
+ getLcpRegion(), FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
+ FIELD.PARAMETER.TENANT_DISABLED ]);
+ break;
+ case COMPONENT.VF_MODULE:
+ parameterList = parameterList.concat([
+ getLcpRegion(),
+ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
+ FIELD.PARAMETER.TENANT_DISABLED
+ ]);
+
+ var availableVolumeGroupList = DataService.getAvailableVolumeGroupList();
+
+ if (availableVolumeGroupList && availableVolumeGroupList.length > 0) {
+ var availableVolumeGroupNames = [FIELD.STATUS.NONE];
+
+ for (var i = 0; i < availableVolumeGroupList.length; i++) {
+ availableVolumeGroupNames.push(availableVolumeGroupList[i].instance.name);
+ }
+
+ parameterList.push(addOptionList(
+ FIELD.PARAMETER.AVAILABLE_VOLUME_GROUP,
+ availableVolumeGroupNames));
+ }
+ break;
+ case COMPONENT.VOLUME_GROUP:
+ parameterList = parameterList.concat([ getLcpRegion(),
+ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
+ FIELD.PARAMETER.TENANT_DISABLED ]);
+ }
+ }
+
+ parameterList.push(FIELD.PARAMETER.SUPPRESS_ROLLBACK);
+
+ addArbitraryParameters(parameterList);
+
+ return parameterList;
+ };
+
+ var addArbitraryParameters = function(parameterList) {
+ if ( DataService.getModelInfo(_this.componentId).displayInputs != null ) {
+ var inputs = DataService.getModelInfo(_this.componentId).displayInputs;
+ for ( var key in inputs) {
+ var parameter = {
+ id : key,
+ type : PARAMETER.STRING,
+ name : ComponentService.getFieldDisplayName(key),
+ value : inputs[key][PARAMETER.DEFAULT],
+ isRequired : inputs[key][PARAMETER.REQUIRED],
+ description : inputs[key][PARAMETER.DESCRIPTION]
+ };
+ switch (inputs[key][PARAMETER.TYPE]) {
+ case PARAMETER.INTEGER:
+ parameter.type = PARAMETER.NUMBER;
+ break;
+ case PARAMETER.BOOLEAN:
+ parameter.type = PARAMETER.BOOLEAN;
+ break;
+ case PARAMETER.RANGE:
+ break;
+ case PARAMETER.LIST:
+ break;
+ case PARAMETER.MAP:
+ parameter.type = PARAMETER.MAP;
+ break;
+ }
+
+ if ( UtilityService.hasContents(inputs[key][PARAMETER.CONSTRAINTS])
+ && ( inputs[key][PARAMETER.CONSTRAINTS].length > 0 ) ) {
+ var constraintsArray = inputs[key][PARAMETER.CONSTRAINTS];
+ //console.log ("Calling addConstraintParameters for input name=" + key);
+ addConstraintParameters (parameterList, constraintsArray, key, inputs, parameter);
+ }
+ else {
+
+ parameterList.push(parameter);
+ }
+ }
+ }
+ };
+
+ var addConstraintParameters = function(parameterList, constraintsArray, key, inputs, parameter) {
+ // If there are constraints and the operator is "valid_values",
+ // use a select parameter type.
+ var i = constraintsArray.length;
+ var parameterPushed = false;
+ if ( i > 0 ) {
+ while ( (i--) && (!parameterPushed) ) {
+ var keys = Object.keys(constraintsArray[i]);
+ //var keys_len = keys.length;
+ for ( var operator in keys ) {
+ //console.log ("keys[operator]=" + keys[operator]);
+ switch (keys[operator]) {
+ case PARAMETER.VALID_VALUES:
+ var j = constraintsArray[i][PARAMETER.VALID_VALUES].length;
+ if ( j > 0 ) {
+ var oList = [];
+ var option;
+ while (j--) {
+ option = {
+ name: constraintsArray[i][PARAMETER.VALID_VALUES][j],
+ isDefault: false
+ }
+ if ( ( UtilityService.hasContents (inputs[key][PARAMETER.DEFAULT]) )
+ && (inputs[key][PARAMETER.DEFAULT] === constraintsArray[i][PARAMETER.VALID_VALUES][j] ) ) {
+ option = {
+ name: constraintsArray[i][PARAMETER.VALID_VALUES][j],
+ isDefault: true
+ }
+ }
+ oList.push(option);
+ }
+ parameter.type = PARAMETER.SELECT;
+ parameter.optionList = oList;
+ parameterList.push(parameter);
+ parameterPushed = true;
+ //console.log ("pushed param for valid values");
+ }
+ break;
+
+ case PARAMETER.EQUAL:
+ if ( constraintsArray[i][PARAMETER.EQUAL] != null ) {
+ //override parameter type
+ parameter.type = PARAMETER.STRING;
+ parameter.isReadOnly = true;
+ parameter.value = constraintsArray[i][PARAMETER.EQUAL];
+ parameterList.push(parameter);
+ parameterPushed = true;
+ //console.log ("pushed param for equal");
+ }
+ break;
+
+ case PARAMETER.LENGTH:
+ if ( constraintsArray[i][PARAMETER.LENGTH] != null ) {
+ parameter.minLength = constraintsArray[i][PARAMETER.LENGTH];
+ parameter.maxLength = constraintsArray[i][PARAMETER.LENGTH];
+ parameterList.push(parameter);
+ parameterPushed = true;
+ //console.log ("pushed param for length: ");
+ //console.log (JSON.stringify (parameter, null, 4));
+ }
+ break;
+ case PARAMETER.MAX_LENGTH:
+ if ( constraintsArray[i][PARAMETER.MAX_LENGTH] != null ) {
+ parameter.maxLength = constraintsArray[i][PARAMETER.MAX_LENGTH];
+ parameterList.push(parameter);
+ parameterPushed = true;
+ //console.log ("pushed param for max length: ");
+ //console.log (JSON.stringify (parameter, null, 4));
+ }
+ break;
+ case PARAMETER.MIN_LENGTH:
+ if ( constraintsArray[i][PARAMETER.MIN_LENGTH] != null ) {
+ parameter.minLength = constraintsArray[i][PARAMETER.MIN_LENGTH];
+ parameterList.push(parameter);
+ parameterPushed = true;
+ //console.log ("pushed param for min length: ");
+ //console.log (JSON.stringify (parameter, null, 4));
+ }
+ break;
+ case PARAMETER.IN_RANGE:
+ if ( constraintsArray[i][PARAMETER.IN_RANGE] != null ) {
+ if (constraintsArray[i][PARAMETER.IN_RANGE].length > 1 ) {
+ parameter.min = constraintsArray[i][PARAMETER.IN_RANGE][0];
+ parameter.max = constraintsArray[i][PARAMETER.IN_RANGE][1];
+ parameter.type = PARAMETER.NUMBER;
+ parameter.value = inputs[key][PARAMETER.DEFAULT]
+ parameterList.push(parameter);
+ parameterPushed = true;
+ //console.log ("pushed param for in_range");
+ }
+ }
+ break;
+ case PARAMETER.GREATER_THAN:
+ if ( constraintsArray[i][PARAMETER.GREATER_THAN] != null ) {
+ parameter.type = PARAMETER.NUMBER;
+ parameter.min = constraintsArray[i][PARAMETER.GREATER_THAN];
+ parameter.value = inputs[key][PARAMETER.DEFAULT]
+ parameterList.push(parameter);
+ parameterPushed = true;
+ //console.log ("pushed param for greater_than");
+
+ }
+ break;
+ }//switch
+ }//for
+
+ }//while
+ }//if
+ };
+ var addToList = function(name, value) {
+ _this.parameterList.push({
+ name : name,
+ value : value
+ });
+ };
+
+ /*
+ * The "*Mso*" functions return URL and request details that can be passed
+ * to the MSO controller. The request details defines the info passed as
+ * part of the POST body.
+ */
+
+ var getMsoUrl = function() {
+ switch (_this.componentId) {
+ case COMPONENT.NETWORK:
+ return "mso_create_nw_instance/"
+ + DataService.getServiceInstanceId();
+ case COMPONENT.SERVICE:
+ return "mso_create_svc_instance";
+ case COMPONENT.VNF:
+ return "mso_create_vnf_instance/"
+ + DataService.getServiceInstanceId();
+ case COMPONENT.VF_MODULE:
+ return "mso_create_vfmodule_instance/"
+ + DataService.getServiceInstanceId() + "/vnfs/"
+ + DataService.getVnfInstanceId();
+ case COMPONENT.VOLUME_GROUP:
+ return "mso_create_volumegroup_instance/"
+ + DataService.getServiceInstanceId() + "/vnfs/"
+ + DataService.getVnfInstanceId();
+ }
+ };
+
+ var getMsoRequestDetails = function(parameterList) {
+ console.log("getMsoRequestDetails invoked, parameterList="); console.log(JSON.stringify(parameterList,null,4));
+ var modelInfo = DataService.getModelInfo(_this.componentId);
+ var requestorloggedInId = DataService.getLoggedInUserId();
+ if (requestorloggedInId == null)
+ requestorloggedInId = "";
+ var isSupRollback = false;
+ if (getValueFromList(FIELD.ID.SUPPRESS_ROLLBACK,parameterList) === "true") {
+ isSupRollback = true;
+ }
+ var requestDetails = {
+ requestInfo : {
+ instanceName : getValueFromList(FIELD.ID.INSTANCE_NAME,
+ parameterList),
+ source : FIELD.ID.VID,
+ suppressRollback : isSupRollback,
+ requestorId: requestorloggedInId
+ },
+ modelInfo : {
+ modelType : _this.componentId,
+ modelInvariantId : modelInfo.modelInvariantId,
+ modelVersionId : modelInfo.modelNameVersionId,
+ modelName : modelInfo.modelName,
+ modelVersion : modelInfo.modelVersion,
+ modelCustomizationId: modelInfo.customizationUuid,
+ modelCustomizationName : modelInfo.modelCustomizationName
+ },
+ requestParameters : {
+ userParams : getArbitraryParameters(parameterList)
+ }
+ };
+ if ( (_this.componentId != COMPONENT.SERVICE) || ( !DataService.getALaCarte() ) ) {
+ // include cloud region for everything but service create alacarte
+ var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList);
+ if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) {
+ lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT,
+ parameterList);
+ }
+ requestDetails.cloudConfiguration = {
+ lcpCloudRegionId : lcpRegion,
+ tenantId : getValueFromList(FIELD.ID.TENANT, parameterList)
+ };
+ }
+ switch (_this.componentId) {
+ case COMPONENT.SERVICE:
+ requestDetails.subscriberInfo = {
+ globalSubscriberId : DataService.getGlobalCustomerId(),
+ subscriberName : DataService.getSubscriberName()
+ };
+ requestDetails.requestParameters.subscriptionServiceType = getValueFromList(
+ FIELD.ID.SERVICE_TYPE, parameterList);
+ requestDetails.requestParameters.aLaCarte = DataService.getALaCarte();
+ if ( !DataService.getALaCarte() ) {
+ requestDetails.requestInfo.productFamilyId = getValueFromList(
+ FIELD.ID.PRODUCT_FAMILY, parameterList);
+ }
+ var svcModelInfo = {
+ modelType : _this.componentId,
+ modelInvariantId : modelInfo.modelInvariantId,
+ modelVersionId : modelInfo.modelNameVersionId,
+ modelName : modelInfo.modelName,
+ modelVersion : modelInfo.modelVersion
+ };
+ requestDetails.modelInfo = svcModelInfo;
+ break;
+ case COMPONENT.VNF:
+
+ requestDetails.requestInfo.productFamilyId = getValueFromList(
+ FIELD.ID.PRODUCT_FAMILY, parameterList);
+ break;
+ case COMPONENT.NETWORK:
+ requestDetails.requestInfo.productFamilyId = getValueFromList(
+ FIELD.ID.PRODUCT_FAMILY, parameterList);
+
+ break;
+ case COMPONENT.VF_MODULE:
+ break;
+ case COMPONENT.VOLUME_GROUP:
+ break;
+ }
+
+ var relatedInstanceList = getRelatedInstanceList(parameterList);
+
+ if (relatedInstanceList !== undefined) {
+ requestDetails.relatedInstanceList = relatedInstanceList;
+ }
+
+ return requestDetails;
+ };
+
+ var getRelatedInstanceList = function(parameterList) {
+ var relatedInstanceList = new Array();
+ switch (_this.componentId) {
+ case COMPONENT.SERVICE:
+ return undefined;
+ case COMPONENT.NETWORK:
+ case COMPONENT.VNF:
+ addRelatedInstance(relatedInstanceList, COMPONENT.SERVICE,
+ DataService.getServiceInstanceId());
+ break;
+ case COMPONENT.VF_MODULE:
+ addRelatedInstance(relatedInstanceList, COMPONENT.SERVICE,
+ DataService.getServiceInstanceId());
+ addRelatedInstance(relatedInstanceList, COMPONENT.VNF, DataService
+ .getVnfInstanceId());
+
+ var availableVolumeGroup = getValueFromList(
+ FIELD.ID.AVAILABLE_VOLUME_GROUP, parameterList);
+
+ if (UtilityService.hasContents(availableVolumeGroup) && availableVolumeGroup !== "None") {
+ var availableVolumeGroups = DataService.getAvailableVolumeGroupList();
+
+ for (var i = 0; i < availableVolumeGroups.length; i++) {
+ if (availableVolumeGroups[i].instance.name == availableVolumeGroup) {
+ DataService.setModelInfo(COMPONENT.VOLUME_GROUP, DataService.getModelInfo(COMPONENT.VF_MODULE));
+ DataService.setVolumeGroupInstanceId(availableVolumeGroups[i].instance.object["volume-group-id"]);
+ break;
+ }
+ }
+
+ addRelatedInstance(relatedInstanceList, COMPONENT.VOLUME_GROUP,
+ DataService.getVolumeGroupInstanceId());
+ }
+ break;
+ case COMPONENT.VOLUME_GROUP:
+ addRelatedInstance(relatedInstanceList, COMPONENT.SERVICE,
+ DataService.getServiceInstanceId());
+ addRelatedInstance(relatedInstanceList, COMPONENT.VNF, DataService
+ .getVnfInstanceId());
+ break;
+ }
+
+ return relatedInstanceList;
+ };
+
+ var addRelatedInstance = function(relatedInstanceList, componentId,
+ instanceId) {
+ var modelInfo = DataService.getModelInfo(componentId);
+ var relatedInstance;
+ if (modelInfo !== undefined) {
+ if (componentId === COMPONENT.SERVICE) {
+ relatedInstance = {
+ "instanceId" : instanceId,
+ "modelInfo" : {
+ "modelType" : componentId,
+ "modelName" : modelInfo.modelName,
+ "modelInvariantId" : modelInfo.modelInvariantId,
+ "modelVersion" : modelInfo.modelVersion,
+ "modelVersionId" : modelInfo.modelNameVersionId,
+
+ }
+ };
+ }
+ else {
+ relatedInstance = {
+ "instanceId" : instanceId,
+ "modelInfo" : {
+ "modelType" : componentId,
+ "modelName" : modelInfo.modelName,
+ "modelInvariantId" : modelInfo.modelInvariantId,
+ "modelVersion" : modelInfo.modelVersion,
+ "modelVersionId" : modelInfo.modelNameVersionId,
+ "modelCustomizationId": modelInfo.customizationUuid,
+ "modelCustomizationName": modelInfo.modelCustomizationName
+ }
+ }
+ }
+ relatedInstanceList.push({
+ relatedInstance : relatedInstance
+ });
+ }
+ };
+
+ /*
+ * var getArbitraryParameters = function(parameterList) { var
+ * arbitraryParameters = new Object(); for (var i = 0; i <
+ * parameterList.length; i++) { var parameter = parameterList[i]; switch
+ * (parameter.id) { case FIELD.ID.INSTANCE_NAME: case
+ * FIELD.ID.PRODUCT_FAMILY: case FIELD.ID.LCP_REGION: case
+ * FIELD.ID.LCP_REGION_TEXT: case FIELD.ID.SERVICE_TYPE: case
+ * FIELD.ID.TENANT: case FIELD.ID.SUPPRESS_ROLLBACK: break; default:
+ * arbitraryParameters[parameter.id] = parameter.value; } } return
+ * arbitraryParameters; }
+ */
+ var getArbitraryParameters = function(parameterList) {
+ var arbitraryParameters = new Object();
+ var arbitraryArray = new Array();
+ for (var i = 0; i < parameterList.length; i++) {
+ var parameter = parameterList[i];
+ switch (parameter.id) {
+ case FIELD.ID.AVAILABLE_VOLUME_GROUP:
+ break;
+ case FIELD.ID.INSTANCE_NAME:
+ break;
+ case FIELD.ID.PRODUCT_FAMILY:
+ break;
+ case FIELD.ID.LCP_REGION:
+ break;
+ case FIELD.ID.LCP_REGION_TEXT:
+ break;
+ case FIELD.ID.SERVICE_TYPE:
+ break;
+ case FIELD.ID.TENANT:
+ break;
+ case FIELD.ID.SUPPRESS_ROLLBACK:
+ break;
+ case FIELD.ID.SUBSCRIBER_NAME:
+ break;
+ default:
+ arbitraryParameters = {
+ name : parameter.id,
+ value : parameter.value
+ }
+ arbitraryArray.push(arbitraryParameters);
+ }
+ }
+ return (arbitraryArray);
+ }
+
+ var getModel = function() {
+ AsdcService.getModel(DataService.getModelId(), function(response) {
+ DataService.setModelInfo(_this.componentId, {
+ modelInvariantId : response.data.invariantUUID,
+ modelNameVersionId : response.data.uuid,
+ modelName : response.data.name,
+ modelVersion : response.data.version,
+ inputs : response.data.inputs
+ });
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var getSubscriptionServiceTypeList = function() {
+ AaiService.getSubscriptionServiceTypeList(DataService
+ .getGlobalCustomerId(), function(response) {
+ DataService.setSubscriptionServiceTypeList(response);
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var getLoggedInUserID = function() {
+ AaiService.getLoggedInUserID(function(response) {
+ DataService.setLoggedInUserId(response.data);
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var getSubscribers = function() {
+ AaiService.getSubscribers(function(response) {
+ DataService.setSubscribers(response);
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+ var getServices = function() {
+ AaiService.getServices(function(response) {
+ var serviceIdList = [];
+ angular.forEach(response.data, function(value, key) {
+ angular.forEach(value, function(subVal, key) {
+ var newVal = { "id" : subVal[FIELD.ID.SERVICE_ID], "description" : subVal[FIELD.ID.SERVICE_DESCRIPTION] };
+ serviceIdList.push(newVal);
+ DataService.setServiceIdList(serviceIdList);
+ });
+ });
+
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+ var getLcpCloudRegionTenantList = function() {
+ AaiService.getLcpCloudRegionTenantList(DataService
+ .getGlobalCustomerId(), DataService.getServiceType(), function(
+ response) {
+ DataService.setCloudRegionTenantList(response);
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var internalGetParametersHandler = function() {
+ if (angular.isFunction(_this.getParametersHandler)) {
+ _this.getParametersHandler({
+ summaryList : getSummaryList(),
+ userProvidedList : getUserProvidedList()
+ });
+ }
+ };
+
+ var getSubscribersParameter = function() {
+ var subscribers = DataService.getSubscribers();
+ var parameter = FIELD.PARAMETER.SUBSCRIBER_NAME;
+ if ( UtilityService.hasContents(subscribers)) {
+ parameter.optionList = [];
+
+ for (var i = 0; i < subscribers.length; i++) {
+ parameter.optionList.push({
+ id : subscribers[i][FIELD.ID.GLOBAL_CUSTOMER_ID],
+ name : subscribers[i][FIELD.ID.SUBNAME]
+ })
+ }
+ }
+ return parameter;
+ };
+
+ var getServiceId = function() {
+ var serviceIdList = DataService.getServiceIdList();
+ var serviceTypeList = DataService.getSubscriptionServiceTypeList();
+ var parameter = FIELD.PARAMETER.PRODUCT_FAMILY;
+ parameter.optionList = new Array();
+
+ if (serviceTypeList == null) {
+ getSubscriptionServiceTypeList();
+ serviceTypeList = DataService.getSubscriptionServiceTypeList();
+ }
+ var went = 0;
+ if ( UtilityService.hasContents (serviceIdList) ) {
+ for (var i = 0; i < serviceIdList.length; i++) {
+ var go = 0;
+ var name = serviceIdList[i].id;
+
+ if (UtilityService.hasContents(serviceTypeList) ) {
+ console.log("STL: " + serviceTypeList);
+ for (var k = 0; k < serviceTypeList.length; k++) {
+ if (angular.equals(name,serviceTypeList[k])) {
+ go = 1;
+ went = 1;
+ }
+ }
+ } else {
+ go = 1;
+ went = 1;
+ }
+ if (go == 1) {
+ parameter.optionList.push({
+ id : serviceIdList[i].id,
+ name : serviceIdList[i].description
+ });
+ }
+ } // load them all, ours wasn't in the list
+ if (went == 0) {
+ for (var i = 0; i < serviceIdList.length; i++) {
+ parameter.optionList.push({
+ id : serviceIdList[i].id,
+ name : serviceIdList[i].description
+ });
+ }
+ }
+ }
+ return parameter;
+ };
+
+ var getLcpRegion = function() {
+ var cloudRegionTenantList = DataService.getCloudRegionTenantList();
+ var parameter = FIELD.PARAMETER.LCP_REGION;
+ if ( UtilityService.hasContents (cloudRegionTenantList) ) {
+ parameter.optionList = new Array();
+ for (var i = 0; i < cloudRegionTenantList.length; i++) {
+ for (var j = 0; j < parameter.optionList.length; j++) {
+ if (parameter.optionList[j].id === cloudRegionTenantList[i].cloudRegionId) {
+ break;
+ }
+ }
+ if (j < parameter.optionList.length) {
+ continue;
+ }
+ parameter.optionList.push({
+ id : cloudRegionTenantList[i].cloudRegionId
+ });
+ }
+ }
+ return parameter;
+ };
+
+ var getTenantList = function(cloudRegionId) {
+ var cloudRegionTenantList = DataService.getCloudRegionTenantList();
+ var parameter = "";
+ if ( UtilityService.hasContents (cloudRegionTenantList) ) {
+ parameter = FIELD.PARAMETER.TENANT_ENABLED;
+ parameter.optionList = new Array();
+ for (var i = 0; i < cloudRegionTenantList.length; i++) {
+ if (cloudRegionTenantList[i].cloudRegionId === cloudRegionId) {
+ parameter.optionList.push({
+ id : cloudRegionTenantList[i].tenantId,
+ name : cloudRegionTenantList[i].tenantName
+ });
+ }
+ }
+ }
+ return parameter;
+
+ };
+
+ var addOptionList = function(parameter, optionSimpleArray) {
+ var optionList = new Array();
+ if (!angular.isArray(optionSimpleArray)) {
+ return optionList;
+ }
+ for (var i = 0; i < optionSimpleArray.length; i++) {
+ optionList.push({
+ name : optionSimpleArray[i]
+ });
+ }
+ parameter.optionList = optionList;
+ return parameter;
+ };
+
+ var getValueFromList = function(id, parameterList) {
+ for (var i = 0; i < parameterList.length; i++) {
+ if (parameterList[i].id === id) {
+ return parameterList[i].value;
+ }
+ }
+ };
+ var updateUserParameterList = function(updatedId, parameterListControl) {
+ console.log ("updateUserParameterList() updatedId=" + updatedId);
+ if (updatedId === FIELD.ID.LCP_REGION) {
+ var list = parameterListControl.getList(updatedId);
+ if (list[0].selectedIndex >= 0) {
+ parameterListControl
+ .updateList([ getTenantList(list[0].value) ]);
+ } else {
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.TENANT_DISABLED ]);
+ }
+ if (list[0].value === FIELD.KEY.LCP_REGION_TEXT) {
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_VISIBLE ]);
+ } else {
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN ]);
+ }
+ } else if (updatedId === FIELD.ID.SUBSCRIBER_NAME) {
+ var list = parameterListControl.getList(updatedId);
+ if (list[0].selectedIndex >= 0) {
+ DataService.setGlobalCustomerId(list[0].value);
+
+ AaiService.getSubscriptionServiceTypeList(DataService
+ .getGlobalCustomerId(), function(response) {
+ DataService.setSubscriptionServiceTypeList(response);
+ var serviceTypeParameters = FIELD.PARAMETER.SERVICE_TYPE;
+ serviceTypeParameters.optionList = [];
+
+ for (var i = 0; i < response.length; i++) {
+ serviceTypeParameters.optionList.push({
+ "id" : response[i],
+ "name" : response[i]
+ });
+ }
+ console.log ( "updateUserParameterList: service type parameters " );
+ console.log ( JSON.stringify (serviceTypeParameters, null, 4));
+ parameterListControl.updateList([ serviceTypeParameters ]);
+ });
+
+ }
+ } else if ( updatedId === FIELD.ID.SERVICE_TYPE ) {
+ var list = parameterListControl.getList(updatedId);
+ if (list[0].selectedIndex >= 0) {
+
+ DataService.setServiceType(list[0].value);
+ var cloudRegionTenantList = new Array();
+ AaiService.getLcpCloudRegionTenantList(DataService.getGlobalCustomerId(), DataService.getServiceType(), function(cloudRegionTenantList) {
+ DataService.setCloudRegionTenantList(cloudRegionTenantList);
+ parameterListControl.updateList([ getLcpRegion() ]);
+ });
+ } else {
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.SERVICE_TYPE_DISABLED ]);
+ }
+ }
+
+ };
+
+ return {
+ initializeComponent : function(componentId) {
+ _this.componentId = ComponentService.initialize(componentId);
+ },
+ setHttpErrorHandler : function(httpErrorHandler) {
+ _this.httpErrorHandler = httpErrorHandler;
+ },
+ getComponentDisplayName : ComponentService.getComponentDisplayName,
+ getParameters : function(getParametersHandler) {
+ _this.getParametersHandler = getParametersHandler;
+ UtilityService.setHttpErrorHandler(_this.httpErrorHandler);
+ UtilityService.startAsyncOperations(getAsyncOperationList(),
+ internalGetParametersHandler);
+ },
+ updateUserParameterList : updateUserParameterList,
+ getMsoRequestDetails : getMsoRequestDetails,
+ getMsoUrl : getMsoUrl
+ }
+}
+
+appDS2.factory("CreationService", [ "$log", "AaiService", "AsdcService",
+ "DataService", "ComponentService", "COMPONENT", "FIELD", "PARAMETER",
+ "UtilityService", CreationService ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/dataService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/dataService.js
new file mode 100755
index 0000000..7d913fa
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/dataService.js
@@ -0,0 +1,243 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+var DataService = function($log, DataService) {
+
+ var _this = this;
+
+ return {
+ getAvailableVolumeGroupList : function() {
+ return _this.availableVolumeGroupList;
+ },
+ setAvailableVolumeGroupList : function(availableVolumeGroupList) {
+ _this.availableVolumeGroupList = availableVolumeGroupList;
+ },
+ getCloudRegionTenantList : function() {
+ return _this.cloudRegionTenantList;
+ },
+ setCloudRegionTenantList : function(cloudRegionTenantList) {
+ _this.cloudRegionTenantList = cloudRegionTenantList;
+ },
+ getGlobalCustomerId : function() {
+ return _this.globalCustomerId;
+ },
+ setGlobalCustomerId : function(globalCustomerId) {
+ _this.globalCustomerId = globalCustomerId;
+ },
+ getCustomizationUuid : function() {
+ return _this.customizationUUID;
+ },
+ setCustomizationUuid : function(customizationUUID) {
+ _this.customizationUUID = customizationUUID;
+ },
+ getResCustomizationUuid : function() {
+ return _this.rescustomizationUUID;
+ },
+ setResCustomizationUuid : function(rescustomizationUUID) {
+ _this.rescustomizationUUID = rescustomizationUUID;
+ },
+ getInventoryItem : function() {
+ return _this.inventoryItem;
+ },
+ setInventoryItem : function(inventoryItem) {
+ _this.inventoryItem = inventoryItem;
+ },
+ getModelId : function() {
+ return _this.modelId;
+ },
+ setModelId : function(modelId) {
+ _this.modelId = modelId;
+ },
+ getModelInstanceName : function() {
+ return _this.modelInstanceName;
+ },
+ setModelInstanceName : function(modelInstanceName) {
+ _this.modelInstanceName = modelInstanceName;
+ },
+ getModelInfo : function(componentId) {
+ return _this.modelInfo[componentId];
+ },
+ setModelInfo : function(componentId, modelInfo) {
+ if (_this.modelInfo === undefined) {
+ _this.modelInfo = new Object;
+ }
+ _this.modelInfo[componentId] = modelInfo;
+ },
+ getNetworkInstanceId : function() {
+ return _this.networkInstanceId;
+ },
+ setNetworkInstanceId : function(networkInstanceId) {
+ _this.networkInstanceId = networkInstanceId;
+ },
+ getServiceIdList : function() {
+ return _this.serviceIdList;
+ },
+ setServiceIdList : function(serviceIdList) {
+ _this.serviceIdList = serviceIdList;
+ },
+ getServiceInstanceId : function() {
+ return _this.serviceInstanceId;
+ },
+ setServiceInstanceId : function(serviceInstanceId) {
+ _this.serviceInstanceId = serviceInstanceId;
+ },
+ getServiceInstanceName : function() {
+ return _this.serviceInstanceName;
+ },
+ setServiceInstanceName : function(serviceInstanceName) {
+ _this.serviceInstanceName = serviceInstanceName;
+ },
+ getServiceName : function() {
+ return _this.serviceName;
+ },
+ setServiceName : function(serviceName) {
+ _this.serviceName = serviceName;
+ },
+ getServiceType : function() {
+ return _this.serviceType;
+ },
+ setServiceType : function(serviceType) {
+ _this.serviceType = serviceType;
+ },
+ getServiceUuid : function() {
+ return _this.serviceUuid;
+ },
+ setServiceUuid : function(serviceUuid) {
+ _this.serviceUuid = serviceUuid;
+ },
+ getSubscriberId : function() {
+ return _this.subscriberId;
+ },
+ setSubscriberId : function(subscriberId) {
+ _this.subscriberId = subscriberId;
+ },
+ getLoggedInUserId : function() {
+ return _this.loggedInUserId;
+ },
+ setLoggedInUserId : function(loggedInUserId) {
+ _this.loggedInUserId = loggedInUserId;
+ },
+ getSubscriberName : function() {
+ return _this.subscriberName;
+ },
+ setSubscriberName : function(subscriberName) {
+ _this.subscriberName = subscriberName;
+ },
+ getSubscribers : function() {
+ return _this.subscribers;
+ },
+ setSubscribers : function(subscribers) {
+ _this.subscribers = subscribers;
+ },
+ getSubscriptionServiceTypeList : function() {
+ return _this.subscriptionServiceTypeList;
+ },
+ setSubscriptionServiceTypeList : function(subscriptionServiceTypeList) {
+ _this.subscriptionServiceTypeList = subscriptionServiceTypeList;
+ },
+ getUserParams : function() {
+ return _this.userParams;
+ },
+ setUserParams : function(userParams) {
+ _this.userParams = userParams;
+ },
+ getUserServiceInstanceName : function() {
+ return _this.userServiceInstanceName;
+ },
+ setUserServiceInstanceName : function(userServiceInstanceName) {
+ _this.userServiceInstanceName = userServiceInstanceName;
+ },
+ getVfModuleInstanceId : function() {
+ return _this.vfModuleInstanceId;
+ },
+ setVfModuleInstanceId : function(vfModuleInstanceId) {
+ _this.vfModuleInstanceId = vfModuleInstanceId;
+ },
+ getVnfInstanceId : function() {
+ return _this.vnfInstanceId;
+ },
+ setVnfInstanceId : function(vnfInstanceId) {
+ _this.vnfInstanceId = vnfInstanceId;
+ },
+ getVolumeGroupInstanceId : function() {
+ return _this.volumeGroupInstanceId;
+ },
+ setVolumeGroupInstanceId : function(volumeGroupInstanceId) {
+ _this.volumeGroupInstanceId = volumeGroupInstanceId;
+ },
+ getLcpRegion : function() {
+ return _this.lcpRegion;
+ },
+ setLcpRegion : function(lcpRegion) {
+ _this.lcpRegion = lcpRegion;
+ },
+ getTenant : function() {
+ return _this.tenant;
+ },
+ setTenant : function(tenant) {
+ _this.tenant = tenant;
+ },
+ getTreeHandle : function() {
+ return _this.treeHandle;
+ },
+ setTreeHandle : function(treeHandle) {
+ _this.treeHandle = treeHandle;
+ },
+ setServiceInstanceToCustomer : function(serviceInstanceToCustomer) {
+ _this.serviceInstanceToCustomer = [];
+ _this.serviceInstanceToCustomer = serviceInstanceToCustomer;
+ },
+ getServiceInstanceToCustomer : function() {
+ return _this.serviceInstanceToCustomer;
+ },
+ setALaCarte : function(aval) {
+ _this.aLaCarte = aval;
+ },
+ getALaCarte : function() {
+ // if not set return true
+ if (_this.aLaCarte === undefined) {
+ return true;
+ }
+ return _this.aLaCarte;
+ },
+ getResources : function() {
+ return _this.resources;
+ },
+ setResources : function(r) {
+ _this.resources = r;
+ },
+ getSystemPropProvStatus : function() {
+ return _this.syspropProvStatusList;
+ },
+ setSystemPropProvStatus : function(r) {
+ _this.syspropProvStatusList = r;
+ },
+ getUpdatedVNFProvStatus : function() {
+ return _this.updatedvnfProvStatus;
+ },
+ setUpdatedVNFProvStatus : function(r) {
+ _this.updatedvnfProvStatus = r;
+ }
+ }
+}
+
+appDS2.factory("DataService", [ "$log", DataService ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/deletionService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/deletionService.js
new file mode 100755
index 0000000..62c2b19
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/deletionService.js
@@ -0,0 +1,502 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+var DeletionService = function($log, AaiService, AsdcService, DataService,
+ ComponentService, COMPONENT, FIELD, UtilityService) {
+
+ var _this = this;
+
+ var getAsyncOperationList = function() {
+ if (DataService.getLoggedInUserId() == null)
+ getLoggedInUserID();
+ switch (_this.componentId) {
+ case COMPONENT.SERVICE:
+ return [ getSubscribers, getLcpCloudRegionTenantList ];
+ case COMPONENT.NETWORK:
+ return [ getLcpCloudRegionTenantList ];
+ case COMPONENT.VNF:
+ return [ getLcpCloudRegionTenantList ];
+ case COMPONENT.VF_MODULE:
+ return [ getLcpCloudRegionTenantList ];
+ case COMPONENT.VOLUME_GROUP:
+ return [ getLcpCloudRegionTenantList ];
+ }
+ };
+
+ var getLcpCloudRegionTenantList = function() {
+ //console.log ( "global customer id: " );
+ //console.log ( JSON.stringify (DataService.getGlobalCustomerId()) );
+
+ //console.log ( "service type: " );
+ //console.log ( JSON.stringify (DataService.getServiceType()) );
+
+ AaiService.getLcpCloudRegionTenantList(DataService
+ .getGlobalCustomerId(), DataService.getServiceType(), function(
+ response) {
+ DataService.setCloudRegionTenantList(response);
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var getLoggedInUserID = function() {
+ AaiService.getLoggedInUserID(function(response) {
+ DataService.setLoggedInUserId(response.data);
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var getSubscribers = function() {
+ AaiService.getSubscribers(function(response) {
+ DataService.setSubscribers(response);
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var internalGetParametersHandler = function() {
+ if (angular.isFunction(_this.getParametersHandler)) {
+ if (_this.componentId == COMPONENT.SERVICE) {
+ if ( DataService.getALaCarte() ) {
+ _this.getParametersHandler({
+ summaryList : getSummaryList(),
+ userProvidedList : getUserProvidedList()
+ }, true);
+ }
+ else {
+ _this.getParametersHandler({
+ summaryList : getSummaryList(),
+ userProvidedList : getUserProvidedList()
+ }, false);
+ }
+ }
+ else {
+ _this.getParametersHandler({
+ summaryList : getSummaryList(),
+ userProvidedList : getUserProvidedList()
+ }, false);
+ }
+ }
+ };
+
+ var getSubscribersParameter = function() {
+ var subscribers = DataService.getSubscribers();
+ var parameter = FIELD.PARAMETER.SUBSCRIBER_NAME;
+ parameter.optionList = [];
+
+ for (var i = 0; i < subscribers.length; i++) {
+ parameter.optionList.push({
+ id : subscribers[i][FIELD.ID.GLOBAL_CUSTOMER_ID],
+ name : subscribers[i][FIELD.ID.SUBNAME]
+ })
+ }
+ return parameter;
+ };
+
+ var getServiceId = function() {
+ var serviceIdList = DataService.getServiceIdList();
+ var parameter = FIELD.PARAMETER.PRODUCT_FAMILY;
+ parameter.optionList = new Array();
+ for (var i = 0; i < serviceIdList.length; i++) {
+ parameter.optionList.push({
+ id : serviceIdList[i].id,
+ name : serviceIdList[i].description
+ });
+ }
+ return parameter;
+ };
+
+ var getUserProvidedList = function() {
+
+ //var parameterList = [ FIELD.PARAMETER.INSTANCE_NAME ];
+
+ var parameterList = [];
+
+ switch (_this.componentId) {
+ case COMPONENT.SERVICE:
+ if ( DataService.getALaCarte() ) {
+ parameterList = [];
+ }
+ else {
+ parameterList = parameterList.concat ([getLcpRegion(),
+ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
+ FIELD.PARAMETER.TENANT_DISABLED ]);
+ }
+ break;
+ case COMPONENT.NETWORK:
+ case COMPONENT.VNF:
+ parameterList = parameterList.concat([ //getServiceId(),
+ getLcpRegion(), FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
+ FIELD.PARAMETER.TENANT_DISABLED ]);
+ break;
+ case COMPONENT.VF_MODULE:
+ parameterList = parameterList.concat([
+ getLcpRegion(),
+ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
+ FIELD.PARAMETER.TENANT_DISABLED
+ ]);
+
+ break;
+ case COMPONENT.VOLUME_GROUP:
+ parameterList = parameterList.concat([ getLcpRegion(),
+ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN,
+ FIELD.PARAMETER.TENANT_DISABLED ]);
+ }
+
+ //parameterList.push(FIELD.PARAMETER.SUPPRESS_ROLLBACK);
+
+ //addArbitraryParameters(parameterList);
+
+ return parameterList;
+ };
+ var getSummaryList = function() {
+ switch (_this.componentId) {
+ case COMPONENT.NETWORK:
+ case COMPONENT.SERVICE:
+ case COMPONENT.VNF:
+ case COMPONENT.VF_MODULE:
+ case COMPONENT.VOLUME_GROUP:
+ var summaryList = [ {
+ name : FIELD.NAME.SUBSCRIBER_NAME,
+ value : DataService.getSubscriberName()
+ }, {
+ name : FIELD.NAME.CUSTOMER_ID,
+ value : DataService.getGlobalCustomerId()
+ }, {
+ name : FIELD.NAME.SERVICE_UUID,
+ value : DataService.getServiceUuid()
+ }, {
+ name : FIELD.NAME.SERVICE_NAME,
+ value : DataService.getServiceName()
+ /* }, {
+ name : FIELD.NAME.USER_SERVICE_INSTANCE_NAME,
+ value : DataService.getUserServiceInstanceName()*/
+ } ];
+
+ _this.parameterList = new Array();
+
+ addToList(FIELD.NAME.SERVICE_NAME, DataService.getServiceName());
+
+ switch (_this.componentId) {
+ case COMPONENT.SERVICE:
+ addToList(FIELD.NAME.SERVICE_INVARIANT_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.SERVICE_VERSION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
+ addToList(FIELD.NAME.SERVICE_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
+ addToList(FIELD.NAME.SERVICE_DESCRIPTION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.DESCRIPTION]);
+ addToList(FIELD.NAME.SERVICE_CATEGORY, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.CATEGORY]);
+ break;
+ case COMPONENT.VF_MODULE:
+ addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
+ .getSubscriberName());
+ addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
+ .getServiceInstanceName());
+ addToList(FIELD.NAME.MODEL_NAME, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]);
+ addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.MODEL_VERSION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
+ addToList(FIELD.NAME.MODEL_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
+ break;
+ case COMPONENT.NETWORK:
+ case COMPONENT.VNF:
+ case COMPONENT.VOLUME_GROUP:
+ addToList(FIELD.NAME.SUBSCRIBER_NAME, DataService
+ .getSubscriberName());
+ addToList(FIELD.NAME.SERVICE_INSTANCE_NAME, DataService
+ .getServiceInstanceName());
+ addToList(FIELD.NAME.MODEL_NAME, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME]);
+ addToList(FIELD.NAME.MODEL_INVARIANT_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_INVARIANT_ID]);
+ addToList(FIELD.NAME.MODEL_VERSION, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_VERSION]);
+ addToList(FIELD.NAME.MODEL_UUID, DataService
+ .getModelInfo(_this.componentId)[FIELD.ID.MODEL_NAME_VERSION_ID]);
+ break;
+ }
+
+ /*var additionalList = ComponentService.getInventoryParameterList(
+ _this.componentId, DataService.getInventoryItem());*/
+ var additionalList = ComponentService.getDisplayNames(ComponentService
+ .getInventoryParameterList(_this.componentId, DataService
+ .getInventoryItem(), true ));
+
+ return summaryList.concat(ComponentService
+ .getDisplayNames(additionalList));
+ }
+ };
+
+ var getMsoUrl = function() {
+ switch (_this.componentId) {
+ case COMPONENT.NETWORK:
+ return "mso_delete_nw_instance/"
+ + DataService.getServiceInstanceId() + "/networks/"
+ + DataService.getNetworkInstanceId();
+ case COMPONENT.SERVICE:
+ return "mso_delete_svc_instance/"
+ + DataService.getServiceInstanceId();
+ case COMPONENT.VNF:
+ return "mso_delete_vnf_instance/"
+ + DataService.getServiceInstanceId() + "/vnfs/"
+ + DataService.getVnfInstanceId();
+ case COMPONENT.VF_MODULE:
+ return "mso_delete_vfmodule_instance/"
+ + DataService.getServiceInstanceId() + "/vnfs/"
+ + DataService.getVnfInstanceId() + "/vfModules/"
+ + DataService.getVfModuleInstanceId();
+ case COMPONENT.VOLUME_GROUP:
+ return "mso_delete_volumegroup_instance/"
+ + DataService.getServiceInstanceId() + "/vnfs/"
+ + DataService.getVnfInstanceId() + "/volumeGroups/"
+ + DataService.getVolumeGroupInstanceId();
+ }
+ }
+
+ var addToList = function(name, value) {
+ _this.parameterList.push({
+ name : name,
+ value : value
+ });
+ };
+
+ var getMsoRequestDetails = function(parameterList) {
+ console.log("getMsoRequestDetails invoked");
+ var inventoryInfo = ComponentService.getInventoryInfo(
+ _this.componentId, DataService.getInventoryItem());
+ var modelInfo = DataService.getModelInfo(_this.componentId);
+ var requestorloggedInId = DataService.getLoggedInUserId();
+ if (requestorloggedInId == null)
+ requestorloggedInId = "";
+ var requestDetails = {
+ modelInfo : {
+ modelType : _this.componentId,
+ modelInvariantId : modelInfo.modelInvariantId,
+ modelVersionId : modelInfo.modelNameVersionId,
+ modelName : modelInfo.modelName,
+ modelCustomizationName : modelInfo.modelCustomizationName,
+ modelCustomizationId : modelInfo.customizationUuid,
+ modelVersion : modelInfo.modelVersion
+ },
+ requestInfo : {
+ source : FIELD.ID.VID,
+ requestorId: requestorloggedInId
+ }
+ };
+
+ switch (_this.componentId) {
+ case COMPONENT.SERVICE:
+ requestDetails.requestParameters = {
+ aLaCarte : DataService.getALaCarte()
+ };
+ if ( !(DataService.getALaCarte()) ) {
+ // for macro delete include cloud config.
+ var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList);
+ if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) {
+ lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT,
+ parameterList);
+ }
+ requestDetails.cloudConfiguration = {
+ lcpCloudRegionId : lcpRegion,
+ tenantId : getValueFromList(FIELD.ID.TENANT, parameterList)
+ };
+ }
+ break;
+ case COMPONENT.VNF:
+ console.log("getMsoRequestDetails COMPONENT.VNF");
+ var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList);
+ if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) {
+ lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT,
+ parameterList);
+ }
+ requestDetails.cloudConfiguration = {
+ lcpCloudRegionId : lcpRegion,
+ tenantId : getValueFromList(FIELD.ID.TENANT, parameterList)
+ };
+
+ break;
+ case COMPONENT.VF_MODULE:
+ case COMPONENT.NETWORK:
+ var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList);
+ if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) {
+ lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT,
+ parameterList);
+ }
+ requestDetails.cloudConfiguration = {
+ lcpCloudRegionId : lcpRegion,
+ tenantId : getValueFromList(FIELD.ID.TENANT, parameterList)
+ };
+ break;
+ case COMPONENT.VOLUME_GROUP:
+ var lcpRegion = getValueFromList(FIELD.ID.LCP_REGION, parameterList);
+ if (lcpRegion === FIELD.KEY.LCP_REGION_TEXT) {
+ lcpRegion = getValueFromList(FIELD.ID.LCP_REGION_TEXT,
+ parameterList);
+ }
+ requestDetails.cloudConfiguration = {
+ lcpCloudRegionId : lcpRegion,
+ tenantId : getValueFromList(FIELD.ID.TENANT, parameterList)
+ };
+
+ break;
+ default:
+ requestDetails.cloudConfiguration = {
+ lcpCloudRegionId : DataService.getLcpRegion(),
+ tenantId : DataService.getTenant()
+ };
+ }
+ return requestDetails;
+ }
+
+ var getLcpRegion = function() {
+ var cloudRegionTenantList = DataService.getCloudRegionTenantList();
+ var parameter = "";
+ if ( UtilityService.hasContents (cloudRegionTenantList) ) {
+ parameter = FIELD.PARAMETER.LCP_REGION;
+ parameter.optionList = new Array();
+ for (var i = 0; i < cloudRegionTenantList.length; i++) {
+ for (var j = 0; j < parameter.optionList.length; j++) {
+ if (parameter.optionList[j].id === cloudRegionTenantList[i].cloudRegionId) {
+ break;
+ }
+ }
+ if (j < parameter.optionList.length) {
+ continue;
+ }
+ parameter.optionList.push({
+ id : cloudRegionTenantList[i].cloudRegionId
+ });
+ }
+ }
+ return parameter;
+ };
+
+ var getTenantList = function(cloudRegionId) {
+ var parameter = "";
+ var cloudRegionTenantList = DataService.getCloudRegionTenantList();
+ if ( UtilityService.hasContents (cloudRegionTenantList) ) {
+ var parameter = FIELD.PARAMETER.TENANT_ENABLED;
+ parameter.optionList = new Array();
+ for (var i = 0; i < cloudRegionTenantList.length; i++) {
+ if (cloudRegionTenantList[i].cloudRegionId === cloudRegionId) {
+ parameter.optionList.push({
+ id : cloudRegionTenantList[i].tenantId,
+ name : cloudRegionTenantList[i].tenantName
+ });
+ }
+ }
+ }
+ return parameter;
+
+ };
+
+ var addOptionList = function(parameter, optionSimpleArray) {
+ var optionList = new Array();
+ if (!angular.isArray(optionSimpleArray)) {
+ return optionList;
+ }
+ for (var i = 0; i < optionSimpleArray.length; i++) {
+ optionList.push({
+ name : optionSimpleArray[i]
+ });
+ }
+ parameter.optionList = optionList;
+ return parameter;
+ };
+
+ var getValueFromList = function(id, parameterList) {
+ for (var i = 0; i < parameterList.length; i++) {
+ if (parameterList[i].id === id) {
+ return parameterList[i].value;
+ }
+ }
+ };
+
+ var updateUserParameterList = function(updatedId, parameterListControl) {
+ if (updatedId === FIELD.ID.LCP_REGION) {
+ var list = parameterListControl.getList(updatedId);
+ if (list[0].selectedIndex >= 0) {
+ parameterListControl
+ .updateList([ getTenantList(list[0].value) ]);
+ } else {
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.TENANT_DISABLED ]);
+ }
+ if (list[0].value === FIELD.KEY.LCP_REGION_TEXT) {
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_VISIBLE ]);
+ } else {
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.LCP_REGION_TEXT_HIDDEN ]);
+ }
+ } else if (updatedId === FIELD.ID.SUBSCRIBER_NAME) {
+ var list = parameterListControl.getList(updatedId);
+ if (list[0].selectedIndex >= 0) {
+ DataService.setGlobalCustomerId(list[0].value);
+
+ AaiService.getSubscriptionServiceTypeList(DataService
+ .getGlobalCustomerId(), function(response) {
+ DataService.setSubscriptionServiceTypeList(response);
+ var serviceTypeParameters = FIELD.PARAMETER.SERVICE_TYPE;
+ serviceTypeParameters.optionList = [];
+
+ for (var i = 0; i < response.length; i++) {
+ serviceTypeParameters.optionList.push({
+ "id" : response[i],
+ "name" : response[i]
+ });
+ }
+ parameterListControl.updateList([ serviceTypeParameters ]);
+ });
+
+ } else {
+ parameterListControl
+ .updateList([ FIELD.PARAMETER.SERVICE_TYPE_DISABLED ]);
+ }
+ }
+ };
+
+ return {
+ initializeComponent : function(componentId) {
+ _this.componentId = ComponentService.initialize(componentId);
+ },
+ getComponentDisplayName : ComponentService.getComponentDisplayName,
+ getSummaryList : getSummaryList,
+ getParameters : function(getParametersHandler) {
+ _this.getParametersHandler = getParametersHandler;
+ UtilityService.setHttpErrorHandler(_this.httpErrorHandler);
+ UtilityService.startAsyncOperations(getAsyncOperationList(),
+ internalGetParametersHandler);
+ },
+ updateUserParameterList : updateUserParameterList,
+ getMsoRequestDetails : getMsoRequestDetails,
+ getMsoUrl : getMsoUrl
+ }
+}
+
+appDS2.factory("DeletionService", [ "$log", "AaiService", "AsdcService",
+ "DataService", "ComponentService", "COMPONENT", "FIELD",
+ "UtilityService", DeletionService ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/detailsService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/detailsService.js
new file mode 100755
index 0000000..37220ff
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/detailsService.js
@@ -0,0 +1,98 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+var DetailsService = function($log, DataService, ComponentService, COMPONENT,
+ FIELD, UtilityService) {
+
+ var _this = this;
+
+ var getSummaryList = function() {
+ switch (_this.componentId) {
+ case COMPONENT.NETWORK:
+ case COMPONENT.SERVICE:
+ case COMPONENT.VNF:
+ case COMPONENT.VF_MODULE:
+ case COMPONENT.VOLUME_GROUP:
+ return [ {
+ name : FIELD.NAME.SUBSCRIBER_NAME,
+ value : DataService.getSubscriberName()
+ }, {
+ name : FIELD.NAME.SERVICE_INSTANCE_ID,
+ value : DataService.getServiceInstanceId()
+ }, {
+ name : FIELD.NAME.SERVICE_TYPE,
+ value : DataService.getServiceType()
+ } ];
+ }
+ };
+
+ var getDetailsList = function() {
+ switch (_this.componentId) {
+ case COMPONENT.NETWORK:
+ case COMPONENT.SERVICE:
+ case COMPONENT.VNF:
+ case COMPONENT.VF_MODULE:
+ case COMPONENT.VOLUME_GROUP:
+ return ComponentService.getDisplayNames(ComponentService
+ .getInventoryParameterList(_this.componentId, DataService
+ .getInventoryItem(), false));
+ }
+ };
+
+ var getMsoFilterString = function() {
+
+ var instanceId = "";
+
+ switch (_this.componentId) {
+ case COMPONENT.NETWORK:
+ instanceId = DataService.getNetworkInstanceId();
+ break;
+ case COMPONENT.SERVICE:
+ instanceId = DataService.getServiceInstanceId();
+ break;
+ case COMPONENT.VNF:
+ instanceId = DataService.getVnfInstanceId();
+ break;
+ case COMPONENT.VF_MODULE:
+ instanceId = DataService.getVfModuleInstanceId();
+ break;
+ case COMPONENT.VOLUME_GROUP:
+ instanceId = DataService.getVolumeGroupInstanceId();
+ }
+
+ return "filter=" + _this.componentId + "InstanceId:EQUALS:"
+ + instanceId;
+ };
+
+ return {
+ initializeComponent : function(componentId) {
+ _this.componentId = ComponentService.initialize(componentId);
+ },
+ getComponentDisplayName : ComponentService.getComponentDisplayName,
+ getSummaryList : getSummaryList,
+ getDetailsList : getDetailsList,
+ getMsoFilterString : getMsoFilterString
+ }
+}
+
+appDS2.factory("DetailsService", [ "$log", "DataService", "ComponentService",
+ "COMPONENT", "FIELD", "UtilityService", DetailsService ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js
new file mode 100755
index 0000000..864abe6
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/msoService.js
@@ -0,0 +1,175 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+var MsoService = function($http, $log, PropertyService, UtilityService, COMPONENT, FIELD) {
+
+ var _this = this;
+
+ /*
+ * Common function to handle both create and delete instance requests
+ */
+ var requestInstanceUpdate = function(request, successCallbackFunction) {
+ $log.debug("MsoService:requestInstanceUpdate: request:");
+ $log.debug(request);
+ $http.post( "mso/" + request.url, {
+ requestDetails : request.requestDetails
+ }, {
+ timeout : PropertyService.getServerResponseTimeoutMsec()
+ }).then(successCallbackFunction)["catch"]
+ (UtilityService.runHttpErrorHandler);
+ }
+
+ var checkValidStatus = function(response) {
+ if (response.data.status < 200 || response.data.status > 202) {
+ throw {
+ type : FIELD.ID.MSO_FAILURE
+ }
+ }
+ }
+
+ var addListEntry = function(name, value) {
+ var entry = '"' + name + '": ';
+ if (value === undefined) {
+ return entry + "undefined";
+ } else {
+ return entry + '"' + value + '"';
+ }
+ }
+
+ return {
+ createInstance : requestInstanceUpdate,
+ deleteInstance : requestInstanceUpdate,
+ getOrchestrationRequest : function(requestId, successCallbackFunction) {
+ $log.debug("MsoService:getOrchestrationRequest: requestId: "
+ + requestId);
+ $http.get(
+ "mso/mso_get_orch_req/"
+ + requestId + "?r=" + Math.random(),
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(successCallbackFunction)["catch"]
+ (UtilityService.runHttpErrorHandler);
+ },
+ getOrchestrationRequests : function(filterString,
+ successCallbackFunction) {
+ $log.debug("MsoService:getOrchestrationRequests: filterString: "
+ + filterString);
+ $http.get(
+ "mso/mso_get_orch_reqs/"
+ + encodeURIComponent(filterString) + "?r="
+ + Math.random(),
+ {
+ timeout : PropertyService
+ .getServerResponseTimeoutMsec()
+ }).then(successCallbackFunction)["catch"]
+ (UtilityService.runHttpErrorHandler);
+ },
+ getFormattedCommonResponse : function(response) {
+ return UtilityService.getCurrentTime() + " HTTP Status: "
+ + UtilityService.getHttpStatusText(response.data.status)
+ + "\n" + angular.toJson(response.data.entity, true)
+
+ },
+ checkValidStatus : checkValidStatus,
+ getFormattedGetOrchestrationRequestsResponse : function(response) {
+ UtilityService.checkUndefined(COMPONENT.ENTITY, response.data.entity);
+ UtilityService.checkUndefined(COMPONENT.STATUS, response.data.status);
+ checkValidStatus(response);
+
+ var list = response.data.entity.requestList
+ UtilityService.checkUndefined(FIELD.ID.REQUEST_LIST, list);
+
+ var message = "";
+
+ for (var i = 0; i < list.length; i++) {
+ var request = list[i].request;
+ message += addListEntry(FIELD.ID.REQUEST_ID, request.requestId) + ",\n";
+ message += addListEntry(FIELD.ID.REQUEST_TYPE, request.requestType)
+ + ",\n";
+ var status = request.requestStatus;
+ if (status === undefined) {
+ message += addListEntry(FIELD.ID.REQUEST_STATUS, undefined) + "\n";
+ } else {
+ message += addListEntry(FIELD.ID.TIMESTAMP, status.timestamp)
+ + ",\n";
+ message += addListEntry(FIELD.ID.REQUEST_STATE, status.requestState)
+ + ",\n";
+ message += addListEntry(FIELD.ID.REQUEST_STATUS,
+ status.statusMessage)
+ + ",\n";
+ message += addListEntry(FIELD.ID.PERCENT_PROGRESS,
+ status.percentProgress)
+ + "\n";
+ }
+ if (i < (list.length - 1)) {
+ message += "\n";
+ }
+ }
+ return message;
+ },
+ getFormattedSingleGetOrchestrationRequestResponse : function (response) {
+ UtilityService.checkUndefined(COMPONENT.ENTITY, response.data.entity);
+ UtilityService.checkUndefined(COMPONENT.STATUS, response.data.status);
+ checkValidStatus(response);
+
+ var message = "";
+ if ( UtilityService.hasContents (response.data.entity.request) ) {
+ var request = response.data.entity.request;
+ message += addListEntry(FIELD.ID.REQUEST_ID, request.requestId) + ",\n";
+ message += addListEntry(FIELD.ID.REQUEST_TYPE, request.requestType)
+ + ",\n";
+ var status = request.requestStatus;
+ if (status === undefined) {
+ message += addListEntry(FIELD.ID.REQUEST_STATUS, undefined) + "\n";
+ } else {
+ message += addListEntry(FIELD.ID.TIMESTAMP, status.timestamp)
+ + ",\n";
+ message += addListEntry(FIELD.ID.REQUEST_STATE, status.requestState)
+ + ",\n";
+ message += addListEntry(FIELD.ID.REQUEST_STATUS,
+ status.statusMessage)
+ + ",\n";
+ message += addListEntry(FIELD.ID.PERCENT_PROGRESS,
+ status.percentProgress)
+ + "\n\n";
+ }
+ }
+ return message;
+ },
+ showResponseContentError : function(error, showFunction) {
+ switch (error.type) {
+ case "undefinedObject":
+ showFunction(FIELD.ERROR.SYSTEM_FAILURE, error.message);
+ break;
+ case "msoFailure":
+ showFunction(FIELD.ERROR.MSO, "")
+ break;
+ default:
+ showFunction(FIELD.ERROR.SYSTEM_FAILURE);
+ }
+ }
+ }
+}
+
+appDS2.factory("MsoService", [ "$http", "$log", "PropertyService",
+ "UtilityService", "COMPONENT", "FIELD", MsoService ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/propertyService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/propertyService.js
new file mode 100755
index 0000000..ad9bf7d
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/propertyService.js
@@ -0,0 +1,89 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+var PropertyService = function($location, $http, VIDCONFIGURATION ) {
+
+ var RE = /.*?:\/\/.*?:.*?\/(.*?)\//g;
+ var BASE_PATH = "vid";
+ var DEFAULT_AAI_BASE_URL = "/" + BASE_PATH;
+ var DEFAULT_ASDC_BASE_URL = "asdc";
+ var DEFAULT_MSO_MAX_POLLING_INTERVAL_MSEC = 60000;
+ var DEFAULT_MSO_MAX_POLLS = 10;
+ var DEFAULT_MSO_BASE_URL = "/" + BASE_PATH + "/mso";
+ var DEFAULT_SERVER_RESPONSE_TIMEOUT_MSEC = 60000;
+ var MSO_POLLING_INTERVAL_MSECS = "mso_polling_interval_msecs";
+ var MSO_MAX_POLLS = "mso_max_polls";
+
+ var _this = this;
+
+ _this.asdcBaseUrl = DEFAULT_ASDC_BASE_URL;
+ _this.aaiBaseUrl = DEFAULT_AAI_BASE_URL;
+ _this.msoMaxPollingIntervalMsec = DEFAULT_MSO_MAX_POLLING_INTERVAL_MSEC;
+ _this.msoMaxPolls = DEFAULT_MSO_MAX_POLLS;
+ _this.msoBaseUrl = DEFAULT_MSO_BASE_URL;
+ _this.serverResponseTimeoutMsec = DEFAULT_SERVER_RESPONSE_TIMEOUT_MSEC;
+
+ return {
+
+ setAaiBaseUrl : function(aaiBaseUrl) {
+ _this.aaiBaseUrl = aaiBaseUrl;
+ },
+
+ setAsdcBaseUrl : function(asdcBaseUrl) {
+ _this.asdcBaseUrl = asdcBaseUrl;
+ },
+ retrieveMsoMaxPollingIntervalMsec : function() {
+ _this.msoMaxPollingIntervalMsec = VIDCONFIGURATION.MSO_POLLING_INTERVAL_MSECS;
+ return _this.msoMaxPollingIntervalMsec;
+ },
+ getMsoMaxPollingIntervalMsec : function() {
+ return _this.msoMaxPollingIntervalMsec;
+ },
+ setMsoMaxPollingIntervalMsec : function(msoMaxPollingIntervalMsec) {
+ _this.msoMaxPollingIntervalMsec = msoMaxPollingIntervalMsec;
+ },
+ retrieveMsoMaxPolls : function() {
+ _this.msoMaxPolls = VIDCONFIGURATION.MSO_MAX_POLLS;
+ return _this.msoMaxPolls;
+ },
+ getMsoMaxPolls : function() {
+ return _this.msoMaxPolls;
+ },
+ setMsoMaxPolls : function(msoMaxPolls) {
+ _this.msoMaxPolls = msoMaxPolls;
+ },
+ getMsoBaseUrl : function() {
+ return "mso";
+ },
+ setMsoBaseUrl : function(msoBaseUrl) {
+ _this.msoBaseUrl = msoBaseUrl;
+ },
+ getServerResponseTimeoutMsec : function() {
+ return _this.serverResponseTimeoutMsec;
+ },
+ setServerResponseTimeoutMsec : function(serverResponseTimeoutMsec) {
+ _this.serverResponseTimeoutMsec = serverResponseTimeoutMsec;
+ }
+ };
+}
+
+appDS2.factory("PropertyService", PropertyService);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/statusService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/statusService.js
new file mode 100755
index 0000000..3ed56c3
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/statusService.js
@@ -0,0 +1,185 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+var StatusService = function($log, AaiService, DataService, ComponentService, COMPONENT,
+ FIELD, PARAMETER, UtilityService) {
+
+ var _this = this;
+
+ var getAsyncOperationList = function() {
+
+ return [ getTargetProvStatus ];
+
+ };
+
+ var getSummaryList = function() {
+ switch (_this.componentId) {
+ case COMPONENT.NETWORK:
+ case COMPONENT.SERVICE:
+ case COMPONENT.VNF:
+ case COMPONENT.VF_MODULE:
+ case COMPONENT.VOLUME_GROUP:
+ return [ {
+ name : FIELD.NAME.SUBSCRIBER_NAME,
+ value : DataService.getSubscriberName()
+ }, {
+ name : FIELD.NAME.SERVICE_INSTANCE_ID,
+ value : DataService.getServiceInstanceId()
+ }, {
+ name : FIELD.NAME.SERVICE_INSTANCE_ID,
+ value : DataService.getServiceInstanceName()
+ }, {
+ name : FIELD.NAME.SERVICE_TYPE,
+ value : DataService.getServiceType()
+ } ];
+ }
+ };
+
+ var getVNFStatusList = function() {
+ var inventoryItem = DataService.getInventoryItem();
+ var newProvStatus = DataService.getUpdatedVNFProvStatus();
+ if ( UtilityService.hasContents(newProvStatus) ) {
+
+ }
+ else
+ {
+ newProvStatus = inventoryItem['prov-status'];
+ }
+ return [ {
+ name : FIELD.NAME.VNF_VNF_ID,
+ value : inventoryItem['vnf-id']
+ }, {
+ name : FIELD.NAME.VNF_VNF_Name,
+ value : inventoryItem['vnf-name']
+ }, {
+ name : FIELD.NAME.VNF_VNF_Type,
+ value : inventoryItem['vnf-type']
+ }, {
+ name : FIELD.NAME.VNF_Service_ID,
+ value : inventoryItem['service-id']
+ }, {
+ name : FIELD.NAME.VNF_ORCHESTRATION_STATUS,
+ value :inventoryItem['orchestration-status']
+ }, {
+ name : FIELD.NAME.VNF_In_Maint,
+ value :inventoryItem['in-maint']
+ }, {
+ name : FIELD.NAME.VNF_Operational_Status,
+ value :inventoryItem['operational-state']
+ },
+ {
+ name : FIELD.NAME.VNF_Current_Prov_Status,
+ value : newProvStatus
+ }
+ ];
+ };
+
+ var internalGetParametersHandler = function() {
+ if (angular.isFunction(_this.getParametersHandler)) {
+ if (_this.componentId == COMPONENT.SERVICE)
+ _this.getParametersHandler({
+ summaryList : getSummaryList(),
+ userProvidedList : getUserProvidedList()
+ }, true);
+ else
+ _this.getParametersHandler({
+ summaryList : getSummaryList(),
+ userProvidedList : getUserProvidedList()
+ }, false);
+ }
+ };
+
+ var getTargetProvStatus = function() {
+ AaiService.getProvOptionsFromSystemProp(function(response) {
+ DataService.setSystemPropProvStatus(response);
+ UtilityService.startNextAsyncOperation();
+ });
+ };
+
+ var getUserProvidedList = function() {
+
+ var parameterList = [];
+
+ parameterList = parameterList.concat([
+ getTargetProvParameter()]);
+
+ return parameterList;
+ };
+
+ var getTargetProvParameter = function() {
+ var provStatus = DataService.getSystemPropProvStatus();
+ var parameter = FIELD.PARAMETER.VNF_TARGET_PROVSTATUS;
+ var provArray = provStatus.data.split(",");
+ parameter.optionList = new Array();
+ for (var i = 0; i < provArray.length; i++) {
+ parameter.optionList.push({
+ id : i+1,
+ name : provArray[i]
+ });
+ }
+ return parameter;
+ };
+
+ var getTargetProvParameterText = function(index) {
+ var provStatus = DataService.getSystemPropProvStatus();
+ var parameter = FIELD.PARAMETER.VNF_TARGET_PROVSTATUS;
+ var provArray = provStatus.data.split(",");
+
+ return provArray[index-1];
+ };
+
+ var getTargetProvParameters = function() {
+ var provStatus = DataService.getSystemPropProvStatus();
+
+ };
+
+ var updateUserParameterList = function(updatedId, parameterListControl) {
+ console.log ("updateUserParameterList() updatedId=" + updatedId);
+ if (updatedId === FIELD.ID.VNF_TARGETPROVSTATUS) {
+ var list = parameterListControl.getList(updatedId);
+
+ }
+ };
+
+ return {
+ initializeComponent : function(componentId) {
+ _this.componentId = ComponentService.initialize(componentId);
+ },
+ setHttpErrorHandler : function(httpErrorHandler) {
+ _this.httpErrorHandler = httpErrorHandler;
+ },
+ getComponentDisplayName : ComponentService.getComponentDisplayName,
+ getSummaryList : getSummaryList,
+ getVNFStatusList : getVNFStatusList,
+ getParameters : function(getParametersHandler) {
+ _this.getParametersHandler = getParametersHandler;
+ UtilityService.setHttpErrorHandler(_this.httpErrorHandler);
+ UtilityService.startAsyncOperations(getAsyncOperationList(),
+ internalGetParametersHandler);
+ },
+ updateUserParameterList : updateUserParameterList,
+ getTargetProvParameterText : getTargetProvParameterText
+ }
+}
+
+appDS2.factory("StatusService", [ "$log", "AaiService", "DataService", "ComponentService",
+ "COMPONENT", "FIELD", "PARAMETER", "UtilityService", StatusService ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/utilityService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/utilityService.js
new file mode 100755
index 0000000..1333269
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/utilityService.js
@@ -0,0 +1,640 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+/*
+ * "UtilityService" contains various generic methods.
+ *
+ * (*** DEPRECATED - Use PropertyService instead ***) setProperties() and
+ * getProperties()
+ *
+ * SYNTAX: hasContents(object)
+ *
+ * Returns "true" if "object" contains contents (i.e. is NOT undefined, null or
+ * ""), "false" otherwise.
+ *
+ * SYNTAX: checkUndefined(name, value)
+ *
+ * Throws an exception if "value" is undefined. The exception includes "name" as
+ * the cause of the exception. Returns "value" if it is defined.
+ *
+ * SYNTAX: getCurrentTime()
+ *
+ * Returns the current local date and time in the format "MM/DD/YY HH:MM:SS"
+ *
+ * SYNTAX: setHttpErrorHandler(function)
+ *
+ * Sets the HTTP error handler to "function".
+ *
+ * SYNTAX: runHttpErrorHandler(response, status)
+ *
+ * Logs warning messages and the runs the HTTP error handler previously set by
+ * "setHttpErrorHandler". The intended usage is for "$http" calls. Example:
+ * $http.get(...).then(...)["catch"](UtilityService.runHttpErrorHandler);
+ *
+ * SYNTAX: getHttpStatusText(statusCode)
+ *
+ * Expects "statusCode" to be an HTTP response code (e.g. 404). The function
+ * returns a string that includes both the code and an equivalent text summary.
+ * Example: "Not found (404)"
+ *
+ * SYNTAX: getHttpErrorMessage(response)
+ *
+ * Expects "response" to be the response object generated by a "$http" error
+ * condition. "getHttpErrorMessage" examines the object and returns a summary
+ * string for some known conditions.
+ */
+
+var UtilityService = function($log, DataService) {
+
+ var _this = this;
+ var convertModel = function (serviceModel) {
+
+ var isNewFlow = false;
+
+ for (var networkCustomizationName in serviceModel.networks) {
+ var networkModel = serviceModel.networks[networkCustomizationName];
+ if ( networkModel.customizationUuid != null ) {
+ isNewFlow = true;
+ break;
+ }
+ }
+ if ( !isNewFlow ) {
+ for (var vnfCustomizationName in serviceModel.vnfs) {
+ var vnfModel = serviceModel.vnfs[vnfCustomizationName];
+ if ( vnfModel.customizationUuid != null ) {
+ isNewFlow = true;
+ break;
+ }
+ }
+ }
+ if ( isNewFlow ) {
+ return (convertNewModel (serviceModel) );
+ }
+ else {
+ return (convertOldModel (serviceModel) );
+ }
+ };
+ var convertNewModel = function (serviceModel ) {
+ var completeResources = new Array();
+ var resource = {};
+ var convertedAsdcModel = {
+ "service": serviceModel.service,
+ "networks": {},
+ "vnfs": {},
+ "completeDisplayInputs": {},
+ "isNewFlow": true
+ };
+ var networkModelDisplayInputs = {};
+ var vnfModelDisplayInputs = {};
+ for (var networkCustomizationName in serviceModel.networks) {
+ var networkModel = serviceModel.networks[networkCustomizationName];
+
+ convertedAsdcModel.networks[networkModel.customizationUuid] = {
+ "uuid": networkModel.uuid,
+ "invariantUuid": networkModel.invariantUuid,
+ "version": networkModel.version,
+ "name": networkModel.name,
+ "modelCustomizationName": networkModel.modelCustomizationName,
+ "customizationUuid": networkModel.customizationUuid,
+ "inputs": "",
+ "description": networkModel.description,
+ "commands": {},
+ "displayInputs": {}
+ }
+ resource = {
+ "name": networkModel.modelCustomizationName,
+ "description": networkModel.description
+ };
+ completeResources.push (resource);
+
+ if (networkModel.commands != null) {
+ /*
+ * commands:
+ * internal_net_param_ntu: {
+ * command: get_input,
+ * displaName: internal_net_param_ntu,
+ * inputName: vccfd1_internal_net_param_ntu // pointer to input key
+ * }
+ * If the input name (ptr) is one of instance_node_target, naming_policy or vf_instance_name
+ * then ignore it
+ *
+ */
+
+ for ( var cmd in networkModel.commands ) {
+ var cmdObj = networkModel.commands[cmd];
+ if ( cmdObj.inputName != null ) {
+ switch (cmdObj.inputName) {
+ case "instance_node_target":
+ break;
+ case "naming_policy":
+ break;
+ case "vf_instance_name":
+ break;
+ default:
+ if (serviceModel.service != null && serviceModel.service.inputs != null &&
+ serviceModel.service.inputs[cmdObj.inputName] != null ) {
+ networkModelDisplayInputs[cmdObj.inputName] = (serviceModel.service.inputs[cmdObj.inputName]);
+ }
+ }
+
+ }
+
+ }
+ convertedAsdcModel.networks[networkModel.customizationUuid].displayInputs=networkModelDisplayInputs;
+
+ }
+ }
+
+ for (var vnfCustomizationName in serviceModel.vnfs) {
+ var vnfModel = serviceModel.vnfs[vnfCustomizationName];
+ var vnfCustomizationUuid = vnfModel.customizationUuid;
+ convertedAsdcModel.vnfs[vnfModel.customizationUuid] = {
+ "uuid": vnfModel.uuid,
+ "invariantUuid": vnfModel.invariantUuid,
+ "version": vnfModel.version,
+ "name": vnfModel.name,
+ "modelCustomizationName": vnfModel.modelCustomizationName,
+ "customizationUuid": vnfModel.customizationUuid,
+ "inputs": "",
+ "description": vnfModel.description,
+ "vfModules": {},
+ "volumeGroups": {},
+ "commands": {},
+ "displayInputs": {},
+ "properties": {},
+ "nfRole": "",
+ "nfType": ""
+ }
+
+ resource = {
+ "name": vnfModel.modelCustomizationName,
+ "description": vnfModel.description
+ };
+ completeResources.push (resource);
+
+ if (vnfModel.commands != null) {
+ /*
+ * commands: {
+ * internal_net_param_ntu: {
+ * command: get_input,
+ * displaName: internal_net_param_ntu,
+ * inputName: vccfd1_internal_net_param_ntu // pointer to input key
+ * }
+ * If the input name (ptr) is one of instance_node_target, naming_policy or vf_instance_name
+ * then ignore it
+ *
+ */
+
+ for ( var cmd in vnfModel.commands ) {
+ var cmdObj = vnfModel.commands[cmd];
+ if ( cmdObj.inputName != null ) {
+ // To Do: Make this list configurable
+ switch (cmdObj.inputName) {
+ case "instance_node_target":
+ break;
+ case "naming_policy":
+ break;
+ case "vf_instance_name":
+ break;
+ default:
+ if (serviceModel.service != null && serviceModel.service.inputs != null &&
+ serviceModel.service.inputs[cmdObj.inputName] != null ) {
+ vnfModelDisplayInputs[cmdObj.inputName] = (serviceModel.service.inputs[cmdObj.inputName]);
+ }
+ }
+
+ }
+
+ }
+
+ convertedAsdcModel.vnfs[vnfCustomizationUuid].displayInputs=vnfModelDisplayInputs;
+ convertedAsdcModel.vnfs[vnfCustomizationUuid].properties=vnfModel.properties;
+ //
+ var vnf_type = "";
+ var vnf_role = "";
+ var vnf_function = "";
+ var vnf_code = "";
+ if ( !( isObjectEmpty(vnfModel.properties) ) ) {
+ if (hasContents (vnfModel.properties.nf_type) ) {
+ vnf_type = vnfModel.properties.nf_type;
+ }
+ if (hasContents (vnfModel.properties.nf_role) ) {
+ vnf_role = vnfModel.properties.nf_role;
+ }
+ if (hasContents (vnfModel.properties.nf_function) ) {
+ vnf_function = vnfModel.properties.nf_function;
+ }
+ if (hasContents (vnfModel.properties.nf_code) ) {
+ vnf_code = vnfModel.properties.nf_code;
+ }
+ }
+ convertedAsdcModel.vnfs[vnfCustomizationUuid]["nfType"] = vnf_type;
+ convertedAsdcModel.vnfs[vnfCustomizationUuid]["nfRole"] = vnf_role;
+ convertedAsdcModel.vnfs[vnfCustomizationUuid]["nfFunction"] = vnf_function;
+ convertedAsdcModel.vnfs[vnfCustomizationUuid]["nfCode"] = vnf_code;
+ //
+ for (var vfModuleCustomizationName in serviceModel.vnfs[vnfCustomizationName].vfModules) {
+ var vfModuleModel = serviceModel.vnfs[vnfCustomizationName].vfModules[vfModuleCustomizationName];
+ convertedAsdcModel.vnfs[vnfCustomizationUuid].vfModules[vfModuleModel.customizationUuid] = vfModuleModel;
+ }
+
+ for (var volumeGroupCustomizationName in serviceModel.vnfs[vnfCustomizationName].volumeGroups) {
+ var volumeGroupModel = serviceModel.vnfs[vnfCustomizationName].volumeGroups[volumeGroupCustomizationName];
+ convertedAsdcModel.vnfs[vnfCustomizationUuid].volumeGroups[volumeGroupModel.customizationUuid] = volumeGroupModel;
+ }
+ }
+ }
+
+ var completeDisplayInputs = {};
+
+ for (var key in vnfModelDisplayInputs) {
+ completeDisplayInputs[key] = vnfModelDisplayInputs[key];
+ }
+ for (var key in networkModelDisplayInputs) {
+ completeDisplayInputs[key] = networkModelDisplayInputs[key];
+ }
+
+ convertedAsdcModel.completeDisplayInputs = completeDisplayInputs;
+ // Need to collect all the model customization names (node template tag) and descriptions
+ DataService.setResources (completeResources);
+
+ console.log ("convertedAsdcModel: "); console.log (JSON.stringify ( convertedAsdcModel, null, 4 ));
+ return (convertedAsdcModel);
+ };
+
+ var convertOldModel = function (serviceModel ) {
+
+ var resource = {};
+ var convertedAsdcModel = {
+ "service": serviceModel.service,
+ "networks": {},
+ "vnfs": {},
+ "completeDisplayInputs": {},
+ "isNewFlow": false
+ };
+ var completeResources = new Array();
+ var resource = {};
+ var vnfModelDisplayInputs = {};
+ var networkModelDisplayInputs = {};
+ for (var networkCustomizationName in serviceModel.networks) {
+ var networkModel = serviceModel.networks[networkCustomizationName];
+ convertedAsdcModel.networks[networkModel.invariantUuid] = {};
+ //convertedAsdcModel.networks[networkModel.invariantUuid][networkModel.version] = networkModel;
+ // need a network model to test this
+ convertedAsdcModel.networks[networkModel.uuid] = {
+ "uuid": networkModel.uuid,
+ "invariantUuid": networkModel.invariantUuid,
+ "version": networkModel.version,
+ "name": networkModel.name,
+ "modelCustomizationName": networkModel.modelCustomizationName,
+ "customizationUuid": networkModel.customizationUuid,
+ "inputs": "",
+ "description": networkModel.description,
+ "commands": {},
+ "displayInputs": {}
+ }
+ resource = {
+ "name": networkModel.modelCustomizationName,
+ "description": networkModel.description
+ };
+ completeResources.push (resource);
+ if (networkModel.commands != null) {
+ /*
+ * commands:
+ * internal_net_param_ntu: {
+ * command: get_input,
+ * displaName: internal_net_param_ntu,
+ * inputName: vccfd1_internal_net_param_ntu // pointer to input key
+ * }
+ * If the input name (ptr) is one of instance_node_target, naming_policy or vf_instance_name
+ * then ignore it
+ *
+ */
+
+ for ( var cmd in networkModel.commands ) {
+ var cmdObj = networkModel.commands[cmd];
+ if ( cmdObj.inputName != null ) {
+ switch (cmdObj.inputName) {
+ case "instance_node_target":
+ break;
+ case "naming_policy":
+ break;
+ case "vf_instance_name":
+ break;
+ default:
+ if (serviceModel.service != null && serviceModel.service.inputs != null &&
+ serviceModel.service.inputs[cmdObj.inputName] != null ) {
+ networkModelDisplayInputs[cmdObj.inputName] = (serviceModel.service.inputs[cmdObj.inputName]);
+ }
+ }
+
+ }
+
+ }
+ convertedAsdcModel.networks[networkModel.uuid].displayInputs=networkModelDisplayInputs;
+ }
+ }
+
+ for (var vnfCustomizationName in serviceModel.vnfs) {
+ var vnfModel = serviceModel.vnfs[vnfCustomizationName];
+ convertedAsdcModel.vnfs[vnfModel.uuid] = {
+ "uuid": vnfModel.uuid,
+ "invariantUuid": vnfModel.invariantUuid,
+ "version": vnfModel.version,
+ "name": vnfModel.name,
+ "modelCustomizationName": vnfModel.modelCustomizationName,
+ "customizationUuid": vnfModel.customizationUuid,
+ "inputs": "",
+ "description": vnfModel.description,
+ "vfModules": {},
+ "volumeGroups": {},
+ "commands": {},
+ "displayInputs": {}
+ }
+ resource = {
+ "name": vnfModel.modelCustomizationName,
+ "description": vnfModel.description
+ };
+ completeResources.push (resource);
+
+ if (vnfModel.commands != null) {
+ /*
+ * commands: {
+ * internal_net_param_ntu: {
+ * command: get_input,
+ * displaName: internal_net_param_ntu,
+ * inputName: vccfd1_internal_net_param_ntu // pointer to input key
+ * }
+ * If the input name (ptr) is one of instance_node_target, naming_policy or vf_instance_name
+ * then ignore it
+ *
+ */
+
+ for ( var cmd in vnfModel.commands ) {
+ var cmdObj = vnfModel.commands[cmd];
+ if ( cmdObj.inputName != null ) {
+ // To Do: Make this list configurable
+ switch (cmdObj.inputName) {
+ case "instance_node_target":
+ break;
+ case "naming_policy":
+ break;
+ case "vf_instance_name":
+ break;
+ default:
+ if (serviceModel.service != null && serviceModel.service.inputs != null &&
+ serviceModel.service.inputs[cmdObj.inputName] != null ) {
+ vnfModelDisplayInputs[cmdObj.inputName] = (serviceModel.service.inputs[cmdObj.inputName]);
+ }
+ }
+
+ }
+
+ }
+ convertedAsdcModel.vnfs[vnfModel.uuid].displayInputs=vnfModelDisplayInputs;
+ }
+
+ for (var vfModuleCustomizationName in serviceModel.vnfs[vnfCustomizationName].vfModules) {
+ var vfModuleModel = serviceModel.vnfs[vnfCustomizationName].vfModules[vfModuleCustomizationName];
+ convertedAsdcModel.vnfs[vnfModel.uuid].vfModules[vfModuleModel.uuid] = vfModuleModel;
+ }
+
+ for (var volumeGroupCustomizationName in serviceModel.vnfs[vnfCustomizationName].volumeGroups) {
+ var volumeGroupModel = serviceModel.vnfs[vnfCustomizationName].volumeGroups[volumeGroupCustomizationName];
+ convertedAsdcModel.vnfs[vnfModel.uuid].volumeGroups[volumeGroupModel.uuid] = volumeGroupModel;
+ }
+ }
+ //console.log ("convertedAsdcModel: "); console.log (JSON.stringify ( convertedAsdcModel, null, 4 ) );
+
+ var completeDisplayInputs = {};
+
+ for (var key in vnfModelDisplayInputs) {
+ completeDisplayInputs[key] = vnfModelDisplayInputs[key];
+ }
+ for (var key in networkModelDisplayInputs) {
+ completeDisplayInputs[key] = networkModelDisplayInputs[key];
+ }
+
+ convertedAsdcModel.completeDisplayInputs = completeDisplayInputs;
+ // Need to collect all the model customization names (node template tag) and descriptions
+ DataService.setResources (completeResources);
+ console.log ("convertedAsdcModel: "); console.log (JSON.stringify ( convertedAsdcModel, null, 4 ));
+ return (convertedAsdcModel);
+ };
+
+ function hasContents(object) {
+ if (object === undefined || object === null || object === "") {
+ return false;
+ }
+ return true;
+ };
+ function isObjectEmpty(o) {
+ var len = 0;
+ if (hasContents(o)){
+ var keys = Object.keys(o);
+ len = keys.length;
+ if ( len == 0 ) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ else {
+ return true;
+ }
+ };
+ function padZero(number) {
+ if (number < 10) {
+ return "0" + number;
+ } else {
+ return "" + number;
+ }
+ };
+
+ var httpErrorHandler = function(response, status) {
+ $log.warn("UtilityService:httpErrorHandler: response:");
+ $log.warn(response);
+ $log.warn("UtilityService:httpErrorHandler: status:");
+ $log.warn(status);
+ if (angular.isFunction(_this.httpErrorHandler)) {
+ _this.httpErrorHandler(response, status);
+ }
+ };
+
+ var startNextAsyncOperation = function() {
+ if (_this.asyncOperations.count < _this.asyncOperations.operationList.length) {
+ _this.asyncOperations.operationList[_this.asyncOperations.count++]
+ ();
+ } else {
+ if (angular.isFunction(_this.asyncOperations.callbackFunction)) {
+ _this.asyncOperations.callbackFunction();
+ }
+ }
+ };
+
+ return {
+ setProperties : function(properties) {
+ _this.properties = properties;
+ },
+ getProperties : function() {
+ return _this.properties;
+ },
+ hasContents : hasContents,
+ checkUndefined : function(name, value) {
+ if (value === undefined) {
+ throw {
+ type : "undefinedObject",
+ message : "undefined object: \"" + name + "\""
+ };
+ }
+ return value;
+ },
+ jsonConcat : function (o1, o2) {
+ for (var key in o2) {
+ o1[key] = o2[key];
+ }
+ return o1;
+ },
+ getCurrentTime : function() {
+ var time = new Date();
+ return padZero(time.getMonth() + 1) + "/"
+ + padZero(time.getDate()) + "/"
+ + (time.getFullYear() - 2000) + " "
+ + padZero(time.getHours()) + ":"
+ + padZero(time.getMinutes()) + ":"
+ + padZero(time.getSeconds())
+ },
+ getHttpStatusText : function(statusCode) {
+ var statusMap = {
+ "200" : "OK",
+ "201" : "Created",
+ "202" : "Accepted",
+ "400" : "Bad Request",
+ "401" : "Unauthorized",
+ "404" : "Not Found",
+ "405" : "Method Not Allowed",
+ "409" : "Locked",
+ "500" : "Internal Server Error",
+ "503" : "Service Unavailable",
+ "504" : "Gateway Timeout"
+ }
+
+ if (status === undefined) {
+ return "Undefined";
+ }
+
+ var statusText = statusMap[statusCode];
+ if (statusText === undefined) {
+ statusText = "Unknown";
+ }
+
+ return statusText + " (" + statusCode + ")";
+ },
+ getHttpErrorMessage : function(response) {
+ var data = response.data;
+ if (response.status === 500 && hasContents(data.exception)) {
+ var summary = "exception: " + data.exception;
+ if (hasContents(data.message)) {
+ summary += " message: " + data.message;
+ }
+ return summary;
+ }
+ if (response.status === 0 && response.statusText === "") {
+ /*
+ * This logic is somewhat "fuzzy". Potential (brainstorming)
+ * enhancements if users find the message unreliable include:
+ *
+ * A) SERVER TIMEOUT: perhaps a newer version of Angular can
+ * reliably determine timeouts.
+ *
+ * B) SERVER TIMEOUT: recording start / end times and using that
+ * to determine if timeout occured
+ *
+ * C) SESSION TIMEOUT "Potentially" examine cookies, although
+ * that may not be feasible if cookies are set to "httponly".
+ */
+ if (data === null) {
+ //return "possible server timeout";
+ return "VID has timed out waiting for a response. To see status, close this popup and the screen will be refreshed automatically";
+ }
+ if (data === "") {
+ return "Possible reasons include a session timeout or a server issue. "
+ + "A session timeout might be resolved by refreshing the screen and re-logging in";
+ }
+ }
+ var summary = "";
+ if (response.status !== undefined && response.status > 0) {
+ summary = "status: " + response.status;
+ }
+ if (hasContents(response.statusText)) {
+ if (summary !== "") {
+ summary += " ";
+ }
+ summary += "message: " + response.statusText;
+ }
+ return summary;
+ },
+ setHttpErrorHandler : function(httpErrorHandler) {
+ _this.httpErrorHandler = httpErrorHandler;
+ },
+ runHttpErrorHandler : function(response, status) {
+ httpErrorHandler(response, status);
+ },
+ startAsyncOperations : function(operationList, callbackFunction) {
+ for (var i = 0; i < operationList.length; i++) {
+ if (!angular.isFunction(operationList[i])) {
+ throw "UtilityService:startAsyncOperations: invalid function: index: "
+ + i;
+ }
+ }
+ _this.asyncOperations = {
+ operationList : operationList,
+ callbackFunction : callbackFunction,
+ count : 0
+ };
+ startNextAsyncOperation();
+ },
+ startNextAsyncOperation : startNextAsyncOperation,
+ stopAsyncOperations : function() {
+ _this.asyncOperations.count = _this.asyncOperations.operationList.length;
+ },
+ isObjectEmpty : isObjectEmpty,
+ convertModel : convertModel,
+ convertNewModel : convertNewModel,
+ convertOldModel : convertOldModel,
+ arrayContains : function (a, obj) {
+ var i = a.length;
+ if ( i > 0 ) {
+ while (i--) {
+ if (a[i] === obj) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ }
+}
+
+//app.factory("UtilityService", UtilityService);
+appDS2.factory("UtilityService", [ "$log", "DataService", UtilityService ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/services/vnfService.js b/vid-app-common/src/main/webapp/app/vid/scripts/services/vnfService.js
new file mode 100755
index 0000000..836279b
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/services/vnfService.js
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * 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=========================================================
+ */
+
+"use strict";
+
+var VnfService = function($http, $log, VIDCONFIGURATION, FIELD, UtilityService) {
+ var isVnfStatusValid = function(vnfInstance) {
+
+ if ( (UtilityService.isObjectEmpty(vnfInstance)) || (UtilityService.isObjectEmpty(vnfInstance.object)) ) {
+ return (errorInternalMsg);
+ }
+ var status = {
+ "provStatus": "",
+ "orchestrationStatus": "",
+ "inMaint": false,
+ "operationalStatus": null
+ };
+ var errorAaiStatusMsg = "The prov-status, orchestration-status or in-maint fields are not captured correctly in A&AI for this VNF: "
+ + vnfInstance.object['vnf-name'] + ". Please update these statuses in A&AI before attempting this change.";
+ var errorInvalidCombinationMsg = "The VNF: " + vnfInstance.object['vnf-name'] +
+ ", has reached a status where further changes cannot be made in VID. Additional changes should be made through the Change Management Processes.";
+ var errorInternalMsg = "Internal VID Error: The VNF Instance is not populated."
+
+ if ( ( UtilityService.hasContents ( vnfInstance.object[FIELD.ID.ORCHESTRATION_STATUS] ) ) &&
+ ( UtilityService.hasContents ( vnfInstance.object[FIELD.ID.IN_MAINT] ) ) &&
+ ( UtilityService.hasContents ( vnfInstance.object[FIELD.ID.PROV_STATUS] ) ) ) {
+
+ status.provStatus = vnfInstance.object[FIELD.ID.PROV_STATUS].toLowerCase();
+ status.orchestrationStatus = vnfInstance.object[FIELD.ID.ORCHESTRATION_STATUS].toLowerCase();
+ status.inMaint = vnfInstance.object[FIELD.ID.IN_MAINT];
+
+ if ( UtilityService.hasContents(vnfInstance.object[FIELD.ID.OPERATIONAL_STATUS]) ) {
+ status.operationalStatus = vnfInstance.object[FIELD.ID.OPERATIONAL_STATUS].toLowerCase();
+ }
+
+ if ( UtilityService.arrayContains ( VIDCONFIGURATION.VNF_VALID_STATUS_LIST, status ) ) {
+ return ("");
+ }
+ else {
+ return (errorInvalidCombinationMsg);
+ }
+ }
+ else {
+ return (errorAaiStatusMsg);
+ }
+ };
+ var isVnfListStatusValid = function(vnfArray) {
+ var msg = "";
+ for(var i = 0; i < vnfArray.length; i++) {
+ var vnf = vnfArray[i];
+ msg = isVnfStatusValid (vnf);
+ if ( msg != "" ) {
+ return (msg);
+ }
+ }
+ return (msg);
+ };
+ return {
+ isVnfStatusValid: isVnfStatusValid,
+ isVnfListStatusValid : isVnfListStatusValid
+ }
+};
+
+appDS2.factory("VnfService", [ "$http", "$log", "VIDCONFIGURATION", "FIELD",
+ "UtilityService", VnfService ]);
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiGetSubs.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiGetSubs.htm
new file mode 100755
index 0000000..d22e3d9
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiGetSubs.htm
@@ -0,0 +1,83 @@
+<!--
+ ============LICENSE_START=======================================================
+ VID
+ ================================================================================
+ 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=========================================================
+ -->
+
+<link rel="stylesheet" type="text/css" href="app/vid/styles/aaiGetSubs.css" />
+<link rel="stylesheet" type="text/css" href="app/vid/styles/aaiSubDetails.css" />
+<script src="app/vid/scripts/controller/aaiSubscriberController.js"></script>
+<div ng-controller="aaiSubscriberController" ng-cloak>
+
+ <div>
+ <div class="statusLine" ng-class="{true:'aaiVisible', false:'aaiHidden'}[isSpinnerVisible]">
+ <img src="app/vid/images/spinner.gif"></img>
+ <label>Status:</label><span class="status">{{status}}</span>
+ </div>
+
+ <div ng-if="errorMsg != null"><font color='red'>{{errorMsg}}<pre>{{errorDetails | json}}</pre></font></div>
+
+ <h2 class="heading2"><center>Search Existing Service Instances</center></h2>
+ <br>
+ Please search by the Subscriber name or enter Service Instance Id or Service Instance Name below: <br><br>
+
+ <table>
+ <tr>
+ <td style="width:30%">
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Subscriber Name:</label>
+ </div>
+ </td>
+ <td style="width:30%" nowrap>
+ <div class="fn-ebz-container" ng-init="autoGetSubs();">
+ <select ng-model="selectedCustomer" ng-options="item.globalCustomerId as item.subscriberName for item in customerList | orderBy:'subscriberName'">
+ <option value="">Select a subscriber</option></select>
+ <a class="btn btn-primary" ng-click="refreshSubs();" ><span class="glyphicon glyphicon-refresh"></span></a>
+ </div>
+ </td>
+
+ </tr>
+ <tr>
+ <td style="width:30%">
+ <div class="fn-ebz-container">
+ <select style="width: 250px;" ng-model="selectedserviceinstancetype" ng-options="stype.sinstance as stype.sinstance for stype in serviceInstanceses" >
+ <option value="">Select a Service Instance</option>
+ </select>
+ </div>
+ </td>
+ <td style="width:60%">
+ <div class="fn-ebz-container">
+ <input type="text" style="width: 350px;" name="selectedServiceInstance" ng-model="selectedServiceInstance" restrict-input ="{type : selectedserviceinstancetype}" />
+ </div>
+ </td>
+
+ </tr>
+ <tr>
+ <td>
+ <td style="width:30%">
+ <div>
+ <button type="submit" class="btn btn-primary" size="small" ng-click="getSubscriberDet(selectedCustomer,selectedserviceinstancetype,selectedServiceInstance);">Submit</button></a>
+ </div>
+ </td>
+ </td>
+ </tr>
+ </table>
+
+
+ </div>
+
+</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiGetSubscriberList.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiGetSubscriberList.htm
new file mode 100755
index 0000000..6a911be
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiGetSubscriberList.htm
@@ -0,0 +1,67 @@
+<!--
+ ============LICENSE_START=======================================================
+ VID
+ ================================================================================
+ 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=========================================================
+ -->
+
+<link rel="stylesheet" type="text/css" href="app/vid/styles/aaiGetSubs.css" />
+<link rel="stylesheet" type="text/css" href="app/vid/styles/aaiSubDetails.css" />
+<script src="app/vid/scripts/controller/aaiSubscriberController.js"></script>
+<div ng-controller="aaiSubscriberController" ng-cloak>
+
+ <div>
+ <div class="statusLine" ng-class="{true:'aaiVisible', false:'aaiHidden'}[isSpinnerVisible]">
+ <img src="app/vid/images/spinner.gif"></img>
+ <label>Status:</label><span class="status">{{status}}</span>
+ </div>
+
+ <div ng-if="errorMsg != null"><font color='red'>{{errorMsg}}<pre>{{errorDetails | json}}</pre></font></div>
+
+ <h2 class="heading2"><center>Create New Service Instance</center></h2>
+
+ <table>
+ <tr>
+ <td >
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Subscriber Name:</label>
+ </div>
+ </td>
+ <td style="width:80%" nowrap>
+ <div class="fn-ebz-container" ng-init="autoGetSubs();">
+ <select ng-model="selectedCustomer" ng-options="item.globalCustomerId as item.subscriberName for item in customerList | orderBy:'subscriberName'">
+ <option value="">Select Subscriber Name</option></select>
+ <a class="btn btn-primary" ng-click="refreshSubs();" ><span class="glyphicon glyphicon-refresh"></span></a>
+ </div>
+ </td>
+
+ </tr>
+ <tr>
+ <td >
+ </td>
+ <td style="width:80%">
+ <div >
+ <button type="submit" class="btn btn-primary" size="small" ng-click="getServiceTypes(selectedCustomer);">Submit</button></a>
+ <button type="submit" class="btn btn-primary" size="small" ng-click="cancelCreateSI()">Cancel</button></a>
+ </div>
+ </td>
+ </tr>
+ </table>
+
+
+ </div>
+
+</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiServiceTypes.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiServiceTypes.htm
new file mode 100755
index 0000000..6711bfa
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiServiceTypes.htm
@@ -0,0 +1,80 @@
+<!--
+ ============LICENSE_START=======================================================
+ VID
+ ================================================================================
+ 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=========================================================
+ -->
+
+<link rel="stylesheet" type="text/css" href="app/vid/styles/aaiGetSubs.css" />
+<link rel="stylesheet" type="text/css" href="app/vid/styles/aaiSubDetails.css" />
+<script src="app/vid/scripts/controller/aaiSubscriberController.js"></script>
+<div ng-controller="aaiSubscriberController" ng-cloak>
+
+ <div>
+ <div class="statusLine" ng-class="{true:'aaiVisible', false:'aaiHidden'}[isSpinnerVisible]">
+ <img src="app/vid/images/spinner.gif"></img>
+ <label>Status:</label><span class="status">{{status}}</span>
+ </div>
+ <div ng-if="errorMsg != null"><font color='red'>{{errorMsg}}<pre>{{errorDetails | json}}</pre></font></div>
+ <h2 class="heading2"><center>Create New Service Instance</center></h2>
+
+ <table>
+
+ <tr>
+ <td >
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label" >Subscriber Name :</label>
+ </div>
+ </td>
+ <td style="width:80%" nowrap>
+ <div class="fn-ebz-container">
+ <textarea style=" height: 15px width: 100% border: none resize: none overflow: hidden background-color: #ddd outline: none" ng-model="createSubscriberName">{{createSubscriberName}}</textarea>
+
+ </div>
+ </td>
+
+ </tr>
+ <tr>
+ <td >
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label">Service Type :</label>
+ </div>
+ </td>
+ <td style="width:80%" nowrap>
+ <div class="fn-ebz-container" ng-init="getServiceTypesList()">
+ <select ng-model="selectedServicetype" ng-options="key as value for (key , value) in serviceTypeList">
+ <option value="">Select Service Type</option></select>
+ <a class="btn btn-primary" ng-click="refreshServiceTypes(subId);" ><span class="glyphicon glyphicon-refresh"></span></a>
+ </div>
+ </td>
+
+ </tr>
+ <tr>
+ <td >
+ </td>
+ <td style="width:80%">
+ <div >
+ <button type="submit" class="btn btn-primary" size="small" ng-click="getAaiServiceModels(selectedServicetype,createSubscriberName);">Submit</button></a>
+ <button type="submit" class="btn btn-primary" size="small" ng-click="cancelCreateSIType()">Cancel</button></a>
+ </div>
+ </td>
+ </tr>
+ </table>
+
+
+ </div>
+
+</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiSubDetails.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiSubDetails.htm
new file mode 100755
index 0000000..2426f15
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiSubDetails.htm
@@ -0,0 +1,95 @@
+<!--
+ ============LICENSE_START=======================================================
+ VID
+ ================================================================================
+ 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=========================================================
+ -->
+
+ <div ng-controller="aaiSubscriberController" ng-cloak>
+
+ <div>
+ <div class="statusLine" ng-class="{true:'aaiVisible', false:'aaiHidden'}[isSpinnerVisible]">
+ <img src="app/vid/images/spinner.gif">
+ </img>
+ <label>Status:</label><span class="status">{{status}}</span>
+ </div>
+
+ <div ng-if="errorMsg != null"><font color='red'>{{errorMsg}}<pre>{{errorDetails | json}}</pre></font></div>
+
+ <h1 class="heading1"><center>Subscriber Details for {{selectedSubscriber}} ({{selectedSubscriberName}})</center></h1>
+ <br>
+ <div class="fn-ebz-container">
+ Filter:
+ <input class="fn-ebz-text" type="text" ng-model="searchString" size="20" style="width: 250px;">
+ </div>
+ <div ng-init="getSubDetails();">
+
+ <div style="margin-top: 30px">
+ <table att-table width="100%" table-data="displayData" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage" type="header">
+
+ <thead att-table-row>
+ <tr>
+ <th att-table-header sortable="false" key="viewSubDetails">View/Edit</th>
+ <th att-table-header sortable="true" key="globalCustomerId">Global Customer ID</th>
+ <th att-table-header sortable="true" key="subscriberName">Subscriber Name</th>
+ <th att-table-header sortable="true" key="serviceType">Service Type</th>
+ <th att-table-header default-sort="A" sortable="true" key="serviceInstanceName">Service Instance Name</th>
+ <th att-table-header sortable="true" key="serviceInstanceId">Service Instance ID</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="disData in displayData">
+ <tr>
+ <td att-table-body>
+ <div>
+ <a alt="View/Edit" ng-click="getAsdcModel(disData);"> View/Edit </a>
+ </div>
+ </td>
+ <!-- <td att-table-body ><button type=button ng-click="getAsdcModel(disData);" att-button btn-type="primary" size="small">View/Edit</button></td> --->
+ <td att-table-body ng-bind="disData['globalCustomerId']"></td>
+ <td att-table-body ng-bind="disData['subscriberName']"></td>
+ <td att-table-body ng-bind="disData['serviceType']"></td>
+ <td att-table-body ng-bind="disData['serviceInstanceName']"></td>
+ <td att-table-body ng-bind="disData['serviceInstanceId']"></td>
+ </tr>
+ </tbody>
+ </table>
+ <table width='100%'>
+ <tr>
+ <td width='33%' valign='middle'>
+ <span style="cursor: pointer" ng-if="currentPage>1"><button att-button size="small" ng-click="prevPage();">< prev page</button></span>
+ </td>
+ <td width='33%' valign='middle'>
+ Jump to page:
+ <input class="fn-ebz-text" type="text" ng-model="currentPage" size="5" style="width: 47px;">
+ Results per page: <span style="cursor: pointer" ng-click="viewPerPage = 10" ng-style="viewPerPage === 10 && {'textDecoration':'underline','text-color':'black'}">10</span>
+ | <span style="cursor: pointer" ng-click="viewPerPage = 25" ng-style="viewPerPage === 25 && {'textDecoration':'underline','text-color':'black'}">25</span>
+ | <span style="cursor: pointer" ng-click="viewPerPage = 50" ng-style="viewPerPage === 50 && {'textDecoration':'underline','text-color':'black'}">50</span>
+ </td>
+ <td width='34%' align='right' valign='middle'>
+ <span style="cursor: pointer" ng-if="currentPage<totalPage"><button att-button size="small" ng-click="nextPage();">next page ></button></span>
+ </td>
+ </tr>
+ </table>
+
+
+ </div>
+
+ </div>
+
+
+ </div>
+
+ </div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiSubViewEdit.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiSubViewEdit.htm
new file mode 100755
index 0000000..a7ea833
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/aaiSubViewEdit.htm
@@ -0,0 +1,147 @@
+<!--
+ ============LICENSE_START=======================================================
+ VID
+ ================================================================================
+ 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=========================================================
+ -->
+
+<div ng-controller="aaiSubscriberController" ng-cloak>
+
+ <div popup-window class="popupContents" ngx-show="{{popup.isVisible}}"
+ ng-cloak>
+ <div ng-include="'app/vid/scripts/view-models/creationDialog.htm'"></div>
+ <div ng-include="'app/vid/scripts/view-models/deletionDialog.htm'"></div>
+ <div ng-include="'app/vid/scripts/view-models/detailsDialog.htm'"></div>
+ </div>
+
+ <div>
+ <div class="statusLine">
+ <img src="app/vid/images/spinner.gif"
+ ng-class="{true:'aaiVisible', false:'aaiHidden'}[isSpinnerVisible]"></img>
+ <label>Status:</label><span class="status">{{status}}</span>
+ </div>
+
+ <h2 class="heading2">
+ <center>VIEW/EDIT SERVICE INSTANCE <a class="btn btn-primary btn-xs pull-right" ng-click="reloadRoute();" ><span class="glyphicon glyphicon-refresh"></span></a></center>
+ </h2>
+ </center>
+ </h2>
+ <br>
+
+
+ <center>
+ <table border="1">
+ <tr>
+ <th style="text-align: center" width="33%">SUBSCRIBER:
+ {{globalCustomerId}}</th>
+ <th style="text-align: center" width="34%">SERVICE TYPE:
+ {{serviceType}}</th>
+ <th style="text-align: center" width="33%">SERVICE INSTANCE
+ ID: {{serviceInstanceId}}</th>
+ <tr>
+ <tr>
+ <td colspan='3' style="text-align: center">Service Instance
+ Name: {{serviceInstanceName || "Not defined"}}
+ </td>
+ <tr>
+ </table>
+
+ </center>
+
+
+ <br>
+
+ <div ng-init="autoPopulateViewEdit();">
+ <script type="text/ng-template" id="nodes_renderer.html">
+ <div ui-tree-handle data-drag-enabled="false" class="tree-node tree-node-content">
+ <a class="btn btn-success btn-xs" ng-if="node.nodes && node.nodes.length > 0" data-nodrag ng-click="toggle(this)"><span
+ class="glyphicon"
+ ng-class="{
+ 'glyphicon-chevron-right': collapsed,
+ 'glyphicon-chevron-down': !collapsed
+ }"></span></a>
+ <div class='btn'>{{node.nodeType}}</div><div class='btn'>{{node.nodeId}}</div><div class='btn'>{{node.nodeStatus}}</div>
+
+ <a class="pull-right btn btn-danger btn-xs" ng-if="node.delete != false" data-nodrag ng-click="showVnfDetails(node);"><span class="glyphicon glyphicon-remove"></a>
+ <a class="pull-right btn btn-primary btn-xs" ng-if="node.info != false" data-nodrag ng-click="showVnfDetails();"><span
+ class="glyphicon glyphicon-zoom-in"></span></a>
+
+ </div>
+ <ol ui-tree-nodes ng-model="node.nodes" ng-class="{hidden: collapsed}">
+ <li ng-repeat="node in node.nodes" ui-tree-node ng-include="'nodes_renderer.html'">
+ </li>
+ </ol>
+</script>
+ <b>EXISTING</b>
+ <div ng-controller="TreeCtrl">
+ <div>
+ <div ui-tree id="tree-root" >
+ <ol ui-tree-nodes ng-model="treeList"">
+ <li ng-repeat="node in treeList" ui-tree-node data-nodrag
+ ng-include="'nodes_renderer.html'"></li>
+ </ol>
+ </div>
+ </div>
+
+ </div>
+ <b>AVAILABLE</b>
+
+ <script type="text/ng-template" id="nodes_renderer2.html">
+ <div ui-tree-handle data-drag-enabled="false" class="tree-node tree-node-content" >
+ <a class="btn btn-success btn-xs" ng-if="node.nodes && node.nodes.length > 0" data-nodrag ng-click="toggle(this)"><span
+ class="glyphicon"
+ ng-class="{
+ 'glyphicon-chevron-right': collapsed,
+ 'glyphicon-chevron-down': !collapsed
+ }"></span></a>
+ <div class='btn'>{{node.nodeType}}</div><div class='btn'>{{node.nodeId}}</div><div class='btn'>{{node.nodeStatus}}</div>
+
+ <a class="pull-right btn btn-primary btn-xs" ng-if="node.delete != false" data-nodrag ng-click="callDelete(this)">
+ <span class="glyphicon glyphicon-plus"></span>
+ </a>
+
+ <a class="pull-right btn btn-primary btn-xs" ng-if="node.info != false" data-nodrag ng-click="showInfoDialog(node.itemType, node.nodeId, node.nodeType);">
+ <span class="glyphicon glyphicon-zoom-in"></span>
+ </a>
+
+ </div>
+ <ol ui-tree-nodes ng-model="node.nodes" ng-class="{hidden: collapsed}">
+ <li ng-repeat="node in node.nodes" ui-tree-node ng-include="'nodes_renderer2.html'">
+ </li>
+ </ol>
+</script>
+
+ <div ng-controller="TreeCtrl">
+ <div>
+ <div ui-tree id="tree-root">
+ <ol ui-tree-nodes ng-model="availableTreeList">
+ <li ng-repeat="node in availableTreeList" ui-tree-node
+ data-nodrag ng-include="'nodes_renderer2.html'"></li>
+ </ol>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div>
+
+ <button type="button" " att-button
+ btn-type="primary" size="small">Show Details</button>
+
+ <pre>
+ {{inventoryResponseItem | json}}
+ </pre>
+ </div>
+ </div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/createInstanceServiceModels.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/createInstanceServiceModels.htm
new file mode 100755
index 0000000..a78b95e
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/createInstanceServiceModels.htm
@@ -0,0 +1,125 @@
+<!--
+ ============LICENSE_START=======================================================
+ VID
+ ================================================================================
+ 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=========================================================
+ -->
+
+<link rel="stylesheet" type="text/css" href="app/vid/styles/serviceModels.css" />
+<div popup-window class="popupContents" ngx-show="{{popup.isVisible}}" ng-cloak>
+ <div ng-include="'app/vid/scripts/view-models/creationDialog.htm'"/>
+</div>
+<div >
+
+ <span class="statusLine" ng-class="{true:'smcVisible', false:'smcHidden'}[isSpinnerVisible]">
+ <img src="app/vid/images/spinner.gif"></img>
+ </span>
+ <span class="statusLine" ng-class="{true:'progVisible', false:'progHidden'}[isProgressVisible]">
+ <label>Status:</label><span class="status"><span ng-show="error"><font color='red'><b>Error: </b></font></span>{{status}}</span>
+ </span>
+ <br><br>
+
+
+ <table>
+
+ <tr>
+ <td >
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label" >Subscriber Name :</label>
+ </div>
+ </td>
+ <td style="width:80%" nowrap>
+ <div class="fn-ebz-container">
+ <textarea style=" height: 15px width: 100% border: none resize: none overflow: hidden background-color: #ddd outline: none" ng-model="createSubscriberName">{{createSubscriberName}}</textarea>
+
+ </div>
+ </td>
+
+ </tr>
+ <tr>
+ <td >
+ <div class="fn-ebz-container">
+ <label class="fn-ebz-text-label" >Service Type :</label>
+ </div>
+ </td>
+ <td style="width:80%" nowrap>
+ <div class="fn-ebz-container">
+ <textarea style=" height: 15px width: 100% border: none resize: none overflow: hidden background-color: #ddd outline: none" ng-model="serviceTypeName">{{serviceTypeName}}</textarea>
+
+ </div>
+ </td>
+
+ </tr>
+
+ </table>
+
+ <div class="fn-ebz-container">
+ Filter:
+ <input class="fn-ebz-text" type="text" ng-model="searchString" size="20" style="width: 250px;">
+ </div>
+
+ <!-- <h1 class="heading1" style="margin-top:20px;">Browse SDC Service Models</h1> -->
+ <div style="margin-top:30px" ng-init="getAaiServiceModelsList();">
+
+ <table att-table table-data="services" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header key="action">Action</th>
+ <th att-table-header key="uuid">UUID</th>
+ <th att-table-header key="invariantUUID">Invariant UUID</th>
+ <th att-table-header default-sort="A" key="name">Name</th>
+ <th att-table-header key="version">Version</th>
+ <th att-table-header key="category">Category</th>
+ <th att-table-header key="distributionStatus">Distribution Status</th>
+ <th att-table-header key="lastUpdaterUserId">Last Updated By</th>
+ <th att-table-header key="toscaModelUrl">Tosca Model</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="service in services">
+ <tr>
+ <td att-table-body ><button type=button ng-click="deployService(service)" att-button btn-type="primary" size="small">Deploy</button></td>
+ <td att-table-body ng-bind="service['uuid']"></td>
+ <td att-table-body ng-bind="service['invariantUUID']"></td>
+ <td att-table-body ng-bind="service['name']"></td>
+ <td att-table-body ng-bind="service['version']"></td>
+ <td att-table-body ng-bind="service['category']"></td>
+ <td att-table-body ng-bind="service['distributionStatus']"></td>
+ <td att-table-body ng-bind="service['lastUpdaterUserId']"></td>
+ <td att-table-body ng-bind="service['toscaModelUrl']"></td>
+ </tr>
+ </tbody>
+ </table>
+ <table width='100%'>
+ <tr>
+ <td width='33%' valign='middle'>
+ <span style="cursor: pointer" ng-if="currentPage>1"><button att-button size="small" ng-click="prevPage();">< prev page</button></span>
+ </td>
+ <td width='33%' valign='middle'>
+ Jump to page:
+ <input class="fn-ebz-text" type="text" ng-model="currentPage" size="5" style="width: 47px;">
+ Results per page: <span style="cursor: pointer" ng-click="viewPerPage = 10" ng-style="viewPerPage === 10 && {'textDecoration':'underline','text-color':'black'}">10</span>
+ | <span style="cursor: pointer" ng-click="viewPerPage = 25" ng-style="viewPerPage === 25 && {'textDecoration':'underline','text-color':'black'}">25</span>
+ | <span style="cursor: pointer" ng-click="viewPerPage = 50" ng-style="viewPerPage === 50 && {'textDecoration':'underline','text-color':'black'}">50</span>
+ </td>
+ <td width='34%' align='right' valign='middle'>
+ <span style="cursor: pointer" ng-if="currentPage<totalPage"><button att-button size="small" ng-click="nextPage();">next page ></button></span>
+ </td>
+ </tr>
+ </table>
+
+ </div>
+ </div>
+
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/creationDialog.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/creationDialog.htm
new file mode 100755
index 0000000..0ac74a9
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/creationDialog.htm
@@ -0,0 +1,64 @@
+<!--
+ ============LICENSE_START=======================================================
+ VID
+ ================================================================================
+ 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=========================================================
+ -->
+
+<div ng-controller="creationDialogController">
+
+ <div ng-show="isDialogVisible">
+ <div class="titleLine">
+ <img src="app/vid/images/spinner.gif"
+ ngx-visible="{{isSpinnerVisible}}"></img>
+ <h3>Create {{componentName}} -- {{createType}}</h3>
+ </div>
+
+ <div class="error" ng-show="isErrorVisible">
+ <img src="app/vid/images/error.png"></img>{{error}}
+ </div>
+
+ <div ngx-visible="{{isDataVisible}}">
+ <parameter-block control="summaryControl"></parameter-block>
+ <h4>
+ User Provided Data (<img class="requiredIndicator"
+ src="app/vid/images/asterisk.png" height='10' width='10'></img> indicates required field)
+ </h4>
+ <parameter-block control="userProvidedControl"
+ callback="userParameterChanged(id);" editable></parameter-block>
+
+ <div class="prompt">
+ <p>
+ Enter Data and <span>Confirm</span> to<br />Create <span>{{componentName}}</span>
+ </p>
+ <p>
+ <span>Cancel</span> to Return to Previous Page.<br />Data entered
+ will be lost
+ </p>
+ </div>
+
+ </div>
+ <div class="buttonRow">
+ <button ngx-enabled="{{isConfirmEnabled}}" att-button size="small"
+ ng-click="confirm();">Confirm</button>
+ <button type="button" ng-click="cancel();" att-button
+ btn-type="primary" size="small">Cancel</button>
+ </div>
+ </div>
+
+ <div ng-include="'app/vid/scripts/view-models/msoCommit.htm'"></div>
+
+</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/deletionDialog.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/deletionDialog.htm
new file mode 100755
index 0000000..b4b9316
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/deletionDialog.htm
@@ -0,0 +1,70 @@
+<!--
+ ============LICENSE_START=======================================================
+ VID
+ ================================================================================
+ 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=========================================================
+ -->
+
+<div ng-controller="deletionDialogController">
+
+ <div ng-show="isDialogVisible">
+ <div class="titleLine">
+ <img src="app/vid/images/spinner.gif"
+ ngx-visible="{{isSpinnerVisible}}"></img>
+ <h3>Delete {{componentName}}</h3>
+ </div>
+
+ <div class="error" ng-show="isErrorVisible">
+ <img src="app/vid/images/error.png"></img>{{error}}
+ </div>
+
+ <parameter-block control="summaryControl"></parameter-block>
+
+ <div ngx-visible="{{isDataVisible}}">
+
+ <h4>
+ User Provided Data (<img class="requiredIndicator"
+ src="app/vid/images/asterisk.png" height='10' width='10'></img> indicates required field)
+ </h4>
+ <parameter-block control="userProvidedControl"
+ callback="userParameterChanged(id);" editable></parameter-block>
+
+ <div class="prompt">
+ <p>
+ Enter Data and <span>Confirm</span> to<br />Delete <span>{{componentName}}</span>
+ </p>
+ <p>
+ <span>Cancel</span> to Return to Previous Page.<br />Data entered
+ will be lost
+ </p>
+ </div>
+ </div>
+
+ <div class="buttonRow">
+ <!-- <button type="button" ng-click="confirm();" att-button
+ btn-type="primary" size="small" class="confirm">Confirm</button>
+ <button type="button" ng-click="cancel();" att-button
+ btn-type="primary" size="small">Cancel</button> --->
+ <button ngx-enabled="{{isConfirmEnabled}}" att-button size="small"
+ ng-click="confirm();">Confirm</button>
+ <button type="button" ng-click="cancel();" att-button
+ btn-type="primary" size="small">Cancel</button>
+ </div>
+ </div>
+
+ <div ng-include="'app/vid/scripts/view-models/msoCommit.htm'"></div>
+
+</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/detailsDialog.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/detailsDialog.htm
new file mode 100755
index 0000000..0e72e77
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/detailsDialog.htm
@@ -0,0 +1,48 @@
+<!--
+ ============LICENSE_START=======================================================
+ VID
+ ================================================================================
+ 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=========================================================
+ -->
+
+<div ng-controller="detailsDialogController" ng-show="isDialogVisible">
+
+ <div class="titleLine">
+ <img src="app/vid/images/spinner.gif"
+ ngx-visible="{{isSpinnerVisible}}"></img>
+ <h3>Service Instance Details</h3> <!-- {{componentName}} -->
+ </div>
+
+ <div class="error" ng-show="isErrorVisible">
+ <img src="app/vid/images/error.png"></img>{{error}}
+ </div>
+
+ <parameter-block control="summaryControl"></parameter-block>
+
+ <h4>{{componentName}} Details</h4>
+
+ <parameter-block control="detailsControl"></parameter-block>
+
+ <h4>Instantiation Transactions</h4>
+
+ <pre class="log">{{log}}</pre>
+
+ <div class="buttonRow">
+ <button type="button" ng-click="close();" att-button
+ btn-type="primary" size="small">Close</button>
+ </div>
+
+</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/instantiate.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/instantiate.htm
new file mode 100755
index 0000000..e4bb67f
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/instantiate.htm
@@ -0,0 +1,248 @@
+<!--
+ ============LICENSE_START=======================================================
+ VID
+ ================================================================================
+ 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=========================================================
+ -->
+
+<div ng-controller="InstantiationController">
+
+ <div popup-window class="popupContents" ngx-show="{{popup.isVisible}}"
+ ng-cloak>
+ <div ng-include="'app/vid/scripts/view-models/creationDialog.htm'"></div>
+ <div ng-include="'app/vid/scripts/view-models/deletionDialog.htm'"></div>
+ <div ng-include="'app/vid/scripts/view-models/detailsDialog.htm'"></div>
+ <div ng-include="'app/vid/scripts/view-models/statusDialog.htm'"></div>
+ </div>
+ <div ng-controller="aaiSubscriberController" ng-init="getComponentList() ">
+ <div class="statusLine" ng-class="{true:'aaiVisible', false:'aaiHidden'}[isSpinnerVisible]">
+ <img src="app/vid/images/spinner.gif"></img>
+ <label>Status:</label><span class="status">{{status}}</span>
+ </div>
+
+ <div ng-if="errorMsg != null"><font color='red'>{{errorMsg}}<pre>{{errorDetails | json}}</pre></font></div>
+
+ <h1 class="heading1" style="margin-top: 20px;">View/Edit Service Instance</h1>
+ <a class="btn btn-primary btn-xs pull-right" ng-click="reloadRoute();" ><span class="glyphicon glyphicon-refresh"></span></a>
+
+ <br>
+
+ <center>
+ <table att-table border="1" ng-model="service">
+ <tr>
+ <th style="text-align: center" width="33%">SUBSCRIBER:
+ {{service.instance.subscriberName}}</th>
+ <th style="text-align: center" width="34%">SERVICE TYPE:
+ {{service.instance.serviceType}}</th>
+ <th style="text-align: center" width="33%">SERVICE INSTANCE
+ ID: {{service.instance.serviceInstanceId}}</th>
+ <tr>
+ <tr>
+ <td colspan='3' style="text-align: center">Service Instance
+ Name: {{service.instance.name || "Not defined"}}
+ </td>
+ <tr>
+ </table>
+
+ </center>
+
+ <div ui-tree data-drag-enabled="false" data-nodrop-enabled="true" style="margin: 30px">
+
+ <ol ui-tree-nodes="" ng-model="service" >
+ <li ng-repeat="aService in [service]" ui-tree-node>
+ <div ui-tree-handle class="tree-node tree-node-content">
+ <a class="btn btn-success btn-xs" ng-if="(aService.instance.vnfs && aService.instance.vnfs.length > 0) || (aService.instance.networks && aService.instance.networks.length > 0)" data-nodrag ng-click="this.toggle()">
+ <span class="glyphicon" ng-class="{'glyphicon-chevron-right': collapsed,'glyphicon-chevron-down': !collapsed}"></span>
+ </a>
+ SERVICE INSTANCE: {{aService.instance.name}}
+ <a ng-if="((isMacro()) || ( ( isObjectEmpty(aService.instance.vnfs) && isObjectEmpty(aService.instance.networks) ) ))" class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="deleteService(aService.instance);">
+ <span class="glyphicon glyphicon-remove"></span>
+ </a>
+ <div class="pull-right btn-group" ng-if="aService.convertedModel.vnfs && (!(isObjectEmpty(aService.convertedModel.vnfs))) && (!(aService.convertedModel.isNewFlow))">
+ <button type="button" class="btn btn-success btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+ Add VNF<span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu" ng-model="aService.convertedModel.vnfs">
+ <a role="menuitem" ng-repeat="(vnfUuid, vnf) in aService.convertedModel.vnfs" ng-click="addVnfInstance(vnf, aService.instance.vnfs)">{{vnf.modelCustomizationName}}</a>
+
+ </ul>
+ </div>
+ <div class="pull-right btn-group" ng-if="aService.convertedModel.vnfs && (!(isObjectEmpty(aService.convertedModel.vnfs))) && (aService.convertedModel.isNewFlow)">
+ <button type="button" class="btn btn-success btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+ Add VNF<span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu" ng-model="aService.convertedModel.vnfs">
+ <li role="menuitem" ng-repeat="(vnfUuid, vnf) in aService.convertedModel.vnfs">
+ <a ng-click="addVnfInstance(vnf, aService.instance.vnfs)">{{vnf.modelCustomizationName}} {{vnf.nfType}} {{vnf.nfRole}} {{vnf.nfFunction}} {{vnf.nfCode}}</a>
+ </li>
+ </ul>
+ </div>
+ <!-- <div class="pull-right btn-group" ng-if="aService.model.networks && !equals(aService.model.networks, {})">-->
+ <div class="pull-right btn-group" ng-if="aService.convertedModel.networks && (!(isObjectEmpty(aService.convertedModel.networks)))">
+ <!--<div class="pull-right btn-group" ng-if="aService.model.networks">-->
+ <button type="button" class="btn btn-success btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+ Add Network<span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu" ng-model="aService.convertedModel.networks">
+ <li ng-repeat="(networkUuid, network) in aService.convertedModel.networks">
+ <a ng-click="addNetworkInstance(network, aService.instance.vnfs)">{{network.modelCustomizationName}}</a>
+ </li>
+ </ul>
+ </div>
+ <a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="describeService(aService.instance)" style="margin-right: 8px;">
+ <span class="glyphicon glyphicon-info-sign"></span>
+ </a>
+ </div>
+ <ol ui-tree-nodes="" ng-model="aService.instance.vnfs" ng-class="{hidden: collapsed}">
+ <li ng-repeat="vnf in aService.instance.vnfs" ui-tree-node>
+ <div ui-tree-handle class="tree-node tree-node-content">
+ <a class="btn btn-success btn-xs" ng-if="(vnf.vfModules && vnf.vfModules.length > 0) || (vnf.volumeGroups && vnf.volumeGroups.length > 0)" data-nodrag ng-click="this.toggle()">
+ <span class="glyphicon" ng-class="{'glyphicon-chevron-right': collapsed,'glyphicon-chevron-down': !collapsed}"></span>
+ </a>
+ VNF: {{vnf.name}} | TYPE: {{vnf.nodeType}} | ORCH STATUS: {{vnf.nodeStatus}}
+ <a ng-if="(vnf.vfModules.length == 0) && (vnf.volumeGroups.length == 0)" class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="deleteVnf(aService.instance, vnf)">
+ <span class="glyphicon glyphicon-remove"></span>
+ </a>
+ <!-- <div class="pull-right btn-group" ng-if="aService.convertedModel.vnfs[vnf.object['model-invariant-id']][vnf.object['model-version-id']].vfModules">-->
+ <div class="pull-right btn-group" ng-if="(hasVfModules(vnf.object) && (aService.convertedModel.isNewFlow))">
+
+ <button type="button" class="btn btn-success btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+ Add VF-Module<span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu" ng-model="vfModule" >
+ <a ng-repeat="(vfModuleCustomizationUuid, vfModule) in aService.convertedModel.vnfs[vnf.object['model-customization-id']].vfModules" ng-click="addVfModuleInstance(vnf, vfModule)">{{vfModule.modelCustomizationName}} </a>
+ </ul>
+ </div>
+
+
+ <div class="pull-right btn-group" ng-if="(hasVfModules(vnf.object) && (!(aService.convertedModel.isNewFlow)))">
+
+ <button type="button" class="btn btn-success btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+ Add VF-Module<span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu" ng-model="vnf">
+ <a ng-repeat="(vfModuleUuid, vfModule) in aService.convertedModel.vnfs[vnf.object['model-version-id']].vfModules" ng-click="addVfModuleInstance(vnf, vfModule)">{{vfModule.modelCustomizationName}}</a>
+ </li>
+ </ul>
+
+ </div>
+
+ <div class="pull-right btn-group" ng-if="(hasVolumeGroups(vnf.object) && (aService.convertedModel.isNewFlow))">
+
+ <button type="button" class="btn btn-success btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+ Add Volume Group<span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu" ng-model="volumeGroup" >
+ <a ng-repeat="(volumeGroupCustomizationUuid, volumeGroup) in aService.convertedModel.vnfs[vnf.object['model-customization-id']].volumeGroups" ng-click="addVolumeGroupInstance(vnf, volumeGroup)">{{volumeGroup.modelCustomizationName}}</a>
+ </ul>
+ </div>
+
+ <div class="pull-right btn-group" ng-if="(hasVolumeGroups(vnf.object) && (!(aService.convertedModel.isNewFlow)))">
+
+ <button type="button" class="btn btn-success btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+ Add Volume Group<span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu" ng-model="vnf">
+ <a ng-repeat="(volumeGroupUuid, volumeGroup) in aService.convertedModel.vnfs[vnf.object['model-version-id']].volumeGroups" ng-click="addVolumeGroupInstance(vnf, volumeGroup)">{{volumeGroup.modelCustomizationName}}</a>
+ </li>
+ </ul>
+
+ </div>
+
+ <!-- VID-374/378 - switching-off feature <a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="getStatusOfVnf(aService.instance, vnf)" style="margin-right: 8px;">
+ <span class="glyphicon glyphicon-exclamation-sign"></span>
+ </a> -->
+ <a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="describeVnf(aService.instance, vnf)" style="margin-right: 8px;">
+ <span class="glyphicon glyphicon-info-sign"></span>
+ </a>
+ </div>
+ <ol ui-tree-nodes="" ng-model="vnf.vfModules" ng-class="{hidden: collapsed}">
+ <li ng-repeat="vfModule in vnf.vfModules" ui-tree-node>
+ <div ui-tree-handle class="tree-node tree-node-content">
+ <a class="btn btn-success btn-xs" ng-if="(vfModule.volumeGroups && vfModule.volumeGroups.length > 0)" data-nodrag ng-click="this.toggle()">
+ <span class="glyphicon" ng-class="{'glyphicon-chevron-right': collapsed,'glyphicon-chevron-down': !collapsed}"></span>
+ </a>
+ VFMODULE: {{vfModule.name}} | TYPE: {{vfModule.nodeType}} | ORCH STATUS: {{vfModule.nodeStatus}}
+ <!-- -->
+ <a class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="deleteVfModule(aService.instance, vfModule, vnf)">
+ <span class="glyphicon glyphicon-remove"></span>
+ </a>
+ <div class="pull-right btn-group">
+ <!-- <button type="button" class="btn btn-success btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
+ Attach Volume Group<span class="caret"></span>
+ </button>
+ <ul class="dropdown-menu" ng-model="vnf.volumeGroups">
+ <li ng-repeat="volumeGroup in vnf.availableVolumeGroups">
+ <a ng-click="attachVolumeGroupInstance(vfModule, volumeGroup)">{{volumeGroup.name}}</a>
+ </li>
+ </ul> -->
+ </div>
+ <a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="describeVfModule(aService.instance, vfModule, vnf)" style="margin-right: 8px;">
+ <span class="glyphicon glyphicon-info-sign"></span>
+ </a>
+ </div>
+ <ol ui-tree-nodes="" ng-model="vfModule.volumeGroups" ng-class="{hidden: collapsed}">
+ <li ng-repeat="volumeGroup in vfModule.volumeGroups" ui-tree-node>
+ <div ui-tree-handle class="tree-node tree-node-content">
+ VOLUME GROUP: {{volumeGroup.name}} | TYPE: {{volumeGroup.nodeType}} | ORCH STATUS: {{volumeGroup.nodeStatus}}
+ <!-- <a class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="deleteVolumeGroup(aService.instance, vnf, vfModule, volumeGroup)">
+ <span class="glyphicon glyphicon-remove"></span>
+ </a> -->
+ <a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="describeVolumeGroup(aService.instance, vnf, volumeGroup)" style="margin-right: 8px;">
+ <span class="glyphicon glyphicon-info-sign"></span>
+ </a>
+ </div>
+ </li>
+ </ol>
+ </li>
+ </ol>
+ <ol ui-tree-nodes="" ng-model="vnf.availableVolumeGroups" ng-class="{hidden: collapsed}">
+ <li ng-repeat="volumeGroup in vnf.availableVolumeGroups" ui-tree-node>
+ <div ui-tree-handle class="tree-node tree-node-content">
+ VOLUME GROUP: {{volumeGroup.name}} | TYPE: {{volumeGroup.nodeType}} | ORCH STATUS: {{volumeGroup.nodeStatus}}
+ <a class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="deleteVnfVolumeGroup(aService.instance, vnf, volumeGroup)">
+ <span class="glyphicon glyphicon-remove"></span>
+ </a>
+ <a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="describeVolumeGroup(aService.instance, vnf, volumeGroup)" style="margin-right: 8px;">
+ <span class="glyphicon glyphicon-info-sign"></span>
+ </a>
+ </div>
+ </li>
+ </ol>
+ </li>
+ </ol>
+ <ol ui-tree-nodes="" ng-model="aService.instance.networks" ng-class="{hidden: collapsed}">
+ <li ng-repeat="network in aService.instance.networks" ui-tree-node>
+ <div ui-tree-handle class="tree-node tree-node-content">
+ NETWORK: {{network.name}} | TYPE: {{network.nodeType}} | ORCH STATUS: {{network.nodeStatus}}
+
+ <a class="pull-right btn btn-danger btn-xs" ng-if="(!isMacro())" data-nodrag ng-click="deleteNetwork(aService.instance, network)">
+ <span class="glyphicon glyphicon-remove"></span>
+ </a>
+ <!-- <a class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="deleteNetwork(aService.instance, network)">
+ <span class="glyphicon glyphicon-remove"></span>
+ </a>-->
+ <a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="describeNetwork(aService.instance, network)" style="margin-right: 8px;">
+ <span class="glyphicon glyphicon-info-sign"></span>
+ </a>
+ </div>
+ </li>
+ </ol>
+ </li>
+ </ol>
+ </div>
+ </div>
+</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/msoCommit.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/msoCommit.htm
new file mode 100755
index 0000000..e3f415c
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/msoCommit.htm
@@ -0,0 +1,47 @@
+<!--
+ ============LICENSE_START=======================================================
+ VID
+ ================================================================================
+ 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=========================================================
+ -->
+
+<div ng-controller="msoCommitController" ng-show="isViewVisible">
+
+ <div class="statusLine">
+ <img src="app/vid/images/spinner.gif"
+ ngx-visible="{{isSpinnerVisible}}"> </img> <label>Status:</label><span
+ class="status">{{status}}</span>
+ </div>
+
+ <div class="feedback">
+
+ <div progress-bar control="progressBarControl"
+ value="{{percentProgress}}" increases-only="true"
+ ngx-show="{{isProgressVisible}}"></div>
+
+ <div class="error" ng-show="!isProgressVisible">
+ <img src="app/vid/images/error.png"></img>{{error}}
+ </div>
+
+ </div>
+
+ <pre class="log">{{log}}</pre>
+
+ <div class="buttonRow">
+ <button ngx-enabled="{{isCloseEnabled}}" att-button size="small"
+ ng-click="close();">Close</button>
+ </div>
+</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/popupWindow.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/popupWindow.htm
new file mode 100755
index 0000000..b932f25
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/popupWindow.htm
@@ -0,0 +1,30 @@
+<!--
+ ============LICENSE_START=======================================================
+ VID
+ ================================================================================
+ 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=========================================================
+ -->
+
+<div>
+<table
+ style="display: none; position: absolute; left: 0; top: 0; width: 100%; height: 100%; border-collapse: collapse; margin: 0; padding: 0">
+ <tr>
+ <td align="center" style="vertical-align: top; padding: 10px"><div
+ style="display: inline-block; padding: 5px; background-color: white"
+ ng-transclude></div></td>
+ </tr>
+</table>
+</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceModels.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceModels.htm
new file mode 100755
index 0000000..c0a8ee5
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/serviceModels.htm
@@ -0,0 +1,91 @@
+<!--
+ ============LICENSE_START=======================================================
+ VID
+ ================================================================================
+ 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=========================================================
+ -->
+
+<link rel="stylesheet" type="text/css" href="app/vid/styles/serviceModels.css" />
+<div popup-window class="popupContents" ngx-show="{{popup.isVisible}}" ng-cloak>
+ <div ng-include="'app/vid/scripts/view-models/creationDialog.htm'"/>
+</div>
+<div>
+
+ <span class="statusLine" ng-class="{true:'smcVisible', false:'smcHidden'}[isSpinnerVisible]">
+ <img src="app/vid/images/spinner.gif"></img>
+ </span>
+ <span class="statusLine" ng-class="{true:'progVisible', false:'progHidden'}[isProgressVisible]">
+ <label>Status:</label><span class="status"><span ng-show="error"><font color='red'><b>Error: </b></font></span>{{status}}</span>
+ </span>
+ <br><br>
+
+ <div class="fn-ebz-container">
+ Filter:
+ <input class="fn-ebz-text" type="text" ng-model="searchString" size="20" style="width: 250px;">
+ </div>
+
+ <h1 class="heading1" style="margin-top:20px;">Browse SDC Service Models</h1>
+ <div style="margin-top:30px" ng-init="getServiceModels();">
+
+ <table att-table table-data="services" view-per-page="viewPerPage" current-page="currentPage" search-category="searchCategory" search-string="searchString" total-page="totalPage">
+ <thead att-table-row type="header">
+ <tr>
+ <th att-table-header key="action">Action</th>
+ <th att-table-header key="uuid">UUID</th>
+ <th att-table-header key="invariantUUID">Invariant UUID</th>
+ <th att-table-header default-sort="A" key="name">Name</th>
+ <th att-table-header key="version">Version</th>
+ <th att-table-header key="category">Category</th>
+ <th att-table-header key="distributionStatus">Distribution Status</th>
+ <th att-table-header key="lastUpdaterUserId">Last Updated By</th>
+ <th att-table-header key="toscaModelUrl">Tosca Model</th>
+ </tr>
+ </thead>
+ <tbody att-table-row type="body" row-repeat="service in services">
+ <tr>
+ <td att-table-body ><button type=button ng-click="deployService(service)" att-button btn-type="primary" size="small">Deploy</button></td>
+ <td att-table-body ng-bind="service['uuid']"></td>
+ <td att-table-body ng-bind="service['invariantUUID']"></td>
+ <td att-table-body ng-bind="service['name']"></td>
+ <td att-table-body ng-bind="service['version']"></td>
+ <td att-table-body ng-bind="service['category']"></td>
+ <td att-table-body ng-bind="service['distributionStatus']"></td>
+ <td att-table-body ng-bind="service['lastUpdaterUserId']"></td>
+ <td att-table-body ng-bind="service['toscaModelUrl']"></td>
+ </tr>
+ </tbody>
+ </table>
+ <table width='100%'>
+ <tr>
+ <td width='33%' valign='middle'>
+ <span style="cursor: pointer" ng-if="currentPage>1"><button att-button size="small" ng-click="prevPage();">< prev page</button></span>
+ </td>
+ <td width='33%' valign='middle'>
+ Jump to page:
+ <input class="fn-ebz-text" type="text" ng-model="currentPage" size="5" style="width: 47px;">
+ Results per page: <span style="cursor: pointer" ng-click="viewPerPage = 10" ng-style="viewPerPage === 10 && {'textDecoration':'underline','text-color':'black'}">10</span>
+ | <span style="cursor: pointer" ng-click="viewPerPage = 25" ng-style="viewPerPage === 25 && {'textDecoration':'underline','text-color':'black'}">25</span>
+ | <span style="cursor: pointer" ng-click="viewPerPage = 50" ng-style="viewPerPage === 50 && {'textDecoration':'underline','text-color':'black'}">50</span>
+ </td>
+ <td width='34%' align='right' valign='middle'>
+ <span style="cursor: pointer" ng-if="currentPage<totalPage"><button att-button size="small" ng-click="nextPage();">next page ></button></span>
+ </td>
+ </tr>
+ </table>
+
+ </div>
+ </div>
+
diff --git a/vid-app-common/src/main/webapp/app/vid/scripts/view-models/statusDialog.htm b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/statusDialog.htm
new file mode 100755
index 0000000..914516b
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/scripts/view-models/statusDialog.htm
@@ -0,0 +1,66 @@
+<!--
+ ============LICENSE_START=======================================================
+ VID
+ ================================================================================
+ 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=========================================================
+ -->
+
+<div ng-controller="statusDialogController" ng-show="isDialogVisible">
+
+ <div class="titleLine">
+ <img src="app/vid/images/spinner.gif"
+ ngx-visible="{{isSpinnerVisible}}"></img>
+ <h3>VNF Update Prov Status</h3> <!-- {{componentName}} -->
+ </div>
+
+ <div class="error" ng-show="isErrorVisible">
+ <img src="app/vid/images/error.png"></img>{{error}}
+ </div>
+
+ <div class="success" ng-show="isSuccessVisible">
+ <b><center><h3><font color="green">{{success}}</font></h3></center></b>
+ </div>
+
+ <parameter-block control="summaryControl"></parameter-block>
+
+ <h4>{{componentName}} Status</h4>
+
+ <parameter-block control="detailsControl"></parameter-block>
+
+ <h4>
+ Modify Prov_Status: (<img class="requiredIndicator"
+ src="app/vid/images/asterisk.png" height='10' width='10'></img> indicates required field)
+ </h4>
+ <parameter-block control="userProvidedControl"
+ callback="userParameterChanged(id);" editable></parameter-block>
+
+ <div class="prompt">
+ <p>
+ Select Target Prov Status and <span>Submit</span> to<br />to Change the Prov Status of <span>{{componentName}}</span>
+ </p>
+ <p>
+ <span>Close</span> to Return to Previous Page.<br />
+ </p>
+ </div>
+
+ <div class="buttonRow">
+ <button ngx-enabled="{{isSubmitEnabled}}" att-button size="small"
+ ng-click="submit();">Submit</button>
+ <button ngx-enabled="{{isCancelEnabled}}" ng-click="cancel();" att-button
+ btn-type="primary" size="small">Close</button>
+ </div>
+
+</div>
diff --git a/vid-app-common/src/main/webapp/app/vid/styles/aaiGetSubs.css b/vid-app-common/src/main/webapp/app/vid/styles/aaiGetSubs.css
new file mode 100755
index 0000000..feabda8
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/styles/aaiGetSubs.css
@@ -0,0 +1,62 @@
+div[ng-controller=aaiSubscriberController] .popupContents {
+ text-align: left;
+}
+
+div[ng-controller=aaiSubscriberController] .statusLine {
+ vertical-align: center;
+}
+
+div[ng-controller=aaiSubscriberController] .statusLine img {
+ width: 20px;
+ margin: 10px;
+}
+
+div[ng-controller=aaiSubscriberController] .status {
+ margin-left: 5px;
+}
+
+div[ng-controller=aaiSubscriberController] .feedback {
+ height: 35px;
+ vertical-align: center;
+}
+
+div[ng-controller=aaiSubscriberController] .progress {
+ margin: 0px 10px;
+ font-weight: bold;
+}
+
+div[ng-controller=aaiSubscriberController] .error {
+ width: 630px;
+ font-weight: bold;
+ font-size: 16px;
+ color: red;
+ margin: 0px 10px 0px 45px;
+}
+
+div[ng-controller=aaiSubscriberController] .error img {
+ width: 25px;
+ margin: 0px 10px;
+}
+
+div[ng-controller=aaiSubscriberController] .buttonRow {
+ text-align: center;
+ margin-bottom: 10px;
+}
+
+div[ng-controller=aaiSubscriberController] .log {
+ width: 700px;
+ height: 500px;
+ border: solid black 1px;
+ text-align: left !important;
+ margin: 10px;
+ padding: 10px;
+ overflow: auto;
+}
+
+div[ng-controller=aaiSubscriberController] .aaiHidden {
+ visibility: hidden;
+}
+
+div[ng-controller=aaiSubscriberController] .aaiVisible {
+ visibility: visible;
+}
\ No newline at end of file
diff --git a/vid-app-common/src/main/webapp/app/vid/styles/aaiSubDetails.css b/vid-app-common/src/main/webapp/app/vid/styles/aaiSubDetails.css
new file mode 100755
index 0000000..feabda8
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/styles/aaiSubDetails.css
@@ -0,0 +1,62 @@
+div[ng-controller=aaiSubscriberController] .popupContents {
+ text-align: left;
+}
+
+div[ng-controller=aaiSubscriberController] .statusLine {
+ vertical-align: center;
+}
+
+div[ng-controller=aaiSubscriberController] .statusLine img {
+ width: 20px;
+ margin: 10px;
+}
+
+div[ng-controller=aaiSubscriberController] .status {
+ margin-left: 5px;
+}
+
+div[ng-controller=aaiSubscriberController] .feedback {
+ height: 35px;
+ vertical-align: center;
+}
+
+div[ng-controller=aaiSubscriberController] .progress {
+ margin: 0px 10px;
+ font-weight: bold;
+}
+
+div[ng-controller=aaiSubscriberController] .error {
+ width: 630px;
+ font-weight: bold;
+ font-size: 16px;
+ color: red;
+ margin: 0px 10px 0px 45px;
+}
+
+div[ng-controller=aaiSubscriberController] .error img {
+ width: 25px;
+ margin: 0px 10px;
+}
+
+div[ng-controller=aaiSubscriberController] .buttonRow {
+ text-align: center;
+ margin-bottom: 10px;
+}
+
+div[ng-controller=aaiSubscriberController] .log {
+ width: 700px;
+ height: 500px;
+ border: solid black 1px;
+ text-align: left !important;
+ margin: 10px;
+ padding: 10px;
+ overflow: auto;
+}
+
+div[ng-controller=aaiSubscriberController] .aaiHidden {
+ visibility: hidden;
+}
+
+div[ng-controller=aaiSubscriberController] .aaiVisible {
+ visibility: visible;
+}
\ No newline at end of file
diff --git a/vid-app-common/src/main/webapp/app/vid/styles/aaiSubViewEdit.css b/vid-app-common/src/main/webapp/app/vid/styles/aaiSubViewEdit.css
new file mode 100755
index 0000000..feabda8
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/styles/aaiSubViewEdit.css
@@ -0,0 +1,62 @@
+div[ng-controller=aaiSubscriberController] .popupContents {
+ text-align: left;
+}
+
+div[ng-controller=aaiSubscriberController] .statusLine {
+ vertical-align: center;
+}
+
+div[ng-controller=aaiSubscriberController] .statusLine img {
+ width: 20px;
+ margin: 10px;
+}
+
+div[ng-controller=aaiSubscriberController] .status {
+ margin-left: 5px;
+}
+
+div[ng-controller=aaiSubscriberController] .feedback {
+ height: 35px;
+ vertical-align: center;
+}
+
+div[ng-controller=aaiSubscriberController] .progress {
+ margin: 0px 10px;
+ font-weight: bold;
+}
+
+div[ng-controller=aaiSubscriberController] .error {
+ width: 630px;
+ font-weight: bold;
+ font-size: 16px;
+ color: red;
+ margin: 0px 10px 0px 45px;
+}
+
+div[ng-controller=aaiSubscriberController] .error img {
+ width: 25px;
+ margin: 0px 10px;
+}
+
+div[ng-controller=aaiSubscriberController] .buttonRow {
+ text-align: center;
+ margin-bottom: 10px;
+}
+
+div[ng-controller=aaiSubscriberController] .log {
+ width: 700px;
+ height: 500px;
+ border: solid black 1px;
+ text-align: left !important;
+ margin: 10px;
+ padding: 10px;
+ overflow: auto;
+}
+
+div[ng-controller=aaiSubscriberController] .aaiHidden {
+ visibility: hidden;
+}
+
+div[ng-controller=aaiSubscriberController] .aaiVisible {
+ visibility: visible;
+}
\ No newline at end of file
diff --git a/vid-app-common/src/main/webapp/app/vid/styles/angular-ui-tree.css b/vid-app-common/src/main/webapp/app/vid/styles/angular-ui-tree.css
new file mode 100755
index 0000000..8a0ea78
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/styles/angular-ui-tree.css
@@ -0,0 +1,61 @@
+.angular-ui-tree {
+}
+
+.angular-ui-tree-empty {
+ border: 1px dashed #bbb;
+ min-height: 100px;
+ background-color: #e5e5e5;
+ background-image: -webkit-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff), -webkit-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff);
+ background-image: -moz-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff), -moz-linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff);
+ background-image: linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff), linear-gradient(45deg, #fff 25%, transparent 25%, transparent 75%, #fff 75%, #fff);
+ background-size: 60px 60px;
+ background-position: 0 0, 30px 30px;
+ pointer-events: none;
+}
+
+.angular-ui-tree-nodes {
+ position: relative;
+ margin: 0;
+ padding: 0;
+ list-style: none;
+}
+
+.angular-ui-tree-nodes .angular-ui-tree-nodes {
+ padding-left: 20px;
+}
+
+.angular-ui-tree-node, .angular-ui-tree-placeholder {
+ position: relative;
+ margin: 0;
+ padding: 0;
+ min-height: 20px;
+ line-height: 20px;
+}
+
+.angular-ui-tree-hidden {
+ display: none;
+}
+
+.angular-ui-tree-placeholder {
+ margin: 5px 0;
+ padding: 0;
+ min-height: 30px;
+}
+
+.angular-ui-tree-handle {
+ cursor: move;
+ text-decoration: none;
+ font-weight: bold;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ min-height: 20px;
+ line-height: 20px;
+}
+
+.angular-ui-tree-drag {
+ position: absolute;
+ pointer-events: none;
+ z-index: 999;
+ opacity: .8;
+}
diff --git a/vid-app-common/src/main/webapp/app/vid/styles/dialogs.css b/vid-app-common/src/main/webapp/app/vid/styles/dialogs.css
new file mode 100755
index 0000000..f199aaa
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/styles/dialogs.css
@@ -0,0 +1,133 @@
+/*
+ * Common style sheet for the pop-up dialogs.
+ */
+
+/*
+ * Common style settings ...
+ */
+.popupContents .titleLine img {
+ float: left;
+ margin: 5px;
+ width: 20px;
+}
+
+.popupContents .titleLine>h3 {
+ display: inline-block;
+ padding-right: 40px;
+}
+
+.popupContents .requiredIndicator {
+ width: 14px;
+ padding-bottom: 5px;
+}
+
+.popupContents div[control=summaryControl] {
+ display: inline-block;
+ width: 600px;
+ margin: 0px 10px 10px 10px;
+}
+
+.popupContents div[control=detailsControl], .popupContents div[control=userProvidedControl]
+ {
+ display: inline-block;
+ border: solid black 1px;
+ margin: 10px;
+ padding: 10px;
+ max-height: 300px;
+ width: 600px;
+ overflow: auto;
+}
+
+.popupContents .prompt {
+ margin: 10px;
+}
+
+.popupContents .prompt p {
+ margin: 5px;
+}
+
+.popupContents .prompt span {
+ font-weight: bold;
+}
+
+.popupContents .statusLine {
+ vertical-align: center;
+}
+
+.popupContents .statusLine img {
+ width: 20px;
+ margin: 10px;
+}
+
+.popupContents .status {
+ margin-left: 5px;
+}
+
+.popupContents .feedback {
+ height: 35px;
+ vertical-align: center;
+}
+
+.popupContents .progress {
+ margin: 0px 10px;
+}
+
+.popupContents .error {
+ width: 630px;
+ text-align: left;
+ font-weight: bold;
+ font-size: 16px;
+ color: red;
+ margin: 0px 10px 0px 45px;
+ font-weight: bold;
+}
+
+.popupContents .error img {
+ width: 25px;
+ margin: 0px 10px;
+}
+
+.popupContents .buttonRow {
+ text-align: center;
+ margin-bottom: 10px;
+}
+
+.popupContents .log {
+ width: 700px;
+ height: 500px;
+ border: solid black 1px;
+ text-align: left !important;
+ margin: 10px;
+ padding: 10px;
+ overflow: auto;
+}
+
+::-webkit-input-placeholder {
+ text-align: center;
+}
+
+::-moz-placeholder {
+ text-align: center;
+}
+
+:-ms-input-placeholder {
+ text-align: center;
+}
+
+/*
+ * Styling for specific screens ...
+ */
+div[ng-controller=detailsDialogController] .log {
+ height: 200px;
+}
+
+/*
+ * Styling for specific screens ...
+ */
+div[ng-controller=statusDialogController] .log {
+ height: 200px;
+}
+
+div[ng-controller=msoCommitController] {
+ text-align: left;
+}
\ No newline at end of file
diff --git a/vid-app-common/src/main/webapp/app/vid/styles/dummy.txt b/vid-app-common/src/main/webapp/app/vid/styles/dummy.txt
new file mode 100755
index 0000000..e69de29
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/styles/dummy.txt
diff --git a/vid-app-common/src/main/webapp/app/vid/styles/instantiate.css b/vid-app-common/src/main/webapp/app/vid/styles/instantiate.css
new file mode 100755
index 0000000..13e2cf0
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/styles/instantiate.css
@@ -0,0 +1,62 @@
+div[ng-controller=InstantiationController] .popupContents {
+ text-align: left;
+}
+
+div[ng-controller=InstantiationController] .statusLine {
+ vertical-align: center;
+}
+
+div[ng-controller=InstantiationController] .statusLine img {
+ width: 20px;
+ margin: 10px;
+}
+
+div[ng-controller=InstantiationController] .status {
+ margin-left: 5px;
+}
+
+div[ng-controller=InstantiationController] .feedback {
+ height: 35px;
+ vertical-align: center;
+}
+
+div[ng-controller=InstantiationController] .progress {
+ margin: 0px 10px;
+ font-weight: bold;
+}
+
+div[ng-controller=InstantiationController] .error {
+ width: 630px;
+ font-weight: bold;
+ font-size: 16px;
+ color: red;
+ margin: 0px 10px 0px 45px;
+}
+
+div[ng-controller=InstantiationController] .error img {
+ width: 25px;
+ margin: 0px 10px;
+}
+
+div[ng-controller=InstantiationController] .buttonRow {
+ text-align: center;
+ margin-bottom: 10px;
+}
+
+div[ng-controller=InstantiationController] .log {
+ width: 700px;
+ height: 500px;
+ border: solid black 1px;
+ text-align: left !important;
+ margin: 10px;
+ padding: 10px;
+ overflow: auto;
+}
+
+div[ng-controller=InstantiationController] .aaiHidden {
+ visibility: hidden;
+}
+
+div[ng-controller=InstantiationController] .aaiVisible {
+ visibility: visible;
+}
\ No newline at end of file
diff --git a/vid-app-common/src/main/webapp/app/vid/styles/serviceModels.css b/vid-app-common/src/main/webapp/app/vid/styles/serviceModels.css
new file mode 100755
index 0000000..0a64299
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/styles/serviceModels.css
@@ -0,0 +1,70 @@
+div[ng-controller=ServiceModelController] .popupContents {
+ text-align: left;
+}
+
+div[ng-controller=ServiceModelController] .statusLine {
+ vertical-align: center;
+}
+
+div[ng-controller=ServiceModelController] .statusLine img {
+ width: 20px;
+ margin: 10px;
+}
+
+div[ng-controller=ServiceModelController] .status {
+ margin-left: 5px;
+}
+
+div[ng-controller=ServiceModelController] .feedback {
+ height: 35px;
+ vertical-align: center;
+}
+
+div[ng-controller=ServiceModelController] .progress {
+ margin: 0px 10px;
+ font-weight: bold;
+}
+
+div[ng-controller=ServiceModelController] .error {
+ width: 630px;
+ font-weight: bold;
+ font-size: 16px;
+ color: red;
+ margin: 0px 10px 0px 45px;
+}
+
+div[ng-controller=ServiceModelController] .error img {
+ width: 25px;
+ margin: 0px 10px;
+}
+
+div[ng-controller=ServiceModelController] .buttonRow {
+ text-align: center;
+ margin-bottom: 10px;
+}
+
+div[ng-controller=ServiceModelController] .log {
+ width: 700px;
+ height: 500px;
+ border: solid black 1px;
+ text-align: left !important;
+ margin: 10px;
+ padding: 10px;
+ overflow: auto;
+}
+
+div[ng-controller=ServiceModelController] .smcHidden {
+ visibility: hidden;
+}
+
+div[ng-controller=ServiceModelController] .smcVisible {
+ visibility: visible;
+}
+
+div[ng-controller=ServiceModelController] .progHidden {
+ visibility: hidden;
+}
+
+div[ng-controller=ServiceModelController] .progVisible {
+ visibility: visible;
+}
\ No newline at end of file
diff --git a/vid-app-common/src/main/webapp/app/vid/styles/subscriberSearch.css b/vid-app-common/src/main/webapp/app/vid/styles/subscriberSearch.css
new file mode 100755
index 0000000..461de01
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/styles/subscriberSearch.css
@@ -0,0 +1,8 @@
+div[ng-controller=aaiSubscriberSearchController] button {
+ width: 200px;
+ margin: 3px;
+}
+
+h3 {
+ margin-bottom: 5px;
+}
diff --git a/vid-app-common/src/main/webapp/app/vid/styles/vidTree.css b/vid-app-common/src/main/webapp/app/vid/styles/vidTree.css
new file mode 100755
index 0000000..1aec73d
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/styles/vidTree.css
@@ -0,0 +1,67 @@
+
+.btn {
+ margin-right: 8px;
+}
+
+.angular-ui-tree-handle {
+ background: #f8faff;
+ border: 1px solid #dae2ea;
+ color: #7c9eb2;
+ padding: 10px 10px;
+}
+
+.angular-ui-tree-handle:hover {
+ color: #438eb9;
+ background: #f4f6f7;
+ border-color: #dce2e8;
+}
+
+.angular-ui-tree-placeholder {
+ background: #f0f9ff;
+ border: 2px dashed #bed2db;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+}
+
+tr.angular-ui-tree-empty {
+ height:100px
+}
+
+.group-title {
+ background-color: #687074 !important;
+ color: #FFF !important;
+}
+
+
+/* --- Tree --- */
+.tree-node {
+ border: 1px solid #dae2ea;
+ background: #f8faff;
+ color: #7c9eb2;
+}
+
+.nodrop {
+ background-color: #f2dede;
+}
+
+.tree-node-content {
+ margin: 10px;
+}
+.tree-handle {
+ padding: 10px;
+ background: #428bca;
+ color: #FFF;
+ margin-right: 10px;
+}
+
+.angular-ui-tree-handle:hover {
+}
+
+.angular-ui-tree-placeholder {
+ background: #f0f9ff;
+ border: 2px dashed #bed2db;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+}
\ No newline at end of file
diff --git a/vid-app-common/src/main/webapp/app/vid/test/testAaiData.js b/vid-app-common/src/main/webapp/app/vid/test/testAaiData.js
new file mode 100755
index 0000000..95dd158
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/test/testAaiData.js
@@ -0,0 +1,254 @@
+var exampleServiceModelInfo = {
+ modelInvariantId : "SERVICE_INVARIANT_ID_c99-b43e0d88a9a1",
+ modelNameVersionId : "SERVICE_NAME_VERSION_ID-4d54-8548-5d0ed23e962b",
+ modelName : "SERVICE_NAME_DE220127",
+ modelVersion : "SERVICE_VERSION_0.1"
+};
+
+var exampleVnfModelInfo = {
+ modelInvariantId : "VNF_INVARIANT_ID_c99-b43e0d88a9a1",
+ modelNameVersionId : "VNF_NAME_VERSION_ID-4d54-8548-5d0ed23e962b",
+ modelName : "VNF_NAME_DE220127",
+ modelVersion : "VNF_VERSION_0.1"
+};
+
+var exampleVfModuleModelInfo = {
+ modelInvariantId : "VF_MODULE_INVARIANT_ID_c99-b43e0d88a9a1",
+ modelNameVersionId : "VF_MODULE_NAME_VERSION_ID-4d54-8548-5d0ed23e962b",
+ modelName : "VF_MODULE_NAME_DE220127",
+ modelVersion : "VF_MODULE_VERSION_0.1"
+};
+
+var exampleVolumeGroupModelInfo = {
+ modelInvariantId : "VOLUME_GROUP_INVARIANT_ID_c99-b43e0d88a9a1",
+ modelNameVersionId : "VOLUME_GROUP_NAME_VERSION_ID-4d54-8548-5d0ed23e962b",
+ modelName : "VOLUME_GROUP_NAME_DE220127",
+ modelVersion : "VOLUME_GROUP_VERSION_0.1"
+};
+
+var exampleAvailableVolumeGroupList = [ "Volume Group Alpha",
+ "Volume Group Baker", "Volume Group Charlie" ];
+
+var exampleNetworkModelInfo = {
+ modelInvariantId : "NETWORK_INVARIANT_ID_c99-b43e0d88a9a1",
+ modelNameVersionId : "NETWORK_NAME_VERSION_ID-4d54-8548-5d0ed23e962b",
+ modelName : "NETWORK_NAME_DE220127",
+ modelVersion : "NETWORK_VERSION_0.1"
+};
+
+var exampleCloudRegionTenantList = [ {
+ cloudRegionId : "LEGACYREGION",
+ tenantId : "ebe382f38e414b4dbf45b408c7e5bf9f",
+ tenantName : "vMOG-AKRON-123"
+}, {
+ cloudRegionId : "LEGACYREGION",
+ tenantId : "abcdefhi38e414b4dbf45b408c7e5bf9f",
+ tenantName : "tenant 2"
+}, {
+ cloudRegionId : "LEGACYREGION",
+ tenantId : "rstuvwzyx38e414b4dbf45b408c7e5bf9f",
+ tenantName : "tenant 3"
+}, {
+ cloudRegionId : "cloudR2",
+ tenantId : "jklmnop38e414b4dbf45b408c7e5bf9f",
+ tenantName : "tenant4"
+}, {
+ cloudRegionId : "cloudR2",
+ tenantId : "qurstuv38e414b4dbf45b408c7e5bf9f",
+ tenantName : "tenant 5"
+}, {
+ cloudRegionId : "cloudR3",
+ tenantId : "zyxw38e414b4dbf45b408c7e5bf9f",
+ tenantName : "tenant 6"
+} ];
+
+var exampleServiceIdList = [ {
+ id : "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ description : "Mobility"
+}, {
+ id : "e433710f-9217-458d-a79d-1c7aff376d89",
+ description : "VIRTUAL USP"
+}, {
+ id : "c7611ebe-c324-48f1-8085-94aef0c6ef3d",
+ description : "HOSTED COMMUNICATIONS"
+} ];
+
+var exampleServiceItem = {
+ "generic-service" : {
+ "service-id" : "415d4d6c-19e8-44ed-bd28-28d41c5b5185",
+ "service-name" : "ZRDM1MMSC01",
+ "service-type" : "vMMSC Svc Jul 12/vMMSC VOLUME VF new Jul 12 13",
+ "service-id" : "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "orchestration-status" : "active",
+ "in-maint" : false,
+ "is-closed-loop-disabled" : false,
+ "resource-version" : "1469558690",
+ "persona-model-id" : "1fe5c0e1-7ae8-4a3b-bf06-e64b9fa7e7c9",
+ "persona-model-version" : "1.0"
+ }
+};
+
+var exampleVfModuleItem = {
+ "generic-vfModule" : {
+ "vfModule-id" : "415d4d6c-19e8-44ed-bd28-28d41c5b5185",
+ "vfModule-name" : "ZRDM1MMSC01",
+ "vfModule-type" : "vMMSC Svc Jul 12/vMMSC VOLUME VF new Jul 12 13",
+ "vfModule-id" : "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "orchestration-status" : "active",
+ "in-maint" : false,
+ "is-closed-loop-disabled" : false,
+ "resource-version" : "1469558690",
+ "persona-model-id" : "1fe5c0e1-7ae8-4a3b-bf06-e64b9fa7e7c9",
+ "persona-model-version" : "1.0"
+ }
+};
+
+var exampleVolumeGroupItem = {
+ "generic-volumeGroup" : {
+ "volumeGroup-id" : "415d4d6c-19e8-44ed-bd28-28d41c5b5185",
+ "volumeGroup-name" : "ZRDM1MMSC01",
+ "volumeGroup-type" : "vMMSC Svc Jul 12/vMMSC VOLUME VF new Jul 12 13",
+ "volumeGroup-id" : "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "orchestration-status" : "active",
+ "in-maint" : false,
+ "is-closed-loop-disabled" : false,
+ "resource-version" : "1469558690",
+ "persona-model-id" : "1fe5c0e1-7ae8-4a3b-bf06-e64b9fa7e7c9",
+ "persona-model-version" : "1.0"
+ }
+};
+
+var exampleNetworkItem = {
+ "generic-network" : {
+ "network-id" : "415d4d6c-19e8-44ed-bd28-28d41c5b5185",
+ "network-name" : "ZRDM1MMSC01",
+ "network-type" : "vMMSC Svc Jul 12/vMMSC VOLUME VF new Jul 12 13",
+ "network-id" : "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "orchestration-status" : "active",
+ "in-maint" : false,
+ "is-closed-loop-disabled" : false,
+ "resource-version" : "1469558690",
+ "persona-model-id" : "1fe5c0e1-7ae8-4a3b-bf06-e64b9fa7e7c9",
+ "persona-model-version" : "1.0"
+ }
+};
+
+/*
+ * Sample query provided by Jimmy on 8/11/16.
+ */
+
+var exampleAaiResult = {
+ "service-instance" : {
+ "service-instance-id" : "mmsc-test-service-instance",
+ "resource-version" : "1470921501"
+ },
+ "extra-properties" : {},
+ "inventory-response-items" : {
+ "inventory-response-item" : [ {
+ "generic-vnf" : {
+ "vnf-id" : "415d4d6c-19e8-44ed-bd28-28d41c5b5185",
+ "vnf-name" : "ZRDM1MMSC01",
+ "vnf-type" : "vMMSC Svc Jul 12/vMMSC VOLUME VF new Jul 12 13",
+ "service-id" : "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "orchestration-status" : "active",
+ "in-maint" : false,
+ "is-closed-loop-disabled" : false,
+ "resource-version" : "1469558690",
+ "persona-model-id" : "1fe5c0e1-7ae8-4a3b-bf06-e64b9fa7e7c9",
+ "persona-model-version" : "1.0"
+ },
+ "extra-properties" : {},
+ "inventory-response-items" : {
+ "inventory-response-item" : [ {
+ "vf-module" : {
+ "vf-module-id" : "4dd25057-0b2b-4255-b9cd-669443c9b470",
+ "vf-module-name" : "ZRDM1MMSC01_base",
+ "heat-stack-id" : "ZRDM1MMSC01_base/6261554c-6c34-4604-b91c-68afd148a096",
+ "orchestration-status" : "active",
+ "is-base-vf-module" : true,
+ "resource-version" : "1469559159",
+ "persona-model-id" : "6e3b9ac7-cb21-4f39-99ba-f248ba2a597a",
+ "persona-model-version" : "1"
+ },
+ "extra-properties" : {},
+ "inventory-response-items" : {
+ "inventory-response-item" : [
+ {
+ "l3-network" : {
+ "network-id" : "b13635a1-5ab8-4dee-9598-768a83eea099",
+ "network-name" : "MMS-24413-LAB-vMMSC-01_int_eca_mgmt_net_1",
+ "network-type" : "CONTRAIL_BASIC",
+ "network-role" : "int_eca_mgmt",
+ "network-technology" : "contrail",
+ "neutron-network-id" : "07919187-754f-49c2-abb3-9888cfd8ec7d",
+ "is-bound-to-vpn" : false,
+ "service-id" : "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "network-role-instance" : 0,
+ "resource-version" : "1469558694",
+ "orchestration-status" : "active",
+ "heat-stack-id" : "MMS-24413-LAB-vMMSC-01_int_eca_mgmt_net_1/8d34d139-c95f-4d80-86df-d7d13af01067"
+ },
+ "extra-properties" : {},
+ "inventory-response-items" : {}
+ },
+ {
+ "l3-network" : {
+ "network-id" : "44e0d9e0-9334-4ec6-9344-07a96dac629f",
+ "network-name" : "dmz_protected_net_0",
+ "network-type" : "CONTRAIL_EXTERNAL",
+ "network-role" : "dmz_protected",
+ "network-technology" : "contrail",
+ "neutron-network-id" : "1ad6b2c5-97d0-4298-b016-7e28939e0baf",
+ "is-bound-to-vpn" : false,
+ "service-id" : "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "resource-version" : "1469563787",
+ "orchestration-status" : "active",
+ "heat-stack-id" : "dmz_protected_net_0/3f93df5c-f4f1-484f-a269-12d3a6b1ec82"
+ },
+ "extra-properties" : {},
+ "inventory-response-items" : {}
+ },
+ {
+ "l3-network" : {
+ "network-id" : "ac49d99b-5daf-4624-9f8e-188b126ea166",
+ "network-name" : "cor_direct_net_0",
+ "network-type" : "CONTRAIL_BASIC",
+ "network-role" : "cor_direct",
+ "network-technology" : "contrail",
+ "neutron-network-id" : "ac49d99b-5daf-4624-9f8e-188b126ea166",
+ "is-bound-to-vpn" : false,
+ "service-id" : "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "network-role-instance" : 0,
+ "resource-version" : "1470846979",
+ "orchestration-status" : "active",
+ "heat-stack-id" : "",
+ "mso-catalog-key" : ""
+ },
+ "extra-properties" : {},
+ "inventory-response-items" : {}
+ },
+ {
+ "l3-network" : {
+ "network-id" : "c597ab81-fece-49f4-a4f5-710cebb13c29",
+ "network-name" : "oam_protected_net_0",
+ "network-type" : "CONTRAIL_BASIC",
+ "network-role" : "oam_protected",
+ "network-technology" : "contrail",
+ "neutron-network-id" : "c597ab81-fece-49f4-a4f5-710cebb13c29",
+ "is-bound-to-vpn" : false,
+ "service-id" : "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "network-role-instance" : 0,
+ "resource-version" : "1470846979",
+ "orchestration-status" : "active",
+ "heat-stack-id" : "",
+ "mso-catalog-key" : ""
+ },
+ "extra-properties" : {},
+ "inventory-response-items" : {}
+ } ]
+ }
+ } ]
+ }
+ } ]
+ }
+};
diff --git a/vid-app-common/src/main/webapp/app/vid/test/testMso.css b/vid-app-common/src/main/webapp/app/vid/test/testMso.css
new file mode 100755
index 0000000..b0844ee
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/test/testMso.css
@@ -0,0 +1,22 @@
+div[ng-controller=testController] button {
+ width: 200px;
+ margin: 3px;
+}
+
+h3 {
+ margin-bottom: 5px;
+}
+
+ol, li {
+ list-style-type: decimal !important;
+}
+
+div[ng-controller=testController]>div>span {
+ font-size: 20px;
+ margin-left: 10px;
+}
+
+div[ng-controller=testController] input[type=checkbox] {
+ height: 20px;
+ width: 20px;
+}
\ No newline at end of file
diff --git a/vid-app-common/src/main/webapp/app/vid/test/testMso.js b/vid-app-common/src/main/webapp/app/vid/test/testMso.js
new file mode 100755
index 0000000..884ba8d
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/test/testMso.js
@@ -0,0 +1,486 @@
+"use strict";
+
+app.config(function($logProvider){
+ // Optionally set to "false" to disable debug logging.
+ $logProvider.debugEnabled(true);
+});
+
+app.controller("testController", [ "$scope", "$timeout", "$cookieStore", "$log", "COMPONENT", "DataService", "PropertyService",
+ function($scope, $timeout, $cookieStore, $log, COMPONENT, DataService, PropertyService) {
+
+ $scope.popup = new Object();
+ $scope.isTestMode = false;
+
+ $scope.init = function(properties) {
+ /*
+ * These 2 statements should be included in non-test code.
+ */
+ PropertyService.setMsoMaxPollingIntervalMsec(properties.msoMaxPollingIntervalMsec);
+ PropertyService.setMsoMaxPolls(properties.msoMaxPolls);
+
+ /*
+ * "setTestMode" is only used for testing.
+ */
+
+ setTestMode();
+
+ DataService.setSubscriberName("Mobility");
+ DataService.setGlobalCustomerId("CUSTID12345")
+ DataService.setServiceType("Mobility Type 1");
+ DataService.setServiceName("Mobility Service 1");
+ DataService.setServiceInstanceId("mmsc-test-service-instance");
+ DataService.setVnfInstanceId("abcd-12345-56789");
+ DataService.setVfModuleInstanceId("xye-99990123213");
+ }
+
+ var TEST_MODE_COOKIE = "isTestModeEnabled";
+
+ var defaultMsoBaseUrl = PropertyService.getMsoBaseUrl();
+
+ var setTestMode = function() {
+ setTestMsoMode($cookieStore.get(TEST_MODE_COOKIE));
+ PropertyService.setMsoMaxPollingIntervalMsec(1000);
+ PropertyService.setMsoMaxPolls(7);
+ PropertyService.setServerResponseTimeoutMsec(10000);
+ };
+
+ $scope.testMsoModeChanged = function() {
+ setTestMsoMode($scope.isTestMsoMode);
+ };
+
+ var setTestMsoMode = function(isEnabled) {
+ $scope.isTestMsoMode = isEnabled;
+ $cookieStore.put(TEST_MODE_COOKIE, isEnabled);
+ if (isEnabled) {
+ PropertyService.setMsoBaseUrl("testmso");
+ } else {
+ PropertyService.setMsoBaseUrl(defaultMsoBaseUrl);
+ }
+ }
+
+ $scope.autoStartCommitTest = function() {
+ /*
+ * Optionally comment in / out one of these method calls (or add a similar
+ * entry) to auto-invoke an entry when the test screen is redrawn.
+ */
+ $timeout(function() {
+ // $scope.createServiceInstance();
+ // $scope.deleteServiceInstance();
+ // $scope.generateInvalidUrl404();
+ }, 500);
+ }
+
+ $scope.autoStartQueryTest = function() {
+ /*
+ * Optionally comment in / out one of these method calls (or add a similar
+ * entry) to auto-invoke an entry when the test screen is redrawn.
+ */
+ $timeout(function() {
+ // $scope.queryServiceInstance();
+ }, 500);
+ }
+
+ $scope.queryServiceInstance = function() {
+ /*
+ * Example of method call needed to show service instance details.
+ */
+ $scope.$broadcast("showComponentDetails", {
+ componentId : COMPONENT.SERVICE
+ });
+ }
+
+ $scope.createServiceInstance = function() {
+ /*
+ * Example of method call needed to commit an instance creation request.
+ */
+ $scope.$broadcast("createInstance", {
+ url : "mso_create_svc_instance",
+ requestDetails : createServiceRequestDetails
+ });
+ }
+
+ $scope.deleteServiceInstance = function() {
+ /*
+ * Example of method call needed to commit an instance deletion request.
+ */
+ $scope.$broadcast("deleteInstance", {
+ url : "mso_delete_svc_instance/bc305d54-75b4-431b-adb2-eb6b9e546014",
+ requestDetails : deleteServiceRequestDetails
+ });
+ }
+
+ $scope.createVNFInstance = function() {
+ /*
+ * Example of method call needed to commit an instance creation request.
+ */
+ $scope.$broadcast("createInstance", {
+ url : "mso_create_vnf_instance/bc305d54-75b4-431b-adb2-eb6b9e546099",
+ requestDetails : createVnfRequestDetails
+ });
+ }
+
+ $scope.deleteVNFInstance = function() {
+ /*
+ * Example of method call needed to commit an instance deletion request.
+ */
+ $scope.$broadcast("deleteInstance", {
+ url : "mso_delete_vnf_instance/bc305d54-75b4-431b-adb2-eb6b9e546014/vnfs/ab9000-0009-9999",
+ requestDetails : deleteVnfRequestDetails
+ });
+ }
+
+ $scope.createVolumeGroupInstance = function() {
+ /*
+ * Example of method call needed to commit an instance creation request.
+ */
+ $scope.$broadcast("createInstance", {
+ url : "mso_create_volumegroup_instance/bc305d54-75b4-431b-adb2-eb6b9e546099/vnfs/fe305d54-75b4-431b-adb2-eb6b9e546fea",
+ requestDetails : createVolumeGroupRequestDetails
+ });
+ }
+
+ $scope.deleteVolumeGroupInstance = function() {
+ /*
+ * Example of method call needed to commit an instance deletion request.
+ */
+ $scope.$broadcast("deleteInstance", {
+ url : "mso_delete_volumegroup_instance/bc305d54-75b4-431b-adb2-eb6b9e546014/vnfs/fe305d54-75b4-431b-adb2-eb6b9e546fea/volumeGroups/fe9000-0009-9999",
+ requestDetails : deleteVolumeGroupRequestDetails
+ });
+ }
+ $scope.createVFModuleInstance = function() {
+ /*
+ * Example of method call needed to commit an instance creation request.
+ */
+ $scope.$broadcast("createInstance", {
+ url : "mso_create_vfmodule_instance/bc305d54-75b4-431b-adb2-eb6b9e546099/vnfs/111-111-111-111",
+ requestDetails : createVFModuleRequestDetails
+ });
+ }
+
+ $scope.deleteVFModuleInstance = function() {
+ /*
+ * Example of method call needed to commit an instance deletion request.
+ *
+ */
+ $scope.$broadcast("deleteInstance", {
+ url : "mso_delete_vfmodule_instance/2/vnfs/ab/vfModules/a1",
+ requestDetails : deleteVFModuleRequestDetails
+ });
+ }
+ $scope.createNetworkInstance = function() {
+ $scope.$broadcast("createInstance", {
+ url : "mso_create_nw_instance/789098877777",
+ requestDetails : createNetworkRequestDetails
+ });
+ }
+
+ $scope.deleteNetworkInstance = function() {
+ $scope.$broadcast("deleteInstance", {
+ url : "mso_delete_nw_instance/bc305d54-75b4-431b-adb2-eb6b9e546014/networks/ff305d54-75b4-ff1b-fff1-eb6b9e5460ff",
+ requestDetails : deleteNetworkRequestDetails
+ });
+ }
+
+ $scope.generateError = function(testName) {
+ // Clone example request object
+ var request = JSON.parse(JSON.stringify(createServiceRequestDetails));
+ request.modelInfo.modelName = testName;
+ $scope.$broadcast("createInstance", {
+ url : "mso_create_svc_instance",
+ requestDetails : request
+ });
+ }
+
+ $scope.generateInvalidUrl404 = function() {
+ var baseUrl = PropertyService.getMsoBaseUrl();
+ PropertyService.setMsoBaseUrl("/INVALID_STRING/");
+
+ $scope.$broadcast("createInstance", {
+ url : "mso_create_svc_instance",
+ requestDetails : createServiceRequestDetails,
+ callbackFunction : function() {
+ PropertyService.setMsoBaseUrl(baseUrl);
+ $scope.popup.isVisible = false;
+ }
+ });
+ }
+
+ $scope.generateInvalidUrl405 = function() {
+ $scope.$broadcast("createInstance", {
+ url : "INVALID_STRING_mso_create_svc_instance",
+ requestDetails : createServiceRequestDetails
+ });
+ }
+
+ /*
+ * Test data objects:
+ */
+ /*var requestParameters = {
+ "subscriptionServiceType":"ef5256d1-5a33-aadf-13ab-12abad84e764",
+ "userParams":[{"name":"goldenr","value":"Willie"}, {"name":"lab","value":"Jackson"}, {"name":"goldend","value":"Max"}]} */
+ var requestParameters = { "subscriptionServiceType":"ef5256d1-5a33-aadf-13ab-12abad84e764", userParams:[] };
+ var requestInfo = {
+ instanceName: "sn5256d1-5a33-55df-13ab-12abad84e764",
+ productFamilyId: "sn5256d1-5a33-55df-13ab-12abad84edde",
+ source: "VID",
+ suppressRollback: true
+ };
+ var subscriberInfo = {
+ globalSubscriberId : "C12345",
+ subscriberName : "General Electric Division 12"
+ };
+
+ var cloudConfiguration = {
+ lcpCloudRegionId: "cloudregion1",
+ tenantId: "df5256d1-5a33-55df-13ab-12abad843456"
+
+ };
+ var createServiceRequestDetails = {
+ modelInfo : {
+ modelType : "service",
+ modelInvariantId : "sn5256d1-5a33-55df-13ab-12abad84e764",
+ modelNameVersionId : "ab6478e4-ea33-3346-ac12-ab121484adca",
+ modelName : "WanBonding",
+ modelVersion : "1",
+ modelCustomizationName: ""
+ },
+ subscriberInfo : subscriberInfo,
+ requestInfo : requestInfo,
+ requestParameters : requestParameters
+ };
+
+ var deleteServiceRequestDetails = {
+ modelInfo : {
+ modelType : "service",
+ modelInvariantId : "sn5256d1-5a33-55df-13ab-12abad84e764",
+ modelNameVersionId : "ab6478e4-ea33-3346-ac12-ab121484adca",
+ modelName : "WanBonding",
+ modelVersion : "1",
+ modelCustomizationName: ""
+ },
+ requestInfo : requestInfo
+ };
+
+ var createVFModuleRequestDetails = {
+ modelInfo : {
+ modelType : "VFModule",
+ modelInvariantId : "ab5256d1-5a33-55df-13ab-12abad84e764",
+ modelNameVersionId : "9b6478e4-ea33-3346-ac12-ab121484adc2",
+ modelName : "model1",
+ modelVersion : "1",
+ modelCustomizationName: ""
+ },
+ cloudConfiguration: cloudConfiguration,
+ requestInfo : requestInfo,
+ relatedInstanceList: [
+ {
+ relatedInstance: {
+ instanceId: "c3514e3-5a33-55df-13ab-12abad84e7cc",
+ modelInfo: {
+ modelType: "volumeGroup",
+ modelInvariantId: "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ modelNameVersionId: "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ modelName: "parentServiceModelName",
+ modelVersion: "1.0"
+ }
+ }
+ },
+ {
+ relatedInstance: {
+ instanceId: "c3514e3-5a33-55df-13ab-12abad84e7cc",
+ modelInfo: {
+ modelType: "service",
+ modelInvariantId: "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ modelNameVersionId: "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ modelName: "parentServiceModelName",
+ modelVersion: "1.0"
+ }
+ }
+ },
+ {
+ relatedInstance: {
+ instanceId: "fab256d1-5a33-55df-13ab-12abad8445ff34",
+ modelInfo: {
+ modelType: "vnf",
+ modelInvariantId: "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+ modelNameVersionId: "fe6478e4-ea33-3346-ac12-ab121484a3fe",
+ modelName: "vSAMP12",
+ modelVersion: "1.0",
+ modelCustomizationName: "vSAMP12 1"
+ }
+ }
+ }
+
+ ],
+ requestParameters : requestParameters
+ };
+
+ var deleteVFModuleRequestDetails = {
+ modelInfo : {
+ modelType : "VFModule",
+ modelInvariantId : "ab5256d1-5a33-55df-13ab-12abad84e764",
+ modelNameVersionId : "9b6478e4-ea33-3346-ac12-ab121484adc2",
+ modelName : "model1",
+ modelVersion : "1",
+ modelCustomizationName: ""
+ },
+ cloudConfiguration: cloudConfiguration,
+ requestInfo : requestInfo,
+
+ };
+
+ var createVnfRequestDetails = {
+ modelInfo : {
+ modelType : "vnf",
+ modelInvariantId : "ab5256d1-5a33-55df-13ab-12abad84efc2",
+ modelNameVersionId : "9b6478e4-ea33-3346-ac12-ab1214847890",
+ modelName : "model1",
+ modelVersion : "1",
+ modelCustomizationName: ""
+ },
+ requestInfo : requestInfo,
+ cloudConfiguration : cloudConfiguration,
+ relatedInstanceList: [
+ {
+ relatedInstance: {
+ instanceId: "c3514e3-5a09-55df-13ab-1babad84e7cc",
+ modelInfo: {
+ modelType: "service",
+ modelInvariantId: "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ modelNameVersionId: "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ modelName: "parentServiceModelName",
+ modelVersion: "1.0"
+ }
+ }
+ }
+ ]
+ };
+
+ var deleteVnfRequestDetails = {
+ modelInfo : {
+ modelType : "vnf",
+ modelInvariantId : "ab5256d1-5a33-55df-13ab-12abad84efc2",
+ modelNameVersionId : "9b6478e4-ea33-3346-ac12-ab1214847890",
+ modelName : "model1",
+ modelVersion : "1",
+ modelCustomizationName: ""
+ },
+ cloudConfiguration : cloudConfiguration,
+ requestInfo : requestInfo
+ };
+ var createVolumeGroupRequestDetails = {
+ modelInfo : {
+ modelType : "volumeGroup",
+ modelInvariantId : "ab5256d1-5a33-55df-13ab-12abad84efda",
+ modelNameVersionId : "9b6478e4-ea33-3346-ac12-ab12148478fa",
+ modelName : "model1",
+ modelVersion : "1",
+ modelCustomizationName: ""
+ },
+ cloudConfiguration : cloudConfiguration,
+ requestInfo : requestInfo,
+ relatedInstanceList: [
+ {
+ relatedInstance: {
+ instanceId: "c3514e3-5a33-55df-13ab-12abad84e7cc",
+ modelInfo: {
+ modelType: "service",
+ modelInvariantId: "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ modelNameVersionId: "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ modelName: "parentServiceModelName",
+ modelVersion: "1.0"
+ }
+ }
+ },
+ {
+ relatedInstance: {
+ instanceId: "fab256d1-5a33-55df-13ab-12abad8445ff34",
+ modelInfo: {
+ modelType: "vnf",
+ modelInvariantId: "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+ modelNameVersionId: "fe6478e4-ea33-3346-ac12-ab121484a3fe",
+ modelName: "vSAMP12",
+ modelVersion: "1.0",
+ modelCustomizationName: "vSAMP12 1"
+ }
+ }
+ }
+ ]
+
+ };
+
+ var deleteVolumeGroupRequestDetails = {
+ modelInfo : {
+ modelType : "volumeGroup",
+ modelInvariantId : "ab5256d1-5a33-55df-13ab-12abad84efda",
+ modelNameVersionId : "9b6478e4-ea33-3346-ac12-ab12148478fa",
+ modelName : "vIsbcOamNetwork",
+ modelVersion : "1",
+ modelCustomizationName: ""
+ },
+ cloudConfiguration : cloudConfiguration,
+ requestInfo : requestInfo
+ };
+
+ var createNetworkRequestDetails = {
+ modelInfo : {
+ modelType : "network",
+ modelInvariantId : "ab5256d1-5a33-55df-13ab-12abad84e890",
+ modelNameVersionId : "fe6478e4-ea33-3346-aaaa-ab121484a3fa",
+ modelName : "vIsbcOamNetwork",
+ modelVersion : "1",
+ modelCustomizationName: ""
+ },
+ cloudConfiguration: cloudConfiguration,
+ requestInfo : requestInfo
+ };
+
+ var deleteNetworkRequestDetails = {
+ modelInfo : {
+ modelType : "network",
+ modelId : "ff5256d1-5a33-55df-aaaa-12abad84e7ff",
+ modelNameVersionId : "fe6478e4-ea33-3346-aaaa-ab121484a3fe",
+ modelName : "vIsbcOamNetwork",
+ modelVersion : "1"
+ },
+ relatedModelList : [
+ {
+ relatedModel : {
+ instanceId : "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ modelInfo : {
+ modelType : "service",
+ modelId : "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ modelNameVersionId : "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ modelName : "Intercarrier Interconnect Session Border Controller",
+ modelVersion : "1"
+ }
+ }
+ },
+ {
+ relatedModel : {
+ instanceId : "ff305d54-75b4-ff1b-adb2-eb6b9e5460ff",
+ modelInfo : {
+ modelType : "vnf",
+ modelId : "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+ modelNameVersionId : "fe6478e4-ea33-3346-ac12-ab121484a3fe",
+ modelName : "vIsbc",
+ modelVersion : "1"
+ }
+ }
+ },
+ {
+ relatedModel : {
+ instanceId : "ff305d54-75b4-ff1b-bdb2-eb6b9e5460ff",
+ modelInfo : {
+ modelType : "vfModule",
+ modelId : "ff5256d1-5a33-55df-13ab-22abad84e7ff",
+ modelNameVersionId : "fe6478e4-ea33-3346-bc12-ab121484a3fe",
+ modelName : "vIsbcRtpExpansionModule",
+ modelVersion : "1"
+ }
+ }
+ } ]
+ };
+ }
+]);
diff --git a/vid-app-common/src/main/webapp/app/vid/test/testViewEdit.css b/vid-app-common/src/main/webapp/app/vid/test/testViewEdit.css
new file mode 100755
index 0000000..0dfb450
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/test/testViewEdit.css
@@ -0,0 +1,30 @@
+div[ng-controller=testViewEditController] button {
+ width: 120px;
+}
+
+div[ng-controller=testViewEditController]>table {
+ border: solid black 1px;
+ width: auto;
+}
+
+div[ng-controller=testViewEditController]>table td {
+ border: solid black 1px;
+}
+
+h3 {
+ margin-bottom: 5px;
+}
+
+ol, li {
+ list-style-type: decimal !important;
+}
+
+div[ng-controller=testViewEditController]>div>span {
+ font-size: 20px;
+ margin-left: 10px;
+}
+
+div[ng-controller=testViewEditController] input[type=checkbox] {
+ height: 20px;
+ width: 20px;
+}
\ No newline at end of file
diff --git a/vid-app-common/src/main/webapp/app/vid/test/testViewEdit.js b/vid-app-common/src/main/webapp/app/vid/test/testViewEdit.js
new file mode 100755
index 0000000..73da4db
--- /dev/null
+++ b/vid-app-common/src/main/webapp/app/vid/test/testViewEdit.js
@@ -0,0 +1,376 @@
+"use strict";
+
+app.config(function($logProvider) {
+ // Optionally set to "false" to disable debug logging.
+ $logProvider.debugEnabled(true);
+});
+
+var testViewEditController = function(COMPONENT, DataService, PropertyService,
+ UtilityService, $scope, $timeout, $cookieStore, $log) {
+
+ $scope.popup = new Object();
+ $scope.isTestMode = false;
+
+ $scope.init = function(properties) {
+
+ /*
+ * These 2 statements should be included in non-test code.
+ */
+ PropertyService
+ .setMsoMaxPollingIntervalMsec(properties.msoMaxPollingIntervalMsec);
+ PropertyService.setMsoMaxPolls(properties.msoMaxPolls);
+
+ /*
+ * Common parameters that shows an example of how the view edit screen
+ * is expected to pass some common service instance values to the
+ * popups.
+ */
+
+ DataService.setSubscriberName("Mobility");
+ DataService.setGlobalCustomerId("CUSTID12345")
+ DataService.setServiceType("Mobility Type 1");
+ DataService.setServiceInstanceName("Example Service Instance Name");
+ DataService.setServiceName("Mobility Service 1");
+ DataService.setServiceInstanceId("mmsc-test-service-instance");
+ DataService.setServiceUuid("XXXX-YYYY-ZZZZ");
+ DataService.setUserServiceInstanceName("USER_SERVICE_INSTANCE_NAME");
+
+ /*
+ * "setTestMode" is only used for testing.
+ */
+
+ setTestMode();
+
+ }
+
+ $scope.autoStartTest = function() {
+ /*
+ * Optionally comment in / out one of these method calls (or add a
+ * similar entry) to auto-invoke an entry as soon as the page is
+ * refreshed.
+ */
+ $timeout(function() {
+ // $scope.showServiceDetails();
+ // $scope.showVnfDetails();
+ // $scope.createService();
+ // $scope.deleteService();
+ // $scope.createNetwork();
+ // $scope.createVnf();
+ // $scope.createVfModule();
+ // $scope.deleteVnf();
+ // $scope.createVfModule();
+ }, 500);
+ }
+
+ /*
+ * This block of code is only used for testing.
+ */
+
+ /*
+ * The first 3 functions override default values set in the server
+ * properties file.
+ *
+ * 1) The URL for the MSO controller is set to either the "real" controller
+ * or the test version depending on the "Use test MSO controller" checkbox.
+ *
+ * 2) SDC and AAI are set to use test controller versions.
+ *
+ * 3) Maximum polling and timeout values are set to lower values to lessen
+ * the time required to run tests.
+ *
+ */
+
+ var TEST_MODE_COOKIE = "isTestModeEnabled";
+
+ var defaultMsoBaseUrl = PropertyService.getMsoBaseUrl();
+
+ var setTestMode = function() {
+ setTestMsoMode($cookieStore.get(TEST_MODE_COOKIE));
+ PropertyService.setAaiBaseUrl("testaai");
+ PropertyService.setAsdcBaseUrl("testasdc");
+ PropertyService.setMsoMaxPollingIntervalMsec(1000);
+ PropertyService.setMsoMaxPolls(7);
+ PropertyService.setServerResponseTimeoutMsec(10000);
+ };
+
+ $scope.testMsoModeChanged = function() {
+ setTestMsoMode($scope.isTestMsoMode);
+ };
+
+ var setTestMsoMode = function(isEnabled) {
+ $scope.isTestMsoMode = isEnabled;
+ $cookieStore.put(TEST_MODE_COOKIE, isEnabled);
+ if (isEnabled) {
+ PropertyService.setMsoBaseUrl("testmso");
+ } else {
+ PropertyService.setMsoBaseUrl(defaultMsoBaseUrl);
+ }
+ };
+
+ var callbackFunction = function(response) {
+ $scope.callbackResults = "";
+ var color = "none";
+ $scope.callbackStyle = {
+ "background-color" : color
+ };
+ /*
+ * This 1/2 delay was only added to visually highlight the status
+ * change. Probably not needed in the real application code.
+ */
+ $timeout(function() {
+ $scope.callbackResults = UtilityService.getCurrentTime()
+ + " isSuccessful: " + response.isSuccessful;
+ if (response.isSuccessful) {
+ color = "#8F8";
+ } else {
+ color = "#F88";
+ }
+ $scope.callbackStyle = {
+ "background-color" : color
+ };
+ }, 500);
+ };
+
+ /*
+ * End of block of test-specific code
+ */
+
+ /*
+ * Create functions
+ */
+ $scope.createService = function() {
+
+ DataService.setModelId("91238134091820938018230918230989");
+
+ $scope.$broadcast("createComponent", {
+ componentId : COMPONENT.SERVICE,
+ callbackFunction : callbackFunction
+ });
+ }
+
+ $scope.createVnf = function() {
+
+ DataService.setModelId("91238134091820938018230918230989");
+ DataService.setModelInstanceName("VNF_MODEL_INSTANCE_NAME");
+
+ DataService.setCloudRegionTenantList(exampleCloudRegionTenantList)
+ DataService.setServiceIdList(exampleServiceIdList);
+
+ // Data used to create MSO "relatedInstanceList" object
+
+ DataService.setModelInfo(COMPONENT.SERVICE, exampleServiceModelInfo);
+
+ $scope.$broadcast("createComponent", {
+ componentId : COMPONENT.VNF,
+ callbackFunction : callbackFunction
+ });
+ }
+
+ $scope.createVfModule = function() {
+ DataService
+ .setInventoryItem(exampleAaiResult["inventory-response-items"][0]);
+
+ DataService.setModelId("91238134091820938018230918230989");
+ DataService.setModelInstanceName("VF_MODULE_MODEL_INSTANCE_NAME");
+
+ DataService.setLcpRegion("Region2");
+ DataService.setTenant("Tenant2");
+ // Data used to create MSO "relatedInstanceList" object
+
+ DataService.setModelInfo(COMPONENT.SERVICE, exampleServiceModelInfo);
+
+ DataService.setVnfInstanceId("VNF_INSTANCE_ID_12345");
+ DataService.setModelInfo(COMPONENT.VNF, exampleVnfModelInfo);
+
+ DataService.setVolumeGroupInstanceId("VOLUME_GROUP_INSTANCE_ID_12345");
+ DataService
+ .setAvailableVolumeGroupList(exampleAvailableVolumeGroupList);
+ DataService.setModelInfo(COMPONENT.VOLUME_GROUP,
+ exampleVolumeGroupModelInfo);
+
+ $scope.$broadcast("createComponent", {
+ componentId : COMPONENT.VF_MODULE,
+ callbackFunction : callbackFunction
+ });
+ }
+
+ $scope.createVolumeGroup = function() {
+
+ DataService.setModelId("91238134091820938018230918230989");
+ DataService.setModelInstanceName("VOLUME_GROUP_MODEL_INSTANCE_NAME");
+ DataService.setLcpRegion("Region1");
+ DataService.setTenant("Tenant1");
+ // Data used to create MSO "relatedInstanceList" object
+
+ DataService.setModelInfo(COMPONENT.SERVICE, exampleServiceModelInfo);
+
+ DataService.setVnfInstanceId("VNF_INSTANCE_ID_12345");
+ DataService.setModelInfo(COMPONENT.VNF, exampleVnfModelInfo);
+
+ $scope.$broadcast("createComponent", {
+ componentId : COMPONENT.VOLUME_GROUP,
+ callbackFunction : callbackFunction
+ });
+ }
+
+ $scope.createNetwork = function() {
+
+ DataService.setModelId("91238134091820938018230918230989");
+ DataService.setModelInstanceName("NETWORK_MODEL_INSTANCE_NAME");
+
+ DataService.setCloudRegionTenantList(exampleCloudRegionTenantList)
+ DataService.setServiceIdList(exampleServiceIdList);
+
+ // Data used to create MSO "relatedInstanceList" object
+
+ DataService.setModelInfo(COMPONENT.SERVICE, exampleServiceModelInfo);
+
+ $scope.$broadcast("createComponent", {
+ componentId : COMPONENT.NETWORK,
+ callbackFunction : callbackFunction
+ });
+ }
+
+ /*
+ * Delete functions
+ */
+ $scope.deleteService = function() {
+
+ DataService.setInventoryItem(exampleServiceItem);
+
+ DataService.setModelInfo(COMPONENT.SERVICE, exampleServiceModelInfo);
+
+ $scope.$broadcast("deleteComponent", {
+ componentId : COMPONENT.SERVICE,
+ callbackFunction : callbackFunction
+ });
+ }
+
+ $scope.deleteVnf = function() {
+
+ DataService
+ .setInventoryItem(exampleAaiResult["inventory-response-items"]["inventory-response-item"][0]);
+
+ DataService.setVnfInstanceId("VNF_INSTANCE_ID_12345");
+ DataService.setModelInfo(COMPONENT.VNF, exampleVnfModelInfo);
+ DataService.setLcpRegion("Region3");
+ DataService.setTenant("Tenant3");
+
+ $scope.$broadcast("deleteComponent", {
+ componentId : COMPONENT.VNF,
+ callbackFunction : callbackFunction
+ });
+ }
+
+ $scope.deleteVfModule = function() {
+
+ DataService.setInventoryItem(exampleVfModuleItem);
+
+ DataService.setVnfInstanceId("VNF_INSTANCE_ID_12345");
+
+ DataService.setVfModuleInstanceId("VF_MODULE_INSTANCE_ID_12345");
+ DataService.setModelInfo(COMPONENT.VF_MODULE, exampleVfModuleModelInfo);
+ DataService.setLcpRegion("Region4");
+ DataService.setTenant("Tenant4");
+
+ $scope.$broadcast("deleteComponent", {
+ componentId : COMPONENT.VF_MODULE,
+ callbackFunction : callbackFunction
+ });
+ }
+
+ $scope.deleteVolumeGroup = function() {
+
+ DataService.setInventoryItem(exampleVolumeGroupItem);
+
+ DataService.setVolumeGroupInstanceId("VOLUME_GROUP_INSTANCE_ID_12345");
+ DataService.setModelInfo(COMPONENT.VOLUME_GROUP,
+ exampleVolumeGroupModelInfo);
+ DataService.setLcpRegion("Region3");
+ DataService.setTenant("Tenant3");
+
+
+ $scope.$broadcast("deleteComponent", {
+ componentId : COMPONENT.VOLUME_GROUP,
+ callbackFunction : callbackFunction
+ });
+ }
+
+ $scope.deleteNetwork = function() {
+
+ DataService.setInventoryItem(exampleNetworkItem);
+
+ DataService.setNetworkInstanceId("NETWORK_INSTANCE_ID_12345");
+ DataService.setModelInfo(COMPONENT.NETWORK, exampleNetworkModelInfo);
+ DataService.setLcpRegion("Region5");
+ DataService.setTenant("Tenant5");
+
+ $scope.$broadcast("deleteComponent", {
+ componentId : COMPONENT.NETWORK,
+ callbackFunction : callbackFunction
+ });
+ }
+
+ /*
+ * Show Details functions
+ */
+ $scope.showServiceDetails = function() {
+
+ DataService.setInventoryItem(exampleServiceItem);
+
+ $scope.$broadcast("showComponentDetails", {
+ componentId : COMPONENT.SERVICE,
+ callbackFunction : callbackFunction
+ });
+ }
+
+ $scope.showVnfDetails = function() {
+
+ DataService.setVnfInstanceId("VNF_INSTANCE_ID_12345");
+ DataService
+ .setInventoryItem(exampleAaiResult["inventory-response-items"]["inventory-response-item"][0]);
+
+ $scope.$broadcast("showComponentDetails", {
+ componentId : COMPONENT.VNF,
+ callbackFunction : callbackFunction
+ });
+ }
+
+ $scope.showVfModuleDetails = function() {
+
+ DataService.setVnfInstanceId("VNF_INSTANCE_ID_12345");
+ DataService.setVfModuleInstanceId("VF_MODULE_INSTANCE_ID_12345");
+ DataService.setInventoryItem(exampleVfModuleItem);
+
+ $scope.$broadcast("showComponentDetails", {
+ componentId : COMPONENT.VF_MODULE,
+ callbackFunction : callbackFunction
+ });
+ }
+
+ $scope.showVolumeGroupDetails = function() {
+
+ DataService.setVolumeGroupInstanceId("VOLUME_GROUP_INSTANCE_ID_12345");
+ DataService.setInventoryItem(exampleVolumeGroupItem);
+
+ $scope.$broadcast("showComponentDetails", {
+ componentId : COMPONENT.VOLUME_GROUP,
+ callbackFunction : callbackFunction
+ });
+ }
+
+ $scope.showNetworkDetails = function() {
+
+ DataService.setNetworkInstanceId("NETWORK_INSTANCE_ID_12345");
+ DataService.setInventoryItem(exampleNetworkItem);
+
+ $scope.$broadcast("showComponentDetails", {
+ componentId : COMPONENT.NETWORK,
+ callbackFunction : callbackFunction
+ });
+ }
+}
+
+app.controller("testViewEditController", [ "COMPONENT", "DataService",
+ "PropertyService", "UtilityService", "$scope", "$timeout",
+ "$cookieStore", "$log", testViewEditController ]);
\ No newline at end of file
diff --git a/vid-app-common/src/main/webapp/index.jsp b/vid-app-common/src/main/webapp/index.jsp
new file mode 100755
index 0000000..056f209
--- /dev/null
+++ b/vid-app-common/src/main/webapp/index.jsp
@@ -0,0 +1,5 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+<%-- Redirected because we can't set the welcome page to a virtual URL. --%>
+<%-- Forward to the intended start page to reduce frustration for new users. --%>
+<c:redirect url="/login.htm"></c:redirect>
diff --git a/vid-app-common/src/main/webapp/test.jsp b/vid-app-common/src/main/webapp/test.jsp
new file mode 100755
index 0000000..1b0c14a
--- /dev/null
+++ b/vid-app-common/src/main/webapp/test.jsp
@@ -0,0 +1,29 @@
+<html>
+<head><title>Test VID Properties related to MSO </title></head>
+<!-- This is a temporary test page. It will be removed from source control -->
+<body>
+<%@ page import="org.openecomp.portalsdk.core.util.SystemProperties" %>
+<%@ page import="org.openecomp.vid.controller.MsoController" %>
+<%@ page import="org.openecomp.vid.mso.rest.Request" %>
+<%@ page import="org.openecomp.vid.mso.rest.RequestDetails" %>
+<%@ page import="org.openecomp.vid.mso.rest.RelatedModel" %>
+<%@ page import="org.openecomp.vid.domain.mso.SubscriberInfo" %>
+<%@ page import="org.openecomp.vid.domain.mso.Response" %>
+<%@ page import="org.openecomp.vid.domain.mso.ModelInfo" %>
+<%@ page import="org.openecomp.vid.domain.mso.RequestInfo" %>
+<%@ page import="org.openecomp.vid.domain.mso.CloudConfiguration" %>
+<%@ page import="org.openecomp.vid.mso.MsoProperties" %>
+<%@ page import="java.net.URI" %>
+<%@ page import="com.sun.jersey.api.client.ClientResponse" %>
+ <%
+ String url = SystemProperties.getProperty(MsoProperties.MSO_SERVER_URL);
+ String max_polls = SystemProperties.getProperty(MsoProperties.MSO_MAX_POLLS);
+ String max_polling_interval_msecs = SystemProperties.getProperty(MsoProperties.MSO_POLLING_INTERVAL_MSECS);
+ %>
+ <h2>VID properties related to MSO:</h2>
+ <h3>MSO server URL:</h3><p>"<%= url %>"</p>
+ <h3>MSO max number of polls:</h3><p>"<%= max_polls %>"</p>
+ <h3>MSO polling interval (msecs):</h3><p>"<%= max_polling_interval_msecs %>"</p>
+ <a href="<%= request.getRequestURI() %>"><h3>Try Again</h3></a>
+</body>
+</html>
diff --git a/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/FirstClass.java b/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/FirstClass.java
new file mode 100755
index 0000000..ed06994
--- /dev/null
+++ b/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/FirstClass.java
@@ -0,0 +1,606 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.ecomp.vid.selenium;
+
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.ie.InternetExplorerDriver;
+import org.openqa.selenium.support.ui.Select;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+import org.apache.log4j.Logger;
+import org.testng.Assert;
+import org.testng.asserts.*;
+
+/**
+ * The Class FirstClass.
+ */
+public class FirstClass {
+
+ /** The login button. */
+ WebElement loginButton;
+
+ /** The eg. */
+ String eg;
+
+ /** The login. */
+ WebElement login;
+
+ /** The pwd. */
+ WebElement pwd;
+
+ /** The log. */
+ Logger log;
+
+ /** The errormessage. */
+ WebElement errormessage;
+
+
+ /** The driver. */
+ WebDriver driver=new FirefoxDriver();
+
+
+
+ /** The config prop. */
+ private final Properties configProp = new Properties();
+
+
+ /**
+ * Instantiates a new first class.
+ */
+ private FirstClass() {
+ // TODO Auto-generated constructor stub
+ //
+ try{
+ // InputStream input =this.getClass().getClassLoader().getResourceAsStream("objectmap.properties");
+ //FileInputStream input1 = new FileInputStream("objectmap.properties");
+
+ InputStream input =new FileInputStream("objectconfig.properties");
+ System.out.println("Read all properties from file");
+ configProp.load(input);
+ System.out.println("Read all properties from file completed");
+ }
+ catch(IOException e) {
+
+ e.printStackTrace();
+ }
+ }
+
+
+ /*
+
+
+ @BeforeClass
+ public void setUp() {
+ System.out.println("*******************");
+ System.out.println("launching IE browser");
+ System.setProperty("webdriver.ie.driver", driverPath+"IEDriverServer.exe");
+ driver = new InternetExplorerDriver();
+ driver.findElement(By.className());
+ driver.manage().window().maximize();
+
+
+ login = driver.findElement(By.xpath("//input[@class='fn-ebz-text ng-pristine ng-valid']"));
+ pwd = driver.findElement(By.xpath("//input[@class='span3 ng-pristine ng-valid']"));
+ loginButton = driver.findElement(By.id("loginBtn"));
+ }
+
+
+ */
+ /**
+ * Sets the up.
+ */
+ // TODO Auto-generated method stub
+ @BeforeClass
+ public void setUp()
+ {
+
+
+ //WebDriver driver=new FirefoxDriver();
+
+ log = Logger.getLogger(FirstClass.class.getName());
+
+
+
+ // Get url
+ driver.get(configProp.getProperty("baseURL"));
+ driver.manage().window().maximize();
+
+
+ login = driver.findElement(By.xpath(configProp.getProperty("login")));
+
+ pwd = driver.findElement(By.xpath(configProp.getProperty("pwd")));
+ loginButton = driver.findElement(By.id(configProp.getProperty("loginButton")));
+ }
+
+
+ /**
+ * Empty username password.
+ */
+ @Test(priority=1)
+ public void emptyUsernamePassword()
+ {
+
+
+ //User Name and Password field is empty
+ log.info("-----VID-11 TC-8----Username and password empty");
+ loginButton.click();
+ errormessage=driver.findElement(By.xpath("//*[@id='errorInfo']/span"));
+ String errmsg= errormessage.getText();
+ //System.out.println("Error message is"+errmsg);
+ //String expected = "Invaild username or password, Please try again";
+
+ //Assert.assertEquals(errmsg,expected);
+
+ Boolean str = driver.getPageSource().contains("Invalid username or password, Please try again");
+ System.out.println(driver.getPageSource().contains("Invalid username or password, Please try again"));
+
+ if(str==true)
+ {
+ log.info("Error message validated");
+ log.info("VID-11 TC-8 PASSED");
+
+ }else
+ log.error("Failed validation");
+
+ }
+
+
+
+ /**
+ * Invalid user name.
+ */
+ @Test(priority=2)
+ public void invalidUserName()
+ {
+
+ log.info("-----VID-11 TC-6----Invalid Username and Valid Password");
+
+
+ login.sendKeys("xxx");
+ pwd.sendKeys("abc123");
+ loginButton.click();
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+
+ String errmsg= errormessage.getText();
+ String expected = "Invalid username or password, Please try again";
+ Assert.assertEquals(errmsg,expected);
+ //Boolean str1 = driver.getPageSource().contains("Invalid username or password, Please try again");
+ //System.out.print(str1);
+
+ log.info("VID-11 TC-6 PASSED");
+
+ }
+
+
+ /**
+ * Invalid password.
+ */
+ @Test(priority=3)
+ public void invalidPassword()
+ {
+ log.info("-----VID-11 TC-7----Valid Username and Invalid Password");
+ // Valid user name and Invalid password.
+ login.clear();
+ pwd.clear();
+ login.sendKeys("testuser");
+ pwd.sendKeys("xxx");
+ loginButton.click();
+ driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
+
+
+ String errmsg= errormessage.getText();
+ String expected = "Invalid username or password, Please try again";
+ Assert.assertEquals(errmsg,expected);
+
+ //Boolean str2 = driver.getPageSource().contains("Invaild username or password, Please try again");
+ //System.out.print(str2);
+
+ log.info("VID-11 TC-7 PASSED");
+ }
+
+
+ /**
+ * Login successful.
+ */
+ @Test(priority=4)
+ public void loginSuccessful()
+ {
+ log.info("-----VID-11 TC-1----Valid Username and Valid Password");
+ //Login with valid user name and password.
+ login.clear();
+ login.sendKeys("su");
+ pwd.clear();
+ pwd.sendKeys("fusion");
+
+
+ loginButton.click();
+ driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
+
+ try {
+ Thread.sleep(6000);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ Assert.assertTrue(driver.getPageSource().contains("Search Existing Service Instances"));
+ log.info("VID-11 TC-1 PASSED");
+
+ }
+
+
+ /**
+ * Verify home page elements left pane.
+ */
+ @Test(priority=5)
+ public void verifyHomePageElementsLeftPane()
+
+ {
+
+
+ log.info("VID-10 TC 1 ");
+ //VID Home
+ log.info("VID 11 TC-2");
+ driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[1]/a/span")).isDisplayed();
+ //Create New Service Instance
+ driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[2]/a/span")).isDisplayed();
+
+ //Browse Service Type
+ driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[3]/a/span")).isDisplayed();
+ //View Log
+ driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[4]/a/span")).isDisplayed();
+
+ //Profile
+ driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[5]/a/span")).isDisplayed();
+ //Admin
+ driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[6]/a/span")).isDisplayed();
+ //Logout
+ driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[7]/a/span")).isDisplayed();
+
+ //Infrastructure Subscriber Name
+ driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[1]/div/label")).isDisplayed();
+ //Infrastructure Subscriber Name Select Drop down
+ driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select")).isDisplayed();
+ //Infrastructure Service Type
+ driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[1]/div/label")).isDisplayed();
+ //Infrastructure Service Type Select Drop down
+ driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select")).isDisplayed();
+ //Submit button
+ driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[3]/td/div/button")).isDisplayed();
+
+ //Login Snippet Icon
+ driver.findElement(By.xpath(".//*[@class='icon-user-small login-snippet-icon']")).isDisplayed();
+
+
+ //String bodyText = driver.findElement(By.tagName("body")).getText();
+ //Assert.assertTrue("Text not found!", bodyText.contains("Search Existing Service Instances"));
+ //Assert.IsTrue(driver.getPageSource.Contains("Search Existing Service Instances"));
+
+ log.info("VID-12 TC-1");
+ Assert.assertTrue(driver.getPageSource().contains("Search Existing Service Instances"));
+ Assert.assertTrue(driver.getPageSource().contains("Please search by the Subscriber name or Service Type from below:"));
+ log.info("VID-12 TC-1 PASSED");
+ log.info("VID-10 TC 1 PASSED");
+ log.info("VID-11 TC-2 PASSED");
+ }
+
+
+ /**
+ * Disabled submit button.
+ */
+ @Test(priority=6)
+ public void disabledSubmitButton()
+ {
+ log.info("VID-12 TC-13");
+ //Assert submit button disabled.
+ Assert.assertFalse(driver.findElement(By.xpath(configProp.getProperty("submitButton"))).isEnabled());
+ log.info("VID-12 TC-13 PASSED");
+
+ }
+
+ /**
+ * Default list box value.
+ */
+ @Test(priority=7)
+ public void defaultListBoxValue()
+ {
+ log.info("VID-12 TC-2");
+
+
+ //WebElement subscribername =driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select"));
+
+ Select oSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown"))));
+ Select iSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("serviceTypeDropDown"))));
+
+
+ WebElement ielement=iSelect.getFirstSelectedOption();
+ WebElement oelement=oSelect.getFirstSelectedOption();
+ String defaultsubscribername=oelement.getText();
+ String defaultservicetype=ielement.getText();
+
+ Assert.assertEquals(defaultsubscribername,"Select Subscriber Name");
+ Assert.assertEquals(defaultservicetype,"Select Service Type");
+
+
+
+
+ //Verify Select Subscriber Name isDisplayed.
+ //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select/option[1]")).isSelected();
+
+ //Verify Select Service Type isDisplayed.
+ //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select/option[1]")).isSelected();
+
+
+ log.info("VID-12 TC-2 PASSED");
+
+ }
+
+
+
+ /**
+ * Select subscriber name drop down.
+ *
+ * @throws InterruptedException the interrupted exception
+ */
+ @Test(priority=8)
+ public void selectSubscriberNameDropDown() throws InterruptedException
+ {
+ log.info("------------------VID-10 TC-2,VID-12 TC-11, VID-12 TC-9, VID 12 TC-10,VID-12 TC-6, VID 12 TC-5--------------------");
+
+
+ driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown")));
+
+ driver.findElement(By.xpath(configProp.getProperty("serviceTypeDropDown")));
+ Thread.sleep(5000);
+
+ //Infrastructure Subscriber Name
+ Select oSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown"))));
+
+ List <WebElement> elementCount = oSelect.getOptions();
+ log.info("Select Element Count of Service Name");
+ System.out.println(elementCount.size());
+
+
+ //Verifying getInfrastructureSubscribersList
+ log.info("VID-29 TC-1");
+ Assert.assertTrue(elementCount.size()>0);
+ log.info("VID-29 TC-1 PASSED");
+
+ oSelect.selectByIndex(2);
+ String selectedOption = new Select(driver.findElement(By.xpath(configProp.getProperty("subscriberNameDropDown")))).getFirstSelectedOption().getText();
+
+ System.out.println("Service Name selected is " +selectedOption);
+ log.info("VID-10 TC-2 PASSED");
+
+ //Submit button is clicked
+ driver.findElement(By.xpath(configProp.getProperty("submitButton"))).click();
+
+
+ //Verify whether the page header is displayed "Selected Subscriber's Service Instance Details:"
+ driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/h1")).isDisplayed();
+ //Assert.assertTrue(driver.getPageSource().contains("Selected Subscriber's Service Instance Details:"))
+
+
+ //Verify whether the page header is displayed "Global Customer ID"
+ driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/div/table/thead/tr/th[2]/div")).isDisplayed();
+ Assert.assertTrue(driver.getPageSource().contains("Global Customer ID"));
+ Assert.assertTrue(driver.getPageSource().contains("Subscriber Name"));
+ Assert.assertTrue(driver.getPageSource().contains("Service Type"));
+ Assert.assertTrue(driver.getPageSource().contains("Service Instance ID"));
+
+ log.info("VID-12 TC-5 PASSED");
+ log.info("VID-12 TC-11 PASSED");
+
+ WebElement serviceinstancetable =driver.findElement(By.xpath("//table[@class='tablesorter tablesorter-default ng-isolate-scope']"));
+
+ List<WebElement> rows_table = serviceinstancetable.findElements(By.tagName("tr"));
+ //To calculate no of rows In table.
+ int rows_count = rows_table.size();
+
+ //Loop will execute till the last row of table.
+ for (int row=0; row<rows_count; row++){
+ //To locate columns(cells) of that specific row.
+ List<WebElement> Columns_row = rows_table.get(row).findElements(By.tagName("td"));
+ //To calculate no of columns(cells) In that specific row.
+ int columns_count = Columns_row.size();
+ //System.out.println("Number of cells In Row "+row+" are "+columns_count);
+
+ //Loop will execute till the last cell of that specific row.
+ for (int column=0; column<columns_count; column++){
+ //To retrieve text from that specific cell.
+ String celtext = Columns_row.get(column).getText();
+ //System.out.println("Cell Value Of row number "+row+" and column number "+column+" Is "+celtext);
+
+
+
+ //log.info("Testing Get column and row value");
+ List <WebElement> exx= rows_table.get(1).findElements(By.tagName("td"));
+ eg=Columns_row.get(2).getText();
+ // System.out.println("Cell value of row 1 and column 2 is" +eg);
+ }
+ }
+
+
+
+
+ //Verify View/Edit isDisplayed and Click
+
+ driver.findElement(By.xpath("//a[@alt='View/Edit']")).isDisplayed();
+
+ driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/div/table/tbody/tr[1]/td[1]/div/a")).click();
+
+ log.info("User clicked View/Edit");
+
+ //Verify the Subscriber Name displayed.
+ String header= driver.findElement(By.xpath("//h1[@class='heading1 ng-binding']")).getText();
+ //System.out.println(header);
+
+
+ if(header.contains(eg))
+ {
+ System.out.println("Header contains the subscriber name");
+ }else
+ System.out.println("Header does not contain the subscriber name");
+
+
+
+ Assert.assertTrue(driver.getPageSource().contains("PerfTest Subscriber00020021"));
+ log.info("VID-12 TC-6 PASSED");
+
+
+
+ driver.navigate().back();
+ //Cancel button isDisplayed
+ driver.findElement(By.xpath("//button[@class='button button--small button--primary']")).isDisplayed();
+ log.info("VID-12 TC-9 PASSED");
+
+ //Cancel button is clicked
+ driver.findElement(By.xpath("//button[@class='button button--small button--primary']")).click();
+ log.info("Cancel button is clicked");
+
+ //Verifying VID Home page is displayed
+ Assert.assertTrue(driver.getPageSource().contains("Search Existing Service Instances"));
+ log.info("VID-12 TC-10 PASSED");
+
+ }
+
+
+ /**
+ * Refresh subscriber name.
+ */
+ @Test(priority=9)
+ public void refreshSubscriberName()
+ {
+ log.info("VID-10 TC-4");
+
+
+ driver.findElement(By.xpath(configProp.getProperty("refreshButtonSubscriberName"))).isDisplayed();
+
+ log.info("VID-10 TC-4 PASSED");
+
+
+ }
+
+
+ /**
+ * Select subscriber type drop down.
+ *
+ * @throws InterruptedException the interrupted exception
+ */
+ @Test(priority=9)
+ public void selectSubscriberTypeDropDown() throws InterruptedException
+ {
+ Thread.sleep(5000);
+ log.info("------------------VID-10 TC-3, VID-12 TC-12,--------------------");
+ //Infrastructure Subscriber Type
+ Select iSelect = new Select(driver.findElement(By.xpath(configProp.getProperty("serviceTypeDropDown"))));
+
+ List <WebElement> ielementCount = iSelect.getOptions();
+ log.info("Select Element Count of Service type");
+ System.out.println(ielementCount.size());
+ iSelect.selectByIndex(1);
+
+ log.info("VID-10 TC-3 PASSED");
+
+
+ //Submit button is clicked
+ driver.findElement(By.xpath(configProp.getProperty("submitButton"))).click();
+
+ //Verify whether the page header is displayed "Selected Subscriber's Service Instance Details:"
+ driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/h1")).isDisplayed();
+ //Assert.assertTrue(driver.getPageSource().contains("Selected Subscriber's Service Instance Details:"))
+ log.info("Page Header: Selected Subscriber's Service Instance Details");
+
+
+ //Verify whether the page header is displayed "Global Customer ID"
+ driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/div/table/thead/tr/th[2]/div")).isDisplayed();
+
+ //Assert.assertTrue(driver.getPageSource().contains("Global Customer ID"));
+ log.info("Table is displayed");
+
+ log.info("VID-12 TC-12 PASSED");
+
+ }
+
+
+
+ /**
+ * Logout under profile.
+ */
+ @Test(priority=10)
+ public void logoutUnderProfile()
+ {
+
+ log.info("-----------VID-11 TC-5---------------------");
+ //driver.findElement(By.partialLinkText("Click here to login")).click();
+ //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
+
+
+ driver.findElement(By.xpath(".//*[@class='icon-user-small login-snippet-icon']")).click();
+ driver.findElement(By.xpath(".//*[@id='reg-logout-div']/a")).click();
+ //Validate that the user has logged out of VID. Displays "Portal"
+ Assert.assertTrue(driver.getPageSource().contains("Portal"));
+
+ log.info("VID-11 TC-5 PASSED");
+
+ }
+
+
+
+ /**
+ * Tear down.
+ */
+ @AfterClass
+ public void tearDown()
+ {
+ driver.close();
+
+ }
+
+
+
+ }
+
+
+
+
diff --git a/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/LogOutLeftPane.java b/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/LogOutLeftPane.java
new file mode 100755
index 0000000..66ea075
--- /dev/null
+++ b/vid-app-common/src/test/java/org/openecomp/ecomp/vid/selenium/LogOutLeftPane.java
@@ -0,0 +1,242 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.ecomp.vid.selenium;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.log4j.Logger;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.support.ui.Select;
+import org.testng.Assert;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+/**
+ * The Class LogOutLeftPane.
+ */
+@Test(enabled=true)
+public class LogOutLeftPane {
+
+ /** The login button. */
+ WebElement loginButton;
+
+ /** The login. */
+ WebElement login;
+
+ /** The pwd. */
+ WebElement pwd;
+
+ /** The log. */
+ Logger log;
+
+ /** The errormessage. */
+ WebElement errormessage;
+
+ /** The driver. */
+ WebDriver driver=new FirefoxDriver();
+
+
+ /** The config prop. */
+ private final Properties configProp = new Properties();
+
+
+ /**
+ * Instantiates a new log out left pane.
+ */
+ private LogOutLeftPane() {
+ // TODO Auto-generated constructor stub
+ //
+ try{
+ // InputStream input =this.getClass().getClassLoader().getResourceAsStream("objectmap.properties");
+ //FileInputStream input1 = new FileInputStream("objectmap.properties");
+
+ InputStream input =new FileInputStream("objectconfig.properties");
+ System.out.println("Read all properties from file");
+ configProp.load(input);
+ System.out.println("Read all properties from file completed");
+ }
+ catch(IOException e) {
+
+ e.printStackTrace();
+ }
+ }
+
+
+
+
+ /**
+ * Do before test.
+ */
+ // TODO Auto-generated method stub
+ @BeforeTest
+ public void doBeforeTest()
+ {
+ //WebDriver driver=new FirefoxDriver();
+
+ log = Logger.getLogger(LogOutLeftPane.class.getName());
+
+
+
+ // Get url
+ driver.get("http://vid.onap.org:9080/vid/login_external.htm");
+ driver.manage().window().maximize();
+
+
+ login = driver.findElement(By.xpath("//input[@class='fn-ebz-text ng-pristine ng-valid']"));
+ pwd = driver.findElement(By.xpath("//input[@class='span3 ng-pristine ng-valid']"));
+ loginButton = driver.findElement(By.id("loginBtn"));
+ }
+
+
+ /**
+ * Expand collapse panel.
+ *
+ * @throws InterruptedException the interrupted exception
+ */
+ @Test(priority=1)
+ public void expandCollapsePanel() throws InterruptedException
+ {
+
+
+
+ login.clear();
+ login.sendKeys("su");
+ pwd.clear();
+ pwd.sendKeys("fusion");
+ //driver.findElement(By.partialLinkText("Click here to login")).click();
+ //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
+
+ loginButton.click();
+ driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
+
+
+ log.info("Clicking Profile link from left pane");
+ Thread.sleep(3000);
+ System.out.println("properties file details --->"+configProp.getProperty("profilelink"));
+ driver.findElement(By.xpath(configProp.getProperty("profilelink"))).click();
+ Thread.sleep(3000);
+
+ //Verify whether the sub panel is displayed
+ //To verify the following :Search import from webphone and Self
+ driver.findElement(By.xpath(".//*[@id='panel4']")).isDisplayed();
+ log.info("Expand and collapse passed for Profile link");
+
+ //For Admin
+ //Verify expand and collapse working for ADMIN
+ log.info("Clicking Admin link from left pane");
+ driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[6]/a/span")).click();
+ //To verify the following: Roles, Roles Functions, Usages
+ driver.findElement(By.xpath(".//*[@id='panel5']")).isDisplayed();
+
+
+ log.info("Expand and collapse passed for ADMIN link");
+
+ log.info("VID-11 TC-3 PASSED");
+
+ }
+
+
+ /**
+ * Drop down list.
+ *
+ * @throws InterruptedException the interrupted exception
+ */
+ @Test(priority=2)
+ public void dropDownList() throws InterruptedException
+ {
+ //VID-12 TC-3
+ log.info("VID-12 TC-3");
+ //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select"));
+
+ //driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select"));
+ Thread.sleep(5000);
+
+ //Infrastructure Subscriber Name
+ Select oSelect = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select")));
+ Select iSelect = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select")));
+
+ List <WebElement> elementCount = oSelect.getOptions();
+ log.info("Subscriber Name Drop Down");
+ System.out.println(elementCount.size());
+ oSelect.selectByIndex(1);
+ log.info("Subscriber name selected");
+ //String selectedOption = new Select(driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select"))).getFirstSelectedOption().getText();
+
+
+ List <WebElement> count = iSelect.getOptions();
+ log.info("Subscriber type drop down");
+ System.out.println(count.size());
+ oSelect.selectByIndex(1);
+ log.info("Subscriber type selected");
+
+
+
+ //Submit button is clicked
+ driver.findElement(By.xpath(".//*[@id='mContent']/div/div/table/tbody/tr[3]/td/div/button")).click();
+
+
+ //Verify whether the page header is displayed "Selected Subscriber's Service Instance Details:"
+ driver.findElement(By.xpath(".//*[@id='mContent']/div/div/div/h1")).isDisplayed();
+ log.info("VID-12 TC-3 PASSED");
+ }
+
+
+
+
+ /**
+ * Logout left pane.
+ */
+ @Test(priority=3)
+ public void logoutLeftPane()
+ {
+ //To Verify if the logout link redirects to Login page when clicked.
+
+
+ /*log.info("----------------VID-11 TC-4----------------");
+ login.clear();
+ login.sendKeys("testuser");
+ pwd.clear();
+ pwd.sendKeys("abc123");
+ //driver.findElement(By.partialLinkText("Click here to login")).click();
+ //driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
+
+ loginButton.click();
+ driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);*/
+ log.info("----------------VID-11 TC-4----------------");
+ driver.findElement(By.xpath("html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[7]/a")).click();
+ //Validate that the user has logged out of VID. Displays "Portal"
+ Assert.assertTrue(driver.getPageSource().contains("Portal"));
+
+ log.info("VID 11 TC-4 PASSED");
+
+ driver.close();
+
+ }
+
+}
diff --git a/vid-app-common/src/test/java/org/openecomp/fusion/core/MockApplicationContextTestSuite.java b/vid-app-common/src/test/java/org/openecomp/fusion/core/MockApplicationContextTestSuite.java
new file mode 100755
index 0000000..64d72ab
--- /dev/null
+++ b/vid-app-common/src/test/java/org/openecomp/fusion/core/MockApplicationContextTestSuite.java
@@ -0,0 +1,176 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.fusion.core;
+
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.web.AnnotationConfigWebContextLoader;
+import org.springframework.test.context.web.WebAppConfiguration;
+import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+
+import org.openecomp.portalsdk.core.conf.AppConfig;
+import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager;
+import org.openecomp.portalsdk.core.util.SystemProperties;
+import org.openecomp.portalsdk.core.util.CacheManager;
+
+/**
+ *
+ *
+ *
+ * In order to write a unit test,
+ * 1. inherit this class - See SanityTest.java
+ * 2. place the "war" folder on your test class's classpath
+ * 3. run the test with the following VM argument; This is important because when starting the application from Container, the System Properties file (SystemProperties.java) can have the direct path
+ * but, when running from the Mock Junit container, the path should be prefixed with "classpath" to enable the mock container to search for the file in the classpath
+ * -Dcontainer.classpath="classpath:"
+ *
+ */
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@WebAppConfiguration
+@ContextConfiguration(loader = AnnotationConfigWebContextLoader.class, classes = {MockAppConfig.class})
+@ActiveProfiles(value="test")
+public class MockApplicationContextTestSuite {
+
+ /** The wac. */
+ @Autowired
+ public WebApplicationContext wac;
+
+ /** The mock mvc. */
+ private MockMvc mockMvc;
+
+ /**
+ * Setup.
+ */
+ @Before
+ public void setup() {
+ if(mockMvc == null) {
+ this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();
+
+ }
+ }
+
+ /**
+ * Gets the bean.
+ *
+ * @param name the name
+ * @return the bean
+ */
+ public Object getBean(String name) {
+ return this.wac.getBean(name);
+ }
+
+
+ /**
+ * Gets the mock mvc.
+ *
+ * @return the mock mvc
+ */
+ public MockMvc getMockMvc() {
+ return mockMvc;
+ }
+
+ /**
+ * Sets the mock mvc.
+ *
+ * @param mockMvc the new mock mvc
+ */
+ public void setMockMvc(MockMvc mockMvc) {
+ this.mockMvc = mockMvc;
+ }
+
+ /**
+ * Gets the web application context.
+ *
+ * @return the web application context
+ */
+ public WebApplicationContext getWebApplicationContext() {
+ return wac;
+ }
+
+
+
+
+}
+
+
+ @Configuration
+ @ComponentScan(basePackages = "org.openecomp",
+ excludeFilters = {
+ // the following source configurations should not be scanned; instead of using Exclusion filter, we can use the @Profile annotation to exclude them
+ // see AppConfig class
+ //@ComponentScan.Filter(type = FilterType.REGEX, pattern = "org.openecomp.portalsdk.core.*AppConfig*")//,
+ //@ComponentScan.Filter(type = FilterType.REGEX, pattern = org.openecomp.*.*AppConfig*")
+ }
+ )
+ @Profile("test")
+ class MockAppConfig extends AppConfig {
+
+ @Bean
+ public SystemProperties systemProperties(){
+ return new MockSystemProperties();
+ }
+
+ @Bean
+ public AbstractCacheManager cacheManager() {
+ return new CacheManager() {
+
+ public void configure() throws IOException {
+
+ }
+ };
+ }
+
+ protected String[] tileDefinitions() {
+ return new String[] {"classpath:/WEB-INF/fusion/defs/definitions.xml", "classpath:/WEB-INF/defs/definitions.xml"};
+ }
+
+ @Override
+ public void addInterceptors(InterceptorRegistry registry) {
+ //registry.addInterceptor(new SessionTimeoutInterceptor()).excludePathPatterns(getExcludeUrlPathsForSessionTimeout());
+ //registry.addInterceptor(resourceInterceptor());
+ }
+
+ public static class MockSystemProperties extends SystemProperties {
+
+ public MockSystemProperties() {
+ }
+
+ }
+
+ }
+
+
+
+
diff --git a/vid-app-common/src/test/java/org/openecomp/fusionapp/controller/NetMapTest.java b/vid-app-common/src/test/java/org/openecomp/fusionapp/controller/NetMapTest.java
new file mode 100755
index 0000000..8c00c3b
--- /dev/null
+++ b/vid-app-common/src/test/java/org/openecomp/fusionapp/controller/NetMapTest.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.fusionapp.controller;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.test.web.servlet.ResultActions;
+import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+
+import org.openecomp.fusion.core.MockApplicationContextTestSuite;
+
+/**
+ * The Class NetMapTest.
+ */
+public class NetMapTest extends MockApplicationContextTestSuite {
+
+ /**
+ * Test get net map.
+ *
+ * @throws Exception the exception
+ */
+ @Test
+ public void testGetNetMap() throws Exception {
+ ResultActions ra =getMockMvc().perform(MockMvcRequestBuilders.get("/net_map"));
+ //Assert.assertEquals(UrlAccessRestrictedException.class,ra.andReturn().getResolvedException().getClass());
+ Assert.assertEquals("net_map_int",ra.andReturn().getModelAndView().getModel().get("frame_int"));
+ }
+
+
+}
diff --git a/vid-app-common/src/test/java/org/openecomp/fusionapp/service/ProfileServiceTest.java b/vid-app-common/src/test/java/org/openecomp/fusionapp/service/ProfileServiceTest.java
new file mode 100755
index 0000000..43370c7
--- /dev/null
+++ b/vid-app-common/src/test/java/org/openecomp/fusionapp/service/ProfileServiceTest.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.fusionapp.service;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import org.openecomp.fusion.core.MockApplicationContextTestSuite;
+import org.openecomp.portalsdk.core.domain.Profile;
+import org.openecomp.portalsdk.core.domain.User;
+import org.openecomp.portalsdk.core.service.ProfileService;
+import org.openecomp.portalsdk.core.service.UserProfileService;
+
+
+/**
+ * The Class ProfileServiceTest.
+ */
+public class ProfileServiceTest extends MockApplicationContextTestSuite {
+
+ /** The service. */
+ @Autowired
+ ProfileService service;
+
+ /** The user profile service. */
+ @Autowired
+ UserProfileService userProfileService;
+
+ /**
+ * Test find all.
+ */
+ @Test
+ public void testFindAll() {
+
+ List<Profile> profiles = service.findAll();
+ Assert.assertTrue(profiles.size() > 0);
+ }
+
+ /**
+ * Test find all active.
+ */
+ @Test
+ public void testFindAllActive() {
+
+ List<User> users = userProfileService.findAllActive();
+ List<User> activeUsers = userProfileService.findAllActive();
+ Assert.assertTrue(users.size() - activeUsers.size() >= 0);
+ }
+}
diff --git a/vid-app-common/src/test/java/org/openecomp/src/main/java/org/vid/dao/FnAppDoaImplTest.java b/vid-app-common/src/test/java/org/openecomp/src/main/java/org/vid/dao/FnAppDoaImplTest.java
new file mode 100755
index 0000000..08fd9f5
--- /dev/null
+++ b/vid-app-common/src/test/java/org/openecomp/src/main/java/org/vid/dao/FnAppDoaImplTest.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.src.main.java.org.vid.dao;
+
+import java.io.IOException;
+import java.sql.SQLException;
+
+import org.junit.Test;
+
+import org.openecomp.vid.dao.FnAppDoaImpl;
+
+public class FnAppDoaImplTest {
+
+ @Test
+ public void testGetconnection() throws ClassNotFoundException, IOException, SQLException{
+ FnAppDoaImpl impl=new FnAppDoaImpl();
+ impl.getConnection(null,null,null, null);
+
+ }
+
+ @Test
+ public void testProfileCount() throws ClassNotFoundException, IOException, SQLException{
+ FnAppDoaImpl impl=new FnAppDoaImpl();
+ impl.getProfileCount(null,null,null, null);
+ }
+
+}
diff --git a/vid-app-common/src/test/resources/objectconfig.properties b/vid-app-common/src/test/resources/objectconfig.properties
new file mode 100755
index 0000000..312e5bc
--- /dev/null
+++ b/vid-app-common/src/test/resources/objectconfig.properties
@@ -0,0 +1,16 @@
+baseURL=http://vid.onap.org:9080/vid/login_external.htm
+
+
+
+login=//input[@class='fn-ebz-text ng-pristine ng-valid']
+pwd=//input[@class='span3 ng-pristine ng-valid']
+loginButton=loginBtn
+
+
+profilelink=html/body/div[1]/div[1]/div/div/div[2]/div/div/div[1]/div/div/accordion/div/div[5]/a/span
+refreshButtonSubscriberName=//img[@src='static/fusion/images/refresh.jpg']
+
+subscriberNameDropDown=.//*[@id='mContent']/div/div/table/tbody/tr[1]/td[2]/div/select
+serviceTypeDropDown=.//*[@id='mContent']/div/div/table/tbody/tr[2]/td[2]/div/select
+submitButton=.//*[@id='mContent']/div/div/table/tbody/tr[3]/td/div/button
+