diff --git a/adapters/mso-vfc-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml b/adapters/mso-vfc-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml
index 58ddb4a..e7bc08a 100644
--- a/adapters/mso-vfc-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml
+++ b/adapters/mso-vfc-adapter/WebContent/WEB-INF/jboss-deployment-structure.xml
@@ -1,16 +1,17 @@
 <jboss-deployment-structure>
 	<deployment>
-		<!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
+		<!-- Exclusions allow you to prevent the server from automatically adding 
+			some dependencies -->
 		<exclusions>
 			<module name="org.apache.log4j" />
 			<module name="org.slf4j" />
 			<module name="org.slf4j.impl" />
 		</exclusions>
 		<dependencies>
-			    <module name="org.jboss.jandex" slot="main" />
-                <module name="org.javassist" slot="main" />
-                <module name="org.antlr" slot="main" />
-                <module name="org.dom4j" slot="main" />
+			<module name="org.jboss.jandex" slot="main" />
+			<module name="org.javassist" slot="main" />
+			<module name="org.antlr" slot="main" />
+			<module name="org.dom4j" slot="main" />
 		</dependencies>
 	</deployment>
 </jboss-deployment-structure>
\ No newline at end of file
diff --git a/adapters/mso-vfc-adapter/WebContent/WEB-INF/web.xml b/adapters/mso-vfc-adapter/WebContent/WEB-INF/web.xml
index 160dfb8..0c198de 100644
--- a/adapters/mso-vfc-adapter/WebContent/WEB-INF/web.xml
+++ b/adapters/mso-vfc-adapter/WebContent/WEB-INF/web.xml
@@ -1,118 +1,121 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
-  <display-name>mso-vfc-adapter</display-name>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns="http://java.sun.com/xml/ns/javaee"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+	id="WebApp_ID" version="3.0">
+	<display-name>mso-vfc-adapter</display-name>
 
-   <context-param>
-	<param-name>resteasy.jndi.resources</param-name>
-	<param-value>java:module/MsoPropertiesFactory,java:module/CloudConfigFactory</param-value>
-   </context-param>
+	<context-param>
+		<param-name>resteasy.jndi.resources</param-name>
+		<param-value>java:module/MsoPropertiesFactory,java:module/CloudConfigFactory</param-value>
+	</context-param>
 
-   <context-param>
-  	<param-name>log.configuration</param-name>
-  	<param-value>logback.vfc.xml</param-value>
-  </context-param>
-  <context-param>
-  	<param-name>mso.configuration</param-name>
-  	<param-value>MSO_PROP_NETWORK_ADAPTER=mso.vfc.properties,MSO_PROP_TOPOLOGY=topology.properties</param-value>
-  </context-param>
-  <context-param>
-  	<param-name>mso.cloud_config.configuration</param-name>
-  	<param-value>cloud_config.json=2</param-value>
-  </context-param>
-  <context-param>
-    <param-name>resteasy.resources</param-name>
-    <param-value>
+	<context-param>
+		<param-name>log.configuration</param-name>
+		<param-value>logback.vfc.xml</param-value>
+	</context-param>
+	<context-param>
+		<param-name>mso.configuration</param-name>
+		<param-value>MSO_PROP_NETWORK_ADAPTER=mso.vfc.properties,MSO_PROP_TOPOLOGY=topology.properties</param-value>
+	</context-param>
+	<context-param>
+		<param-name>mso.cloud_config.configuration</param-name>
+		<param-value>cloud_config.json=2</param-value>
+	</context-param>
+	<context-param>
+		<param-name>resteasy.resources</param-name>
+		<param-value>
 		org.openecomp.mso.MsoStatusHandler,
 		org.openecomp.mso.logger.MsoLoggingServlet,
 		org.openecomp.mso.adapters.vfc.HealthCheckHandler,
 		org.openecomp.mso.adapters.vfc.VfcAdapterRest
     </param-value>
-  </context-param>
-  <context-param>
-    <param-name>resteasy.servlet.mapping.prefix</param-name>
-    <param-value>/rest</param-value>
-  </context-param>
-  <servlet>
-    <servlet-name>Resteasy</servlet-name>
-    <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
-  </servlet>
-  <servlet-mapping>
-    <servlet-name>Resteasy</servlet-name>
-    <url-pattern>/vfcadapter/*</url-pattern>
-  </servlet-mapping>
-    <security-constraint>
-        <web-resource-collection>
-            <web-resource-name>SoapRequests</web-resource-name>
-            <description>Soap Ingress Requests</description>
-            <url-pattern>/VfcAdapter</url-pattern>
-            <url-pattern>/VfcAdapterAsync</url-pattern>
-            <http-method>POST</http-method>
-        </web-resource-collection>
-        <auth-constraint>
-            <role-name>BPEL-Client</role-name>
-        </auth-constraint>
-    </security-constraint>
-    <security-constraint>
-        <web-resource-collection>
-            <web-resource-name>SiteStatus</web-resource-name>
-            <description>SiteStatus APIs</description>
-            <url-pattern>/rest/setStatus/*</url-pattern>
-            <http-method>POST</http-method>
-        </web-resource-collection>
-        <auth-constraint>
-            <role-name>SiteControl-Client</role-name>
-        </auth-constraint>
-    </security-constraint>
-    <security-constraint>
-        <web-resource-collection>
-            <web-resource-name>RestRequests</web-resource-name>
-            <description>Rest Ingress Requests</description>
-            <url-pattern>/rest/v1/vfc/*</url-pattern>
-            <http-method>DELETE</http-method>
-            <http-method>GET</http-method>
-            <http-method>POST</http-method>
-            <http-method>PUT</http-method>
-        </web-resource-collection>
-        <auth-constraint>
-            <role-name>BPEL-Client</role-name>
-        </auth-constraint>
-    </security-constraint>
-    <security-constraint>
-        <web-resource-collection>
-            <web-resource-name>MSO internal Requests</web-resource-name>
-            <description>Internal Requests</description>
-            <url-pattern>/rest/logging/*</url-pattern>
-            <url-pattern>/rest/properties/*</url-pattern>
-            <http-method>POST</http-method>
-            <http-method>GET</http-method>
-        </web-resource-collection>
-        <auth-constraint>
-            <role-name>MSO-Client</role-name>
-        </auth-constraint>
-    </security-constraint>
-    <login-config>
-        <auth-method>BASIC</auth-method>
-        <realm-name>ApplicationRealm</realm-name>
-    </login-config>
-    <security-role>
-        <role-name>BPEL-Client</role-name>
-    </security-role>
-    <security-role>
-        <role-name>SiteControl-Client</role-name>
-    </security-role>
-    <security-role>
-        <role-name>MSO-Client</role-name>
-    </security-role>
-  <filter>
+	</context-param>
+	<context-param>
+		<param-name>resteasy.servlet.mapping.prefix</param-name>
+		<param-value>/rest</param-value>
+	</context-param>
+	<servlet>
+		<servlet-name>Resteasy</servlet-name>
+		<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
+	</servlet>
+	<servlet-mapping>
+		<servlet-name>Resteasy</servlet-name>
+		<url-pattern>/vfcadapter/*</url-pattern>
+	</servlet-mapping>
+	<security-constraint>
+		<web-resource-collection>
+			<web-resource-name>SoapRequests</web-resource-name>
+			<description>Soap Ingress Requests</description>
+			<url-pattern>/VfcAdapter</url-pattern>
+			<url-pattern>/VfcAdapterAsync</url-pattern>
+			<http-method>POST</http-method>
+		</web-resource-collection>
+		<auth-constraint>
+			<role-name>BPEL-Client</role-name>
+		</auth-constraint>
+	</security-constraint>
+	<security-constraint>
+		<web-resource-collection>
+			<web-resource-name>SiteStatus</web-resource-name>
+			<description>SiteStatus APIs</description>
+			<url-pattern>/rest/setStatus/*</url-pattern>
+			<http-method>POST</http-method>
+		</web-resource-collection>
+		<auth-constraint>
+			<role-name>SiteControl-Client</role-name>
+		</auth-constraint>
+	</security-constraint>
+	<security-constraint>
+		<web-resource-collection>
+			<web-resource-name>RestRequests</web-resource-name>
+			<description>Rest Ingress Requests</description>
+			<url-pattern>/rest/v1/vfc/*</url-pattern>
+			<http-method>DELETE</http-method>
+			<http-method>GET</http-method>
+			<http-method>POST</http-method>
+			<http-method>PUT</http-method>
+		</web-resource-collection>
+		<auth-constraint>
+			<role-name>BPEL-Client</role-name>
+		</auth-constraint>
+	</security-constraint>
+	<security-constraint>
+		<web-resource-collection>
+			<web-resource-name>MSO internal Requests</web-resource-name>
+			<description>Internal Requests</description>
+			<url-pattern>/rest/logging/*</url-pattern>
+			<url-pattern>/rest/properties/*</url-pattern>
+			<http-method>POST</http-method>
+			<http-method>GET</http-method>
+		</web-resource-collection>
+		<auth-constraint>
+			<role-name>MSO-Client</role-name>
+		</auth-constraint>
+	</security-constraint>
+	<login-config>
+		<auth-method>BASIC</auth-method>
+		<realm-name>ApplicationRealm</realm-name>
+	</login-config>
+	<security-role>
+		<role-name>BPEL-Client</role-name>
+	</security-role>
+	<security-role>
+		<role-name>SiteControl-Client</role-name>
+	</security-role>
+	<security-role>
+		<role-name>MSO-Client</role-name>
+	</security-role>
+	<filter>
 		<filter-name>LogFilter</filter-name>
 		<filter-class>org.openecomp.mso.logger.LogFilter</filter-class>
-  </filter>
-    <filter-mapping>
+	</filter>
+	<filter-mapping>
 		<filter-name>LogFilter</filter-name>
 		<url-pattern>/*</url-pattern>
 	</filter-mapping>
-  <welcome-file-list>
-    <welcome-file>check.html</welcome-file>
-  </welcome-file-list>
+	<welcome-file-list>
+		<welcome-file>check.html</welcome-file>
+	</welcome-file-list>
 </web-app>
 
diff --git a/adapters/mso-vfc-adapter/WebContent/check.html b/adapters/mso-vfc-adapter/WebContent/check.html
index 00f37d6..b4250aa 100644
--- a/adapters/mso-vfc-adapter/WebContent/check.html
+++ b/adapters/mso-vfc-adapter/WebContent/check.html
@@ -4,7 +4,6 @@
 <meta charset="ISO-8859-1">
 <title>Health Check</title>
 </head>
-<body>
-Application ready
+<body>Application ready
 </body>
 </html>
\ No newline at end of file
diff --git a/adapters/mso-vfc-adapter/pom.xml b/adapters/mso-vfc-adapter/pom.xml
index fcf0682..b5e3780 100644
--- a/adapters/mso-vfc-adapter/pom.xml
+++ b/adapters/mso-vfc-adapter/pom.xml
@@ -1,121 +1,118 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.openecomp.so</groupId>
-        <artifactId>adapters</artifactId>
-        <version>1.1.0-SNAPSHOT</version>
-    </parent>
-    <groupId>org.openecomp.so.adapters</groupId>
-    <artifactId>mso-vfc-adapter</artifactId>
-    <packaging>war</packaging>
-    <name>mso-vfc-adapter</name>
-    <description>Web service endpoint for vfc operations</description>
-    <!-- <properties> -->
-    <!-- <project.build.sourceEncoding/> -->
-    <!-- <project.reporting.outputEncoding/> -->
-    <!-- </properties> -->
-    <build>
-        <finalName>${project.artifactId}-${project.version}</finalName>
-        <plugins>
-            <plugin>
-                <artifactId>maven-war-plugin</artifactId>
-                <version>2.4</version>
-                <configuration>
-                    <warSourceDirectory>WebContent</warSourceDirectory>
-                    <failOnMissingWebXml>false</failOnMissingWebXml>
-                    <attachClasses>true</attachClasses>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-    <dependencies>
-        <!--<dependency>
-            <groupId>javax</groupId>
-            <artifactId>javaee-web-api</artifactId>
-            <version>6.0</version>
-            <scope>provided</scope>
-        </dependency>-->
-        <dependency>
-            <groupId>javax.ws.rs</groupId>
-            <artifactId>javax.ws.rs-api</artifactId>
-            <version>2.0</version>
-        </dependency>
-        <dependency>
-            <groupId>org.openecomp.so.adapters</groupId>
-            <artifactId>mso-adapter-utils</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.openecomp.so.adapters</groupId>
-            <artifactId>mso-adapters-rest-interface</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.mockito</groupId>
-            <artifactId>mockito-all</artifactId>
-            <version>1.10.19</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>javax.servlet-api</artifactId>
-            <version>3.1.0</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.spec.javax.ejb</groupId>
-            <artifactId>jboss-ejb-api_3.2_spec</artifactId>
-            <version>1.0.0.Final</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.jboss.ejb3</groupId>
-            <artifactId>jboss-ejb3-ext-api</artifactId>
-            <version>2.2.0.Final</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.openecomp.so</groupId>
-            <artifactId>status-control</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.openecomp.so</groupId>
-            <artifactId>mso-requests-db</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.jmockit</groupId>
-            <artifactId>jmockit</artifactId>
-            <version>1.19</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>4.12</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.jmockit</groupId>
-            <artifactId>jmockit-coverage</artifactId>
-            <version>1.19</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.glassfish.jersey.core</groupId>
-            <artifactId>jersey-common</artifactId>
-            <version>2.22.2</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>javax.servlet</groupId>
-            <artifactId>javax.servlet-api</artifactId>
-            <version>3.1.0</version>
-        </dependency>
-    </dependencies>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.openecomp.so</groupId>
+		<artifactId>adapters</artifactId>
+		<version>1.1.0-SNAPSHOT</version>
+	</parent>
+	<groupId>org.openecomp.so.adapters</groupId>
+	<artifactId>mso-vfc-adapter</artifactId>
+	<packaging>war</packaging>
+	<name>mso-vfc-adapter</name>
+	<description>Web service endpoint for vfc operations</description>
+	<!-- <properties> -->
+	<!-- <project.build.sourceEncoding/> -->
+	<!-- <project.reporting.outputEncoding/> -->
+	<!-- </properties> -->
+	<build>
+		<finalName>${project.artifactId}-${project.version}</finalName>
+		<plugins>
+			<plugin>
+				<artifactId>maven-war-plugin</artifactId>
+				<version>2.4</version>
+				<configuration>
+					<warSourceDirectory>WebContent</warSourceDirectory>
+					<failOnMissingWebXml>false</failOnMissingWebXml>
+					<attachClasses>true</attachClasses>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+	<dependencies>
+		<!--<dependency> <groupId>javax</groupId> <artifactId>javaee-web-api</artifactId> 
+			<version>6.0</version> <scope>provided</scope> </dependency> -->
+		<dependency>
+			<groupId>javax.ws.rs</groupId>
+			<artifactId>javax.ws.rs-api</artifactId>
+			<version>2.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.openecomp.so.adapters</groupId>
+			<artifactId>mso-adapter-utils</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.openecomp.so.adapters</groupId>
+			<artifactId>mso-adapters-rest-interface</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.mockito</groupId>
+			<artifactId>mockito-all</artifactId>
+			<version>1.10.19</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>javax.servlet-api</artifactId>
+			<version>3.1.0</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.jboss.spec.javax.ejb</groupId>
+			<artifactId>jboss-ejb-api_3.2_spec</artifactId>
+			<version>1.0.0.Final</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.jboss.ejb3</groupId>
+			<artifactId>jboss-ejb3-ext-api</artifactId>
+			<version>2.2.0.Final</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.openecomp.so</groupId>
+			<artifactId>status-control</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.openecomp.so</groupId>
+			<artifactId>mso-requests-db</artifactId>
+			<version>${project.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-io</groupId>
+			<artifactId>commons-io</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.jmockit</groupId>
+			<artifactId>jmockit</artifactId>
+			<version>1.19</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>4.12</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.jmockit</groupId>
+			<artifactId>jmockit-coverage</artifactId>
+			<version>1.19</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.glassfish.jersey.core</groupId>
+			<artifactId>jersey-common</artifactId>
+			<version>2.22.2</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>javax.servlet-api</artifactId>
+			<version>3.1.0</version>
+		</dependency>
+	</dependencies>
 </project>
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiUtil.java
index 29f27d0..719385f 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/AaiUtil.java
@@ -22,25 +22,24 @@
 import org.openecomp.mso.adapters.vfc.model.RestfulResponse;
 
 /**
- * Implement class of operating aai database table
- * <br>
+ * Implement class of operating aai database table <br>
  * <p>
  * </p>
  * 
  * @author
- * @version     ONAP Amsterdam Release  2017-08-28
+ * @version ONAP Amsterdam Release 2017-08-28
  */
 public class AaiUtil {
 
-    public static RestfulResponse addRelation(String globalSubsriberId, String serviceType,  String serviceInstanceId, String resourceInstanceId)
-    {
-        //sent rest to aai to add relation for service and ns.
-        return null;
-    }
-    
-    public static RestfulResponse removeRelation(String globalSubsriberId,  String serviceType, String serviceInstanceId ,String resourceInstanceId)
-    {
-        //sent rest to aai to remove relation between service an ns.
-        return null;
-    }
+  public static RestfulResponse addRelation(String globalSubsriberId, String serviceType,
+      String serviceInstanceId, String resourceInstanceId) {
+    // sent rest to aai to add relation for service and ns.
+    return null;
+  }
+
+  public static RestfulResponse removeRelation(String globalSubsriberId, String serviceType,
+      String serviceInstanceId, String resourceInstanceId) {
+    // sent rest to aai to remove relation between service an ns.
+    return null;
+  }
 }
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java
index 52286fd..6c2ab4d 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcAdapterRest.java
@@ -41,8 +41,7 @@
 import org.openecomp.mso.logger.MsoLogger;
 
 /**
- * The rest class for VF-c Adapter
- * <br>
+ * The rest class for VF-c Adapter <br>
  * <p>
  * </p>
  * 
@@ -52,162 +51,161 @@
 @Path("/vfcadapter/v1")
 public class VfcAdapterRest {
 
-    private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+  private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
 
-    private final VfcManager driverMgr = new VfcManager();
+  private final VfcManager driverMgr = new VfcManager();
 
-    public VfcAdapterRest() {
+  public VfcAdapterRest() {
 
+  }
+
+  /**
+   * Create a NS <br>
+   * 
+   * @param servletReq the http request
+   * @return
+   * @since ONAP Amsterdam Release
+   */
+  @POST
+  @Path("/ns")
+  @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+  @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+  public Response createNfvoNs(HttpServletRequest servletReq) {
+    // Step 1: get parameters from request for current node
+    try {
+      String body = RestfulUtil.getRequestBody(servletReq);
+      ValidateUtil.assertObjectNotNull(body);
+      LOGGER.debug("body from request is {}" + body);
+      NSResourceInputParameter nsInput = JsonUtil.unMarshal(body, NSResourceInputParameter.class);
+      RestfulResponse rsp = driverMgr.createNs(nsInput);
+      return buildResponse(rsp);
+    } catch (ApplicationException e) {
+      LOGGER.debug("ApplicationException: ", e);
+      return e.buildErrorResponse();
     }
+  }
 
-    /**
-     * Create a NS
-     * <br>
-     * 
-     * @param servletReq the http request
-     * @return
-     * @since ONAP Amsterdam Release
-     */
-    @POST
-    @Path("/ns")
-    @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-    public Response createNfvoNs(HttpServletRequest servletReq) {
-        // Step 1: get parameters from request for current node
-        try {
-            String body = RestfulUtil.getRequestBody(servletReq);
-            ValidateUtil.assertObjectNotNull(body);
-            LOGGER.debug("body from request is {}" + body);
-            NSResourceInputParameter nsInput = JsonUtil.unMarshal(body, NSResourceInputParameter.class);
-            RestfulResponse rsp = driverMgr.createNs(nsInput);
-            return buildResponse(rsp);
-        } catch(ApplicationException e) {
-            LOGGER.debug("ApplicationException: ", e);
-            return e.buildErrorResponse();
-        }
+  /**
+   * Delete NS instance<br>
+   *
+   * @param servletReq http request
+   * @return response
+   * @since ONAP Amsterdam Release
+   */
+  @DELETE
+  @Path("/ns/{nsInstanceId}")
+  @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+  @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+  public Response deleteNfvoNs(HttpServletRequest servletReq,
+      @PathParam("nsInstanceId") String nsInstanceId) {
+    try {
+      // Step 1: get parameters from request for current node
+      String body = RestfulUtil.getRequestBody(servletReq);
+      ValidateUtil.assertObjectNotNull(body);
+      LOGGER.debug("body from request is {}" + body);
+      NsOperationKey nsOperationKey = JsonUtil.unMarshal(body, NsOperationKey.class);
+      RestfulResponse rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId);
+      return buildResponse(rsp);
+    } catch (ApplicationException e) {
+      LOGGER.debug("ApplicationException: ", e);
+      return e.buildErrorResponse();
     }
+  }
 
-    /**
-     * Delete NS instance<br>
-     *
-     * @param servletReq http request
-     * @return response
-     * @since ONAP Amsterdam Release
-     */
-    @DELETE
-    @Path("/ns/{nsInstanceId}")
-    @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-    public Response deleteNfvoNs(HttpServletRequest servletReq, @PathParam("nsInstanceId") String nsInstanceId) {
-        try {
-            // Step 1: get parameters from request for current node
-            String body = RestfulUtil.getRequestBody(servletReq);
-            ValidateUtil.assertObjectNotNull(body);
-            LOGGER.debug("body from request is {}" + body);
-            NsOperationKey nsOperationKey = JsonUtil.unMarshal(body, NsOperationKey.class);
-            RestfulResponse rsp = driverMgr.deleteNs(nsOperationKey, nsInstanceId);
-            return buildResponse(rsp);
-        } catch(ApplicationException e) {
-            LOGGER.debug("ApplicationException: ", e);
-            return e.buildErrorResponse();
-        }
+  /**
+   * Query Operation job status <br>
+   * 
+   * @param servletReq The Http Request
+   * @param jobId The job id
+   * @return
+   * @since ONAP Amsterdam Release
+   */
+  @POST
+  @Path("/jobs/{jobId}")
+  @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+  @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+  public Response queryNfvoJobStatus(HttpServletRequest servletReq,
+      @PathParam("jobId") String jobId) {
+    try {
+      ValidateUtil.assertObjectNotNull(jobId);
+      String body = RestfulUtil.getRequestBody(servletReq);
+      ValidateUtil.assertObjectNotNull(body);
+      LOGGER.debug("body from request is {}" + body);
+      NsOperationKey nsOperationKey = JsonUtil.unMarshal(body, NsOperationKey.class);
+
+      RestfulResponse rsp = driverMgr.getNsProgress(nsOperationKey, jobId);
+      return buildResponse(rsp);
+    } catch (ApplicationException e) {
+      LOGGER.debug("ApplicationException: ", e);
+      return e.buildErrorResponse();
     }
+  }
 
-    /**
-     * Query Operation job status
-     * <br>
-     * 
-     * @param servletReq The Http Request
-     * @param jobId The job id
-     * @return
-     * @since ONAP Amsterdam Release
-     */
-    @POST
-    @Path("/jobs/{jobId}")
-    @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-    public Response queryNfvoJobStatus(HttpServletRequest servletReq, @PathParam("jobId") String jobId) {
-        try {
-            ValidateUtil.assertObjectNotNull(jobId);
-            String body = RestfulUtil.getRequestBody(servletReq);
-            ValidateUtil.assertObjectNotNull(body);
-            LOGGER.debug("body from request is {}" + body);
-            NsOperationKey nsOperationKey = JsonUtil.unMarshal(body, NsOperationKey.class);
-
-            RestfulResponse rsp = driverMgr.getNsProgress(nsOperationKey, jobId);
-            return buildResponse(rsp);
-        } catch(ApplicationException e) {
-            LOGGER.debug("ApplicationException: ", e);
-            return e.buildErrorResponse();
-        }
+  /**
+   * Instantiate NS instance <br>
+   * 
+   * @param servletReq The http request
+   * @param nsInstanceId The NS instance id
+   * @return
+   * @since ONAP Amsterdam Release
+   */
+  @POST
+  @Path("/ns/{nsInstanceId}/instantiate")
+  @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+  @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+  public Response instantiateNfvoNs(HttpServletRequest servletReq,
+      @PathParam("nsInstanceId") String nsInstanceId) {
+    String body = RestfulUtil.getRequestBody(servletReq);
+    try {
+      ValidateUtil.assertObjectNotNull(body);
+      LOGGER.debug("body from request is {}" + body);
+      NSResourceInputParameter nsInput = JsonUtil.unMarshal(body, NSResourceInputParameter.class);
+      RestfulResponse rsp = driverMgr.instantiateNs(nsInstanceId, nsInput);
+      return buildResponse(rsp);
+    } catch (ApplicationException e) {
+      LOGGER.debug("ApplicationException: ", e);
+      return e.buildErrorResponse();
     }
+  }
 
-    /**
-     * Instantiate NS instance
-     * <br>
-     * 
-     * @param servletReq The http request
-     * @param nsInstanceId The NS instance id
-     * @return
-     * @since ONAP Amsterdam Release
-     */
-    @POST
-    @Path("/ns/{nsInstanceId}/instantiate")
-    @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-    public Response instantiateNfvoNs(HttpServletRequest servletReq, @PathParam("nsInstanceId") String nsInstanceId) {
-        String body = RestfulUtil.getRequestBody(servletReq);
-        try {
-            ValidateUtil.assertObjectNotNull(body);
-            LOGGER.debug("body from request is {}" + body);
-            NSResourceInputParameter nsInput = JsonUtil.unMarshal(body, NSResourceInputParameter.class);
-            RestfulResponse rsp = driverMgr.instantiateNs(nsInstanceId, nsInput);
-            return buildResponse(rsp);
-        } catch(ApplicationException e) {
-            LOGGER.debug("ApplicationException: ", e);
-            return e.buildErrorResponse();
-        }
+  /**
+   * Terminate NS instance <br>
+   * 
+   * @param servletReq The http request
+   * @param nsInstanceId The NS instance id
+   * @return
+   * @since ONAP Amsterdam Release
+   */
+  @POST
+  @Path("/ns/{nsInstanceId}/terminate")
+  @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+  @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+  public Response terminateNfvoNs(HttpServletRequest servletReq,
+      @PathParam("nsInstanceId") String nsInstanceId) {
+    try {
+      ValidateUtil.assertObjectNotNull(nsInstanceId);
+      String body = RestfulUtil.getRequestBody(servletReq);
+      ValidateUtil.assertObjectNotNull(body);
+      LOGGER.debug("body from request is {}" + body);
+      NsOperationKey nsOperationKey = JsonUtil.unMarshal(body, NsOperationKey.class);
+      RestfulResponse rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId);
+      return buildResponse(rsp);
+    } catch (ApplicationException e) {
+      LOGGER.debug("ApplicationException: ", e);
+      return e.buildErrorResponse();
     }
+  }
 
-    /**
-     * Terminate NS instance
-     * <br>
-     * 
-     * @param servletReq The http request
-     * @param nsInstanceId The NS instance id
-     * @return
-     * @since ONAP Amsterdam Release
-     */
-    @POST
-    @Path("/ns/{nsInstanceId}/terminate")
-    @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
-    public Response terminateNfvoNs(HttpServletRequest servletReq, @PathParam("nsInstanceId") String nsInstanceId) {
-        try {
-            ValidateUtil.assertObjectNotNull(nsInstanceId);
-            String body = RestfulUtil.getRequestBody(servletReq);
-            ValidateUtil.assertObjectNotNull(body);
-            LOGGER.debug("body from request is {}" + body);
-            NsOperationKey nsOperationKey = JsonUtil.unMarshal(body, NsOperationKey.class);
-            RestfulResponse rsp = driverMgr.terminateNs(nsOperationKey, nsInstanceId);
-            return buildResponse(rsp);
-        } catch(ApplicationException e) {
-            LOGGER.debug("ApplicationException: ", e);
-            return e.buildErrorResponse();
-        }
-    }
-
-    /**
-     * build response from restful response
-     * <br>
-     * 
-     * @param rsp general response object
-     * @return
-     * @since ONAP Amsterdam Release
-     */
-    private Response buildResponse(RestfulResponse rsp) {
-        ResponseBuilder rspBuilder = Response.status(rsp.getStatus());
-        rspBuilder.entity(rsp.getResponseContent());
-        return rspBuilder.build();
-    }
+  /**
+   * build response from restful response <br>
+   * 
+   * @param rsp general response object
+   * @return
+   * @since ONAP Amsterdam Release
+   */
+  private Response buildResponse(RestfulResponse rsp) {
+    ResponseBuilder rspBuilder = Response.status(rsp.getStatus());
+    rspBuilder.entity(rsp.getResponseContent());
+    return rspBuilder.build();
+  }
 }
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java
index 8c503aa..78ec50f 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/VfcManager.java
@@ -46,8 +46,7 @@
 import org.slf4j.LoggerFactory;
 
 /**
- * VF-C Manager
- * <br>
+ * VF-C Manager <br>
  * <p>
  * </p>
  * 
@@ -56,355 +55,364 @@
  */
 public class VfcManager {
 
-    private static final Logger LOGGER = LoggerFactory.getLogger(VfcManager.class);
+  private static final Logger LOGGER = LoggerFactory.getLogger(VfcManager.class);
 
-    /**
-     * nfvo url map
-     */
-    private static Map<String, String> nfvoUrlMap;
+  /**
+   * nfvo url map
+   */
+  private static Map<String, String> nfvoUrlMap;
 
-    static {
-        nfvoUrlMap = new HashMap<>();
-        nfvoUrlMap.put(Step.CREATE, CommonConstant.NFVO_CREATE_URL);
-        nfvoUrlMap.put(Step.INSTANTIATE, CommonConstant.NFVO_INSTANTIATE_URL);
-        nfvoUrlMap.put(Step.TERMINATE, CommonConstant.NFVO_TERMINATE_URL);
-        nfvoUrlMap.put(Step.DELETE, CommonConstant.NFVO_DELETE_URL);
-        nfvoUrlMap.put(Step.QUERY, CommonConstant.NFVO_QUERY_URL);
+  static {
+    nfvoUrlMap = new HashMap<>();
+    nfvoUrlMap.put(Step.CREATE, CommonConstant.NFVO_CREATE_URL);
+    nfvoUrlMap.put(Step.INSTANTIATE, CommonConstant.NFVO_INSTANTIATE_URL);
+    nfvoUrlMap.put(Step.TERMINATE, CommonConstant.NFVO_TERMINATE_URL);
+    nfvoUrlMap.put(Step.DELETE, CommonConstant.NFVO_DELETE_URL);
+    nfvoUrlMap.put(Step.QUERY, CommonConstant.NFVO_QUERY_URL);
+  }
+
+  public VfcManager() {
+
+  }
+
+  /**
+   * create network service <br>
+   * 
+   * @param segInput input parameters for current node from http request
+   * @return
+   * @since ONAP Amsterdam Release
+   */
+  public RestfulResponse createNs(NSResourceInputParameter segInput) throws ApplicationException {
+
+    // Step1: get service template by node type
+    String nsdId = segInput.getNsOperationKey().getNodeTemplateUUID();
+    // nsdId for NFVO is "id" in the response, while for SDNO is "servcice template id"
+    LOGGER.info("serviceTemplateId is {}, id is {}", nsdId);
+
+    LOGGER.info("create ns -> begin");
+    // Step2: Prepare url and method type
+    String url = getUrl(null, CommonConstant.Step.CREATE);
+    String methodType = CommonConstant.MethodType.POST;
+
+    // Step3: Prepare restful parameters and options
+    NsCreateReq oRequest = new NsCreateReq();
+    oRequest.setNsdId(nsdId);
+    oRequest.setNsName(segInput.getNsServiceName());
+    oRequest.setDescription(segInput.getNsServiceDescription());
+    String createReq = JsonUtil.marshal(oRequest);
+
+    // Step4: Call NFVO or SDNO lcm to create ns
+    RestfulResponse createRsp = RestfulUtil.send(url, methodType, createReq);
+    ValidateUtil.assertObjectNotNull(createRsp);
+    LOGGER.info("create ns response status is : {}", createRsp.getStatus());
+    LOGGER.info("create ns response content is : {}", createRsp.getResponseContent());
+    @SuppressWarnings("unchecked")
+    Map<String, String> rsp = JsonUtil.unMarshal(createRsp.getResponseContent(), Map.class);
+    String nsInstanceId = rsp.get(CommonConstant.NS_INSTANCE_ID);
+    if (ValidateUtil.isStrEmpty(nsInstanceId)) {
+      LOGGER.error("Invalid instanceId from create operation");
+      throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+          DriverExceptionID.INVALID_RESPONSEE_FROM_CREATE_OPERATION);
+    }
+    LOGGER.info("create ns -> end");
+    LOGGER.info("save segment and operaton info -> begin");
+    // Step 5: add relation between service and NS
+    AaiUtil.addRelation(segInput.getNsOperationKey().getGlobalSubscriberId(),
+        segInput.getNsOperationKey().getServiceType(), segInput.getNsOperationKey().getServiceId(),
+        nsInstanceId);
+
+    // Step 6: save resource operation information
+    ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance())
+        .getResourceOperationStatus(segInput.getNsOperationKey().getServiceId(),
+            segInput.getNsOperationKey().getOperationId(),
+            segInput.getNsOperationKey().getNodeTemplateUUID());
+    nsOperInfo.setStatus(RequestsDbConstant.Status.PROCESSING);
+    (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+
+    if (!HttpCode.isSucess(createRsp.getStatus())) {
+      LOGGER.error("update segment operation status : fail to create ns");
+      nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+      nsOperInfo.setErrorCode(String.valueOf(createRsp.getStatus()));
+      (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+      throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+          DriverExceptionID.FAIL_TO_CREATE_NS);
+    }
+    LOGGER.info("save segment and operation info -> end");
+    return createRsp;
+  }
+
+  /**
+   * delete network service <br>
+   * 
+   * @param nsOperationKey The operation key of the NS resource
+   * @param nsInstanceId The NS instance id
+   * @return
+   * @since ONAP Amsterdam Release
+   */
+  public RestfulResponse deleteNs(NsOperationKey nsOperationKey, String nsInstanceId)
+      throws ApplicationException {
+    LOGGER.info("delete ns -> begin");
+    // Step1: prepare url and methodType
+    String url = getUrl(nsInstanceId, CommonConstant.Step.DELETE);
+    String methodType = CommonConstant.MethodType.DELETE;
+
+    // Step2: prepare restful parameters and options
+    RestfulResponse deleteRsp = RestfulUtil.send(url, methodType, "");
+    ValidateUtil.assertObjectNotNull(deleteRsp);
+    LOGGER.info("delete ns response status is : {}", deleteRsp.getStatus());
+    LOGGER.info("delete ns response content is : {}", deleteRsp.getResponseContent());
+    LOGGER.info("delete ns -> end");
+    ResourceOperationStatus nsOperInfo =
+        (RequestsDatabase.getInstance()).getResourceOperationStatus(nsOperationKey.getServiceId(),
+            nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
+    if (!HttpCode.isSucess(deleteRsp.getStatus())) {
+      LOGGER.error("fail to delete ns");
+
+      nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+      nsOperInfo.setErrorCode(String.valueOf(deleteRsp.getStatus()));
+      nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
+      (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+      throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+          DriverExceptionID.FAIL_TO_DELETE_NS);
     }
 
-    public VfcManager() {
+    // Step3: remove relation info between service and ns
+    AaiUtil.removeRelation(nsOperationKey.getGlobalSubscriberId(), nsOperationKey.getServiceType(),
+        nsOperationKey.getServiceId(), nsInstanceId);
+    LOGGER.info("delete segment information -> end");
 
+    // Step4: update service segment operation status
+    nsOperInfo.setStatus(RequestsDbConstant.Status.FINISHED);
+    nsOperInfo.setErrorCode(String.valueOf(deleteRsp.getStatus()));
+    (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+    LOGGER.info("update segment operaton status for delete -> end");
+
+    return deleteRsp;
+
+  }
+
+  /**
+   * instantiate network service <br>
+   * 
+   * @param nsInstanceId The NS instance id
+   * @param segInput input parameters for current node from http request
+   * @return
+   * @since ONAP Amsterdam Release
+   */
+  public RestfulResponse instantiateNs(String nsInstanceId, NSResourceInputParameter segInput)
+      throws ApplicationException {
+    // Call the NFVO or SDNO service to instantiate service
+    LOGGER.info("instantiate ns -> begin");
+
+    // Step1: Prepare restful parameters and options
+    NsInstantiateReq oRequest = new NsInstantiateReq();
+    oRequest.setNsInstanceId(nsInstanceId);
+    NsParameters nsParameters = segInput.getNsParameters();
+    oRequest.setLocationConstraints(nsParameters.getLocationConstraints());
+    oRequest.setAdditionalParamForNs(nsParameters.getAdditionalParamForNs());
+    String instReq = JsonUtil.marshal(oRequest);
+    // Step2: prepare url and
+    String url = getUrl(nsInstanceId, CommonConstant.Step.INSTANTIATE);
+    String methodType = CommonConstant.MethodType.POST;
+
+    RestfulResponse instRsp = RestfulUtil.send(url, methodType, instReq);
+    ValidateUtil.assertObjectNotNull(instRsp);
+    LOGGER.info("instantiate ns response status is : {}", instRsp.getStatus());
+    LOGGER.info("instantiate ns response content is : {}", instRsp.getResponseContent());
+    ValidateUtil.assertObjectNotNull(instRsp.getResponseContent());
+    @SuppressWarnings("unchecked")
+    Map<String, String> rsp = JsonUtil.unMarshal(instRsp.getResponseContent(), Map.class);
+    String jobId = rsp.get(CommonConstant.JOB_ID);
+    ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance())
+        .getResourceOperationStatus(segInput.getNsOperationKey().getServiceId(),
+            segInput.getNsOperationKey().getOperationId(),
+            segInput.getNsOperationKey().getNodeTemplateUUID());
+    if (ValidateUtil.isStrEmpty(jobId)) {
+      LOGGER.error("Invalid jobId from instantiate operation");
+      nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+      nsOperInfo.setErrorCode(String.valueOf(instRsp.getStatus()));
+      nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED);
+      (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+      throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+          DriverExceptionID.INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION);
+    }
+    LOGGER.info("instantiate ns -> end");
+
+    if (!HttpCode.isSucess(instRsp.getStatus())) {
+      LOGGER.error("update segment operation status : fail to instantiate ns");
+      nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+      nsOperInfo.setErrorCode(String.valueOf(instRsp.getStatus()));
+      nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED);
+      (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+      throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+          DriverExceptionID.FAIL_TO_INSTANTIATE_NS);
     }
 
-    /**
-     * create network service
-     * <br>
-     * 
-     * @param segInput input parameters for current node from http request
-     * @return
-     * @since ONAP Amsterdam Release
-     */
-    public RestfulResponse createNs(NSResourceInputParameter segInput) throws ApplicationException {
+    // Step 3: update segment operation job id
+    LOGGER.info("update resource operation status job id -> begin");
+    nsOperInfo.setJobId(jobId);
+    (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+    LOGGER.info("update segment operation job id -> end");
 
-        // Step1: get service template by node type
-        String nsdId = segInput.getNsOperationKey().getNodeTemplateUUID();
-        // nsdId for NFVO is "id" in the response, while for SDNO is "servcice template id"
-        LOGGER.info("serviceTemplateId is {}, id is {}", nsdId);
+    return instRsp;
+  }
 
-        LOGGER.info("create ns -> begin");
-        // Step2: Prepare url and method type
-        String url = getUrl(null, CommonConstant.Step.CREATE);
-        String methodType = CommonConstant.MethodType.POST;
+  /**
+   * terminate network service <br>
+   * 
+   * @param nsOperationKey The operation key for NS resource
+   * @param nsInstanceId The NS instance id
+   * @return
+   * @since ONAP Amsterdam Release
+   */
+  public RestfulResponse terminateNs(NsOperationKey nsOperationKey, String nsInstanceId)
+      throws ApplicationException {
+    // Step1: save segment operation info for delete process
+    LOGGER.info("save segment operation for delete process");
+    ResourceOperationStatus nsOperInfo =
+        (RequestsDatabase.getInstance()).getResourceOperationStatus(nsOperationKey.getServiceId(),
+            nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
+    nsOperInfo.setStatus(RequestsDbConstant.Status.PROCESSING);
+    (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
 
-        // Step3: Prepare restful parameters and options
-        NsCreateReq oRequest = new NsCreateReq();
-        oRequest.setNsdId(nsdId);
-        oRequest.setNsName(segInput.getNsServiceName());
-        oRequest.setDescription(segInput.getNsServiceDescription());
-        String createReq = JsonUtil.marshal(oRequest);
+    LOGGER.info("terminate ns -> begin");
+    // Step2: prepare url and method type
+    String url = getUrl(nsInstanceId, CommonConstant.Step.TERMINATE);
+    String methodType = CommonConstant.MethodType.POST;
 
-        // Step4: Call NFVO or SDNO lcm to create ns
-        RestfulResponse createRsp = RestfulUtil.send(url, methodType, createReq);
-        ValidateUtil.assertObjectNotNull(createRsp);
-        LOGGER.info("create ns response status is : {}", createRsp.getStatus());
-        LOGGER.info("create ns response content is : {}", createRsp.getResponseContent());
-        @SuppressWarnings("unchecked")
-        Map<String, String> rsp = JsonUtil.unMarshal(createRsp.getResponseContent(), Map.class);
-        String nsInstanceId = rsp.get(CommonConstant.NS_INSTANCE_ID);
-        if(ValidateUtil.isStrEmpty(nsInstanceId)) {
-            LOGGER.error("Invalid instanceId from create operation");
-            throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
-                    DriverExceptionID.INVALID_RESPONSEE_FROM_CREATE_OPERATION);
-        }
-        LOGGER.info("create ns -> end");
-        LOGGER.info("save segment and operaton info -> begin");
-        // Step 5: add relation between service and NS
-        AaiUtil.addRelation(segInput.getNsOperationKey().getGlobalSubscriberId(),
-                segInput.getNsOperationKey().getServiceType(), segInput.getNsOperationKey().getServiceId(),
-                nsInstanceId);
+    // Step3: prepare restful parameters and options
+    Map<String, String> reqBody = new HashMap<>();
+    reqBody.put("nsInstanceId", nsInstanceId);
+    reqBody.put("terminationType", "graceful");
+    reqBody.put("gracefulTerminationTimeout", "60");
 
-        // Step 6: save resource operation information
-        ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
-                segInput.getNsOperationKey().getServiceId(), segInput.getNsOperationKey().getOperationId(),
-                segInput.getNsOperationKey().getNodeTemplateUUID());
-        nsOperInfo.setStatus(RequestsDbConstant.Status.PROCESSING);
-        (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-
-        if(!HttpCode.isSucess(createRsp.getStatus())) {
-            LOGGER.error("update segment operation status : fail to create ns");
-            nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
-            nsOperInfo.setErrorCode(String.valueOf(createRsp.getStatus()));
-            (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-            throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_CREATE_NS);
-        }
-        LOGGER.info("save segment and operation info -> end");
-        return createRsp;
+    // Step4: Call the NFVO or SDNO service to terminate service
+    RestfulResponse terminateRsp = RestfulUtil.send(url, methodType, JsonUtil.marshal(reqBody));
+    ValidateUtil.assertObjectNotNull(terminateRsp);
+    LOGGER.info("terminate ns response status is : {}", terminateRsp.getStatus());
+    LOGGER.info("terminate ns response content is : {}", terminateRsp.getResponseContent());
+    @SuppressWarnings("unchecked")
+    Map<String, String> rsp = JsonUtil.unMarshal(terminateRsp.getResponseContent(), Map.class);
+    String jobId = rsp.get(CommonConstant.JOB_ID);
+    if (ValidateUtil.isStrEmpty(jobId)) {
+      LOGGER.error("Invalid jobId from terminate operation");
+      nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+      nsOperInfo.setErrorCode(String.valueOf(terminateRsp.getStatus()));
+      nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
+      (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+      throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+          DriverExceptionID.INVALID_RESPONSE_FROM_TERMINATE_OPERATION);
     }
+    LOGGER.info("terminate ns -> end");
 
-    /**
-     * delete network service
-     * <br>
-     * 
-     * @param nsOperationKey The operation key of the NS resource
-     * @param nsInstanceId The NS instance id
-     * @return
-     * @since ONAP Amsterdam Release
-     */
-    public RestfulResponse deleteNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException {
-        LOGGER.info("delete ns -> begin");
-        // Step1: prepare url and methodType
-        String url = getUrl(nsInstanceId, CommonConstant.Step.DELETE);
-        String methodType = CommonConstant.MethodType.DELETE;
+    // Step 3: update segment operation
+    if (!HttpCode.isSucess(terminateRsp.getStatus())) {
+      LOGGER.error("fail to instantiate ns");
+      nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+      nsOperInfo.setErrorCode(String.valueOf(terminateRsp.getStatus()));
+      nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
+      (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
 
-        // Step2: prepare restful parameters and options
-        RestfulResponse deleteRsp = RestfulUtil.send(url, methodType, "");
-        ValidateUtil.assertObjectNotNull(deleteRsp);
-        LOGGER.info("delete ns response status is : {}", deleteRsp.getStatus());
-        LOGGER.info("delete ns response content is : {}", deleteRsp.getResponseContent());
-        LOGGER.info("delete ns -> end");
-        ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
-                nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
-        if(!HttpCode.isSucess(deleteRsp.getStatus())) {
-            LOGGER.error("fail to delete ns");
+      throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+          DriverExceptionID.FAIL_TO_TERMINATE_NS);
+    }
+    LOGGER.info("update segment job id -> begin");
+    nsOperInfo.setJobId(jobId);
+    (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+    LOGGER.info("update segment job id -> end");
 
-            nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
-            nsOperInfo.setErrorCode(String.valueOf(deleteRsp.getStatus()));
-            nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
-            (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-            throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_DELETE_NS);
-        }
+    return terminateRsp;
+  }
 
-        // Step3: remove relation info between service and ns
-        AaiUtil.removeRelation(nsOperationKey.getGlobalSubscriberId(), nsOperationKey.getServiceType(),
-                nsOperationKey.getServiceId(), nsInstanceId);
-        LOGGER.info("delete segment information -> end");
+  /**
+   * get ns progress by job Id <br>
+   * 
+   * @param nsOperationKey The OperationKey for NS resource
+   * @param jobId the job id
+   * @return
+   * @since ONAP Amsterdam Release
+   */
+  public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId)
+      throws ApplicationException {
 
-        // Step4: update service segment operation status
+    ValidateUtil.assertObjectNotNull(jobId);
+    // Step 1: query the current resource operation status
+    ResourceOperationStatus nsOperInfo =
+        (RequestsDatabase.getInstance()).getResourceOperationStatus(nsOperationKey.getServiceId(),
+            nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
+
+    // Step 2: start query
+    LOGGER.info("query ns status -> begin");
+    String url = getUrl(jobId, CommonConstant.Step.QUERY);
+    String methodType = CommonConstant.MethodType.GET;
+    // prepare restful parameters and options
+    RestfulResponse rsp = RestfulUtil.send(url, methodType, "");
+    ValidateUtil.assertObjectNotNull(rsp);
+    LOGGER.info("query ns progress response status is : {}", rsp.getStatus());
+    LOGGER.info("query ns progress response content is : {}", rsp.getResponseContent());
+    // Step 3:check the response staus
+    if (!HttpCode.isSucess(rsp.getStatus())) {
+      LOGGER.info("fail to query job status");
+      nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus()));
+      nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+      nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED);
+      (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+      throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+          DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS);
+    }
+    // Step 4: Process Network Service Instantiate Response
+    NsProgressStatus nsProgress =
+        JsonUtil.unMarshal(rsp.getResponseContent(), NsProgressStatus.class);
+    ResponseDescriptor rspDesc = nsProgress.getResponseDescriptor();
+    // Step 5: update segment operation progress
+
+    nsOperInfo.setProgress(rspDesc.getProgress());
+    nsOperInfo.setStatusDescription(rspDesc.getStatusDescription());
+    (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+
+    // Step 6: update segment operation status
+    if (RequestsDbConstant.Progress.ONE_HUNDRED.equals(rspDesc.getProgress())
+        && RequestsDbConstant.Status.FINISHED.equals(rspDesc.getStatus())) {
+      LOGGER.info("job result is succeeded, operType is {}", nsOperInfo.getOperType());
+      nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus()));
+      nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED);
+
+      if (RequestsDbConstant.OperationType.CREATE.equals(nsOperInfo.getOperType())) {
         nsOperInfo.setStatus(RequestsDbConstant.Status.FINISHED);
-        nsOperInfo.setErrorCode(String.valueOf(deleteRsp.getStatus()));
-        (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-        LOGGER.info("update segment operaton status for delete -> end");
-
-        return deleteRsp;
-
+      }
+      (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+    } else if (RequestsDbConstant.Status.ERROR.equals(rspDesc.getStatus())) {
+      LOGGER.error("job result is failed, operType is {}", nsOperInfo.getOperType());
+      nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus()));
+      nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED);
+      nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
+      (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
+      throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
+          DriverExceptionID.JOB_STATUS_ERROR);
+    } else {
+      LOGGER.error("unexcepted response status");
     }
+    LOGGER.info("query ns status -> end");
 
-    /**
-     * instantiate network service
-     * <br>
-     * 
-     * @param nsInstanceId The NS instance id
-     * @param segInput input parameters for current node from http request
-     * @return
-     * @since ONAP Amsterdam Release
-     */
-    public RestfulResponse instantiateNs(String nsInstanceId, NSResourceInputParameter segInput)
-            throws ApplicationException {
-        // Call the NFVO or SDNO service to instantiate service
-        LOGGER.info("instantiate ns -> begin");
+    return rsp;
+  }
 
-        // Step1: Prepare restful parameters and options
-        NsInstantiateReq oRequest = new NsInstantiateReq();
-        oRequest.setNsInstanceId(nsInstanceId);
-        NsParameters nsParameters = segInput.getNsParameters();
-        oRequest.setLocationConstraints(nsParameters.getLocationConstraints());
-        oRequest.setAdditionalParamForNs(nsParameters.getAdditionalParamForNs());
-        String instReq = JsonUtil.marshal(oRequest);
-        // Step2: prepare url and
-        String url = getUrl(nsInstanceId, CommonConstant.Step.INSTANTIATE);
-        String methodType = CommonConstant.MethodType.POST;
+  /**
+   * get url for the operation <br>
+   * 
+   * @param variable variable should be put in the url
+   * @param step step of the operation (terminate,query,delete)
+   * @return
+   * @since ONAP Amsterdam Release
+   */
+  private String getUrl(String variable, String step) {
 
-        RestfulResponse instRsp = RestfulUtil.send(url, methodType, instReq);
-        ValidateUtil.assertObjectNotNull(instRsp);
-        LOGGER.info("instantiate ns response status is : {}", instRsp.getStatus());
-        LOGGER.info("instantiate ns response content is : {}", instRsp.getResponseContent());
-        ValidateUtil.assertObjectNotNull(instRsp.getResponseContent());
-        @SuppressWarnings("unchecked")
-        Map<String, String> rsp = JsonUtil.unMarshal(instRsp.getResponseContent(), Map.class);
-        String jobId = rsp.get(CommonConstant.JOB_ID);
-        ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
-                segInput.getNsOperationKey().getServiceId(), segInput.getNsOperationKey().getOperationId(),
-                segInput.getNsOperationKey().getNodeTemplateUUID());
-        if(ValidateUtil.isStrEmpty(jobId)) {
-            LOGGER.error("Invalid jobId from instantiate operation");
-            nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
-            nsOperInfo.setErrorCode(String.valueOf(instRsp.getStatus()));
-            nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED);
-            (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-            throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
-                    DriverExceptionID.INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION);
-        }
-        LOGGER.info("instantiate ns -> end");
+    String url;
+    String originalUrl;
+    originalUrl = (String) nfvoUrlMap.get(step);
+    url = String.format(originalUrl, variable);
+    return url;
 
-        if(!HttpCode.isSucess(instRsp.getStatus())) {
-            LOGGER.error("update segment operation status : fail to instantiate ns");
-            nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
-            nsOperInfo.setErrorCode(String.valueOf(instRsp.getStatus()));
-            nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.INSTANTIATE_NS_FAILED);
-            (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-            throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_INSTANTIATE_NS);
-        }
-
-        // Step 3: update segment operation job id
-        LOGGER.info("update resource operation status job id -> begin");
-        nsOperInfo.setJobId(jobId);
-        (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-        LOGGER.info("update segment operation job id -> end");
-
-        return instRsp;
-    }
-
-    /**
-     * terminate network service
-     * <br>
-     * 
-     * @param nsOperationKey The operation key for NS resource
-     * @param nsInstanceId The NS instance id
-     * @return
-     * @since ONAP Amsterdam Release
-     */
-    public RestfulResponse terminateNs(NsOperationKey nsOperationKey, String nsInstanceId) throws ApplicationException {
-        // Step1: save segment operation info for delete process
-        LOGGER.info("save segment operation for delete process");
-        ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
-                nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
-        nsOperInfo.setStatus(RequestsDbConstant.Status.PROCESSING);
-        (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-
-        LOGGER.info("terminate ns -> begin");
-        // Step2: prepare url and method type
-        String url = getUrl(nsInstanceId, CommonConstant.Step.TERMINATE);
-        String methodType = CommonConstant.MethodType.POST;
-
-        // Step3: prepare restful parameters and options
-        Map<String, String> reqBody = new HashMap<>();
-        reqBody.put("nsInstanceId", nsInstanceId);
-        reqBody.put("terminationType", "graceful");
-        reqBody.put("gracefulTerminationTimeout", "60");
-
-        // Step4: Call the NFVO or SDNO service to terminate service
-        RestfulResponse terminateRsp = RestfulUtil.send(url, methodType, JsonUtil.marshal(reqBody));
-        ValidateUtil.assertObjectNotNull(terminateRsp);
-        LOGGER.info("terminate ns response status is : {}", terminateRsp.getStatus());
-        LOGGER.info("terminate ns response content is : {}", terminateRsp.getResponseContent());
-        @SuppressWarnings("unchecked")
-        Map<String, String> rsp = JsonUtil.unMarshal(terminateRsp.getResponseContent(), Map.class);
-        String jobId = rsp.get(CommonConstant.JOB_ID);
-        if(ValidateUtil.isStrEmpty(jobId)) {
-            LOGGER.error("Invalid jobId from terminate operation");
-            nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
-            nsOperInfo.setErrorCode(String.valueOf(terminateRsp.getStatus()));
-            nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
-            (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-            throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR,
-                    DriverExceptionID.INVALID_RESPONSE_FROM_TERMINATE_OPERATION);
-        }
-        LOGGER.info("terminate ns -> end");
-
-        // Step 3: update segment operation
-        if(!HttpCode.isSucess(terminateRsp.getStatus())) {
-            LOGGER.error("fail to instantiate ns");
-            nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
-            nsOperInfo.setErrorCode(String.valueOf(terminateRsp.getStatus()));
-            nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.TERMINATE_NS_FAILED);
-            (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-
-            throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_TERMINATE_NS);
-        }
-        LOGGER.info("update segment job id -> begin");
-        nsOperInfo.setJobId(jobId);
-        (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-        LOGGER.info("update segment job id -> end");
-
-        return terminateRsp;
-    }
-
-    /**
-     * get ns progress by job Id
-     * <br>
-     * 
-     * @param nsOperationKey The OperationKey for NS resource
-     * @param jobId the job id
-     * @return
-     * @since ONAP Amsterdam Release
-     */
-    public RestfulResponse getNsProgress(NsOperationKey nsOperationKey, String jobId) throws ApplicationException {
-
-        ValidateUtil.assertObjectNotNull(jobId);
-        // Step 1: query the current resource operation status
-        ResourceOperationStatus nsOperInfo = (RequestsDatabase.getInstance()).getResourceOperationStatus(
-                nsOperationKey.getServiceId(), nsOperationKey.getOperationId(), nsOperationKey.getNodeTemplateUUID());
-
-        // Step 2: start query
-        LOGGER.info("query ns status -> begin");
-        String url = getUrl(jobId, CommonConstant.Step.QUERY);
-        String methodType = CommonConstant.MethodType.GET;
-        // prepare restful parameters and options
-        RestfulResponse rsp = RestfulUtil.send(url, methodType, "");
-        ValidateUtil.assertObjectNotNull(rsp);
-        LOGGER.info("query ns progress response status is : {}", rsp.getStatus());
-        LOGGER.info("query ns progress response content is : {}", rsp.getResponseContent());
-        // Step 3:check the response staus
-        if(!HttpCode.isSucess(rsp.getStatus())) {
-            LOGGER.info("fail to query job status");
-            nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus()));
-            nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
-            nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED);
-            (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-            throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.FAIL_TO_QUERY_JOB_STATUS);
-        }
-        // Step 4: Process Network Service Instantiate Response
-        NsProgressStatus nsProgress = JsonUtil.unMarshal(rsp.getResponseContent(), NsProgressStatus.class);
-        ResponseDescriptor rspDesc = nsProgress.getResponseDescriptor();
-        // Step 5: update segment operation progress
-
-        nsOperInfo.setProgress(rspDesc.getProgress());
-        nsOperInfo.setStatusDescription(rspDesc.getStatusDescription());
-        (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-
-        // Step 6: update segment operation status
-        if(RequestsDbConstant.Progress.ONE_HUNDRED.equals(rspDesc.getProgress())
-                && RequestsDbConstant.Status.FINISHED.equals(rspDesc.getStatus())) {
-            LOGGER.info("job result is succeeded, operType is {}", nsOperInfo.getOperType());
-            nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus()));
-            nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED);
-
-            if(RequestsDbConstant.OperationType.CREATE.equals(nsOperInfo.getOperType())) {
-                nsOperInfo.setStatus(RequestsDbConstant.Status.FINISHED);
-            }
-            (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-        } else if(RequestsDbConstant.Status.ERROR.equals(rspDesc.getStatus())) {
-            LOGGER.error("job result is failed, operType is {}", nsOperInfo.getOperType());
-            nsOperInfo.setErrorCode(String.valueOf(rsp.getStatus()));
-            nsOperInfo.setStatusDescription(CommonConstant.StatusDesc.QUERY_JOB_STATUS_FAILED);
-            nsOperInfo.setStatus(RequestsDbConstant.Status.ERROR);
-            (RequestsDatabase.getInstance()).updateResOperStatus(nsOperInfo);
-            throw new ApplicationException(HttpCode.INTERNAL_SERVER_ERROR, DriverExceptionID.JOB_STATUS_ERROR);
-        } else {
-            LOGGER.error("unexcepted response status");
-        }
-        LOGGER.info("query ns status -> end");
-
-        return rsp;
-    }
-
-    /**
-     * get url for the operation
-     * <br>
-     * 
-     * @param variable variable should be put in the url
-     * @param step step of the operation (terminate,query,delete)
-     * @return
-     * @since ONAP Amsterdam Release
-     */
-    private String getUrl(String variable, String step) {
-
-        String url;
-        String originalUrl;
-        originalUrl = (String)nfvoUrlMap.get(step);
-        url = String.format(originalUrl, variable);
-        return url;
-
-    }
+  }
 
 }
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java
index a160b82..afaa901 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/constant/DriverExceptionID.java
@@ -31,27 +31,29 @@
  */
 public class DriverExceptionID {
 
-    public static final String INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION =
-            "Invalid response from instantiate operation";
+  public static final String INVALID_RESPONSE_FROM_INSTANTIATE_OPERATION =
+      "Invalid response from instantiate operation";
 
-    public static final String INVALID_RESPONSEE_FROM_CREATE_OPERATION = "Invalid response from create operation";
+  public static final String INVALID_RESPONSEE_FROM_CREATE_OPERATION =
+      "Invalid response from create operation";
 
-    public static final String FAIL_TO_INSTANTIATE_NS = "Fail to instantiate ns";
+  public static final String FAIL_TO_INSTANTIATE_NS = "Fail to instantiate ns";
 
-    public static final String FAIL_TO_CREATE_NS = "Fail to create ns";
+  public static final String FAIL_TO_CREATE_NS = "Fail to create ns";
 
-    public static final String INVALID_RESPONSE_FROM_TERMINATE_OPERATION = "Invalid response from terminate operation";
+  public static final String INVALID_RESPONSE_FROM_TERMINATE_OPERATION =
+      "Invalid response from terminate operation";
 
-    public static final String FAIL_TO_DELETE_NS = "Fail to delete ns";
+  public static final String FAIL_TO_DELETE_NS = "Fail to delete ns";
 
-    public static final String FAIL_TO_TERMINATE_NS = "Fail to terminate ns";
+  public static final String FAIL_TO_TERMINATE_NS = "Fail to terminate ns";
 
-    public static final String JOB_STATUS_ERROR = "Job status error";
+  public static final String JOB_STATUS_ERROR = "Job status error";
 
-    public static final String FAIL_TO_QUERY_JOB_STATUS = "Fail to query job status";
+  public static final String FAIL_TO_QUERY_JOB_STATUS = "Fail to query job status";
 
-    private DriverExceptionID() {
+  private DriverExceptionID() {
 
-    }
+  }
 
 }
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/JsonUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/JsonUtil.java
index a9546d5..69ad951 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/JsonUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/JsonUtil.java
@@ -40,93 +40,93 @@
  */
 public class JsonUtil {
 
-    /**
-     * Log service
-     */
-    private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+  /**
+   * Log service
+   */
+  private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
 
-    /**
-     * Mapper.
-     */
-    private static final ObjectMapper MAPPER = new ObjectMapper();
+  /**
+   * Mapper.
+   */
+  private static final ObjectMapper MAPPER = new ObjectMapper();
 
-    static {
-        MAPPER.setDeserializationConfig(MAPPER.getDeserializationConfig()
-                .without(org.codehaus.jackson.map.DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES));
-        MAPPER.setSerializationInclusion(Inclusion.NON_NULL);
+  static {
+    MAPPER.setDeserializationConfig(MAPPER.getDeserializationConfig().without(
+        org.codehaus.jackson.map.DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES));
+    MAPPER.setSerializationInclusion(Inclusion.NON_NULL);
+  }
+
+  /**
+   * Constructor<br/>
+   * <p>
+   * </p>
+   * 
+   * @since ONAP Amsterdam Release 2017-9-6
+   */
+  private JsonUtil() {
+
+  }
+
+  /**
+   * Parse the string in form of json.<br/>
+   * 
+   * @param jsonstr json string.
+   * @param type that convert json string to
+   * @return model object
+   * @since ONAP Amsterdam Release 2017-9-6
+   */
+  public static <T> T unMarshal(String jsonstr, Class<T> type) throws ApplicationException {
+    try {
+      return MAPPER.readValue(jsonstr, type);
+    } catch (IOException e) {
+      LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError,
+          "fail to unMarshal json", e);
+      throw new ApplicationException(HttpCode.BAD_REQUEST, "fail to unMarshal json");
     }
+  }
 
-    /**
-     * Constructor<br/>
-     * <p>
-     * </p>
-     * 
-     * @since ONAP Amsterdam Release 2017-9-6
-     */
-    private JsonUtil() {
-
+  /**
+   * Parse the string in form of json.<br/>
+   * 
+   * @param jsonstr json string.
+   * @param type that convert json string to
+   * @return model object
+   * @since ONAP Amsterdam Release 2017-9-6
+   */
+  public static <T> T unMarshal(String jsonstr, TypeReference<T> type) throws ApplicationException {
+    try {
+      return MAPPER.readValue(jsonstr, type);
+    } catch (IOException e) {
+      LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError,
+          "fail to unMarshal json", e);
+      throw new ApplicationException(HttpCode.BAD_REQUEST, "fail to unMarshal json");
     }
+  }
 
-    /**
-     * Parse the string in form of json.<br/>
-     * 
-     * @param jsonstr json string.
-     * @param type that convert json string to
-     * @return model object
-     * @since ONAP Amsterdam Release 2017-9-6
-     */
-    public static <T> T unMarshal(String jsonstr, Class<T> type) throws ApplicationException {
-        try {
-            return MAPPER.readValue(jsonstr, type);
-        } catch(IOException e) {
-            LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError,
-                    "fail to unMarshal json", e);
-            throw new ApplicationException(HttpCode.BAD_REQUEST, "fail to unMarshal json");
-        }
+  /**
+   * Convert object to json string.<br/>
+   * 
+   * @param srcObj data object
+   * @return json string
+   * @since ONAP Amsterdam Release 2017-9-6
+   */
+  public static String marshal(Object srcObj) throws ApplicationException {
+    try {
+      return MAPPER.writeValueAsString(srcObj);
+    } catch (IOException e) {
+      LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError,
+          "fail to marshal json", e);
+      throw new ApplicationException(HttpCode.BAD_REQUEST, "srcObj marshal failed!");
     }
+  }
 
-    /**
-     * Parse the string in form of json.<br/>
-     * 
-     * @param jsonstr json string.
-     * @param type that convert json string to
-     * @return model object
-     * @since ONAP Amsterdam Release 2017-9-6
-     */
-    public static <T> T unMarshal(String jsonstr, TypeReference<T> type) throws ApplicationException {
-        try {
-            return MAPPER.readValue(jsonstr, type);
-        } catch(IOException e) {
-            LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError,
-                    "fail to unMarshal json", e);
-            throw new ApplicationException(HttpCode.BAD_REQUEST, "fail to unMarshal json");
-        }
-    }
-
-    /**
-     * Convert object to json string.<br/>
-     * 
-     * @param srcObj data object
-     * @return json string
-     * @since ONAP Amsterdam Release 2017-9-6
-     */
-    public static String marshal(Object srcObj) throws ApplicationException {
-        try {
-            return MAPPER.writeValueAsString(srcObj);
-        } catch(IOException e) {
-            LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError,
-                    "fail to marshal json", e);
-            throw new ApplicationException(HttpCode.BAD_REQUEST, "srcObj marshal failed!");
-        }
-    }
-
-    /**
-     * Get mapper.<br/>
-     * 
-     * @return mapper
-     * @since ONAP Amsterdam Release 2017-9-6
-     */
-    public static ObjectMapper getMapper() {
-        return MAPPER;
-    }
+  /**
+   * Get mapper.<br/>
+   * 
+   * @return mapper
+   * @since ONAP Amsterdam Release 2017-9-6
+   */
+  public static ObjectMapper getMapper() {
+    return MAPPER;
+  }
 }
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
index 8e5f0b4..85065c0 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/RestfulUtil.java
@@ -58,179 +58,179 @@
  */
 public class RestfulUtil {
 
-    /**
-     * Log service
-     */
-    private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+  /**
+   * Log service
+   */
+  private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
 
-    private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
+  private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
 
-    private static final int DEFAULT_TIME_OUT = 60;
+  private static final int DEFAULT_TIME_OUT = 60;
 
-    private RestfulUtil() {
+  private RestfulUtil() {
 
-    }
+  }
 
-    public static RestfulResponse send(String url, String methodType, String content) {
-        LOGGER.info(MessageEnum.RA_NS_EXC, url, "VFC", "");
-        LOGGER.debug("VFC Request Body:\n" + content);
+  public static RestfulResponse send(String url, String methodType, String content) {
+    LOGGER.info(MessageEnum.RA_NS_EXC, url, "VFC", "");
+    LOGGER.debug("VFC Request Body:\n" + content);
 
-        HttpRequestBase method = null;
-        HttpResponse httpResponse = null;
+    HttpRequestBase method = null;
+    HttpResponse httpResponse = null;
 
+    try {
+      int timeout = DEFAULT_TIME_OUT;
+
+      RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout)
+          .setConnectTimeout(timeout).setConnectionRequestTimeout(timeout).build();
+
+      HttpClient client = HttpClientBuilder.create().build();
+
+      if ("POST".equals(methodType)) {
+        HttpPost httpPost = new HttpPost(url);
+        httpPost.setConfig(requestConfig);
+        httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
+        method = httpPost;
+      } else if ("PUT".equals(methodType)) {
+        HttpPut httpPut = new HttpPut(url);
+        httpPut.setConfig(requestConfig);
+        httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
+        method = httpPut;
+      } else if ("GET".equals(methodType)) {
+        HttpGet httpGet = new HttpGet(url);
+        httpGet.setConfig(requestConfig);
+        method = httpGet;
+      } else if ("DELETE".equals(methodType)) {
+        HttpDelete httpDelete = new HttpDelete(url);
+        httpDelete.setConfig(requestConfig);
+        method = httpDelete;
+      }
+
+      // now VFC have no auth
+      // String userCredentials =
+      // SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP,
+      // Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY);
+      // String authorization = "Basic " +
+      // DatatypeConverter.printBase64Binary(userCredentials.getBytes());
+      // method.setHeader("Authorization", authorization);
+
+      httpResponse = client.execute(method);
+
+      String responseContent = null;
+      if (httpResponse.getEntity() != null) {
+        responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
+      }
+
+      int statusCode = httpResponse.getStatusLine().getStatusCode();
+      String statusMessage = httpResponse.getStatusLine().getReasonPhrase();
+
+      LOGGER.debug("VFC Response: " + statusCode + " " + statusMessage
+          + (responseContent == null ? "" : System.lineSeparator() + responseContent));
+
+      if (httpResponse.getStatusLine().getStatusCode() >= 300) {
+        String errMsg = "VFC returned " + statusCode + " " + statusMessage;
+        logError(errMsg);
+        return createResponse(statusCode, errMsg);
+      }
+
+      httpResponse = null;
+
+      if (null != method) {
+        method.reset();
+      } else {
+        LOGGER.debug("method is NULL:");
+      }
+
+      method = null;
+
+      LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "SDNC", "");
+      return createResponse(statusCode, responseContent);
+
+    } catch (SocketTimeoutException e) {
+      String errMsg = "Request to SDNC timed out";
+      logError(errMsg, e);
+      return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
+
+    } catch (ConnectTimeoutException e) {
+      String errMsg = "Request to SDNC timed out";
+      logError(errMsg, e);
+      return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
+
+    } catch (Exception e) {
+      String errMsg = "Error processing request to SDNC";
+      logError(errMsg, e);
+      return createResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg);
+
+    } finally {
+      if (httpResponse != null) {
         try {
-            int timeout = DEFAULT_TIME_OUT;
-
-            RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout)
-                    .setConnectionRequestTimeout(timeout).build();
-
-            HttpClient client = HttpClientBuilder.create().build();
-
-            if("POST".equals(methodType)) {
-                HttpPost httpPost = new HttpPost(url);
-                httpPost.setConfig(requestConfig);
-                httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
-                method = httpPost;
-            } else if("PUT".equals(methodType)) {
-                HttpPut httpPut = new HttpPut(url);
-                httpPut.setConfig(requestConfig);
-                httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
-                method = httpPut;
-            } else if("GET".equals(methodType)) {
-                HttpGet httpGet = new HttpGet(url);
-                httpGet.setConfig(requestConfig);
-                method = httpGet;
-            } else if("DELETE".equals(methodType)) {
-                HttpDelete httpDelete = new HttpDelete(url);
-                httpDelete.setConfig(requestConfig);
-                method = httpDelete;
-            }
-
-            // now VFC have no auth
-            // String userCredentials =
-            // SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP,
-            // Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY);
-            // String authorization = "Basic " +
-            // DatatypeConverter.printBase64Binary(userCredentials.getBytes());
-            // method.setHeader("Authorization", authorization);
-
-            httpResponse = client.execute(method);
-
-            String responseContent = null;
-            if(httpResponse.getEntity() != null) {
-                responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
-            }
-
-            int statusCode = httpResponse.getStatusLine().getStatusCode();
-            String statusMessage = httpResponse.getStatusLine().getReasonPhrase();
-
-            LOGGER.debug("VFC Response: " + statusCode + " " + statusMessage
-                    + (responseContent == null ? "" : System.lineSeparator() + responseContent));
-
-            if(httpResponse.getStatusLine().getStatusCode() >= 300) {
-                String errMsg = "VFC returned " + statusCode + " " + statusMessage;
-                logError(errMsg);
-                return createResponse(statusCode, errMsg);
-            }
-
-            httpResponse = null;
-
-            if(null != method) {
-                method.reset();
-            }
-            else {
-                LOGGER.debug("method is NULL:");
-            }
-            
-            method = null;
-
-            LOGGER.info(MessageEnum.RA_RESPONSE_FROM_SDNC, responseContent, "SDNC", "");
-            return createResponse(statusCode, responseContent);
-
-        } catch(SocketTimeoutException e) {
-            String errMsg = "Request to SDNC timed out";
-            logError(errMsg, e);
-            return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
-
-        } catch(ConnectTimeoutException e) {
-            String errMsg = "Request to SDNC timed out";
-            logError(errMsg, e);
-            return createResponse(HttpURLConnection.HTTP_CLIENT_TIMEOUT, errMsg);
-
-        } catch(Exception e) {
-            String errMsg = "Error processing request to SDNC";
-            logError(errMsg, e);
-            return createResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, errMsg);
-
-        } finally {
-            if(httpResponse != null) {
-                try {
-                    EntityUtils.consume(httpResponse.getEntity());
-                } catch(Exception e) {
-                	LOGGER.debug("Exception :",e);
-                }
-            }
-
-            if(method != null) {
-                try {
-                    method.reset();
-                } catch(Exception e) {
-                	LOGGER.debug("Exception :",e);
-                }
-            }
+          EntityUtils.consume(httpResponse.getEntity());
+        } catch (Exception e) {
+          LOGGER.debug("Exception :", e);
         }
-    }
+      }
 
-    private static void logError(String errMsg, Throwable t) {
-        LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError, errMsg, t);
-        ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg);
-    }
-
-    private static void logError(String errMsg) {
-        LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError, errMsg);
-        ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg);
-    }
-
-    private static RestfulResponse createResponse(int statusCode, String content) {
-        RestfulResponse rsp = new RestfulResponse();
-        rsp.setStatus(statusCode);
-        rsp.setResponseContent(content);
-        return rsp;
-    }
-
-    /**
-     * @param request
-     * @return
-     */
-    public static String getRequestBody(HttpServletRequest request) {
-        String body = null;
-        StringBuilder stringBuilder = new StringBuilder();
-        BufferedReader bufferedReader = null;
+      if (method != null) {
         try {
-            InputStream inputStream = request.getInputStream();
-            if(inputStream != null) {
-                bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
-                char[] charBuffer = new char[128];
-                int bytesRead = -1;
-                while((bytesRead = bufferedReader.read(charBuffer)) > 0)
-                    stringBuilder.append(charBuffer, 0, bytesRead);
-            }
-        } catch(IOException ex) {
-            LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError,
-                    "read inputStream buffer catch exception:", ex);
-        } finally {
-            if(bufferedReader != null) {
-                try {
-                    bufferedReader.close();
-                } catch(IOException ex) {
-                    LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError,
-                            "close buffer catch exception:", ex);
-                }
-            }
+          method.reset();
+        } catch (Exception e) {
+          LOGGER.debug("Exception :", e);
         }
-
-        body = stringBuilder.toString();
-        return body;
+      }
     }
+  }
+
+  private static void logError(String errMsg, Throwable t) {
+    LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError, errMsg,
+        t);
+    ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg);
+  }
+
+  private static void logError(String errMsg) {
+    LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError, errMsg);
+    ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, errMsg);
+  }
+
+  private static RestfulResponse createResponse(int statusCode, String content) {
+    RestfulResponse rsp = new RestfulResponse();
+    rsp.setStatus(statusCode);
+    rsp.setResponseContent(content);
+    return rsp;
+  }
+
+  /**
+   * @param request
+   * @return
+   */
+  public static String getRequestBody(HttpServletRequest request) {
+    String body = null;
+    StringBuilder stringBuilder = new StringBuilder();
+    BufferedReader bufferedReader = null;
+    try {
+      InputStream inputStream = request.getInputStream();
+      if (inputStream != null) {
+        bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
+        char[] charBuffer = new char[128];
+        int bytesRead = -1;
+        while ((bytesRead = bufferedReader.read(charBuffer)) > 0)
+          stringBuilder.append(charBuffer, 0, bytesRead);
+      }
+    } catch (IOException ex) {
+      LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError,
+          "read inputStream buffer catch exception:", ex);
+    } finally {
+      if (bufferedReader != null) {
+        try {
+          bufferedReader.close();
+        } catch (IOException ex) {
+          LOGGER.error(MessageEnum.RA_NS_EXC, "VFC", "", MsoLogger.ErrorCode.AvailabilityError,
+              "close buffer catch exception:", ex);
+        }
+      }
+    }
+
+    body = stringBuilder.toString();
+    return body;
+  }
 
 }
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java
index a6fa2d2..26f8d6e 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/openecomp/mso/adapters/vfc/util/ValidateUtil.java
@@ -27,60 +27,61 @@
 
 public class ValidateUtil {
 
-    /**
-     * Log server.
-     */
-    private static final Logger LOGGER = LoggerFactory.getLogger(ValidateUtil.class);
+  /**
+   * Log server.
+   */
+  private static final Logger LOGGER = LoggerFactory.getLogger(ValidateUtil.class);
 
-    /**
-     * Constructor<br/>
-     * <p>
-     * </p>
-     * 
-     * @since ONAP Amsterdam Release 2017-9-6
-     */
-    private ValidateUtil() {
+  /**
+   * Constructor<br/>
+   * <p>
+   * </p>
+   * 
+   * @since ONAP Amsterdam Release 2017-9-6
+   */
+  private ValidateUtil() {
 
+  }
+
+  /**
+   * Assert String parameter.<br/>
+   * 
+   * @param paramValue parameter data
+   * @param name of parameter
+   * @since ONAP Amsterdam Release 2017-9-6
+   */
+  public static void assertStringNotNull(String paramValue, String paramName)
+      throws ApplicationException {
+    if (null != paramValue && !paramValue.isEmpty()) {
+      return;
     }
 
-    /**
-     * Assert String parameter.<br/>
-     * 
-     * @param paramValue parameter data
-     * @param name of parameter
-     * @since ONAP Amsterdam Release 2017-9-6
-     */
-    public static void assertStringNotNull(String paramValue, String paramName) throws ApplicationException {
-        if(null != paramValue && !paramValue.isEmpty()) {
-            return;
-        }
+    LOGGER.error(paramName + ": Parameter is null or empty.");
+    throw new ApplicationException(HttpCode.BAD_REQUEST, paramName + ": Invalid parameter.");
+  }
 
-        LOGGER.error(paramName + ": Parameter is null or empty.");
-        throw new ApplicationException(HttpCode.BAD_REQUEST, paramName + ": Invalid parameter.");
+  /**
+   * Assert object is null.<br/>
+   * 
+   * @param object data object
+   * @since ONAP Amsterdam Release 2017-9-6
+   */
+  public static void assertObjectNotNull(Object object) throws ApplicationException {
+    if (null == object) {
+      LOGGER.error("Object is null.");
+      throw new ApplicationException(HttpCode.BAD_REQUEST, "Object is null.");
     }
 
-    /**
-     * Assert object is null.<br/>
-     * 
-     * @param object data object
-     * @since ONAP Amsterdam Release 2017-9-6
-     */
-    public static void assertObjectNotNull(Object object) throws ApplicationException {
-        if(null == object) {
-            LOGGER.error("Object is null.");
-            throw new ApplicationException(HttpCode.BAD_REQUEST, "Object is null.");
-        }
+  }
 
-    }
-
-    /**
-     * <br>
-     * 
-     * @param str
-     * @return
-     * @since ONAP Amsterdam Release
-     */
-    public static boolean isStrEmpty(String str) {
-        return null == str || str.isEmpty();
-    }
+  /**
+   * <br>
+   * 
+   * @param str
+   * @return
+   * @since ONAP Amsterdam Release
+   */
+  public static boolean isStrEmpty(String str) {
+    return null == str || str.isEmpty();
+  }
 }
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java
index 4dc8fff..84991d7 100644
--- a/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java
+++ b/adapters/mso-vfc-adapter/src/test/java/org/openecomp/mso/adapters/vfc/VfcAdapterTest.java
@@ -43,8 +43,7 @@
 import mockit.MockUp;
 
 /**
- * VF-C adapter UT
- * <br>
+ * VF-C adapter UT <br>
  * <p>
  * </p>
  * 
@@ -53,200 +52,194 @@
  */
 public class VfcAdapterTest {
 
-    private VfcAdapterRest vfcAdapter = new VfcAdapterRest();
+  private VfcAdapterRest vfcAdapter = new VfcAdapterRest();
 
-    /**
-     * File path
-     */
-    private static final String FILE_PATH = "src/test/resources/json/";
+  /**
+   * File path
+   */
+  private static final String FILE_PATH = "src/test/resources/json/";
 
-    /**
-     * Mock the request body form a file
-     * <br>
-     * 
-     * @param fileName
-     * @since ONAP Amsterdam Release
-     */
-    private void mockRestfulUtil(String fileName) {
-        new MockUp<RestfulUtil>() {
+  /**
+   * Mock the request body form a file <br>
+   * 
+   * @param fileName
+   * @since ONAP Amsterdam Release
+   */
+  private void mockRestfulUtil(String fileName) {
+    new MockUp<RestfulUtil>() {
 
-            /**
-             * mock get request body
-             * <br>
-             * 
-             * @param request
-             * @return
-             * @since ONAP Amsterdam Release
-             */
-            @Mock
-            public String getRequestBody(HttpServletRequest request) {
-                return getJsonString(fileName);
-            }
+      /**
+       * mock get request body <br>
+       * 
+       * @param request
+       * @return
+       * @since ONAP Amsterdam Release
+       */
+      @Mock
+      public String getRequestBody(HttpServletRequest request) {
+        return getJsonString(fileName);
+      }
 
-            /**
-             * mock get send method
-             * <br>
-             * 
-             * @param url
-             * @param methodType
-             * @param content
-             * @return
-             * @since ONAP Amsterdam Release
-             */
-            @Mock
-            public RestfulResponse send(String url, String methodType, String content) {
-                if(url.equals(CommonConstant.NFVO_CREATE_URL) && methodType.equals(CommonConstant.MethodType.POST)) {
-                    return getResponse("createNsRsp.json");
-                } else if(url.contains("instantiate") && methodType.equals(CommonConstant.MethodType.POST)) {
-                    return getResponse("instantiateNsRsp.json");
-                } else if(methodType.equals(CommonConstant.MethodType.DELETE)) {
-                    return getResponse(null);
-                } else if(url.contains("terminate") && methodType.equals(CommonConstant.MethodType.POST)) {
-                    return getResponse("terminateNsRsp.json");
-                } else if(url.contains("/api/nslcm/v1/jobs") && methodType.equals(CommonConstant.MethodType.GET)) {
-                    return getResponse("queryJobRsp.json");
-                }
-                else {
-                    return null;
-                }
-            }
-        };
-    }
-
-    /**
-     * Mock the request body form a file
-     * <br>
-     * 
-     * @param fileName
-     * @since ONAP Amsterdam Release
-     */
-    private void mockRequestDatabase() {
-        new MockUp<RequestsDatabase>() {
-
-            /**
-             * mock get resource operation status
-             * <br>
-             * 
-             * @param request
-             * @return
-             * @since ONAP Amsterdam Release
-             */
-            @Mock
-            public ResourceOperationStatus getResourceOperationStatus(String serviceId, String operationId,
-                    String resourceTemplateUUID) {
-                ResourceOperationStatus resStatus = new ResourceOperationStatus();
-                resStatus.setServiceId("111");
-                resStatus.setOperationId("111");
-                return resStatus;
-            }
-
-            /**
-             * Mock update Res Oper Status
-             * <br>
-             * 
-             * @param operStatus
-             * @since ONAP Amsterdam Release
-             */
-            @Mock
-            public void updateResOperStatus(ResourceOperationStatus operStatus) {
-
-            }
-        };
-    }
-
-    /**
-     * Before executing UT, start mock requst database
-     * <br>
-     * 
-     * @since ONAP Amsterdam Release
-     */
-    @Before
-    public void start() {
-        mockRequestDatabase();
-    }
-
-    /**
-     * After executing UT, close session<br/>
-     * 
-     * @since ONAP Amsterdam Release
-     */
-    @After
-    public void stop() {
-
-    }
-
-    @Test
-    public void createTest() {
-        // get request
-        mockRestfulUtil(FILE_PATH + "createNsReq.json");
-        vfcAdapter.createNfvoNs(null);
-    }
-
-    @Test
-    public void deleteTest() {
-        // get request
-        mockRestfulUtil(FILE_PATH + "deleteNsReq.json");
-        vfcAdapter.deleteNfvoNs(null, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
-    }
-
-    @Test
-    public void instantiateTest() {
-        // get request
-        mockRestfulUtil(FILE_PATH + "instantiateNsReq.json");
-        vfcAdapter.instantiateNfvoNs(null, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
-    }
-
-    @Test
-    public void terminateTest() {
-        mockRestfulUtil(FILE_PATH + "terminateNsReq.json");
-        vfcAdapter.terminateNfvoNs(null, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
-    }
-
-    @Test
-    public void queryJobTest() {
-        mockRestfulUtil(FILE_PATH + "queryJobReq.json");
-        vfcAdapter.queryNfvoJobStatus(null, "1");
-    }
-
-    /**
-     * Get json string from file.<br/>
-     * 
-     * @param file the path of file
-     * @return json string
-     * @throws IOException when fail to read
-     * @since ONAP Amsterdam Release 2017-9-6
-     */
-    @SuppressWarnings("deprecation")
-    private String getJsonString(final String file) {
-        if(ValidateUtil.isStrEmpty(file)) {
-            return "";
+      /**
+       * mock get send method <br>
+       * 
+       * @param url
+       * @param methodType
+       * @param content
+       * @return
+       * @since ONAP Amsterdam Release
+       */
+      @Mock
+      public RestfulResponse send(String url, String methodType, String content) {
+        if (url.equals(CommonConstant.NFVO_CREATE_URL)
+            && methodType.equals(CommonConstant.MethodType.POST)) {
+          return getResponse("createNsRsp.json");
+        } else if (url.contains("instantiate")
+            && methodType.equals(CommonConstant.MethodType.POST)) {
+          return getResponse("instantiateNsRsp.json");
+        } else if (methodType.equals(CommonConstant.MethodType.DELETE)) {
+          return getResponse(null);
+        } else if (url.contains("terminate") && methodType.equals(CommonConstant.MethodType.POST)) {
+          return getResponse("terminateNsRsp.json");
+        } else if (url.contains("/api/nslcm/v1/jobs")
+            && methodType.equals(CommonConstant.MethodType.GET)) {
+          return getResponse("queryJobRsp.json");
+        } else {
+          return null;
         }
+      }
+    };
+  }
 
-        String json = null;
-        try {
-            FileInputStream fileStream = new FileInputStream(new File(file));
-            json = IOUtils.toString(fileStream);
-        } catch(Exception e) {
-            Assert.fail(e.getMessage());
-        }
-        return json;
+  /**
+   * Mock the request body form a file <br>
+   * 
+   * @param fileName
+   * @since ONAP Amsterdam Release
+   */
+  private void mockRequestDatabase() {
+    new MockUp<RequestsDatabase>() {
+
+      /**
+       * mock get resource operation status <br>
+       * 
+       * @param request
+       * @return
+       * @since ONAP Amsterdam Release
+       */
+      @Mock
+      public ResourceOperationStatus getResourceOperationStatus(String serviceId,
+          String operationId, String resourceTemplateUUID) {
+        ResourceOperationStatus resStatus = new ResourceOperationStatus();
+        resStatus.setServiceId("111");
+        resStatus.setOperationId("111");
+        return resStatus;
+      }
+
+      /**
+       * Mock update Res Oper Status <br>
+       * 
+       * @param operStatus
+       * @since ONAP Amsterdam Release
+       */
+      @Mock
+      public void updateResOperStatus(ResourceOperationStatus operStatus) {
+
+      }
+    };
+  }
+
+  /**
+   * Before executing UT, start mock requst database <br>
+   * 
+   * @since ONAP Amsterdam Release
+   */
+  @Before
+  public void start() {
+    mockRequestDatabase();
+  }
+
+  /**
+   * After executing UT, close session<br/>
+   * 
+   * @since ONAP Amsterdam Release
+   */
+  @After
+  public void stop() {
+
+  }
+
+  @Test
+  public void createTest() {
+    // get request
+    mockRestfulUtil(FILE_PATH + "createNsReq.json");
+    vfcAdapter.createNfvoNs(null);
+  }
+
+  @Test
+  public void deleteTest() {
+    // get request
+    mockRestfulUtil(FILE_PATH + "deleteNsReq.json");
+    vfcAdapter.deleteNfvoNs(null, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
+  }
+
+  @Test
+  public void instantiateTest() {
+    // get request
+    mockRestfulUtil(FILE_PATH + "instantiateNsReq.json");
+    vfcAdapter.instantiateNfvoNs(null, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
+  }
+
+  @Test
+  public void terminateTest() {
+    mockRestfulUtil(FILE_PATH + "terminateNsReq.json");
+    vfcAdapter.terminateNfvoNs(null, "9b9f02c0-298b-458a-bc9c-be3692e4f354");
+  }
+
+  @Test
+  public void queryJobTest() {
+    mockRestfulUtil(FILE_PATH + "queryJobReq.json");
+    vfcAdapter.queryNfvoJobStatus(null, "1");
+  }
+
+  /**
+   * Get json string from file.<br/>
+   * 
+   * @param file the path of file
+   * @return json string
+   * @throws IOException when fail to read
+   * @since ONAP Amsterdam Release 2017-9-6
+   */
+  @SuppressWarnings("deprecation")
+  private String getJsonString(final String file) {
+    if (ValidateUtil.isStrEmpty(file)) {
+      return "";
     }
 
-    /**
-     * get the response from file
-     * <br>
-     * 
-     * @param fileName
-     * @return
-     * @since ONAP Amsterdam Release
-     */
-    private RestfulResponse getResponse(String fileName) {
-        RestfulResponse responseSuccess = new RestfulResponse();
-        responseSuccess.setStatus(HttpCode.RESPOND_OK);
-        if(null != fileName) {
-            String jsonStr = getJsonString(FILE_PATH + fileName);
-            responseSuccess.setResponseContent(jsonStr);
-        }
-        return responseSuccess;
+    String json = null;
+    try {
+      FileInputStream fileStream = new FileInputStream(new File(file));
+      json = IOUtils.toString(fileStream);
+    } catch (Exception e) {
+      Assert.fail(e.getMessage());
     }
+    return json;
+  }
+
+  /**
+   * get the response from file <br>
+   * 
+   * @param fileName
+   * @return
+   * @since ONAP Amsterdam Release
+   */
+  private RestfulResponse getResponse(String fileName) {
+    RestfulResponse responseSuccess = new RestfulResponse();
+    responseSuccess.setStatus(HttpCode.RESPOND_OK);
+    if (null != fileName) {
+      String jsonStr = getJsonString(FILE_PATH + fileName);
+      responseSuccess.setResponseContent(jsonStr);
+    }
+    return responseSuccess;
+  }
 }
diff --git a/adapters/mso-vfc-adapter/src/test/resources/logback-test.xml b/adapters/mso-vfc-adapter/src/test/resources/logback-test.xml
index 26a8687..61d9c45 100644
--- a/adapters/mso-vfc-adapter/src/test/resources/logback-test.xml
+++ b/adapters/mso-vfc-adapter/src/test/resources/logback-test.xml
@@ -1,48 +1,39 @@
-<!--
-  ============LICENSE_START=======================================================
-  ONAP SO
-  ================================================================================
-  Copyright (C) 2017 Huawei Intellectual Property. All rights reserved.
-  ================================================================================
-  Licensed under the Apache License, Version 2.0 (the "License");
-  you may not use this file except in compliance with the License.
-  You may obtain a copy of the License at
-  
-       http://www.apache.org/licenses/LICENSE-2.0
-  
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT 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_START======================================================= 
+	ONAP SO ================================================================================ 
+	Copyright (C) 2017 Huawei Intellectual Property. All rights reserved. ================================================================================ 
+	Licensed under the Apache License, Version 2.0 (the "License"); you may not 
+	use this file except in compliance with the License. You may obtain a copy 
+	of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required 
+	by applicable law or agreed to in writing, software distributed under the 
+	License is distributed on an "AS IS" BASIS, WITHOUT 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========================================================= -->
 
-<configuration >
-  
-  
-  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
-    <encoder>
-      <pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n</pattern>
-    </encoder>
-  </appender>
+<configuration>
 
 
-  <logger name="com.att.eelf.audit" level="info" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger>
-  
-  <logger name="com.att.eelf.metrics" level="info" additivity="false">
-        <appender-ref ref="STDOUT" />
-  </logger>
+	<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+		<encoder>
+			<pattern>%d{MM/dd-HH:mm:ss.SSS}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServiceName}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}||%X{ServerIPAddress}|%X{ServerFQDN}|%X{RemoteHost}||%X{Timer}|%msg%n</pattern>
+		</encoder>
+	</appender>
 
-  <logger name="com.att.eelf.error" level="trace" additivity="false">
-    <appender-ref ref="STDOUT" />
-  </logger> 
 
-  <root level="info">
-    <appender-ref ref="STDOUT" />
-  </root>
- 
+	<logger name="com.att.eelf.audit" level="info" additivity="false">
+		<appender-ref ref="STDOUT" />
+	</logger>
+
+	<logger name="com.att.eelf.metrics" level="info" additivity="false">
+		<appender-ref ref="STDOUT" />
+	</logger>
+
+	<logger name="com.att.eelf.error" level="trace" additivity="false">
+		<appender-ref ref="STDOUT" />
+	</logger>
+
+	<root level="info">
+		<appender-ref ref="STDOUT" />
+	</root>
+
 
 </configuration>
