Merge "Add junit tests for CallbackHandlerService"
authorSteve Smokowski <ss835w@att.com>
Thu, 7 Mar 2019 15:20:39 +0000 (15:20 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 7 Mar 2019 15:20:39 +0000 (15:20 +0000)
83 files changed:
adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/authentication/KeystoneV3Authentication.java
adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
adapters/mso-catalog-db-adapter/src/main/resources/application.yaml
adapters/mso-openstack-adapters/pom.xml
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java [moved from adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackServiceData.java with 94% similarity]
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java [new file with mode: 0644]
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditVServer.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/HeatStackAudit.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/NetworkAdapterRest.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfCloudifyAdapterImpl.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRest.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestUtils.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterRestV2.java
adapters/mso-openstack-adapters/src/main/resources/application.yaml
adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditCreateStackServiceTest.java [moved from adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java with 88% similarity]
adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditVServerTest.java
adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/HeatStackAuditTest.java
adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/GeneralBuildingBlock.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/CDSPropertiesImpl.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json
bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json
bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpectedWUserParamsInfo.json
bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ActivateVfModuleBB.bpmn
bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ActivateVfModuleBBTest.java
bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVfModuleBBTest.java
bpmn/so-bpmn-building-blocks/src/test/resources/logback-test.xml
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/audit/AuditTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CloudSiteCatalogUtils.java
common/src/main/java/org/onap/so/client/RestClient.java
common/src/main/java/org/onap/so/client/aai/AAIDSLQueryClient.java
common/src/main/java/org/onap/so/client/aai/AAIQueryClient.java
common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java
common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java [new file with mode: 0644]
common/src/main/java/org/onap/so/client/cds/CDSProcessingClient.java
common/src/main/java/org/onap/so/client/cds/CDSProperties.java
common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryQueryClient.java
common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNode.java
common/src/main/java/org/onap/so/client/graphinventory/entities/DSLNodeKey.java
common/src/main/java/org/onap/so/client/graphinventory/entities/DSLQueryBuilder.java
common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryRelationships.java
common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryResultWrapper.java
common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java [new file with mode: 0644]
common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java [new file with mode: 0644]
common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java [new file with mode: 0644]
common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java [new file with mode: 0644]
common/src/test/java/org/onap/so/client/aai/AAIQueryClientTest.java
common/src/test/java/org/onap/so/client/aai/AAIResourcesClientTest.java
common/src/test/java/org/onap/so/client/aai/DSLQueryBuilderTest.java
common/src/test/java/org/onap/so/client/aai/entities/RelationshipsTest.java
common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
common/src/test/java/org/onap/so/client/cds/TestCDSPropertiesImpl.java
common/src/test/java/org/onap/so/client/defaultproperties/DefaultAAIPropertiesImpl.java
common/src/test/resources/__files/aai/query/pathed-result.json [new file with mode: 0644]
common/src/test/resources/__files/aai/query/single-query-result.json [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequestTest.java
mso-api-handlers/mso-requests-db-repositories/src/main/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImpl.java
mso-api-handlers/mso-requests-db-repositories/src/test/java/org/onap/so/db/request/data/repository/InfraActiveRequestsRepositoryImplTest.java
mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
so-monitoring/so-monitoring-handler/src/main/java/org/onap/so/monitoring/configuration/rest/CorsConfigurer.java
so-monitoring/so-monitoring-handler/src/test/java/org/onap/so/montoring/db/api/DatabaseServiceProviderTest.java
so-monitoring/so-monitoring-service/src/test/java/org/onap/so/monitoring/rest/api/Constants.java [new file with mode: 0644]
so-monitoring/so-monitoring-service/src/test/java/org/onap/so/monitoring/rest/api/SoMonitoringControllerTest.java
so-monitoring/so-monitoring-service/src/test/resources/application-test.yaml
so-monitoring/so-monitoring-service/src/test/resources/databaseResponses/searchResult.json [new file with mode: 0644]

index 00602af..8fbccaa 100644 (file)
@@ -128,6 +128,6 @@ public class KeystoneV3Authentication {
                                }
                        }
                }
-               throw new ServiceEndpointNotFoundException("endpoint url not found");
+               throw new ServiceEndpointNotFoundException("endpoint url not found: type:" + type +" region: " + region + " facing: " + facing);
        }
 }
index ee1c79c..a0fbd48 100644 (file)
@@ -999,6 +999,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
             OpenStackRequest <Stack> request = heatClient.getStacks ().byName (stackName);
             return executeAndRecordOpenstackRequest (request);
         } catch (OpenStackResponseException e) {
+               logger.error("Error in Query Stack", e);
             if (e.getStatus () == 404) {
                 logger.debug ("queryHeatStack - stack not found: {}", stackName);
                 return null;
index aa9317c..07b0008 100644 (file)
@@ -28,6 +28,7 @@ spring:
     password: ${DB_ADMIN_PASSWORD}
     outOfOrder: true
     validateOnMigrate: false
+    repeatableSqlMigrationPrefix: RATT
   jpa:
       show-sql: true
       hibernate:
index f2f411d..cb35e90 100644 (file)
@@ -13,8 +13,8 @@
 
        <build>
                <finalName>${project.artifactId}-${project.version}</finalName>
-
-               <plugins>
+               
+               <plugins>                       
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-dependency-plugin</artifactId>
                                </executions>
                        </plugin>
 
-                       <!-- run the following plugin only when there's a wsdl change and you 
-                               need to recompile the java classes <plugin> <groupId>org.codehaus.mojo</groupId> 
-                               <artifactId>jaxws-maven-plugin</artifactId> <version>2.4.1</version> <executions> 
-                               <execution> <id>generate-network-async-stubs</id> <phase>process-classes</phase> 
-                               <goals> <goal>wsimport</goal> </goals> <configuration> <vmArgs> <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg> 
-                               </vmArgs> <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory> <wsdlFiles> 
-                               <wsdlFile>NetworkAdapterNotify.wsdl</wsdlFile> </wsdlFiles> <wsdlLocation>/NetworkAdapterNotify.wsdl</wsdlLocation> 
-                               <packageName>org.onap.so.adapters.network.async.client</packageName> <xnocompile>false</xnocompile> 
-                               <keep>true</keep> </configuration> </execution> <execution> <id>generate-vnf-async-stubs</id> 
-                               <phase>process-classes</phase> <goals> <goal>wsimport</goal> </goals> <configuration> 
-                               <vmArgs> <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg> </vmArgs> <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory> 
-                               <wsdlFiles> <wsdlFile>VnfAdapterNotify.wsdl</wsdlFile> </wsdlFiles> <wsdlLocation>/VnfAdapterNotify.wsdl</wsdlLocation> 
-                               <packageName>org.onap.so.adapters.vnf.async.client</packageName> <xnocompile>false</xnocompile> 
-                               <keep>true</keep> </configuration> </execution> </executions> </plugin> <plugin> 
-                               <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> 
-                               <version>3.0.0</version> <executions> <execution> <id>add-source</id> <phase>generate-sources</phase> 
-                               <goals> <goal>add-source</goal> </goals> <configuration> <sources> <source>${project.build.directory}/generated-sources/wsimport/</source> 
-                               </sources> </configuration> </execution> </executions> </plugin> -->
+<!--  run the following plugin only when there's a wsdl change and you need to recompile the java classes
+                       <plugin>
+                               <groupId>org.codehaus.mojo</groupId>
+                               <artifactId>jaxws-maven-plugin</artifactId>
+                               <version>2.4.1</version>
+                               <executions>
+                                       <execution>
+                                               <id>generate-network-async-stubs</id>
+                                               <phase>process-classes</phase>
+                                               <goals>
+                                                       <goal>wsimport</goal>
+                                               </goals>
+                                               <configuration>
+                            <vmArgs>
+                                <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
+                            </vmArgs>
+                                                       <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory>
+                                                       <wsdlFiles>
+                                                               <wsdlFile>NetworkAdapterNotify.wsdl</wsdlFile>
+                                                       </wsdlFiles>
+                                                       <wsdlLocation>/NetworkAdapterNotify.wsdl</wsdlLocation>
+                                                       <packageName>org.onap.so.adapters.network.async.client</packageName>
+                                                       <xnocompile>false</xnocompile>
+                                                       <keep>true</keep>
+                                               </configuration>
+                                       </execution>
+                                       
+                                       <execution>
+                                               <id>generate-vnf-async-stubs</id>
+                                               <phase>process-classes</phase>
+                                               <goals>
+                                                       <goal>wsimport</goal>
+                                               </goals>
+                                               <configuration>
+                                               <vmArgs>
+                                                   <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
+                                               </vmArgs>
+                                                       <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory>
+                                                       <wsdlFiles>
+                                                               <wsdlFile>VnfAdapterNotify.wsdl</wsdlFile>
+                                                       </wsdlFiles>
+                                                       <wsdlLocation>/VnfAdapterNotify.wsdl</wsdlLocation>
+                                                       <packageName>org.onap.so.adapters.vnf.async.client</packageName>
+                                                       <xnocompile>false</xnocompile>
+                                                       <keep>true</keep>
+                                               </configuration>
+                                       </execution>
+                               </executions>
+                       </plugin>
                        <plugin>
+                           <groupId>org.codehaus.mojo</groupId>
+                           <artifactId>build-helper-maven-plugin</artifactId>
+                           <version>3.0.0</version>
+                           <executions>
+                               <execution>
+                                   <id>add-source</id>
+                                   <phase>generate-sources</phase>
+                                   <goals>
+                                       <goal>add-source</goal>
+                                   </goals>
+                                   <configuration>
+                                       <sources>
+                                           <source>${project.build.directory}/generated-sources/wsimport/</source>
+                                       </sources>
+                                   </configuration>
+                               </execution>
+                           </executions>
+                        </plugin>                      
+ -->           <plugin>
                                <groupId>org.jacoco</groupId>
                                <artifactId>jacoco-maven-plugin</artifactId>
                        </plugin>
                                        </execution>
                                </executions>
                        </plugin>
-               </plugins>
-
-
+               </plugins>              
+               
+               
                <pluginManagement>
                        <plugins>
-                               <!--This plugin's configuration is used to store Eclipse m2e settings 
+                               <!--This plugin's configuration is used to store Eclipse m2e settings
                                        only. It has no influence on the Maven build itself. -->
                                <plugin>
                                        <groupId>org.eclipse.m2e</groupId>
        </build>
 
        <dependencies>
-               <!-- added for spring boot support -->
+       <!-- added for spring boot support -->  
                <dependency>
-                       <groupId>org.springframework.boot</groupId>
-                       <artifactId>spring-boot-starter-actuator</artifactId>
+               <groupId>org.springframework.boot</groupId>
+               <artifactId>spring-boot-starter-actuator</artifactId>
                </dependency>
                <dependency>
                        <groupId>org.springframework.boot</groupId>
                <dependency>
                        <groupId>org.apache.cxf</groupId>
                        <artifactId>cxf-spring-boot-starter-jaxws</artifactId>
-                       <version>${cxf.version}</version>
+                       <version>${cxf.version}</version>
                </dependency>
                <dependency>
                        <groupId>org.apache.cxf</groupId>
                        <version>${cxf.version}</version>
                </dependency>
                <dependency>
-                       <groupId>org.apache.cxf</groupId>
-                       <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
-                       <version>${cxf.version}</version>
+               <groupId>org.apache.cxf</groupId>
+               <artifactId>cxf-rt-rs-service-description-swagger</artifactId>
+               <version>${cxf.version}</version>
                </dependency>
                <dependency>
                        <groupId>org.webjars</groupId>
                        <scope>test</scope>
                </dependency>
                <dependency>
-                       <groupId>janino</groupId>
-                       <artifactId>janino</artifactId>
-                       <version>2.5.15</version>
+               <groupId>janino</groupId>
+               <artifactId>janino</artifactId>
+               <version>2.5.15</version>
                </dependency>
-
-               <!-- end added for spring boot support -->
-
-
-
-               <!-- added for unit testing -->
+        
+       <!-- end added for spring boot support -->      
+       
+       
+       
+       <!-- added for unit testing -->         
                <dependency>
                        <groupId>org.onap.so.adapters</groupId>
                        <artifactId>mso-adapter-utils</artifactId>
                        <groupId>javax.servlet</groupId>
                        <artifactId>javax.servlet-api</artifactId>
                        <scope>test</scope>
-               </dependency>
+               </dependency>           
                <dependency>
                        <groupId>org.mariadb.jdbc</groupId>
                        <artifactId>mariadb-java-client</artifactId>
-               </dependency>
+               </dependency>           
                <dependency>
                        <groupId>org.onap.so</groupId>
                        <artifactId>common</artifactId>
                        <version>${openstack.version}</version>
                </dependency>
                <dependency>
-                       <groupId>org.camunda.bpm</groupId>
-                       <artifactId>camunda-external-task-client</artifactId>
-                       <version>1.0.0</version>
-               </dependency>
+                       <groupId>org.camunda.bpm</groupId>
+                       <artifactId>camunda-external-task-client</artifactId>
+                       <version>1.1.1</version>
+               </dependency>   
        </dependencies>
 </project>
@@ -22,7 +22,6 @@
 
 package org.onap.so.adapters.audit;
 
-
 import org.camunda.bpm.client.task.ExternalTask;
 import org.camunda.bpm.client.task.ExternalTaskService;
 import org.onap.logging.ref.slf4j.ONAPLogConstants;
@@ -35,14 +34,14 @@ import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Component;
 
 @Component
-public class AuditStackServiceData {
+public class AuditCreateStackService {
        
        private static final String UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI = "Unable to find all VServers and L-Interaces in A&AI";
        
        private static final int[] RETRY_SEQUENCE = new int[] { 1, 1, 2, 3, 5, 8, 13, 20};
 
        
-       private static final Logger logger = LoggerFactory.getLogger(AuditStackServiceData.class);
+       private static final Logger logger = LoggerFactory.getLogger(AuditCreateStackService.class);
        
        @Autowired
        public HeatStackAudit heatStackAudit; 
@@ -56,7 +55,7 @@ public class AuditStackServiceData {
                boolean success = false;
                try {
                        logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory,externalTask.getRetries());
-                       success=heatStackAudit.auditHeatStack(auditInventory.getCloudRegion(), auditInventory.getCloudOwner(),
+                       success=heatStackAudit.auditHeatStackCreate(auditInventory.getCloudRegion(), auditInventory.getCloudOwner(),
                                        auditInventory.getTenantId(), auditInventory.getHeatStackName());
                } catch (Exception e) {
                        logger.error("Error during audit of stack", e);
@@ -72,7 +71,7 @@ public class AuditStackServiceData {
                        }else if(externalTask.getRetries() != null &&
                                        externalTask.getRetries()-1 == 0){
                                logger.debug("The External Task Id: {}  Failed, All Retries Exhausted", externalTask.getId());
-                               externalTaskService.handleBpmnError(externalTask, "AuditAAIInventoryFailure");
+                               externalTaskService.handleBpmnError(externalTask, "AuditAAIInventoryFailure", "Number of Retries Exceeded auditing inventory");
                        }else{
                                logger.debug("The External Task Id: {}  Failed, Decrementing Retries: {} , Retry Delay: ", externalTask.getId(),externalTask.getRetries()-1, calculateRetryDelay(externalTask.getRetries()));
                                externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, externalTask.getRetries()-1, calculateRetryDelay(externalTask.getRetries()));
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
new file mode 100644 (file)
index 0000000..66d8fbd
--- /dev/null
@@ -0,0 +1,90 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.audit;
+
+import org.camunda.bpm.client.task.ExternalTask;
+import org.camunda.bpm.client.task.ExternalTaskService;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.audit.beans.AuditInventory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AuditDeleteStackService {
+       
+       private static final String UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI = "All VServers have not been deleted in A&AI";
+       
+       private static final int[] RETRY_SEQUENCE = new int[] { 1, 1, 2, 3, 5, 8, 13, 20};
+
+       
+       private static final Logger logger = LoggerFactory.getLogger(AuditDeleteStackService.class);
+       
+       @Autowired
+       public HeatStackAudit heatStackAudit; 
+       
+       @Autowired
+       public Environment env;
+
+       protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService){
+               AuditInventory auditInventory = externalTask.getVariable("auditInventory");
+               setupMDC(externalTask);
+               boolean success = false;
+               try {
+                       logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory,externalTask.getRetries());
+                       success=heatStackAudit.auditHeatStackDeleted(auditInventory.getCloudRegion(), auditInventory.getCloudOwner(),
+                                       auditInventory.getTenantId(), auditInventory.getHeatStackName());
+               } catch (Exception e) {
+                       logger.error("Error during audit of stack", e);
+               }
+               
+               if (success) {
+                       externalTaskService.complete(externalTask);
+                       logger.debug("The External Task Id: {}  Successful", externalTask.getId());
+               } else {
+                       if(externalTask.getRetries() == null){
+                               logger.debug("The External Task Id: {}  Failed, Setting Retries to Default Start Value: {}", externalTask.getId(),RETRY_SEQUENCE.length);
+                               externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, RETRY_SEQUENCE.length, 10000);                      
+                       }else if(externalTask.getRetries() != null &&
+                                       externalTask.getRetries()-1 == 0){
+                               logger.debug("The External Task Id: {}  Failed, All Retries Exhausted", externalTask.getId());
+                               externalTaskService.complete(externalTask);
+                       }else{
+                               logger.debug("The External Task Id: {}  Failed, Decrementing Retries: {} , Retry Delay: ", externalTask.getId(),externalTask.getRetries()-1, calculateRetryDelay(externalTask.getRetries()));
+                               externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, externalTask.getRetries()-1, calculateRetryDelay(externalTask.getRetries()));
+                       }
+                       logger.debug("The External Task Id: {} Failed", externalTask.getId());
+               }
+       }
+       private void setupMDC(ExternalTask externalTask) {
+               String msoRequestId = (String)externalTask.getVariable("mso-request-id");
+               if(msoRequestId != null && !msoRequestId.isEmpty())
+                       MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
+       }
+       protected long calculateRetryDelay(int currentRetries){
+               int retrySequence = RETRY_SEQUENCE.length - currentRetries;
+               long retryMultiplier = Long.parseLong(env.getProperty("mso.workflow.topics.retryMultiplier","6000"));
+               return RETRY_SEQUENCE[retrySequence] * retryMultiplier;
+       }
+}
index 499c113..6ea14dc 100644 (file)
@@ -46,10 +46,30 @@ public class AuditStackService {
        public Environment env;
 
        @Autowired
-       private AuditStackServiceData auditStack;
+       private AuditCreateStackService auditCreateStack;
+       
+       @Autowired
+       private AuditDeleteStackService auditDeleteStack;
 
        @PostConstruct
-       public void auditAAIInventory() {
+       public void auditAddAAIInventory() {
+               String auth = "";
+               try {
+                       auth = CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey"));
+               } catch (IllegalStateException | GeneralSecurityException e) {
+                       logger.error("Error Decrypting Password", e);
+               }
+               ClientRequestInterceptor interceptor = new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"),
+                               auth);
+               ExternalTaskClient client = ExternalTaskClient.create()
+                               .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
+                               .asyncResponseTimeout(120000).build();
+               client.subscribe("InventoryAddAudit").lockDuration(60000)
+                               .handler(auditCreateStack::executeExternalTask).open();
+       }
+       
+       @PostConstruct
+       public void auditDeleteAAIInventory() {
                String auth = "";
                try {
                        auth = CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey"));
@@ -60,9 +80,9 @@ public class AuditStackService {
                                auth);
                ExternalTaskClient client = ExternalTaskClient.create()
                                .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
-                               .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(10000, 2, 120000)).build();
-               client.subscribe("InventoryAudit").lockDuration(60000)
-                               .handler(auditStack::executeExternalTask).open();
+                               .asyncResponseTimeout(120000).build();
+               client.subscribe("InventoryDeleteAudit").lockDuration(60000)
+                               .handler(auditDeleteStack::executeExternalTask).open();
        }
 
 }
index 6e6ecd5..c81dac7 100644 (file)
@@ -39,23 +39,32 @@ import org.springframework.stereotype.Component;
 public class AuditVServer extends AbstractAudit {
        private static final Logger logger = LoggerFactory.getLogger(AuditVServer.class);
 
-       public boolean auditVservers(Set<Vserver> vServersToAudit, String tenantId, String cloudOwner, String cloudRegion) {
+       public boolean auditAllVserversDoExist(Set<Vserver> vServersToAudit, String tenantId, String cloudOwner, String cloudRegion) {
                if (vServersToAudit == null || vServersToAudit.isEmpty()){
                        return false;
                }
                return vServersToAudit.stream()
-                               .filter(vServer -> !doesVServerExistInAAI(vServer, tenantId, cloudOwner, cloudRegion)).findFirst()
+                               .filter(vServer -> !doesVServerExistInAAI(vServer, tenantId, cloudOwner, cloudRegion,true)).findFirst()
+                               .map(v -> false).orElse(true);
+       }
+       
+       public boolean auditAllVserversDoNotExist(Set<Vserver> vServersToAudit, String tenantId, String cloudOwner, String cloudRegion) {
+               if (vServersToAudit == null || vServersToAudit.isEmpty()){
+                       return true;
+               }
+               return vServersToAudit.stream()
+                               .filter(vServer -> doesVServerExistInAAI(vServer, tenantId, cloudOwner, cloudRegion,false)).findFirst()
                                .map(v -> false).orElse(true);
        }
 
-       private boolean doesVServerExistInAAI(Vserver vServer, String tenantId, String cloudOwner, String cloudRegion) {
+       private boolean doesVServerExistInAAI(Vserver vServer, String tenantId, String cloudOwner, String cloudRegion, boolean checkLinterfaces) {
                AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion,
                                tenantId, vServer.getVserverId());
                boolean vServerExists = getAaiClient().exists(vserverURI);
                boolean doesExist = getAaiClient().exists(vserverURI);
                logger.info("v-server {} exists: {}", vServer.getVserverId(), doesExist);
                boolean allNeutronNetworksExist = true;
-               if (vServerExists && vServer.getLInterfaces() != null) {
+               if (vServerExists && vServer.getLInterfaces() != null && checkLinterfaces) {
                        allNeutronNetworksExist = vServer.getLInterfaces()
                                        .getLInterface().stream().filter(lInterface -> !doesLinterfaceExistinAAI(lInterface,
                                                        vServer.getVserverId(), tenantId, cloudOwner, cloudRegion))
index da833c7..19e3ab7 100644 (file)
@@ -57,26 +57,51 @@ public class HeatStackAudit {
        @Autowired
        protected AuditVServer auditVservers;
 
-       public boolean auditHeatStack(String cloudRegion, String cloudOwner, String tenantId, String heatStackName) {
+       public boolean auditHeatStackCreate(String cloudRegion, String cloudOwner, String tenantId, String heatStackName) {
                try {
-                       logger.debug("Fetching Top Level Stack Information");
-                       Resources resources = heat.queryStackResources(cloudRegion, tenantId, heatStackName);
-                       List<Resource> novaResources = resources.getList().stream()
-                                       .filter(p -> "OS::Nova::Server".equals(p.getType())).collect(Collectors.toList());
-                       List<Resource> resourceGroups = resources.getList().stream()
-                                       .filter(p -> "OS::Heat::ResourceGroup".equals(p.getType()) && p.getName().contains("subinterfaces")).collect(Collectors.toList());
-                       if(novaResources.isEmpty())
-                               return true;
-                       else{                           
-                               Set<Vserver> vserversToAudit = createVserverSet(resources, novaResources);
-                               Set<Vserver> vserversWithSubInterfaces = processSubInterfaces(cloudRegion, tenantId, resourceGroups,
-                                       vserversToAudit);
-                               return auditVservers.auditVservers(vserversWithSubInterfaces, tenantId, cloudOwner, cloudRegion);
-                       }
+                       return auditStack(cloudRegion,cloudOwner,tenantId,heatStackName,true);
                } catch (Exception e) {
                        logger.error("Error during auditing stack resources", e);
                        return false;
                }
+       }
+       
+       public boolean auditHeatStackDeleted(String cloudRegion, String cloudOwner, String tenantId, String heatStackName) {
+               try {
+                       return auditStack(cloudRegion,cloudOwner,tenantId,heatStackName,false);
+               } catch (Exception e) {
+                       logger.error("Error during auditing stack resources", e);
+                       return false;
+               }
+       }
+       
+       private boolean auditStack(String cloudRegion, String cloudOwner, String tenantId, String heatStackName,boolean isCreateAudit) throws Exception{
+               logger.debug("Fetching Top Level Stack Information");
+               Resources resources = heat.queryStackResources(cloudRegion, tenantId, heatStackName);
+               List<Resource> novaResources = extractNovaResources(resources);
+               if(novaResources.isEmpty())
+                       return true;
+               else{
+                       List<Resource> resourceGroups = extractResourceGroups(resources);
+                       Set<Vserver> vserversToAudit = createVserverSet(resources, novaResources);
+                       Set<Vserver> vserversWithSubInterfaces = processSubInterfaces(cloudRegion, tenantId, resourceGroups,
+                               vserversToAudit);
+                       if(isCreateAudit){
+                               return auditVservers.auditAllVserversDoExist(vserversWithSubInterfaces, tenantId, cloudOwner, cloudRegion);
+                       }else{
+                               return auditVservers.auditAllVserversDoNotExist(vserversWithSubInterfaces, tenantId, cloudOwner, cloudRegion);
+                       }
+               }
+       }
+
+       private List<Resource> extractResourceGroups(Resources resources) {
+               return resources.getList().stream()
+                               .filter(p -> "OS::Heat::ResourceGroup".equals(p.getType()) && p.getName().contains("subinterfaces")).collect(Collectors.toList());
+       }
+
+       private List<Resource> extractNovaResources(Resources resources) {
+               return resources.getList().stream()
+                               .filter(p -> "OS::Nova::Server".equals(p.getType())).collect(Collectors.toList());
        } 
 
        protected Set<Vserver> processSubInterfaces(String cloudRegion, String tenantId, List<Resource> resourceGroups,
@@ -208,5 +233,4 @@ public class HeatStackAudit {
                return Optional.empty();
        }
        
-       
 }
index 8f9152a..253f13d 100644 (file)
@@ -90,6 +90,7 @@ public class NetworkAdapterRest {
 
        @Autowired
        private MsoNetworkAdapterImpl adapter;
+       
        @Autowired
        private Provider<BpelRestClient> bpelRestClientProvider;
        
index 7265a59..8a5a083 100644 (file)
@@ -59,7 +59,7 @@ import org.springframework.stereotype.Component;
  * org.onap.so.adapters.vnf.retrylist list of response codes that will trigger a retry (the special code
  *                     900 means "connection was not established")
  */
-@Component()
+@Component
 @Scope("prototype")
 public class BpelRestClient {
        public  static final String MSO_PROP_VNF_ADAPTER     = "MSO_PROP_VNF_ADAPTER";
index 9616076..ce060ab 100644 (file)
@@ -5,6 +5,8 @@
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
  * 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
@@ -73,6 +75,8 @@ import org.onap.so.adapters.valet.beans.ValetRollbackResponse;
 import org.onap.so.adapters.valet.beans.ValetStatus;
 import org.onap.so.adapters.valet.beans.ValetUpdateResponse;
 import org.onap.so.adapters.valet.GenericValetResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Component;
@@ -93,10 +97,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
        @Autowired
        private Environment environment;
 
+    private static final Logger logger = LoggerFactory.getLogger(MsoVnfAdapterImpl.class);
+
     private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
     private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter.";
-    private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoVnfAdapterImpl.class);
-
     private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters";
     private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq";
     private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
@@ -132,7 +136,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
      */
     @Override
     public void healthCheck () {
-        LOGGER.debug ("Health check call in VNF Adapter");
+        logger.debug ("Health check call in VNF Adapter");
     }
 
     /**
@@ -193,7 +197,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         String vfModuleId = "";
        // Create a hook here to catch shortcut createVf requests:
        if (requestType != null && requestType.startsWith("VFMOD")) {
-                       LOGGER.debug("Calling createVfModule from createVnf -- requestType=" + requestType);
+                       logger.debug("Calling createVfModule from createVnf -- requestType=" + requestType);
                        String newRequestType = requestType.substring(5);
                        String vfVolGroupHeatStackId = "";
                        String vfBaseHeatStackId = "";
@@ -204,7 +208,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                }
                        } catch (Exception e) {
                                // might be ok - both are just blank
-                               LOGGER.debug("ERROR trying to parse the volumeGroupHeatStackId " + volumeGroupHeatStackId,e);
+                               logger.debug("ERROR trying to parse the volumeGroupHeatStackId " + volumeGroupHeatStackId,e);
                        }
                        this.createVfModule(cloudSiteId,
                                        tenantId,
@@ -258,7 +262,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         }
 
     @Override
-    public void updateVnf (String cloudSiteId,
+    public void updateVnf(String cloudSiteId,
                            String tenantId,
                            String vnfType,
                            String vnfVersion,
@@ -272,7 +276,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
        // As of 1707 - this method should no longer be called
        MsoLogger.setLogContext (msoRequest.getRequestId (), msoRequest.getServiceInstanceId ());
        MsoLogger.setServiceName ("UpdateVnf");
-       LOGGER.debug("UpdateVnf called?? This should not be called any longer - update vfModule");
+      logger.debug("UpdateVnf called?? This should not be called any longer - update vfModule");
     }
 
     /**
@@ -301,7 +305,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                           Holder <Map <String, String>> outputs) throws VnfException {
         MsoLogger.setLogContext (msoRequest);
        MsoLogger.setServiceName ("QueryVnf");
-        LOGGER.debug ("Querying VNF " + vnfName + " in " + cloudSiteId + "/" + tenantId);
+        logger.debug("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
 
         // Will capture execution time for metrics
         long startTime = System.currentTimeMillis ();
@@ -310,15 +314,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         long subStartTime = System.currentTimeMillis ();
         try {
             heatStack = heat.queryStack (cloudSiteId, tenantId, vnfName);
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_MSG, "OpenStack", "QueryStack", vnfName);
         } catch (MsoException me) {
             me.addContext ("QueryVNF");
             // Failed to query the Stack due to an openstack exception.
             // Convert to a generic VnfException
             String error = "Query VNF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", vnfName);
-            LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, "OpenStack", "QueryVNF", MsoLogger.ErrorCode.DataError, "Exception - queryStack", me);
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+            logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId,
+                tenantId, "OpenStack", "QueryVNF", MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryStack",
+                me);
+            logger.debug(error);
             throw new VnfException (me);
         }
 
@@ -331,16 +335,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             vnfId.value = null;
             outputs.value = new HashMap<>(); // Return as an empty map
 
-            LOGGER.debug ("VNF " + vnfName + " not found");
+            logger.debug ("VNF {} not found", vnfName);
         } else {
             vnfExists.value = Boolean.TRUE;
             status.value = stackStatusToVnfStatus (heatStack.getStatus ());
             vnfId.value = heatStack.getCanonicalName ();
             outputs.value = copyStringOutputs (heatStack.getOutputs ());
 
-            LOGGER.debug ("VNF " + vnfName + " found, ID = " + vnfId.value);
+            logger.debug ("VNF {} found, ID = {}", vnfName, vnfId.value);
         }
-        LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully query VNF");
         return;
     }
 
@@ -362,7 +365,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                            MsoRequest msoRequest) throws VnfException {
         MsoLogger.setLogContext (msoRequest);
        MsoLogger.setServiceName ("DeleteVnf");
-        LOGGER.debug ("Deleting VNF " + vnfName + " in " + cloudSiteId + "/" + tenantId);
+        logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
         // Will capture execution time for metrics
         long startTime = System.currentTimeMillis ();
 
@@ -373,20 +376,19 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         long subStartTime = System.currentTimeMillis ();
         try {
             heat.deleteStack (tenantId, cloudSiteId, vnfName, true);
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_MSG, "OpenStack", "DeleteStack", vnfName);
         } catch (MsoException me) {
             me.addContext ("DeleteVNF");
             // Failed to query the Stack due to an openstack exception.
             // Convert to a generic VnfException
             String error = "Delete VNF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteStack", vnfName);
-            LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vnfName, cloudSiteId, tenantId, "OpenStack", "DeleteVNF", MsoLogger.ErrorCode.DataError, "Exception - DeleteVNF", me);
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+            logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudSiteId,
+                tenantId, "OpenStack", "DeleteVNF", MsoLogger.ErrorCode.DataError.getValue(), "Exception - DeleteVNF",
+                me);
+            logger.debug(error);
             throw new VnfException (me);
         }
 
         // On success, nothing is returned.
-        LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully delete VNF");
         return;
     }
 
@@ -402,8 +404,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         MsoLogger.setServiceName ("RollbackVnf");
        // rollback may be null (e.g. if stack already existed when Create was called)
         if (rollback == null) {
-            LOGGER.info (MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "Rollback request content is null");
+            logger.info(MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
             return;
         }
 
@@ -414,7 +415,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
 
         MsoLogger.setLogContext (rollback.getMsoRequest());
 
-        LOGGER.debug ("Rolling Back VNF " + vnfId + " in " + cloudSiteId + "/" + tenantId);
+        logger.debug("Rolling Back VNF {} in {}", vnfId, cloudSiteId + "/" + tenantId);
 
         // Use the MsoHeatUtils to delete the stack. Set the polling flag to true.
         // The possible outcomes of deleteStack are a StackInfo object with status
@@ -423,18 +424,17 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         long subStartTime = System.currentTimeMillis ();
         try {
             heat.deleteStack (tenantId, cloudSiteId, vnfId, true);
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_MSG, "OpenStack", "DeleteStack", null);
         } catch (MsoException me) {
             // Failed to rollback the Stack due to an openstack exception.
             // Convert to a generic VnfException
             me.addContext ("RollbackVNF");
             String error = "Rollback VNF: " + vnfId + " in " + cloudSiteId + "/" + tenantId + ": " + me;
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteStack", null);
-            LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vnfId, cloudSiteId, tenantId, "OpenStack", "DeleteStack", MsoLogger.ErrorCode.DataError, "Exception - DeleteStack", me);
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+            logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfId, cloudSiteId,
+                tenantId, "OpenStack", "DeleteStack", MsoLogger.ErrorCode.DataError.getValue(),
+                "Exception - DeleteStack", me);
+            logger.debug(error);
             throw new VnfException (me);
         }
-        LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully roll back VNF");
         return;
     }
 
@@ -468,7 +468,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                } else {
                        msg.append(" - unable to call .toString() " + e.getMessage());
                }
-               LOGGER.debug(msg.toString(), e);
+               logger.debug(msg.toString(), e);
             }
         }
         return stringOutputs;
@@ -483,26 +483,28 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
        String openstackIdentityUrl = "", username = "", password = "", tenant = "", region = "", owner = "";
         long waitTimeMs = 10000L;
        try {
-               String[] cmdarray = {"/usr/bin/python", "HeatBridgeMain.py", openstackIdentityUrl, username, password, tenant, region, owner, heatStackId};
-               String[] envp = null;
-               File dir = new File(executionDir);
-               LOGGER.debug("Calling HeatBridgeMain.py in " + dir + " with arguments " + Arrays.toString(cmdarray));
-               Runtime r = Runtime.getRuntime();
-               Process p = r.exec(cmdarray, envp, dir);
-               boolean wait = p.waitFor(waitTimeMs, TimeUnit.MILLISECONDS);
-
-               LOGGER.debug(" HeatBridgeMain.py returned " + wait + " with code " + p.exitValue());
-               return wait && p.exitValue()==0;
-       } catch (IOException e) {
-               LOGGER.debug(" HeatBridgeMain.py failed with IO Exception! " + e);
-               return false;
+          String[] cmdarray =
+              {"/usr/bin/python", "HeatBridgeMain.py", openstackIdentityUrl, username, password, tenant, region, owner,
+                  heatStackId};
+          String[] envp = null;
+          File dir = new File(executionDir);
+          logger.debug("Calling HeatBridgeMain.py in {} with arguments {}", dir, Arrays.toString(cmdarray));
+          Runtime r = Runtime.getRuntime();
+          Process p = r.exec(cmdarray, envp, dir);
+          boolean wait = p.waitFor(waitTimeMs, TimeUnit.MILLISECONDS);
+
+          logger.debug(" HeatBridgeMain.py returned {} with code {}", wait, p.exitValue());
+          return wait && p.exitValue() == 0;
+      } catch (IOException e) {
+          logger.debug(" HeatBridgeMain.py failed with IO Exception! " + e);
+          return false;
        } catch (RuntimeException e) {
-               LOGGER.debug(" HeatBridgeMain.py failed during runtime!" + e);
-               return false;
-       }
+          logger.debug(" HeatBridgeMain.py failed during runtime!" + e);
+          return false;
+      }
                catch (Exception e) {
-               LOGGER.debug(" HeatBridgeMain.py failed for unknown reasons! " + e);
-               return false;
+        logger.debug(" HeatBridgeMain.py failed for unknown reasons! " + e);
+        return false;
        }
     }
 
@@ -511,9 +513,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
             return JSON_MAPPER.writeValueAsString(obj);
         } catch (JsonParseException jpe) {
-            LOGGER.debug("Error converting json to string " + jpe.getMessage(),jpe);
+            logger.debug("Error converting json to string " + jpe.getMessage(),jpe);
         } catch (Exception e) {
-            LOGGER.debug("Error converting json to string " + e.getMessage(),e);
+            logger.debug("Error converting json to string " + e.getMessage(),e);
         }
         return "[Error converting json to string]";
     }
@@ -535,30 +537,30 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                         String str = this.convertNode((JsonNode) obj);
                         stringMap.put(key, str);
                     } catch (Exception e) {
-                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for JsonNode "+ key,e);
+                        logger.debug("DANGER WILL ROBINSON: unable to convert value for JsonNode "+ key,e);
                         //okay in this instance - only string values (fqdn) are expected to be needed
                     }
                 } else if (obj instanceof java.util.LinkedHashMap) {
-                    LOGGER.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode");
+                    logger.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode");
                     try {
                         String str = JSON_MAPPER.writeValueAsString(obj);
                         stringMap.put(key, str);
                     } catch (Exception e) {
-                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for LinkedHashMap "+ key,e);
+                        logger.debug("DANGER WILL ROBINSON: unable to convert value for LinkedHashMap "+ key,e);
                                        }
                                }  else if (obj instanceof Integer) {
                                        try {
                                                String str = "" + obj;
                                                stringMap.put(key, str);
                                        } catch (Exception e) {
-                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for Integer "+ key,e);
+              logger.debug("DANGER WILL ROBINSON: unable to convert value for Integer "+ key,e);
                     }
                 } else {
                     try {
                                                String str = obj.toString();
                         stringMap.put(key, str);
                     } catch (Exception e) {
-                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value "+ key + " (" + e.getMessage() + ")",e);
+                        logger.debug("DANGER WILL ROBINSON: unable to convert value "+ key + " (" + e.getMessage() + ")",e);
                     }
                 }
             }
@@ -594,11 +596,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         boolean useMCUuid = false;
         if (mcu != null && !mcu.isEmpty()) {
             if ("null".equalsIgnoreCase(mcu)) {
-                LOGGER.debug("modelCustomizationUuid: passed in as the string 'null' - will ignore: " + modelCustomizationUuid);
+                logger.debug("modelCustomizationUuid: passed in as the string 'null' - will ignore: " + modelCustomizationUuid);
                 useMCUuid = false;
                 mcu = "";
             } else {
-                LOGGER.debug("Found modelCustomizationUuid! Will use that: " + mcu);
+                logger.debug("Found modelCustomizationUuid! Will use that: " + mcu);
                 useMCUuid = true;
             }
         }
@@ -621,7 +623,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         boolean oldWay = false;
         if (requestTypeString.startsWith("X")) {
                oldWay = true;
-               LOGGER.debug("orchestrating a VNF - *NOT* a module!");
+            logger.debug("orchestrating a VNF - *NOT* a module!");
                requestTypeString = requestTypeString.substring(1);
         }
 
@@ -632,7 +634,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                isVolumeRequest = true;
         }
 
-        LOGGER.debug("requestTypeString = " + requestTypeString + ", nestedStackId = " + nestedStackId + ", nestedBaseStackId = " + nestedBaseStackId);
+        logger.debug("requestTypeString = " + requestTypeString + ", nestedStackId = " + nestedStackId + ", nestedBaseStackId = " + nestedBaseStackId);
         // Will capture execution time for metrics
         long startTime = System.currentTimeMillis ();
 
@@ -656,15 +658,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         long subStartTime1 = System.currentTimeMillis ();
         try {
             heatStack = heat.queryStack (cloudSiteId, tenantId, vfModuleName);
-            LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_MSG, "OpenStack", "QueryStack", vfModuleName);
         } catch (MsoException me) {
             String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
-            LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", vfModuleName);
-            LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Exception - queryStack", me);
+            logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
+                tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryStack",
+                me);
+            logger.debug(error);
             // Failed to query the Stack due to an openstack exception.
             // Convert to a generic VnfException
             me.addContext ("CreateVFModule");
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
             throw new VnfException (me);
         }
         // New with 1607 - more precise handling/messaging if the stack already exists
@@ -674,40 +676,50 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                if (status == HeatStatus.INIT || status == HeatStatus.BUILDING || status == HeatStatus.DELETING || status == HeatStatus.UPDATING) {
                        // fail - it's in progress - return meaningful error
                 String error = "Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually.";
-                LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Stack " + vfModuleName + " already exists");
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+              logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+                  cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError.getValue(),
+                  "Stack " + vfModuleName + " already exists");
+              logger.debug(error);
                 throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ());
                }
                if (status == HeatStatus.FAILED) {
                        // fail - it exists and is in a FAILED state
-                String error = "Create VF: Stack " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
-                LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Stack " + vfModuleName + " already exists and is in FAILED state");
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+              String error = "Create VF: Stack " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+              logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+                  cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError.getValue(),
+                  "Stack " + vfModuleName + " already exists and is " + "in FAILED state");
+              logger.debug(error);
                 throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ());
                }
                if (status == HeatStatus.UNKNOWN || status == HeatStatus.UPDATED) {
                        // fail - it exists and is in a FAILED state
-                String error = "Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
-                LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Stack " + vfModuleName + " already exists and is in UPDATED or UNKNOWN state");
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
-                throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ());
-               }
+              String error =
+                  "Create VF: Stack " + vfModuleName + " already exists and has status " + status.toString() + " in "
+                      + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+              logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+                  cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError.getValue(),
+                  "Stack " + vfModuleName + " already exists and is " + "in UPDATED or UNKNOWN state");
+              logger.debug(error);
+              throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName());
+          }
                if (status == HeatStatus.CREATED) {
                        // fail - it exists
                        if (failIfExists != null && failIfExists) {
-                               String error = "Create VF: Stack " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId;
-                               LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError, "Stack " + vfModuleName + " already exists");
-                    LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
-                               throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName ());
-                       } else {
-                               LOGGER.debug ("Found Existing stack, status=" + heatStack.getStatus ());
+                String error =
+                    "Create VF: Stack " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId;
+                logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+                    cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.DataError.getValue(),
+                    "Stack " + vfModuleName + " already exists");
+                logger.debug(error);
+                throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, heatStack.getCanonicalName());
+            } else {
+                               logger.debug ("Found Existing stack, status={}", heatStack.getStatus ());
                                // Populate the outputs from the existing stack.
                                vnfId.value = heatStack.getCanonicalName ();
                                outputs.value = copyStringOutputs (heatStack.getOutputs ());
                                rollback.value = vfRollback; // Default rollback - no updates performed
                        }
                }
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create VF Module");
             return;
 
         }
@@ -718,28 +730,29 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         Map<String, Object> nestedVolumeOutputs = null;
         if (nestedStackId != null) {
                try {
-                       LOGGER.debug("Querying for nestedStackId = " + nestedStackId);
+                       logger.debug("Querying for nestedStackId = {}", nestedStackId);
                        nestedHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedStackId);
-                LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_MSG, "OpenStack", "QueryStack", vfModuleName);
                } catch (MsoException me) {
                    // Failed to query the Stack due to an openstack exception.
                    // Convert to a generic VnfException
                    me.addContext ("CreateVFModule");
                    String error = "Create VFModule: Attached heatStack ID Query " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
-                LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", vfModuleName);
-                   LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.BusinessProcesssError, "MsoException trying to query nested stack", me);
-                       LOGGER.debug("ERROR trying to query nested stack= " + error);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+              logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
+                      tenantId, "OpenStack", "queryStack", MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+                      "MsoException trying to query nested stack", me);
+              logger.debug("ERROR trying to query nested stack= {}", error);
                    throw new VnfException (me);
                }
                if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) {
                    String error = "Create VFModule: Attached heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR"  ;
-                   LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, error, "OpenStack", "queryStack", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Attached heatStack ID DOES NOT EXIST");
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
-                   LOGGER.debug(error);
-                   throw new VnfException (error, MsoExceptionCategory.USERDATA);
+              logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
+                  cloudSiteId, tenantId, error, "OpenStack", "queryStack",
+                  MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+                  "Create VFModule: Attached heatStack ID " + "DOES NOT EXIST");
+              logger.debug(error);
+              throw new VnfException (error, MsoExceptionCategory.USERDATA);
                } else {
-                       LOGGER.debug("Found nested volume heat stack - copying values to inputs *later*");
+                       logger.debug("Found nested volume heat stack - copying values to inputs *later*");
                        nestedVolumeOutputs = nestedHeatStack.getOutputs();
                }
         }
@@ -750,28 +763,30 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         Map<String, Object> baseStackOutputs = null;
         if (nestedBaseStackId != null) {
                try {
-                       LOGGER.debug("Querying for nestedBaseStackId = " + nestedBaseStackId);
+                       logger.debug("Querying for nestedBaseStackId = {}", nestedBaseStackId);
                        nestedBaseHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedBaseStackId);
-                LOGGER.recordMetricEvent (subStartTime3, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_MSG, "OpenStack", "QueryStack", vfModuleName);
                } catch (MsoException me) {
                    // Failed to query the Stack due to an openstack exception.
                    // Convert to a generic VnfException
                    me.addContext ("CreateVFModule");
                    String error = "Create VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
-                LOGGER.recordMetricEvent (subStartTime3, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", vfModuleName);
-                   LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.BusinessProcesssError, "MsoException trying to query nested base stack", me);
-                       LOGGER.debug("ERROR trying to query nested base stack= " + error);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
-                   throw new VnfException (me);
+              logger
+                  .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
+                      tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+                      "MsoException trying to query nested base stack", me);
+              logger.debug("ERROR trying to query nested base stack= {}", error);
+              throw new VnfException (me);
                }
                if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) {
                    String error = "Create VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR"  ;
-                   LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Attached base heatStack ID DOES NOT EXIST");
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
-                   LOGGER.debug(error);
+              logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
+                  cloudSiteId, tenantId, error, "OpenStack", "QueryStack",
+                  MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+                  "Create VFModule: Attached base heatStack ID DOES NOT EXIST");
+              logger.debug("Exception occurred", error);
                    throw new VnfException (error, MsoExceptionCategory.USERDATA);
                } else {
-                       LOGGER.debug("Found nested base heat stack - these values will be copied to inputs *later*");
+                       logger.debug("Found nested base heat stack - these values will be copied to inputs *later*");
                        baseStackOutputs = nestedBaseHeatStack.getOutputs();
                }
         }
@@ -785,7 +800,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                VfModule vf = null;
                VnfResource vnfResource = null;
                VfModuleCustomization vfmc = null;
-               LOGGER.debug("version: " + vfVersion);
+               logger.debug("version: {}", vfVersion);
             if (useMCUuid) {
                        // 1707 - db refactoring
                        vfmc = vfModuleCustomRepo.findByModelCustomizationUUID(mcu);
@@ -796,22 +811,24 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
 
                 // 1702 - this will be the new way going forward. We find the vf by mcu - otherwise, code is the same.
                 if (vf == null) {
-                               LOGGER.debug("Unable to find vfModuleCust with modelCustomizationUuid=" + mcu);
+                               logger.debug("Unable to find vfModuleCust with modelCustomizationUuid={}", mcu);
                                String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + mcu;
-                    LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM,
-                            "VF Module ModelCustomizationUuid", modelCustomizationUuid, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Create VF Module: Unable to find vfModule with modelCustomizationUuid=" + mcu);
-                    LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+                    logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+                        "VF Module ModelCustomizationUuid", modelCustomizationUuid, "OpenStack",
+                        MsoLogger.ErrorCode.DataError.getValue(),
+                        "Create VF Module: Unable to find vfModule with " + "modelCustomizationUuid=" + mcu);
+                    logger.debug(error);
                     throw new VnfException(error, MsoExceptionCategory.USERDATA);
                 } else {
-                               LOGGER.trace("Found vfModuleCust entry " + vfmc.toString());
+                               logger.trace("Found vfModuleCust entry {}", vfmc.toString());
                 }
                 if (vf.getIsBase()) {
                     isBaseRequest = true;
-                    LOGGER.debug("This is a BASE VF request!");
+                    logger.debug("This is a BASE VF request!");
                 } else {
-                    LOGGER.debug("This is *not* a BASE VF request!");
+                    logger.debug("This is *not* a BASE VF request!");
                     if (!isVolumeRequest && nestedBaseStackId == null) {
-                        LOGGER.debug("DANGER WILL ROBINSON! This is unexpected - no nestedBaseStackId with this non-base request");
+                        logger.debug("DANGER WILL ROBINSON! This is unexpected - no nestedBaseStackId with this non-base request");
                     }
                 }
                }
@@ -823,15 +840,14 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                        vnfResource = vnfResourceRepo.findByModelName(vnfType);
                                }
                                if (vnfResource == null) {
-                                       String error = "Create VNF: Unknown VNF Type: " + vnfType;
-                                       LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "VNF Type",
-                                                       vnfType, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Create VNF: Unknown VNF Type");
-                    LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
-                                       throw new VnfException(error, MsoExceptionCategory.USERDATA);
-                               }
-                               LOGGER.debug("Got VNF module definition from Catalog: "
-                                               + vnfResource.toString());
-                       }
+            String error = "Create VNF: Unknown VNF Type: " + vnfType;
+            logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VNF Type", vnfType,
+                "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), "Create VNF: Unknown VNF Type");
+            logger.debug(error);
+            throw new VnfException(error, MsoExceptionCategory.USERDATA);
+        }
+                logger.debug("Got VNF module definition from Catalog: {}", vnfResource.toString());
+            }
                        // By here - we have either a vf or vnfResource
 
             //1607 - Add version check
@@ -840,7 +856,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             if (!oldWay && vf.getVnfResources() != null) {
                        vnfResource = vf.getVnfResources();
                        if (vnfResource == null) {
-                               LOGGER.debug("Unable to find vnfResource will not error for now...");
+                               logger.debug("Unable to find vnfResource will not error for now...");
                        }
             }
             String minVersionVnf = null;
@@ -850,7 +866,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                        minVersionVnf = vnfResource.getAicVersionMin();
                        maxVersionVnf = vnfResource.getAicVersionMax();
                } catch (Exception e) {
-                       LOGGER.debug("Unable to pull min/max version for this VNF Resource entry",e);
+                       logger.debug("Unable to pull min/max version for this VNF Resource entry",e);
                        minVersionVnf = null;
                        maxVersionVnf = null;
                }
@@ -881,29 +897,35 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                                        moreThanMax = aicV.isMoreRecentThan(maxVersionVnf);
                                                        equalToMax = aicV.isTheSameVersion(maxVersionVnf);
                                                } catch (Exception e) {
-                                                       LOGGER.debug("An exception occured while trying to test AIC Version " + e.getMessage() + " - will default to not check",e);
-                                                       doNotTest = true;
+                logger.debug("An exception occurred while trying to test AIC Version {} - will default to not check",
+                    e.getMessage(), e);
+                doNotTest = true;
                                                }
                                                if (!doNotTest) {
                                                        if ((moreThanMin || equalToMin) // aic >= min
                                                                        && (equalToMax || !(moreThanMax))) { //aic <= max
-                                                               LOGGER.debug("VNF Resource " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion());
-                                                       } else {
+                  logger.debug(
+                      "VNF Resource " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID()
+                          + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " supported on Cloud: "
+                          + cloudSiteId + " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion());
+              } else {
                                                                // ERROR
                                                                String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSiteOpt.get().getCloudVersion();
-                                                               LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - setVersion");
-                                                               LOGGER.debug(error);
+                  logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
+                      MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
+                  logger.debug(error);
                                                                throw new VnfException(error, MsoExceptionCategory.USERDATA);
                                                        }
                                                } else {
-                                                       LOGGER.debug("bypassing testing AIC version...");
+                                                       logger.debug("bypassing testing AIC version...");
                                                }
                                        } // let this error out downstream to avoid introducing uncertainty at this stage
                                } else {
-                                       LOGGER.debug("cloudConfig is NULL - cannot check cloud site version");
+                                       logger.debug("cloudConfig is NULL - cannot check cloud site version");
                                }
                        } else {
-                               LOGGER.debug("AIC Version not set in VNF_Resource - this is expected thru 1607 - do not error here - not checked.");
+                               logger.debug("AIC Version not set in VNF_Resource - this is expected thru 1607 - do not error here - not checked"
+            + ".");
                        }
                        // End Version check 1607
 
@@ -931,28 +953,31 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
 
                        if (heatTemplate == null) {
                                String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestTypeString;
-                               LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);           
+          logger
+              .error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", vfModuleType,
+                  "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+          logger.debug(error);
                                throw new VnfException(error, MsoExceptionCategory.INTERNAL);
                        } else {
-                               LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate());
+                               logger.debug("Got HEAT Template from DB: {}", heatTemplate.getHeatTemplate());
                        }
 
                        if (oldWay) {
                                //This will handle old Gamma BrocadeVCE VNF
-                               LOGGER.debug ("No environment parameter found for this Type " + vfModuleType);
+                               logger.debug("No environment parameter found for this Type " + vfModuleType);
                        } else {
                    if (heatEnvironment == null) {
                       String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
-                           LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error);
-                           LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+                  logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
+                      "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+                  logger.debug(error);
                            throw new VnfException (error, MsoExceptionCategory.INTERNAL);
                    } else {
-                       LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment());
-                   }
+                  logger.debug("Got Heat Environment from DB: {}", heatEnvironment.getEnvironment());
+              }
                        }
 
-            LOGGER.debug ("In MsoVnfAdapterImpl, about to call db.getNestedTemplates avec templateId="
+            logger.debug("In MsoVnfAdapterImpl, about to call db.getNestedTemplates avec templateId="
                           + heatTemplate.getArtifactUuid ());
 
 
@@ -960,13 +985,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             Map <String, Object> nestedTemplatesChecked = new HashMap <> ();
             if (nestedTemplates != null && !nestedTemplates.isEmpty()) {
                 // for debugging print them out
-                LOGGER.debug ("Contents of nestedTemplates - to be added to files: on stack:");
+                logger.debug("Contents of nestedTemplates - to be added to files: on stack:");
                 for (HeatTemplate entry : nestedTemplates) {
                     nestedTemplatesChecked.put (entry.getTemplateName(), entry.getTemplateBody());
-                    LOGGER.debug (entry.getTemplateName() + " -> " + entry.getTemplateBody());
+                    logger.debug(entry.getTemplateName() + " -> " + entry.getTemplateBody());
                 }
             } else {
-                LOGGER.debug ("No nested templates found - nothing to do here");
+                logger.debug("No nested templates found - nothing to do here");
                 nestedTemplatesChecked = null;
             }
 
@@ -982,18 +1007,20 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                String propertyString = this.environment.getProperty(MsoVnfAdapterImpl.ADD_GET_FILES_ON_VOLUME_REQ);
                if ("true".equalsIgnoreCase(propertyString) || "y".equalsIgnoreCase(propertyString)) {
                        addGetFilesOnVolumeReq = true;
-                       LOGGER.debug("AddGetFilesOnVolumeReq - setting to true! " + propertyString);
+                  logger.debug("AddGetFilesOnVolumeReq - setting to true! {}", propertyString);
                }
             } catch (Exception e) {
-               LOGGER.debug("An error occured trying to get property " + MsoVnfAdapterImpl.ADD_GET_FILES_ON_VOLUME_REQ + " - default to false", e);
+                logger.debug("An error occured trying to get property " + MsoVnfAdapterImpl.ADD_GET_FILES_ON_VOLUME_REQ
+                    + " - default to false", e);
             }
 
                        if (!isVolumeRequest || addGetFilesOnVolumeReq) {
                                if (oldWay) {
-                                       LOGGER.debug("In MsoVnfAdapterImpl createVfModule, this should not happen - old way is gamma only - no heat files!");
+                                       logger.debug("In MsoVnfAdapterImpl createVfModule, this should not happen - old way is gamma only - no heat "
+              + "files!");
                                } else {
                                        // 1607 - now use VF_MODULE_TO_HEAT_FILES table
-                                       LOGGER.debug("In MsoVnfAdapterImpl createVfModule, about to call db.getHeatFilesForVfModule avec vfModuleId="
+                                       logger.debug("In MsoVnfAdapterImpl createVfModule, about to call db.getHeatFilesForVfModule avec vfModuleId="
                                                        + vf.getModelUUID());
                                        heatFiles = vf.getHeatFiles();
                                }
@@ -1002,17 +1029,16 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                        // here, we will map them to Map<String, Object> from
                                        // Map<String, HeatFiles>
                                        // this will match the nested templates format
-                                       LOGGER.debug("Contents of heatFiles - to be added to files: on stack");
+                                       logger.debug("Contents of heatFiles - to be added to files: on stack");
 
-                                       for(HeatFiles heatfile : heatFiles){
-                                               LOGGER.debug(heatfile.getFileName() + " -> "
-                                                               + heatfile.getFileBody());
-                                               heatFilesObjects.put(heatfile.getFileName(), heatfile.getFileBody());
-                                       }
-                               } else {
-                                       LOGGER.debug("No heat files found -nothing to do here");
-                                       heatFilesObjects = null;
-                               }
+            for (HeatFiles heatfile : heatFiles) {
+                logger.debug(heatfile.getFileName() + " -> " + heatfile.getFileBody());
+                heatFilesObjects.put(heatfile.getFileName(), heatfile.getFileBody());
+            }
+        } else {
+            logger.debug("No heat files found -nothing to do here");
+            heatFilesObjects = null;
+        }
                        }
 
             // Check that required parameters have been supplied
@@ -1029,12 +1055,12 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                 String propertyString = this.environment.getProperty (MsoVnfAdapterImpl.CHECK_REQD_PARAMS);
                 if ("false".equalsIgnoreCase (propertyString) || "n".equalsIgnoreCase (propertyString)) {
                     checkRequiredParameters = false;
-                    LOGGER.debug ("CheckRequiredParameters is FALSE. Will still check but then skip blocking..."
-                                  + MsoVnfAdapterImpl.CHECK_REQD_PARAMS);
+                    logger.debug("CheckRequiredParameters is FALSE. Will still check but then skip blocking..."
+                        + MsoVnfAdapterImpl.CHECK_REQD_PARAMS);
                 }
             } catch (Exception e) {
                 // No problem - default is true
-                LOGGER.debug ("An exception occured trying to get property " + MsoVnfAdapterImpl.CHECK_REQD_PARAMS, e);
+                logger.debug("An exception occured trying to get property {}", MsoVnfAdapterImpl.CHECK_REQD_PARAMS, e);
             }
             // 1604 - Add enhanced environment & parameter checking
             // Part 1: parse envt entries to see if reqd parameter is there (before used a simple grep
@@ -1043,7 +1069,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             MsoHeatEnvironmentEntry mhee = null;
             if (heatEnvironment != null && heatEnvironment.getEnvironment() != null && heatEnvironment.getEnvironment().contains ("parameters:")) {
 
-               LOGGER.debug("Enhanced environment checking enabled - 1604");
+               logger.debug("Enhanced environment checking enabled - 1604");
                 StringBuilder sb = new StringBuilder(heatEnvironment.getEnvironment());
 
                 mhee = new MsoHeatEnvironmentEntry(sb);
@@ -1057,14 +1083,14 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                        sb2.append("\nEnvironment:");
                        sb2.append(mhee.toFullString());
                 }
-                LOGGER.debug(sb2.toString());
+                logger.debug(sb2.toString());
             } else {
-               LOGGER.debug("NO ENVIRONMENT for this entry");
+                logger.debug("NO ENVIRONMENT for this entry");
             }
             // New with 1707 - all variables converted to their native object types
             Map<String, Object> goldenInputs = null;
 
-            LOGGER.debug("Now handle the inputs....first convert");
+            logger.debug("Now handle the inputs....first convert");
             ArrayList<String> parameterNames = new ArrayList<>();
             HashMap<String, String> aliasToParam = new HashMap<>();
             StringBuilder sb = new StringBuilder("\nTemplate Parameters:\n");
@@ -1079,36 +1105,35 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                        }
                        sb.append("\n");
                }
-               LOGGER.debug(sb.toString());
+                logger.debug(sb.toString());
             } catch (Exception e) {
-               LOGGER.debug("??An exception occurred trying to go through Parameter Names " + e.getMessage(),e);
+                logger.debug("??An exception occurred trying to go through Parameter Names {}", e.getMessage(),e);
             }
             // Step 1 - convert what we got as inputs (Map<String, String>) to a
             // Map<String, Object> - where the object matches the param type identified in the template
             // This will also not copy over params that aren't identified in the template
             goldenInputs = heat.convertInputMap(inputs, heatTemplate);
             // Step 2 - now simply add the outputs as we received them - no need to convert to string
-            LOGGER.debug("Now add in the base stack outputs if applicable");
+            logger.debug("Now add in the base stack outputs if applicable");
             heat.copyBaseOutputsToInputs(goldenInputs, baseStackOutputs, parameterNames, aliasToParam);
             // Step 3 - add the volume inputs if any
-            LOGGER.debug("Now add in the volume stack outputs if applicable");
+            logger.debug("Now add in the volume stack outputs if applicable");
             heat.copyBaseOutputsToInputs(goldenInputs, nestedVolumeOutputs, parameterNames, aliasToParam);
 
             for (HeatTemplateParam parm : heatTemplate.getParameters ()) {
-                LOGGER.debug ("Parameter:'" + parm.getParamName ()
-                              + "', isRequired="
-                              + parm.isRequired ()
-                              + ", alias="
-                              + parm.getParamAlias ());
+                logger.debug(
+                    "Parameter:'" + parm.getParamName() + "', isRequired=" + parm.isRequired() + ", alias=" + parm
+                        .getParamAlias());
 
                 if (parm.isRequired () && (goldenInputs == null || !goldenInputs.containsKey (parm.getParamName ()))) {
                        // The check for an alias was moved to the method in MsoHeatUtils - when we converted the Map<String, String> to Map<String, Object>
-                       LOGGER.debug("**Parameter " + parm.getParamName() + " is required and not in the inputs...check environment");
+                       logger.debug("**Parameter " + parm.getParamName() + " is required and not in the inputs...check "
+                      + "environment");
                     if (mhee != null && mhee.containsParameter(parm.getParamName())) {
-                        LOGGER.debug ("Required parameter " + parm.getParamName ()
-                                      + " appears to be in environment - do not count as missing");
+                        logger.debug("Required parameter {} appears to be in environment - do not count as missing",
+                            parm.getParamName());
                     } else {
-                        LOGGER.debug ("adding to missing parameters list: " + parm.getParamName ());
+                        logger.debug("adding to missing parameters list: {}", parm.getParamName());
                         if (missingParams == null) {
                             missingParams = parm.getParamName ();
                         } else {
@@ -1122,14 +1147,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                if (checkRequiredParameters) {
                        // Problem - missing one or more required parameters
                        String error = "Create VFModule: Missing Required inputs: " + missingParams;
-                       LOGGER.error (MessageEnum.RA_MISSING_PARAM, missingParams, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Create VFModule: Missing Required inputs");
-                    LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error);
+                  logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "OpenStack",
+                      MsoLogger.ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
+                  logger.debug(error);
                        throw new VnfException (error, MsoExceptionCategory.USERDATA);
                } else {
-                       LOGGER.debug ("found missing parameters - but checkRequiredParameters is false - will not block");
+                       logger.debug ("found missing parameters - but checkRequiredParameters is false - will not block");
                }
             } else {
-                LOGGER.debug ("No missing parameters found - ok to proceed");
+                logger.debug ("No missing parameters found - ok to proceed");
             }
             // We can now remove the recreating of the ENV with only legit params - that check is done for us,
             // and it causes problems with json that has arrays
@@ -1145,10 +1171,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             // Valet - 1806
             boolean isValetEnabled = this.checkBooleanProperty(MsoVnfAdapterImpl.VALET_ENABLED, false);
             boolean failRequestOnValetFailure = this.checkBooleanProperty(MsoVnfAdapterImpl.FAIL_REQUESTS_ON_VALET_FAILURE, false);
-            LOGGER.debug("isValetEnabled=" + isValetEnabled + ", failRequestsOnValetFailure=" + failRequestOnValetFailure);
+            logger.debug("isValetEnabled={}, failRequestsOnValetFailure={}", isValetEnabled, failRequestOnValetFailure);
             if (oldWay || isVolumeRequest) {
                isValetEnabled = false;
-               LOGGER.debug("do not send to valet for volume requests or brocade");
+                logger.debug("do not send to valet for volume requests or brocade");
             }
             boolean sendResponseToValet = false;
             if (isValetEnabled) {
@@ -1172,7 +1198,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                        backout = true;
                }
                if (heat != null) {
-                       LOGGER.debug("heat is not null!!");
+                  logger.debug("heat is not null!!");
 
                        heatStack = heat.createStack (cloudSiteId,
                                               tenantId,
@@ -1187,39 +1213,40 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                               backout.booleanValue());
                }
                else {
-                       LOGGER.debug("heat is null!");
+                  logger.debug("heat is null!");
                        throw new MsoHeatNotFoundException();
                }
-                LOGGER.recordMetricEvent (createStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_MSG, "OpenStack", "CreateStack", vfModuleName);
             } catch (MsoException me) {
                 me.addContext ("CreateVFModule");
                 String error = "Create VF Module " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me;
-                LOGGER.recordMetricEvent (createStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "CreateStack", vfModuleName);
-                LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "MsoException - createStack", me);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+                logger
+                    .error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
+                        tenantId, "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), "MsoException - createStack",
+                        me);
+                logger.debug(error);
                 if (isValetEnabled && sendResponseToValet) {
-                       LOGGER.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
+                       logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
                        try {
                                GenericValetResponse<ValetRollbackResponse> gvr = this.vci.callValetRollbackRequest(msoRequest.getRequestId(), null, backout, me.getMessage());
                                // Nothing to really do here whether it succeeded or not other than log it.
-                               LOGGER.debug("Return code from Rollback response is " + gvr.getStatusCode());
+                               logger.debug("Return code from Rollback response is {}", gvr.getStatusCode());
                        } catch (Exception e) {
-                               LOGGER.error("Exception encountered while sending Rollback to Valet ", e);
+                               logger.error("Exception encountered while sending Rollback to Valet ", e);
                        }
                 }
                 throw new VnfException (me);
             } catch (NullPointerException npe) {
                 String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + npe;
-                LOGGER.recordMetricEvent (createStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "CreateStack", vfModuleName);
-                LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "NullPointerException - createStack", npe);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
-                LOGGER.debug("NULL POINTER EXCEPTION at heat.createStack");
+                logger
+                    .error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
+                        tenantId, "OpenStack", MsoLogger.ErrorCode.DataError.getValue(),
+                        "NullPointerException - createStack", npe);
+                logger.debug(error);
+                logger.debug("NULL POINTER EXCEPTION at heat.createStack");
                 //npe.addContext ("CreateVNF");
                 throw new VnfException ("NullPointerException during heat.createStack");
             } catch (Exception e) {
-                LOGGER.recordMetricEvent (createStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while creating stack with OpenStack", "OpenStack", "CreateStack", vfModuleName);
-                LOGGER.debug("unhandled exception at heat.createStack",e);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while creating stack with OpenStack");
+                logger.debug("unhandled exception at heat.createStack",e);
                throw new VnfException("Exception during heat.createStack! " + e.getMessage());
             }
             // Reach this point if createStack is successful.
@@ -1231,20 +1258,19 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             outputs.value = copyStringOutputs (heatStack.getOutputs ());
             rollback.value = vfRollback;
             if (isValetEnabled && sendResponseToValet) {
-               LOGGER.debug("valet is enabled, the orchestration succeeded - now send confirm to valet with stack id");
+               logger.debug("valet is enabled, the orchestration succeeded - now send confirm to valet with stack id");
                try {
                     GenericValetResponse<ValetConfirmResponse> gvr = this.vci.callValetConfirmRequest(msoRequest.getRequestId(), heatStack.getCanonicalName());
                     // Nothing to really do here whether it succeeded or not other than log it.
-                    LOGGER.debug("Return code from Confirm response is " + gvr.getStatusCode());
+                    logger.debug("Return code from Confirm response is {}", gvr.getStatusCode());
                 } catch (Exception e) {
-                    LOGGER.error("Exception encountered while sending Confirm to Valet ", e);
+                    logger.error("Exception encountered while sending Confirm to Valet ", e);
                 }
             }
-            LOGGER.debug ("VF Module " + vfModuleName + " successfully created");
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create VF Module");
+            logger.debug("VF Module {} successfully created", vfModuleName);
             return;
         } catch (Exception e) {
-               LOGGER.debug("unhandled exception in create VF",e);
+               logger.debug("unhandled exception in create VF",e);
                throw new VnfException("Exception during create VF " + e.getMessage());
         }
     }
@@ -1255,9 +1281,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                            String vnfName,
                            MsoRequest msoRequest,
                            Holder <Map <String, String>> outputs) throws VnfException {
-        MsoLogger.setLogContext (msoRequest);
-       MsoLogger.setServiceName ("DeleteVf");
-        LOGGER.debug ("Deleting VF " + vnfName + " in " + cloudSiteId + "/" + tenantId);
+
+        logger.debug("Deleting VF {} in ", vnfName, cloudSiteId + "/" + tenantId);
         // Will capture execution time for metrics
         long startTime = System.currentTimeMillis ();
 
@@ -1271,9 +1296,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             // Convert to a generic VnfException
             me.addContext ("DeleteVFModule");
             String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
-            LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null);
-            LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, "Exception - QueryStack", me);
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+            logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId,
+                tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), "Exception - QueryStack",
+                me);
+            logger.debug(error);
             throw new VnfException (me);
         }
         // call method which handles the conversion from Map<String,Object> to Map<String,String> for our expected Object types
@@ -1281,7 +1307,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
 
         boolean isValetEnabled = this.checkBooleanProperty(MsoVnfAdapterImpl.VALET_ENABLED, false);
         boolean failRequestOnValetFailure = this.checkBooleanProperty(MsoVnfAdapterImpl.FAIL_REQUESTS_ON_VALET_FAILURE, false);
-        LOGGER.debug("isValetEnabled=" + isValetEnabled + ", failRequestsOnValetFailure=" + failRequestOnValetFailure);
+        logger.debug("isValetEnabled={}, failRequestsOnValetFailure={}", isValetEnabled, failRequestOnValetFailure);
         boolean valetDeleteRequestSucceeded = false;
         if (isValetEnabled) {
                valetDeleteRequestSucceeded = this.valetDeleteRequest(cloudSiteId, tenantId, vnfName, msoRequest, failRequestOnValetFailure);
@@ -1294,41 +1320,40 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         long subStartTime = System.currentTimeMillis ();
         try {
             heat.deleteStack (tenantId, cloudSiteId, vnfName, true);
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, SUCCESS_MSG, "OpenStack", "DeleteStack", vnfName);
         } catch (MsoException me) {
             me.addContext ("DeleteVNF");
             // Failed to query the Stack due to an openstack exception.
             // Convert to a generic VnfException
             String error = "Delete VF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "DeleteStack", vnfName);
-            LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vnfName, cloudSiteId, tenantId, "OpenStack", "DeleteStack", MsoLogger.ErrorCode.DataError, "Exception - deleteStack", me);
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+            logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudSiteId,
+                tenantId, "OpenStack", "DeleteStack", MsoLogger.ErrorCode.DataError.getValue(),
+                "Exception - deleteStack", me);
+            logger.debug(error);
             if (isValetEnabled && valetDeleteRequestSucceeded) {
-               LOGGER.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
+               logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
                try {
                        GenericValetResponse<ValetRollbackResponse> gvr = this.vci.callValetRollbackRequest(msoRequest.getRequestId(), vnfName, false, me.getMessage());
                        // Nothing to really do here whether it succeeded or not other than log it.
-                       LOGGER.debug("Return code from Rollback response is " + gvr.getStatusCode());
+                       logger.debug("Return code from Rollback response is {}", gvr.getStatusCode());
                } catch (Exception e) {
-                       LOGGER.error("Exception encountered while sending Rollback to Valet ", e);
+                       logger.error("Exception encountered while sending Rollback to Valet ", e);
                }
             }
             throw new VnfException (me);
         }
         if (isValetEnabled && valetDeleteRequestSucceeded) {
                // only if the original request succeeded do we send a confirm
-               LOGGER.debug("valet is enabled, the delete succeeded - now send confirm to valet");
+               logger.debug("valet is enabled, the delete succeeded - now send confirm to valet");
                try {
                 GenericValetResponse<ValetConfirmResponse> gvr = this.vci.callValetConfirmRequest(msoRequest.getRequestId(), vnfName);
                 // Nothing to really do here whether it succeeded or not other than log it.
-                LOGGER.debug("Return code from Confirm response is " + gvr.getStatusCode());
+              logger.debug("Return code from Confirm response is {}", gvr.getStatusCode());
             } catch (Exception e) {
-                LOGGER.error("Exception encountered while sending Confirm to Valet ", e);
+              logger.error("Exception encountered while sending Confirm to Valet ", e);
             }
         }
 
         // On success, nothing is returned.
-        LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully delete VF");
         return;
     }
 
@@ -1366,17 +1391,18 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
        sbInit.append("baseVfHeatStackId=" + baseVfHeatStackId + "\n");
        sbInit.append("vfModuleStackId=" + vfModuleStackId + "\n");
        sbInit.append("modelCustomizationUuid=" + modelCustomizationUuid + "\n");
-       LOGGER.debug(sbInit.toString());
+      logger.debug(sbInit.toString());
 
         String mcu = modelCustomizationUuid;
         boolean useMCUuid = false;
         if (mcu != null && !mcu.isEmpty()) {
             if ("null".equalsIgnoreCase(mcu)) {
-                LOGGER.debug("modelCustomizationUuid: passed in as the string 'null' - will ignore: " + modelCustomizationUuid);
+                logger.debug("modelCustomizationUuid: passed in as the string 'null' - will ignore: {}",
+                    modelCustomizationUuid);
                 useMCUuid = false;
                 mcu = "";
             } else {
-                LOGGER.debug("Found modelCustomizationUuid! Will use that: " + mcu);
+                logger.debug("Found modelCustomizationUuid! Will use that: {}", mcu);
                 useMCUuid = true;
             }
         }
@@ -1398,7 +1424,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         if (inputs == null) {
                // Create an empty set of inputs
                inputs = new HashMap<>();
-               LOGGER.debug("inputs == null - setting to empty");
+            logger.debug("inputs == null - setting to empty");
         }
 
         boolean isBaseRequest = false;
@@ -1410,8 +1436,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                vfModuleName = this.getVfModuleNameFromModuleStackId(vfModuleStackId);
         }
 
-        LOGGER.debug ("Updating VFModule: " + vfModuleName + " of type " + vfModuleType + "in " + cloudSiteId + "/" + tenantId);
-        LOGGER.debug("requestTypeString = " + requestTypeString + ", nestedVolumeStackId = " + nestedStackId + ", nestedBaseStackId = " + nestedBaseStackId);
+        logger.debug ("Updating VFModule: " + vfModuleName + " of type " + vfModuleType + "in " + cloudSiteId + "/" + tenantId);
+        logger.debug("requestTypeString = " + requestTypeString + ", nestedVolumeStackId = " + nestedStackId + ", nestedBaseStackId = " + nestedBaseStackId);
 
         // Will capture execution time for metrics
         long startTime = System.currentTimeMillis ();
@@ -1430,18 +1456,18 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
 
         StackInfo heatStack = null;
         long queryStackStarttime = System.currentTimeMillis ();
-        LOGGER.debug("UpdateVfModule - querying for " + vfModuleName);
+        logger.debug("UpdateVfModule - querying for {}", vfModuleName);
         try {
             heatStack = heat.queryStack (cloudSiteId, tenantId, vfModuleName);
-            LOGGER.recordMetricEvent (queryStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully receive response from Open Stack", "OpenStack", "QueryStack", null);
         } catch (MsoException me) {
             // Failed to query the Stack due to an openstack exception.
             // Convert to a generic VnfException
             me.addContext ("UpdateVFModule");
             String error = "Update VFModule: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
-            LOGGER.recordMetricEvent (queryStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null);
-            LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, "Exception - QueryStack", me);
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+            logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
+                tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), "Exception - QueryStack",
+                me);
+            logger.debug(error);
             throw new VnfException (me);
         }
 
@@ -1449,11 +1475,11 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         if (heatStack == null || heatStack.getStatus () == HeatStatus.NOTFOUND) {
             // Not Found
             String error = "Update VF: Stack " + vfModuleName + " does not exist in " + cloudSiteId + "/" + tenantId;
-            LOGGER.error (MessageEnum.RA_VNF_NOT_EXIST, vfModuleName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, error);
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+            logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_NOT_EXIST.toString(), vfModuleName, cloudSiteId,
+                tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), error);
             throw new VnfNotFound (cloudSiteId, tenantId, vfModuleName);
         } else {
-            LOGGER.debug ("Found Existing stack, status=" + heatStack.getStatus ());
+            logger.debug("Found Existing stack, status={}", heatStack.getStatus());
             // Populate the outputs from the existing stack.
             outputs.value = copyStringOutputs (heatStack.getOutputs ());
             rollback.value = vfRollback; // Default rollback - no updates performed
@@ -1465,29 +1491,28 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         Map<String, Object> nestedVolumeOutputs = null;
         if (nestedStackId != null) {
                try {
-                       LOGGER.debug("Querying for nestedStackId = " + nestedStackId);
+                       logger.debug("Querying for nestedStackId = {}", nestedStackId);
                        nestedHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedStackId);
-                LOGGER.recordMetricEvent (queryStackStarttime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully receive response from Open Stack", "OpenStack", "QueryStack", null);
                } catch (MsoException me) {
                    // Failed to query the Stack due to an openstack exception.
                    // Convert to a generic VnfException
                    me.addContext ("UpdateVFModule");
                    String error = "Update VF: Attached heatStack ID Query " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
-                LOGGER.recordMetricEvent (queryStackStarttime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null);
-                   LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, "Exception - " + error, me);
-                       LOGGER.debug("ERROR trying to query nested stack= " + error);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
-                   throw new VnfException (me);
+              logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId,
+                  tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), "Exception - " + error,
+                  me);
+              logger.debug("ERROR trying to query nested stack= {}", error);
+              throw new VnfException (me);
                }
                if (nestedHeatStack == null || nestedHeatStack.getStatus() == HeatStatus.NOTFOUND) {
                        MsoLogger.setServiceName (serviceName);
                    String error = "Update VFModule: Attached volume heatStack ID DOES NOT EXIST " + nestedStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR"  ;
-                   LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, error);
-                   LOGGER.debug(error);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+              logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId,
+                  tenantId, error, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+              logger.debug(error);
                    throw new VnfException (error, MsoExceptionCategory.USERDATA);
                } else {
-                       LOGGER.debug("Found nested heat stack - copying values to inputs *later*");
+                       logger.debug("Found nested heat stack - copying values to inputs *later*");
                        nestedVolumeOutputs = nestedHeatStack.getOutputs();
                        heat.copyStringOutputsToInputs(inputs, nestedHeatStack.getOutputs(), false);
                }
@@ -1498,29 +1523,30 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         if (nestedBaseStackId != null) {
             long queryStackStarttime3 = System.currentTimeMillis ();
                try {
-                       LOGGER.debug("Querying for nestedBaseStackId = " + nestedBaseStackId);
+                       logger.debug("Querying for nestedBaseStackId = {}", nestedBaseStackId);
                        nestedBaseHeatStack = heat.queryStack(cloudSiteId, tenantId, nestedBaseStackId);
-                LOGGER.recordMetricEvent (queryStackStarttime3, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully receive response from Open Stack", "OpenStack", "QueryStack", null);
                } catch (MsoException me) {
                    // Failed to query the Stack due to an openstack exception.
                    // Convert to a generic VnfException
                    me.addContext ("UpdateVfModule");
                    String error = "Update VFModule: Attached baseHeatStack ID Query " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
-                LOGGER.recordMetricEvent (queryStackStarttime3, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "QueryStack", null);
-                   LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, "Exception - " + error, me);
-                       LOGGER.debug("ERROR trying to query nested base stack= " + error);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+              logger
+                  .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
+                      tenantId, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError.getValue(),
+                      "Exception - " + error, me);
+              logger.debug("ERROR trying to query nested base stack= {}", error);
                    throw new VnfException (me);
                }
                if (nestedBaseHeatStack == null || nestedBaseHeatStack.getStatus() == HeatStatus.NOTFOUND) {
                        MsoLogger.setServiceName (serviceName);
                    String error = "Update VFModule: Attached base heatStack ID DOES NOT EXIST " + nestedBaseStackId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR"  ;
-                   LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, error, "OpenStack", "QueryStack", MsoLogger.ErrorCode.DataError, error);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
-                   LOGGER.debug(error);
+                   logger.error ("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
+                  cloudSiteId, tenantId, error, "OpenStack",
+                  "QueryStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+                   logger.debug(error);
                    throw new VnfException (error, MsoExceptionCategory.USERDATA);
                } else {
-                       LOGGER.debug("Found nested base heat stack - copying values to inputs *later*");
+                       logger.debug("Found nested base heat stack - copying values to inputs *later*");
                        baseStackOutputs = nestedBaseHeatStack.getOutputs();
                        heat.copyStringOutputsToInputs(inputs, nestedBaseHeatStack.getOutputs(), false);
                }
@@ -1538,25 +1564,25 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                        vfmc = vfModuleCustomRepo.findByModelCustomizationUUID(modelCustomizationUuid);
                        vf = vfmc != null ? vfmc.getVfModule() : null;
                 if (vf == null) {
-                    LOGGER.debug("Unable to find a vfModule matching modelCustomizationUuid=" + mcu);
+                    logger.debug("Unable to find a vfModule matching modelCustomizationUuid={}", mcu);
                 }
                } else {
-                       LOGGER.debug("1707 and later - MUST PROVIDE Model Customization UUID!");
+                       logger.debug("1707 and later - MUST PROVIDE Model Customization UUID!");
             }
                if (vf == null) {
-               String error = "Update VfModule: unable to find vfModule with modelCustomizationUuid=" + mcu;
-                LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "VF Module Type", vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataError, error);
-                throw new VnfException (error, MsoExceptionCategory.USERDATA);
+                  String error = "Update VfModule: unable to find vfModule with modelCustomizationUuid=" + mcu;
+                  logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module Type",
+                      vfModuleType, "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+                  throw new VnfException(error, MsoExceptionCategory.USERDATA);
             }
-            LOGGER.debug ("Got VF module definition from Catalog: " + vf.toString ());
+            logger.debug("Got VF module definition from Catalog: {}", vf.toString());
             if (vf.getIsBase()) {
                isBaseRequest = true;
-               LOGGER.debug("This a BASE update request");
+               logger.debug("This a BASE update request");
             } else {
-               LOGGER.debug("This is *not* a BASE VF update request");
+               logger.debug("This is *not* a BASE VF update request");
                if (!isVolumeRequest && nestedBaseStackId == null) {
-                       LOGGER.debug("DANGER WILL ROBINSON! This is unexpected - no nestedBaseStackId with this non-base request");
+                       logger.debug("DANGER WILL ROBINSON! This is unexpected - no nestedBaseStackId with this non-base request");
                }
             }
 
@@ -1568,7 +1594,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
 
                vnfResource = vf.getVnfResources();
                if (vnfResource == null) {
-                       LOGGER.debug("Unable to find vnfResource at " + vnfResourceModelUuid + " will not error for now...");
+                       logger.debug("Unable to find vnfResource at ? will not error for now...", vnfResourceModelUuid);
                }
             }
 
@@ -1579,7 +1605,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                        minVersionVnf = vnfResource.getAicVersionMin();
                        maxVersionVnf = vnfResource.getAicVersionMax();
                } catch (Exception e) {
-                       LOGGER.debug("Unable to pull min/max version for this VNF Resource entry",e);
+                       logger.debug("Unable to pull min/max version for this VNF Resource entry",e);
                        minVersionVnf = null;
                        maxVersionVnf = null;
                        }
@@ -1609,36 +1635,36 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                                moreThanMax = aicV.isMoreRecentThan(maxVersionVnf);
                                                equalToMax = aicV.isTheSameVersion(maxVersionVnf);
                                        } catch (Exception e) {
-                                               LOGGER.debug("An exception occured while trying to test AIC Version " + e.getMessage()
-                                                               + " - will default to not check", e);
-                                               doNotTest = true;
+              logger.debug("An exception occured while trying to test AIC Version {} - will default to not check",
+                  e.getMessage(), e);
+              doNotTest = true;
                                        }
                                        if (!doNotTest) {
                                                if ((moreThanMin || equalToMin) // aic >= min
                                                                && ((equalToMax) || !(moreThanMax))) { // aic <= max
-                                                       LOGGER.debug("VNF Resource " + vnfResource.getModelName() + " VersionMin=" + minVersionVnf
-                                                                       + " VersionMax:" + maxVersionVnf + " supported on Cloud: " + cloudSiteId
-                                                                       + " with AIC_Version:" + aicV);
-                                               } else {
+                logger.debug(
+                    "VNF Resource " + vnfResource.getModelName() + " VersionMin=" + minVersionVnf + " VersionMax:"
+                        + maxVersionVnf + " supported on Cloud: " + cloudSiteId + " with AIC_Version:" + aicV);
+            } else {
                                                        // ERROR
                                                        String error = "VNF Resource type: " + vnfResource.getModelName() + " VersionMin="
                                                                        + minVersionVnf + " VersionMax:" + maxVersionVnf + " NOT supported on Cloud: "
                                                                        + cloudSiteId + " with AIC_Version:" + aicV;
-                                                       LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "",
-                                                                       MsoLogger.ErrorCode.BusinessProcesssError, "Exception - setVersion");
-                                                       LOGGER.debug(error);
+                logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
+                    MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
+                logger.debug(error);
                                                        throw new VnfException(error, MsoExceptionCategory.USERDATA);
                                                }
                                        } else {
-                                               LOGGER.debug("bypassing testing AIC version...");
+                                               logger.debug("bypassing testing AIC version...");
                                        }
                                } // let this error out downstream to avoid introducing uncertainty at this stage
                 } else {
-                                       LOGGER.debug("cloudConfig is NULL - cannot check cloud site version");
+                                       logger.debug("cloudConfig is NULL - cannot check cloud site version");
                 }
 
                        } else {
-                               LOGGER.debug("AIC Version not set in VNF_Resource - do not error for now - not checked.");
+                               logger.debug("AIC Version not set in VNF_Resource - do not error for now - not checked.");
             }
                        // End Version check 1607
 
@@ -1654,45 +1680,46 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
 
                        if (heatTemplate == null) {
                                String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestTypeString;
-                               LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
-                               throw new VnfException(error, MsoExceptionCategory.INTERNAL);
+          logger
+              .error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", vfModuleType,
+                  "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+          throw new VnfException(error, MsoExceptionCategory.INTERNAL);
                        } else {
-                               LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate());
-                       }
+          logger.debug("Got HEAT Template from DB: {}", heatTemplate.getHeatTemplate());
+      }
 
             if (heatEnvironment == null) {
                String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
-                    LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error);
-                    LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+                logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
+                    "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error);
                     throw new VnfException (error, MsoExceptionCategory.INTERNAL);
             } else {
-                LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment());
+                logger.debug ("Got Heat Environment from DB: {}", heatEnvironment.getEnvironment());
             }
 
-            LOGGER.debug ("In MsoVnfAdapterImpl, about to call db.getNestedTemplates avec templateId="
-                          + heatTemplate.getArtifactUuid ());
+        logger.debug("In MsoVnfAdapterImpl, about to call db.getNestedTemplates avec templateId={}",
+            heatTemplate.getArtifactUuid());
 
 
             List<HeatTemplate> nestedTemplates = heatTemplate.getChildTemplates();
             Map <String, Object> nestedTemplatesChecked = new HashMap <> ();
             if (nestedTemplates != null && !nestedTemplates.isEmpty()) {
                 // for debugging print them out
-                LOGGER.debug ("Contents of nestedTemplates - to be added to files: on stack:");
+                logger.debug("Contents of nestedTemplates - to be added to files: on stack:");
                 for (HeatTemplate entry : nestedTemplates) {
 
                     nestedTemplatesChecked.put (entry.getTemplateName(), entry.getTemplateBody());
-                    LOGGER.debug (entry.getTemplateName() + " -> " + entry.getTemplateBody());
+                    logger.debug(entry.getTemplateName() + " -> " + entry.getTemplateBody());
                 }
             } else {
-                LOGGER.debug ("No nested templates found - nothing to do here");
+                logger.debug("No nested templates found - nothing to do here");
                 nestedTemplatesChecked = null;
             }
 
             // Also add the files: for any get_files associated with this VfModule
             // *if* there are any
-            LOGGER.debug ("In MsoVnfAdapterImpl.updateVfModule, about to call db.getHeatFiles avec vfModuleId="
-                          + vf.getModelUUID());
+            logger.debug("In MsoVnfAdapterImpl.updateVfModule, about to call db.getHeatFiles avec vfModuleId={}",
+            vf.getModelUUID());
 
             List<HeatFiles> heatFiles = null;
             Map <String, Object> heatFilesObjects = new HashMap <> ();
@@ -1703,28 +1730,28 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                String propertyString = this.environment.getProperty(MsoVnfAdapterImpl.ADD_GET_FILES_ON_VOLUME_REQ);
                if ("true".equalsIgnoreCase(propertyString) || "y".equalsIgnoreCase(propertyString)) {
                        addGetFilesOnVolumeReq = true;
-                       LOGGER.debug("AddGetFilesOnVolumeReq - setting to true! " + propertyString);
+                       logger.debug("AddGetFilesOnVolumeReq - setting to true! {}", propertyString);
                }
             } catch (Exception e) {
-               LOGGER.debug("An error occured trying to get property " + MsoVnfAdapterImpl.ADD_GET_FILES_ON_VOLUME_REQ + " - default to false", e);
+                logger.debug("An error occured trying to get property {} - default to false",
+                    MsoVnfAdapterImpl.ADD_GET_FILES_ON_VOLUME_REQ, e);
             }
             if (!isVolumeRequest || addGetFilesOnVolumeReq) {
-               LOGGER.debug("In MsoVnfAdapterImpl updateVfModule, about to call db.getHeatFilesForVfModule avec vfModuleId="
-                                               + vf.getModelUUID());
+            logger.debug("In MsoVnfAdapterImpl updateVfModule, about to call db.getHeatFilesForVfModule avec "
+                + "vfModuleId={}", vf.getModelUUID());
 
                heatFiles = vf.getHeatFiles();
                 if (heatFiles != null && !heatFiles.isEmpty()) {
                     // add these to stack - to be done in createStack
                     // here, we will map them to Map<String, Object> from Map<String, HeatFiles>
                     // this will match the nested templates format
-                    LOGGER.debug ("Contents of heatFiles - to be added to files: on stack:");
-                                       for(HeatFiles heatfile : heatFiles){
-                                               LOGGER.debug(heatfile.getFileName() + " -> "
-                                                               + heatfile.getFileBody());
-                                               heatFilesObjects.put(heatfile.getFileName(), heatfile.getFileBody());
-                                       }
+                    logger.debug("Contents of heatFiles - to be added to files: on stack:");
+                    for (HeatFiles heatfile : heatFiles) {
+                        logger.debug(heatfile.getFileName() + " -> " + heatfile.getFileBody());
+                        heatFilesObjects.put(heatfile.getFileName(), heatfile.getFileBody());
+                    }
                 } else {
-                    LOGGER.debug ("No heat files found -nothing to do here");
+                    logger.debug("No heat files found -nothing to do here");
                     heatFilesObjects = null;
                 }
             }
@@ -1743,12 +1770,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                 String propertyString = this.environment.getProperty (MsoVnfAdapterImpl.CHECK_REQD_PARAMS);
                 if ("false".equalsIgnoreCase (propertyString) || "n".equalsIgnoreCase (propertyString)) {
                     checkRequiredParameters = false;
-                    LOGGER.debug ("CheckRequiredParameters is FALSE. Will still check but then skip blocking..."
-                                  + MsoVnfAdapterImpl.CHECK_REQD_PARAMS);
+                    logger.debug("CheckRequiredParameters is FALSE. Will still check but then skip blocking...",
+                        MsoVnfAdapterImpl.CHECK_REQD_PARAMS);
                 }
             } catch (Exception e) {
                 // No problem - default is true
-                LOGGER.debug ("An exception occured trying to get property " + MsoVnfAdapterImpl.CHECK_REQD_PARAMS, e);
+                logger.debug ("An exception occured trying to get property {}", MsoVnfAdapterImpl.CHECK_REQD_PARAMS,
+                    e);
             }
          // 1604 - Add enhanced environment & parameter checking
             // Part 1: parse envt entries to see if reqd parameter is there (before used a simple grep
@@ -1756,7 +1784,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
             // Note this also removes any comments
             MsoHeatEnvironmentEntry mhee = null;
             if (heatEnvironment != null && heatEnvironment.getEnvironment().toLowerCase ().contains ("parameters:")) {
-               LOGGER.debug("Enhanced environment checking enabled - 1604");
+               logger.debug("Enhanced environment checking enabled - 1604");
                 StringBuilder sb = new StringBuilder(heatEnvironment.getEnvironment());
                 mhee = new MsoHeatEnvironmentEntry(sb);
                 StringBuilder sb2 = new StringBuilder("\nHeat Template Parameters:\n");
@@ -1769,16 +1797,16 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                        sb2.append("\nEnvironment:");
                        sb2.append(mhee.toFullString());
                 }
-                LOGGER.debug(sb2.toString());
+                logger.debug(sb2.toString());
             } else {
-               LOGGER.debug("NO ENVIRONMENT for this entry");
+               logger.debug("NO ENVIRONMENT for this entry");
             }
             // New for 1607 - support params of json type
             HashMap<String, JsonNode> jsonParams = new HashMap<>();
             boolean hasJson = false;
 
             for (HeatTemplateParam parm : heatTemplate.getParameters ()) {
-                LOGGER.debug ("Parameter:'" + parm.getParamName ()
+                logger.debug ("Parameter:'" + parm.getParamName ()
                               + "', isRequired="
                               + parm.isRequired ()
                               + ", alias="
@@ -1800,15 +1828,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                        //TODO - what to do here?
                                        //for now - send the error to debug, but just leave it as a String
                                        String errorMessage = jpe.getMessage();
-                                       LOGGER.debug("Json Error Converting " + parm.getParamName() + " - " + errorMessage,jpe);
+                                       logger.debug("Json Error Converting " + parm.getParamName() + " - " + errorMessage,jpe);
                                        hasJson = false;
                                        jsonNode = null;
                                } catch (Exception e) {
-                                       // or here?
-                                       LOGGER.debug("Json Error Converting " + parm.getParamName() + " " + e.getMessage(),e);
-                                       hasJson = false;
-                                       jsonNode = null;
-                               }
+                        // or here?
+                        logger.debug("Json Error Converting " + parm.getParamName() + " " + e.getMessage(), e);
+                        hasJson = false;
+                        jsonNode = null;
+                    }
                                if (jsonNode != null) {
                                        jsonParams.put(parm.getParamName(), jsonNode);
                                }
@@ -1822,15 +1850,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                        //TODO - what to do here?
                                        //for now - send the error to debug, but just leave it as a String
                                        String errorMessage = jpe.getMessage();
-                                       LOGGER.debug("Json Error Converting " + parm.getParamName() + " - " + errorMessage,jpe);
+                                       logger.debug("Json Error Converting " + parm.getParamName() + " - " + errorMessage,jpe);
                                        hasJson = false;
                                        jsonNode = null;
                                } catch (Exception e) {
-                                       // or here?
-                                       LOGGER.debug("Json Error Converting " + parm.getParamName() + " " + e.getMessage(),e);
-                                       hasJson = false;
-                                       jsonNode = null;
-                               }
+                          // or here?
+                          logger.debug("Json Error Converting " + parm.getParamName() + " " + e.getMessage(), e);
+                          hasJson = false;
+                          jsonNode = null;
+                      }
                                if (jsonNode != null) {
                                        // Notice here - we add it to the jsonParams hashMap with the actual name -
                                        // then manipulate the inputs so when we check for aliases below - it will not
@@ -1848,23 +1876,23 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                         String realParamName = parm.getParamName ();
                         String alias = parm.getParamAlias ();
                         Object value = inputs.get (alias);
-                        LOGGER.debug ("*Found an Alias: paramName=" + realParamName
+                        logger.debug ("*Found an Alias: paramName=" + realParamName
                                       + ",alias="
                                       + alias
                                       + ",value="
                                       + value);
                         inputs.remove (alias);
                         inputs.put (realParamName, value);
-                        LOGGER.debug (alias + " entry removed from inputs, added back using " + realParamName);
+                        logger.debug ("{} entry removed from inputs, added back using {}", alias, realParamName);
                     }
                     // enhanced - check if it's in the Environment (note: that method
                     else if (mhee != null && mhee.containsParameter(parm.getParamName())) {
 
-                        LOGGER.debug ("Required parameter " + parm.getParamName ()
-                                      + " appears to be in environment - do not count as missing");
+                        logger.debug("Required parameter {} appears to be in environment - do not count as missing",
+                            parm.getParamName());
                     }
                     else {
-                        LOGGER.debug ("adding to missing parameters list: " + parm.getParamName ());
+                        logger.debug("adding to missing parameters list: {}", parm.getParamName());
                         if (missingParams == null) {
                             missingParams = parm.getParamName ();
                         } else {
@@ -1880,14 +1908,14 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                 // Problem - missing one or more required parameters
                if (checkRequiredParameters) {
                 String error = "Update VNF: Missing Required inputs: " + missingParams;
-                LOGGER.error (MessageEnum.RA_MISSING_PARAM, missingParams, "OpenStack", "", MsoLogger.ErrorCode.DataError, error);
-                    LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error);
+                  logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "OpenStack",
+                      MsoLogger.ErrorCode.DataError.getValue(), error);
                 throw new VnfException (error, MsoExceptionCategory.USERDATA);
                } else {
-                       LOGGER.debug ("found missing parameters - but checkRequiredParameters is false - will not block");
-               }
+                  logger.debug("found missing parameters - but checkRequiredParameters is false - will not block");
+              }
             } else {
-                LOGGER.debug ("No missing parameters found - ok to proceed");
+                logger.debug("No missing parameters found - ok to proceed");
             }
 
             // Just submit the envt entry as received from the database
@@ -1902,7 +1930,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                 // This is not a valid parameter for this template
                 extraParams.removeAll (paramList);
                 if (!extraParams.isEmpty ()) {
-                       LOGGER.warn (MessageEnum.RA_VNF_EXTRA_PARAM, vnfType, extraParams.toString(), "OpenStack", "", MsoLogger.ErrorCode.DataError, "Extra params");
+                    logger.warn("{} {} {} {} {} {}", MessageEnum.RA_VNF_EXTRA_PARAM.toString(), vnfType,
+                        extraParams.toString(), "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), "Extra params");
                     inputs.keySet ().removeAll (extraParams);
                 }
             }
@@ -1929,10 +1958,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
 
             boolean isValetEnabled = this.checkBooleanProperty(MsoVnfAdapterImpl.VALET_ENABLED, false);
             boolean failRequestOnValetFailure = this.checkBooleanProperty(MsoVnfAdapterImpl.FAIL_REQUESTS_ON_VALET_FAILURE, false);
-            LOGGER.debug("isValetEnabled=" + isValetEnabled + ", failRequestsOnValetFailure=" + failRequestOnValetFailure);
+            logger.debug("isValetEnabled={}, failRequestsOnValetFailure={}", isValetEnabled, failRequestOnValetFailure);
             if (isVolumeRequest) {
                isValetEnabled = false;
-               LOGGER.debug("never send a volume request to valet");
+               logger.debug("never send a volume request to valet");
             }
             boolean sendResponseToValet = false;
             if (isValetEnabled) {
@@ -1968,21 +1997,20 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                        nestedTemplatesChecked,
                                        heatFilesObjects
                                );
-                               LOGGER.recordMetricEvent (updateStackStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully receive response from Open Stack", "OpenStack", "UpdateStack", null);
             } catch (MsoException me) {
                 me.addContext ("UpdateVFModule");
                 String error = "Update VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me;
-                LOGGER.recordMetricEvent (updateStackStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "OpenStack", "UpdateStack", null);
-                LOGGER.error (MessageEnum.RA_UPDATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, "OpenStack", "", MsoLogger.ErrorCode.DataError, "Exception - " + error, me);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+                logger
+                    .error("{} {} {} {} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
+                        tenantId, "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), "Exception - " + error, me);
                 if (isValetEnabled && sendResponseToValet) {
-                       LOGGER.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
+                       logger.debug("valet is enabled, the orchestration failed - now sending rollback to valet");
                        try {
                                GenericValetResponse<ValetRollbackResponse> gvr = this.vci.callValetRollbackRequest(msoRequest.getRequestId(), null, false, me.getMessage());
                                // Nothing to really do here whether it succeeded or not other than log it.
-                               LOGGER.debug("Return code from Rollback response is " + gvr.getStatusCode());
+                               logger.debug("Return code from Rollback response is {}", gvr.getStatusCode());
                        } catch (Exception e) {
-                               LOGGER.error("Exception encountered while sending Rollback to Valet ", e);
+                               logger.error("Exception encountered while sending Rollback to Valet ", e);
                        }
                 }
                 throw new VnfException (me);
@@ -1995,19 +2023,18 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
         vfRollback.setVnfCreated (true);
 
         if (isValetEnabled && sendResponseToValet) {
-               LOGGER.debug("valet is enabled, the update succeeded - now send confirm to valet with stack id");
+               logger.debug("valet is enabled, the update succeeded - now send confirm to valet with stack id");
                try {
                 GenericValetResponse<ValetConfirmResponse> gvr = this.vci.callValetConfirmRequest(msoRequest.getRequestId(), heatStack.getCanonicalName());
                 // Nothing to really do here whether it succeeded or not other than log it.
-                LOGGER.debug("Return code from Confirm response is " + gvr.getStatusCode());
+                logger.debug("Return code from Confirm response is {}", gvr.getStatusCode());
             } catch (Exception e) {
-                LOGGER.error("Exception encountered while sending Confirm to Valet ", e);
+                logger.error("Exception encountered while sending Confirm to Valet ", e);
             }
         }
 
         outputs.value = copyStringOutputs (heatStack.getOutputs ());
         rollback.value = vfRollback;
-        LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully update VF Module");
         return;
     }
 
@@ -2023,7 +2050,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
        try {
                vfModuleName = vfModuleStackId.substring(0, index);
        } catch (Exception e) {
-               LOGGER.debug("Exception", e);
+               logger.debug("Exception", e);
                vfModuleName = null;
        }
        return vfModuleName;
@@ -2042,8 +2069,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                        property = false;
                }
        } catch (Exception e) {
-               LOGGER.debug ("An exception occured trying to get property " + propertyName + " - defaulting to " + defaultValue, e);
-               property = defaultValue;
+          logger.debug("An exception occured trying to get property {} - defaulting to ", propertyName, defaultValue, e);
+          property = defaultValue;
        }
        return property;
     }
@@ -2107,13 +2134,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                                Map<String, Object> newInputs = vcr.getParameters();
                                                if (newInputs != null) {
                                                        Map<String, Object> oldGold = goldenInputs;
-                                                       LOGGER.debug("parameters before being modified by valet:" + oldGold.toString());
+                                                       logger.debug("parameters before being modified by valet:{}", oldGold.toString());
                                                        goldenInputs = new HashMap<String, Object>();
                                                        for (String key : newInputs.keySet()) {
                                                                goldenInputs.put(key, newInputs.get(key));
                                                        }
                                                        valetModifiedParamsHolder.value = goldenInputs;
-                                                       LOGGER.debug("parameters after being modified by valet:" + goldenInputs.toString());
+                                                       logger.debug("parameters after being modified by valet:{}", goldenInputs.toString());
                                                        valetSucceeded = true;
                                                }
                                        } else {
@@ -2121,15 +2148,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                        }
                                }
                        } else {
-                               LOGGER.debug("Got a bad response back from valet");
+                               logger.debug("Got a bad response back from valet");
                                valetErrorMessage = "Bad response back from Valet";
                                valetSucceeded = false;
                        }
                } catch (Exception e) {
-                       LOGGER.error("An exception occurred trying to call valet ...", e);
-                       valetSucceeded = false;
-                       valetErrorMessage = e.getMessage();
-               }
+        logger.error("An exception occurred trying to call valet ...", e);
+        valetSucceeded = false;
+        valetErrorMessage = e.getMessage();
+    }
                if (failRequestOnValetFailure && !valetSucceeded) {
                        // The valet request failed - and property says to fail the request
                        //TODO Create a new exception class for valet?
@@ -2170,13 +2197,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                                Map<String, Object> newInputs = vur.getParameters();
                                                if (newInputs != null) {
                                                        Map<String, Object> oldGold = goldenInputs;
-                                                       LOGGER.debug("parameters before being modified by valet:" + oldGold.toString());
+                                                       logger.debug("parameters before being modified by valet:{}", oldGold.toString());
                                                        goldenInputs = new HashMap<String, Object>();
                                                        for (String key : newInputs.keySet()) {
                                                                goldenInputs.put(key, newInputs.get(key));
                                                        }
                                                        valetModifiedParamsHolder.value = goldenInputs;
-                                                       LOGGER.debug("parameters after being modified by valet:" + goldenInputs.toString());
+                                                       logger.debug("parameters after being modified by valet:{}", goldenInputs.toString());
                                                        valetSucceeded = true;
                                                }
                                        } else {
@@ -2184,15 +2211,15 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                        }
                                }
                        } else {
-                               LOGGER.debug("Got a bad response back from valet");
+                               logger.debug("Got a bad response back from valet");
                                valetErrorMessage = "Got a bad response back from valet";
                                valetSucceeded = false;
                        }
                } catch (Exception e) {
-                       LOGGER.error("An exception occurred trying to call valet - will continue processing for now...", e);
-                       valetErrorMessage = e.getMessage();
-                       valetSucceeded = false;
-               }
+        logger.error("An exception occurred trying to call valet - will continue processing for now...", e);
+        valetErrorMessage = e.getMessage();
+        valetSucceeded = false;
+    }
                if (failRequestOnValetFailure && !valetSucceeded) {
                        // The valet request failed - and property says to fail the request
                        // TODO Create a new exception class for valet?
@@ -2216,7 +2243,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                vfModuleId = vnfName.substring(vnfName.indexOf('/') + 1);
                        } catch (Exception e) {
                                // do nothing - send what we got for vnfName for both to valet
-                               LOGGER.error("An exception occurred trying to call MsoVnfAdapterImpl.valetDeleteRequest() method", e);
+                               logger.error("An exception occurred trying to call MsoVnfAdapterImpl.valetDeleteRequest() method", e);
                        }
                        GenericValetResponse<ValetDeleteResponse> deleteReq = this.vci.callValetDeleteRequest(msoRequest.getRequestId(),
                                        cloudSiteId, tenantId, vfModuleId, vfModuleName);
@@ -2225,27 +2252,28 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
                                ValetStatus status = vdr.getStatus();
                                if (status != null) {
                                        String statusCode = status.getStatus(); // "ok" or "failed"
-                                       if ("ok".equalsIgnoreCase(statusCode)) {
-                                               LOGGER.debug("delete request to valet returned success");
-                                               valetDeleteRequestSucceeded = true;
-                                       } else {
-                                               LOGGER.debug("delete request to valet returned failure");
-                                               valetDeleteRequestSucceeded = false;
-                                               valetErrorMessage = status.getMessage();
-                                       }
-                               }
+            if ("ok".equalsIgnoreCase(statusCode)) {
+                logger.debug("delete request to valet returned success");
+                valetDeleteRequestSucceeded = true;
+            } else {
+                logger.debug("delete request to valet returned failure");
+                valetDeleteRequestSucceeded = false;
+                valetErrorMessage = status.getMessage();
+            }
+        }
                        } else {
-                               LOGGER.debug("Got a bad response back from valet - delete request failed");
+                               logger.debug("Got a bad response back from valet - delete request failed");
                                valetDeleteRequestSucceeded = false;
                                valetErrorMessage = "Got a bad response back from valet - delete request failed";
                        }
                } catch (Exception e) {
-                       LOGGER.error("An exception occurred trying to call valet - valetDeleteRequest failed", e);
-                       valetDeleteRequestSucceeded = false;
-                       valetErrorMessage = e.getMessage();
-               }
+        logger.error("An exception occurred trying to call valet - valetDeleteRequest failed", e);
+        valetDeleteRequestSucceeded = false;
+        valetErrorMessage = e.getMessage();
+    }
                if (valetDeleteRequestSucceeded == false && failRequestOnValetFailure == true) {
-                       LOGGER.error("ValetDeleteRequestFailed - del req still will be sent to openstack", new VnfException("ValetDeleteRequestFailedError"));
+                       logger.error("ValetDeleteRequestFailed - del req still will be sent to openstack", new VnfException
+          ("ValetDeleteRequestFailedError"));
                }
                return valetDeleteRequestSucceeded;
        }
index f34a794..b0601e9 100644 (file)
@@ -5,6 +5,7 @@
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -63,6 +64,8 @@ import org.onap.so.openstack.exceptions.MsoExceptionCategory;
 import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry;
 import org.onap.so.openstack.utils.MsoHeatEnvironmentParameter;
 import org.onap.so.openstack.utils.MsoKeystoneUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Component;
@@ -77,11 +80,11 @@ import org.springframework.transaction.annotation.Transactional;
 @WebService(serviceName = "VnfAdapter", endpointInterface = "org.onap.so.adapters.vnf.MsoVnfAdapter", targetNamespace = "http://org.onap.so/vnf")
 public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
 
+    private static Logger logger = LoggerFactory.getLogger(MsoVnfCloudifyAdapterImpl.class);
+
     private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
     private static final String VNF_ADAPTER_SERVICE_NAME = "MSO-BPMN:MSO-VnfAdapter.";
     private static final String LOG_REPLY_NAME = "MSO-VnfAdapter:MSO-BPMN.";
-    private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoVnfCloudifyAdapterImpl.class);
-
     private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters";
     private static final String ADD_GET_FILES_ON_VOLUME_REQ = "org.onap.so.adapters.vnf.addGetFilesOnVolumeReq";
     private static final String CLOUDIFY_RESPONSE_SUCCESS="Successfully received response from Cloudify";
@@ -108,7 +111,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
      */
     @Override
     public void healthCheck () {
-        LOGGER.debug ("Health check call in VNF Cloudify Adapter");
+        logger.debug("Health check call in VNF Cloudify Adapter");
     }
 
     /**
@@ -142,9 +145,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                            Holder <VnfRollback> rollback)
        throws VnfException
     {
-       // This operation is no longer supported at the VNF level.  The adapter is only called to deploy modules.
-       LOGGER.debug ("CreateVNF command attempted but not supported");
-       throw new VnfException ("CreateVNF:  Unsupported command", MsoExceptionCategory.USERDATA);
+        // This operation is no longer supported at the VNF level.  The adapter is only called to deploy modules.
+        logger.debug("CreateVNF command attempted but not supported");
+        throw new VnfException("CreateVNF:  Unsupported command", MsoExceptionCategory.USERDATA);
     }
 
     /**
@@ -167,8 +170,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                throws VnfException
        {
        // This operation is no longer supported at the VNF level.  The adapter is only called to deploy modules.
-       LOGGER.debug ("UpdateVNF command attempted but not supported");
-       throw new VnfException ("UpdateVNF:  Unsupported command", MsoExceptionCategory.USERDATA);
+      logger.debug("UpdateVNF command attempted but not supported");
+      throw new VnfException ("UpdateVNF:  Unsupported command", MsoExceptionCategory.USERDATA);
     }
 
     /**
@@ -205,7 +208,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
     {
         MsoLogger.setLogContext (msoRequest);
        MsoLogger.setServiceName ("QueryVnfCloudify");
-        LOGGER.debug ("Querying VNF " + vnfName + " in " + cloudSiteId + "/" + tenantId);
+        logger.debug ("Querying VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
 
         // Will capture execution time for metrics
         long startTime = System.currentTimeMillis ();
@@ -215,7 +218,6 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
 
        try {
                deployment = cloudifyUtils.queryDeployment(cloudSiteId, tenantId, vnfName);
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, CLOUDIFY_RESPONSE_SUCCESS, CLOUDIFY, "QueryDeployment", vnfName);
        }
        catch (MsoCloudifyManagerNotFound e) {
                // This site does not have a Cloudify Manager.
@@ -223,33 +225,32 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                deployment = null;
        }
        catch (MsoException me) {
-            // Failed to query the Deployment due to a cloudify exception.
-            // Convert to a generic VnfException
-            me.addContext ("QueryVNF");
-            String error = "Query VNF (Cloudify): " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, CLOUDIFY, "QueryDeployment", vnfName);
-            LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, CLOUDIFY, "QueryVNF", MsoLogger.ErrorCode.DataError, "Exception - queryDeployment", me);
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
-            throw new VnfException (me);
-       }
-
-       if (deployment != null  &&  deployment.getStatus() != DeploymentStatus.NOTFOUND) {
+          // Failed to query the Deployment due to a cloudify exception.
+          // Convert to a generic VnfException
+          me.addContext("QueryVNF");
+          String error = "Query VNF (Cloudify): " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
+          logger
+              .error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId, tenantId,
+                  CLOUDIFY, "QueryVNF", MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryDeployment", me);
+          logger.debug(error);
+          throw new VnfException(me);
+      }
+
+        if (deployment != null && deployment.getStatus() != DeploymentStatus.NOTFOUND) {
             vnfExists.value = Boolean.TRUE;
             status.value = deploymentStatusToVnfStatus(deployment);
             vnfId.value = deployment.getId();
-            outputs.value = copyStringOutputs (deployment.getOutputs ());
+            outputs.value = copyStringOutputs(deployment.getOutputs());
 
-            LOGGER.debug ("VNF " + vnfName + " found in Cloudify, ID = " + vnfId.value);
-        }
-        else {
+            logger.debug("VNF {} found in Cloudify, ID = {}", vnfName, vnfId.value);
+        } else {
             vnfExists.value = Boolean.FALSE;
             status.value = VnfStatus.NOTFOUND;
             vnfId.value = null;
-            outputs.value = new HashMap <String, String> (); // Return as an empty map
+            outputs.value = new HashMap<String, String>(); // Return as an empty map
 
-            LOGGER.debug ("VNF " + vnfName + " not found");
-       }
-        LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully query VNF");
+            logger.debug("VNF {} not found", vnfName);
+        }
         return;
     }
 
@@ -268,8 +269,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
        MsoLogger.setServiceName ("DeleteVnf");
 
        // This operation is no longer supported at the VNF level.  The adapter is only called to deploy modules.
-       LOGGER.debug ("DeleteVNF command attempted but not supported");
-       throw new VnfException ("DeleteVNF:  Unsupported command", MsoExceptionCategory.USERDATA);
+        logger.debug("DeleteVNF command attempted but not supported");
+        throw new VnfException ("DeleteVNF:  Unsupported command", MsoExceptionCategory.USERDATA);
     }
 
     /**
@@ -287,14 +288,13 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
         MsoLogger.setServiceName ("RollbackVnf");
        // rollback may be null (e.g. if stack already existed when Create was called)
         if (rollback == null) {
-            LOGGER.info (MessageEnum.RA_ROLLBACK_NULL, "OpenStack", "rollbackVnf", MsoLogger.getServiceName());
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "Rollback request content is null");
+            logger.info ("{} {} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf", MsoLogger
+                .getServiceName());
             return;
         }
 
         // Don't rollback if nothing was done originally
         if (!rollback.getVnfCreated()) {
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Rollback VF Module - nothing to roll back");
             return;
         }
 
@@ -305,7 +305,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
 
         MsoLogger.setLogContext (rollback.getMsoRequest());
 
-        LOGGER.debug ("Rolling Back VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId);
+        logger.debug("Rolling Back VF Module {} in {}", vfModuleId, cloudSiteId + "/" + tenantId);
 
        DeploymentInfo deployment = null;
 
@@ -322,19 +322,18 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
 
                // TODO: Get a reasonable timeout.  Use a global property, or store the creation timeout in rollback object and use that.
             deployment = cloudifyUtils.uninstallAndDeleteDeployment(cloudSiteId, tenantName, vfModuleId, 5);
-            LOGGER.debug("Rolled back deployment: " + deployment.getId());
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, CLOUDIFY_RESPONSE_SUCCESS, CLOUDIFY, "DeleteDeployment", null);
+            logger.debug("Rolled back deployment: {}", deployment.getId());
         } catch (MsoException me) {
             // Failed to rollback the VNF due to a cloudify exception.
             // Convert to a generic VnfException
             me.addContext ("RollbackVNF");
             String error = "Rollback VF Module: " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + me;
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, CLOUDIFY, "DeleteDeployment", null);
-            LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vfModuleId, cloudSiteId, tenantId, CLOUDIFY, "DeleteDeployment", MsoLogger.ErrorCode.DataError, "Exception - DeleteDeployment", me);
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+            logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudSiteId,
+                tenantId, CLOUDIFY, "DeleteDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+                "Exception - DeleteDeployment", me);
+            logger.debug(error);
             throw new VnfException (me);
         }
-        LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully roll back VF Module");
         return;
     }
 
@@ -376,28 +375,28 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                        String str = "" + stackOutputs.get(key);
                        stringOutputs.put(key, str);
                } catch (Exception e) {
-                       LOGGER.debug("Unable to add " + key + " to outputs");
+                       logger.debug("Unable to add " + key + " to outputs");
                }
             } else if (stackOutputs.get(key) instanceof JsonNode) {
                try {
                        String str = this.convertNode((JsonNode) stackOutputs.get(key));
                        stringOutputs.put(key, str);
                } catch (Exception e) {
-                       LOGGER.debug("Unable to add " + key + " to outputs - exception converting JsonNode");
-               }
+                  logger.debug("Unable to add " + key + " to outputs - exception converting JsonNode");
+              }
             } else if (stackOutputs.get(key) instanceof java.util.LinkedHashMap) {
                try {
                                        String str = JSON_MAPPER.writeValueAsString(stackOutputs.get(key));
                        stringOutputs.put(key, str);
                } catch (Exception e) {
-                       LOGGER.debug("Unable to add " + key + " to outputs - exception converting LinkedHashMap");
+                       logger.debug("Unable to add " + key + " to outputs - exception converting LinkedHashMap");
                }
             } else {
                try {
                        String str = stackOutputs.get(key).toString();
                        stringOutputs.put(key, str);
                } catch (Exception e) {
-                       LOGGER.debug("Unable to add " + key + " to outputs - unable to call .toString() " + e.getMessage());
+                       logger.debug("Unable to add " + key + " to outputs - unable to call .toString() " + e.getMessage());
                }
             }
         }
@@ -424,7 +423,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                        sb.append("\t\nitem " + i++ + ": '" + str + "'='" + outputString + "'");
                }
        }
-       LOGGER.debug(sb.toString());
+       logger.debug(sb.toString());
        return;
     }
 
@@ -441,7 +440,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                        sb.append("\titem " + i++ + ": " + str + "=" + inputs.get(str));
                }
        }
-       LOGGER.debug(sb.toString());
+       logger.debug(sb.toString());
        return;
     }
 
@@ -451,9 +450,9 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
             final String json = JSON_MAPPER.writeValueAsString(obj);
             return json;
         } catch (JsonParseException jpe) {
-            LOGGER.debug("Error converting json to string " + jpe.getMessage());
+            logger.debug("Error converting json to string " + jpe.getMessage());
         } catch (Exception e) {
-            LOGGER.debug("Error converting json to string " + e.getMessage());
+            logger.debug("Error converting json to string " + e.getMessage());
         }
         return "[Error converting json to string]";
     }
@@ -475,30 +474,30 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                         String str = this.convertNode((JsonNode) obj);
                         stringMap.put(key, str);
                     } catch (Exception e) {
-                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for JsonNode "+ key);
+                                               logger.debug("DANGER WILL ROBINSON: unable to convert value for JsonNode "+ key);
                         //okay in this instance - only string values (fqdn) are expected to be needed
                     }
                 } else if (obj instanceof java.util.LinkedHashMap) {
-                    LOGGER.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode");
+                    logger.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode");
                     try {
                         String str = JSON_MAPPER.writeValueAsString(obj);
                         stringMap.put(key, str);
                     } catch (Exception e) {
-                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for LinkedHashMap "+ key);
+                        logger.debug("DANGER WILL ROBINSON: unable to convert value for LinkedHashMap "+ key);
                                        }
                                }  else if (obj instanceof Integer) {
                                        try {
                                                String str = "" + obj;
                                                stringMap.put(key, str);
                                        } catch (Exception e) {
-                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for Integer "+ key);
+              logger.debug("DANGER WILL ROBINSON: unable to convert value for Integer "+ key);
                     }
                 } else {
                     try {
                                                String str = obj.toString();
                         stringMap.put(key, str);
                     } catch (Exception e) {
-                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value "+ key + " (" + e.getMessage() + ")");
+                        logger.debug("DANGER WILL ROBINSON: unable to convert value "+ key + " (" + e.getMessage() + ")");
                     }
                 }
             }
@@ -584,12 +583,13 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
        MsoLogger.setServiceName ("CreateVfModule");
 
         // Require a model customization ID.  Every VF Module definition must have one.
-        if (modelCustomizationUuid == null  ||  modelCustomizationUuid.isEmpty()) {
-                       LOGGER.debug("Missing required input: modelCustomizationUuid");
-                       String error = "Create vfModule error: Missing required input: modelCustomizationUuid";
-            LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM,
-                    "VF Module ModelCustomizationUuid", "null", CLOUDIFY, "", MsoLogger.ErrorCode.DataError, "Create VF Module: Missing required input: modelCustomizationUuid");
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+        if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) {
+            logger.debug("Missing required input: modelCustomizationUuid");
+            String error = "Create vfModule error: Missing required input: modelCustomizationUuid";
+            logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+                "VF Module ModelCustomizationUuid", CLOUDIFY, MsoLogger.ErrorCode.DataError.getValue(),
+                "Create VF Module: Missing required input: modelCustomizationUuid");
+            logger.debug(error);
             throw new VnfException(error, MsoExceptionCategory.USERDATA);
         }
 
@@ -606,7 +606,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
         if (inputs == null) {
                // Create an empty set of inputs
                inputs = new HashMap<>();
-               LOGGER.debug("inputs == null - setting to empty");
+               logger.debug("inputs == null - setting to empty");
         } else {
                this.sendMapToDebug(inputs);
         }
@@ -617,7 +617,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                isVolumeRequest = true;
         }
 
-        LOGGER.debug("requestType = " + requestType + ", volumeGroupStackId = " + volumeGroupId + ", baseStackId = " + baseVfModuleId);
+        logger.debug("requestType = " + requestType + ", volumeGroupStackId = " + volumeGroupId + ", baseStackId = " +
+            baseVfModuleId);
 
         // Build a default rollback object (no actions performed)
         VnfRollback vfRollback = new VnfRollback();
@@ -641,17 +642,18 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
        VfModuleCustomization vfmc = null;
 
         try {
-               vfmc = vfModuleCustomRepo.findByModelCustomizationUUID(modelCustomizationUuid);
+            vfmc = vfModuleCustomRepo.findByModelCustomizationUUID(modelCustomizationUuid);
 
             if (vfmc == null) {
-                       String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + modelCustomizationUuid;
-                       LOGGER.debug(error);
-                LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM,
-                            "VF Module ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb", "", MsoLogger.ErrorCode.DataError, error);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+                String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid="
+                    + modelCustomizationUuid;
+                logger.debug(error);
+                logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "VF Module "
+                        + "ModelCustomizationUuid",
+                    modelCustomizationUuid, "CatalogDb", MsoLogger.ErrorCode.DataError.getValue(), error);
                 throw new VnfException(error, MsoExceptionCategory.USERDATA);
             } else {
-                       LOGGER.debug("Found vfModuleCust entry " + vfmc.toString());
+                logger.debug("Found vfModuleCust entry " + vfmc.toString());
             }
 
             // Get the vfModule and vnfResource records
@@ -660,7 +662,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
         }
         catch (Exception e) {
 
-               LOGGER.debug("unhandled exception in create VF - [Query]" + e.getMessage());
+               logger.debug("unhandled exception in create VF - [Query]" + e.getMessage());
                throw new VnfException("Exception during create VF " + e.getMessage());
         }
 
@@ -681,10 +683,13 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                     (vnfMax != null && aicV.isMoreRecentThan(vnfMax)))
                {
                        // ERROR
-                       String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion();
-                       LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - setVersion");
-                       LOGGER.debug(error);
-                       throw new VnfException(error, MsoExceptionCategory.USERDATA);
+        String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID()
+            + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId
+            + " with AIC_Version:" + cloudSite.getCloudVersion();
+        logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
+            MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
+        logger.debug(error);
+        throw new VnfException(error, MsoExceptionCategory.USERDATA);
                }
                // End Version check
 
@@ -696,14 +701,14 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
         long subStartTime1 = System.currentTimeMillis ();
         try {
             cloudifyDeployment = cloudifyUtils.queryDeployment (cloudSiteId, tenantId, vfModuleName);
-            LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, CLOUDIFY_RESPONSE_SUCCESS, CLOUDIFY, "QueryDeployment", vfModuleName);
         }
         catch (MsoException me) {
             // Failed to query the Deployment due to a cloudify exception.
             String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
-            LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError, "Exception - queryDeployment", me);
-            LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, CLOUDIFY, "QueryDeployment", vfModuleName);
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+            logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudSiteId,
+                tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+                "Exception - queryDeployment", me);
+            logger.debug(error);
 
             // Convert to a generic VnfException
             me.addContext ("CreateVFModule");
@@ -714,54 +719,65 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
         if (cloudifyDeployment != null && !(cloudifyDeployment.getStatus () == DeploymentStatus.NOTFOUND)) {
                // CREATED, INSTALLED, INSTALLING, FAILED, UNINSTALLING, UNKNOWN
                DeploymentStatus status = cloudifyDeployment.getStatus();
-                       LOGGER.debug ("Found Existing Deployment, status=" + status);
+                       logger.debug ("Found Existing Deployment, status=" + status);
 
                if (status == DeploymentStatus.INSTALLED) {
                        // fail - it exists
                        if (failIfExists != null && failIfExists) {
                                String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId;
-                               LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError, "Deployment " + vfModuleName + " already exists");
-                    LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
-                               throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId());
+                logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+                    cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+                    "Deployment " + vfModuleName + " already exists");
+                logger.debug(error);
+                throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId());
                        } else {
                                // Found existing deployment and client has not requested "failIfExists".
                                // Populate the outputs from the existing deployment.
 
                                vnfId.value = cloudifyDeployment.getId();
                                outputs.value = copyStringOutputs (cloudifyDeployment.getOutputs ());
-                    LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create VF Module (found existing)");
                     return;
                        }
                }
                // Check through various detailed error cases
                if (status == DeploymentStatus.INSTALLING || status == DeploymentStatus.UNINSTALLING) {
                        // fail - it's in progress - return meaningful error
-                String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually.";
-                LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError, "Deployment " + vfModuleName + " already exists");
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+              String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually.";
+              logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+                  cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+                  "Deployment " + vfModuleName + " already exists");
+              logger.debug(error);
                 throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId());
                }
                else if (status == DeploymentStatus.FAILED) {
                        // fail - it exists and is in a FAILED state
-                String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
-                LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError, "Deployment " + vfModuleName + " already exists and is in FAILED state");
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+              String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+              logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+                  cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+                  "Deployment " + vfModuleName + " already " + "exists and is in FAILED state");
+              logger.debug(error);
                 throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId());
                }
                else if (status == DeploymentStatus.UNKNOWN || status == DeploymentStatus.CREATED) {
                        // fail - it exists and is in a UNKNOWN state
-                String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
-                LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError, "Deployment " + vfModuleName + " already exists and is in " + status.toString() + " state");
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
+              String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+              logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+                  cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+                  "Deployment " + vfModuleName + " already " + "exists and is in " + status.toString() + " state");
+              logger.debug(error);
                 throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId());
                }
                else {
                        // Unexpected, since all known status values have been tested for
-                String error = "Create VF: Deployment " + vfModuleName + " already exists with unexpected status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
-                LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError, "Deployment " + vfModuleName + " already exists and is in an unknown state");
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
-                throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId());
-               }
+              String error =
+                  "Create VF: Deployment " + vfModuleName + " already exists with unexpected status " + status
+                      .toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+              logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+                  cloudSiteId, tenantId, CLOUDIFY, "queryDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+                  "Deployment " + vfModuleName + " already " + "exists and is in an unknown state");
+              logger.debug(error);
+              throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, cloudifyDeployment.getId());
+          }
         }
 
 
@@ -775,28 +791,31 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
             DeploymentInfo volumeDeployment = null;
             try {
                 volumeDeployment = cloudifyUtils.queryDeployment (cloudSiteId, tenantId, volumeGroupId);
-                LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Success response from Cloudify", CLOUDIFY, "QueryDeployment", volumeGroupId);
             }
             catch (MsoException me) {
                 // Failed to query the Volume GroupDeployment due to a cloudify exception.
                 String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
-                LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, volumeGroupId, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(volume)", MsoLogger.ErrorCode.DataError, "Exception - queryDeployment(volume)", me);
-                LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, CLOUDIFY, "QueryDeployment(volume)", volumeGroupId);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
-
+                logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
+                    cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(volume)",
+                    MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryDeployment(volume)", me);
+                logger.debug(error);
                 // Convert to a generic VnfException
                 me.addContext ("CreateVFModule(QueryVolume)");
                 throw new VnfException (me);
             }
 
                if (volumeDeployment == null || volumeDeployment.getStatus() == DeploymentStatus.NOTFOUND) {
-                   String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR"  ;
-                   LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, volumeGroupId, cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(volume)", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Attached Volume Group DOES NOT EXIST");
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
-                   LOGGER.debug(error);
-                   throw new VnfException (error, MsoExceptionCategory.USERDATA);
-               } else {
-                       LOGGER.debug("Found nested volume group");
+              String error =
+                  "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in " + cloudSiteId + "/"
+                      + tenantId + " USER ERROR";
+              logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
+                  cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(volume)",
+                  MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+                  "Create VFModule: Attached Volume Group DOES NOT EXIST");
+              logger.debug(error);
+              throw new VnfException(error, MsoExceptionCategory.USERDATA);
+          } else {
+                       logger.debug("Found nested volume group");
                        volumeGroupOutputs = volumeDeployment.getOutputs();
                        this.sendMapToDebug(volumeGroupOutputs, "volumeGroupOutputs");
                }
@@ -807,15 +826,15 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
         //       Add-On Volume Group or Add-On VF Module
 
         if (vf.getIsBase()) {
-            LOGGER.debug("This is a BASE Module request");
+            logger.debug("This is a BASE Module request");
             vfRollback.setIsBase(true);
         } else {
-            LOGGER.debug("This is an Add-On Module request");
+            logger.debug("This is an Add-On Module request");
 
             // Add-On Modules should always have a Base, but just treat as a warning if not provided.
             // Add-on Volume requests may or may not specify a base.
             if (!isVolumeRequest && baseVfModuleId == null) {
-                LOGGER.debug ("WARNING:  Add-on Module request - no Base Module ID provided");
+                logger.debug ("WARNING:  Add-on Module request - no Base Module ID provided");
             }
 
             if (baseVfModuleId != null) {
@@ -823,31 +842,36 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                    DeploymentInfo baseDeployment = null;
                    try {
                        baseDeployment = cloudifyUtils.queryDeployment (cloudSiteId, tenantId, baseVfModuleId);
-                       LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Success response from Cloudify", CLOUDIFY, "QueryDeployment(Base)", baseVfModuleId);
                    }
                    catch (MsoException me) {
                        // Failed to query the Volume GroupDeployment due to a cloudify exception.
-                       String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
-                       LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, baseVfModuleId, cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(Base)", MsoLogger.ErrorCode.DataError, "Exception - queryDeployment(Base)", me);
-                       LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, CLOUDIFY, "QueryDeployment(Base)", baseVfModuleId);
-                       LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
-
-                       // Convert to a generic VnfException
-                       me.addContext ("CreateVFModule(QueryBase)");
-                       throw new VnfException (me);
+                  String error =
+                      "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudSiteId + "/" + tenantId + ": "
+                          + me;
+                  logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
+                      cloudSiteId, tenantId, CLOUDIFY, "queryDeployment(Base)",
+                      MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryDeployment(Base)", me);
+                  logger.debug(error);
+                  // Convert to a generic VnfException
+                  me.addContext("CreateVFModule(QueryBase)");
+                  throw new VnfException (me);
                    }
 
-                       if (baseDeployment == null || baseDeployment.getStatus() == DeploymentStatus.NOTFOUND) {
-                           String error = "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR"  ;
-                           LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, baseVfModuleId, cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(Base)", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Base Module DOES NOT EXIST");
-                       LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
-                           LOGGER.debug(error);
-                           throw new VnfException (error, MsoExceptionCategory.USERDATA);
-                       } else {
-                               LOGGER.debug("Found base module");
-                               baseModuleOutputs = baseDeployment.getOutputs();
-                               this.sendMapToDebug(baseModuleOutputs, "baseModuleOutputs");
-                       }
+                if (baseDeployment == null || baseDeployment.getStatus() == DeploymentStatus.NOTFOUND) {
+                    String error =
+                        "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudSiteId + "/"
+                            + tenantId + " USER ERROR";
+                    logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
+                        cloudSiteId, tenantId, error, CLOUDIFY, "queryDeployment(Base)",
+                        MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+                        "Create VFModule: Base " + "Module DOES NOT EXIST");
+                    logger.debug(error);
+                    throw new VnfException(error, MsoExceptionCategory.USERDATA);
+                } else {
+                    logger.debug("Found base module");
+                    baseModuleOutputs = baseDeployment.getOutputs();
+                    this.sendMapToDebug(baseModuleOutputs, "baseModuleOutputs");
+                }
             }
         }
 
@@ -871,24 +895,23 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                }
 
                if (heatTemplate == null) {
-                       String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestType;
-                       LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "OpenStack", "", MsoLogger.ErrorCode.DataError, error);
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);                       
-                       throw new VnfException(error, MsoExceptionCategory.INTERNAL);
-               } else {
-                       LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate());
+        String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType="
+            + requestType;
+        logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", vfModuleType,
+            "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+        throw new VnfException(error, MsoExceptionCategory.INTERNAL);
+    } else {
+                       logger.debug("Got HEAT Template from DB: {}", heatTemplate.getHeatTemplate());
                }
 
         if (heatEnvironment == null) {
-           String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
-                LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
-                // Alarm on this error, configuration must be fixed
-
-
-                throw new VnfException (error, MsoExceptionCategory.INTERNAL);
+            String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
+            logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
+                "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+            // Alarm on this error, configuration must be fixed
+            throw new VnfException(error, MsoExceptionCategory.INTERNAL);
         } else {
-            LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment());
+            logger.debug("Got Heat Environment from DB: {}", heatEnvironment.getEnvironment());
         }
 
 
@@ -912,7 +935,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                                HashMap<String, HeatTemplateParam> params = new HashMap<String, HeatTemplateParam>();
 
                                Set<HeatTemplateParam> paramSet = heatTemplate.getParameters();
-                               LOGGER.debug("paramSet has " + paramSet.size() + " entries");
+                               logger.debug("paramSet has {} entries", paramSet.size());
 
                                for (HeatTemplateParam htp : paramSet) {
                                        params.put(htp.getParamName(), htp);
@@ -932,7 +955,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                                                        goldenInputs.put(key, value);
                                                }
                                                else {
-                                                       LOGGER.debug("Failed to convert input " + key + "='" + inputs.get(key) + "' to " + params.get(key).getParamType());
+                                                       logger.debug("Failed to convert input " + key + "='" + inputs.get(key) + "' to " + params.get(key)
+                  .getParamType());
                                                }
                                        } else {
                                                extraInputs.add(key);
@@ -940,7 +964,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                                }
 
                                if (!extraInputs.isEmpty()) {
-                                       LOGGER.debug("Ignoring extra inputs: " + extraInputs);
+                                       logger.debug("Ignoring extra inputs: " + extraInputs);
                                }
 
                                // Next add in Volume Group Outputs if there are any.  Copy directly without conversions.
@@ -979,7 +1003,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                                                                goldenInputs.put(envKey, value);
                                                        }
                                                        else {
-                                                               LOGGER.debug("Failed to convert environment parameter " + envKey + "='" + envParam.getValue() + "' to " + params.get(envKey).getParamType());
+                                                               logger.debug("Failed to convert environment parameter " + envKey + "='" + envParam.getValue() + "' to " +
+                    params.get(envKey).getParamType());
                                                        }
                                                }
                                        }
@@ -995,39 +1020,43 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                        String propertyString = this.environment.getProperty(MsoVnfCloudifyAdapterImpl.CHECK_REQD_PARAMS);
                        if ("false".equalsIgnoreCase (propertyString) || "n".equalsIgnoreCase (propertyString)) {
                            checkRequiredParameters = false;
-                           LOGGER.debug ("CheckRequiredParameters is FALSE. Will still check but then skip blocking..."
-                                         + MsoVnfCloudifyAdapterImpl.CHECK_REQD_PARAMS);
-                       }
+                      logger.debug("CheckRequiredParameters is FALSE. Will still check but then skip blocking... {}",
+                          MsoVnfCloudifyAdapterImpl.CHECK_REQD_PARAMS);
+                  }
                    } catch (Exception e) {
                        // No problem - default is true
-                       LOGGER.debug ("An exception occured trying to get property " + MsoVnfCloudifyAdapterImpl.CHECK_REQD_PARAMS, e);
-                   }
+                  logger.debug("An exception occured trying to get property {}",
+                      MsoVnfCloudifyAdapterImpl.CHECK_REQD_PARAMS, e);
+              }
 
 
                    for (HeatTemplateParam parm : heatTemplate.getParameters ()) {
                        if (parm.isRequired () && (!goldenInputs.containsKey (parm.getParamName ()))) {
-                        LOGGER.debug ("adding to missing parameters list: " + parm.getParamName ());
-                        if (missingParams == null) {
-                            missingParams = parm.getParamName ();
-                        } else {
-                            missingParams += "," + parm.getParamName ();
-                        }
-                       }
+                      logger.debug("adding to missing parameters list: {}", parm.getParamName());
+                      if (missingParams == null) {
+                          missingParams = parm.getParamName();
+                      } else {
+                          missingParams += "," + parm.getParamName();
+                      }
+                  }
                    }
 
-                   if (missingParams != null) {
-                       if (checkRequiredParameters) {
-                               // Problem - missing one or more required parameters
-                               String error = "Create VFModule: Missing Required inputs: " + missingParams;
-                               LOGGER.error (MessageEnum.RA_MISSING_PARAM, missingParams, CLOUDIFY, "", MsoLogger.ErrorCode.DataError, "Create VFModule: Missing Required inputs");
-                           LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error);
-                               throw new VnfException (error, MsoExceptionCategory.USERDATA);
-                       } else {
-                               LOGGER.debug ("found missing parameters [" + missingParams + "] - but checkRequiredParameters is false - will not block");
-                       }
-                   } else {
-                       LOGGER.debug ("No missing parameters found - ok to proceed");
-                   }
+          if (missingParams != null) {
+              if (checkRequiredParameters) {
+                  // Problem - missing one or more required parameters
+                  String error = "Create VFModule: Missing Required inputs: " + missingParams;
+                  logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, CLOUDIFY,
+                      MsoLogger.ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
+                  logger.debug(error);
+                  throw new VnfException(error, MsoExceptionCategory.USERDATA);
+              } else {
+                  logger.debug(
+                      "found missing parameters [" + missingParams + "] - but checkRequiredParameters is false -"
+                          + " will not block");
+              }
+          } else {
+              logger.debug("No missing parameters found - ok to proceed");
+          }
 
                        } // NOTE: END PARAMETER CHECKING
 
@@ -1043,7 +1072,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
 
                        try {
                                if (! cloudifyUtils.isBlueprintLoaded (cloudSiteId, blueprintId)) {
-                                       LOGGER.debug ("Blueprint " + blueprintId + " is not loaded.  Will upload it now.");
+          logger.debug("Blueprint " + blueprintId + " is not loaded.  Will upload it now.");
 
                                        Map<String,byte[]> blueprintFiles = new HashMap<String,byte[]>();
 
@@ -1077,12 +1106,12 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                        }
 
                        catch (MsoException me) {
-                me.addContext ("CreateVFModule");
-                String error = "Create VF Module: Upload blueprint failed.  Blueprint=" + blueprintName + ": " + me;
-                LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, CLOUDIFY, "", MsoLogger.ErrorCode.DataError, "MsoException - uploadBlueprint", me);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
-                throw new VnfException (me);
-
+          me.addContext("CreateVFModule");
+          String error = "Create VF Module: Upload blueprint failed.  Blueprint=" + blueprintName + ": " + me;
+          logger.error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
+              tenantId, CLOUDIFY, MsoLogger.ErrorCode.DataError.getValue(), "MsoException - uploadBlueprint", me);
+          logger.debug(error);
+          throw new VnfException(me);
                        }
 
             // Ignore MsoTenantNotFound and MsoStackAlreadyExists exceptions
@@ -1107,30 +1136,31 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                                               heatTemplate.getTimeoutMinutes (),
                                               backout.booleanValue());
 
-                LOGGER.recordMetricEvent (createDeploymentStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, CLOUDIFY_RESPONSE_SUCCESS, CLOUDIFY, "CreateDeployment", vfModuleName);
             } catch (MsoException me) {
                 me.addContext ("CreateVFModule");
                 String error = "Create VF Module " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me;
-                LOGGER.recordMetricEvent (createDeploymentStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, CLOUDIFY, "CreateDeployment", vfModuleName);
-                LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, CLOUDIFY, "", MsoLogger.ErrorCode.DataError, "MsoException - createDeployment", me);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+                logger
+                    .error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
+                        tenantId, CLOUDIFY, MsoLogger.ErrorCode.DataError.getValue(), "MsoException - createDeployment",
+                        me);
+                logger.debug(error);
                 throw new VnfException (me);
             } catch (NullPointerException npe) {
                 String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + npe;
-                LOGGER.recordMetricEvent (createDeploymentStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, CLOUDIFY, "CreateDeployment", vfModuleName);
-                LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, CLOUDIFY, "", MsoLogger.ErrorCode.DataError, "NullPointerException - createDeployment", npe);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
-                LOGGER.debug("NULL POINTER EXCEPTION at cloudify.createAndInstallDeployment");
+                logger
+                    .error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
+                        tenantId, CLOUDIFY, MsoLogger.ErrorCode.DataError.getValue(),
+                        "NullPointerException - createDeployment", npe);
+                logger.debug(error);
+                logger.debug("NULL POINTER EXCEPTION at cloudify.createAndInstallDeployment");
                 //npe.addContext ("CreateVNF");
                 throw new VnfException ("NullPointerException during cloudify.createAndInstallDeployment");
             } catch (Exception e) {
-                LOGGER.recordMetricEvent (createDeploymentStarttime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while creating deployment with Cloudify", CLOUDIFY, "CreateDeployment", vfModuleName);
-                LOGGER.debug("unhandled exception at cloudify.createAndInstallDeployment");
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while creating deployment with Cloudify");
+                logger.debug("unhandled exception at cloudify.createAndInstallDeployment");
                throw new VnfException("Exception during cloudify.createAndInstallDeployment! " + e.getMessage());
             }
         } catch (Exception e) {
-               LOGGER.debug("unhandled exception in create VF");
+               logger.debug("unhandled exception in create VF");
                throw new VnfException("Exception during create VF " + e.getMessage());
 
         }
@@ -1144,8 +1174,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
 
         rollback.value = vfRollback;
 
-        LOGGER.debug ("VF Module " + vfModuleName + " successfully created");
-        LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create VF Module");
+        logger.debug("VF Module successfully created", vfModuleName);
         return;
     }
 
@@ -1156,7 +1185,7 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                            Holder <Map <String, String>> outputs) throws VnfException {
         MsoLogger.setLogContext (msoRequest);
        MsoLogger.setServiceName ("DeleteVf");
-        LOGGER.debug ("Deleting VF " + vnfName + " in " + cloudSiteId + "/" + tenantId);
+        logger.debug ("Deleting VF " + vnfName + " in " + cloudSiteId + "/" + tenantId);
         // Will capture execution time for metrics
         long startTime = System.currentTimeMillis ();
 
@@ -1169,9 +1198,10 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
             // Failed to query the deployment.  Convert to a generic VnfException
             me.addContext ("DeleteVFModule");
             String error = "Delete VFModule: Query to get outputs: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
-            LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, CLOUDIFY, "QueryDeployment", null);
-            LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfName, cloudSiteId, tenantId, CLOUDIFY, "QueryDeployment", MsoLogger.ErrorCode.DataError, "Exception - QueryDeployment", me);
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+            logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfName, cloudSiteId,
+                tenantId, CLOUDIFY, "QueryDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+                "Exception - QueryDeployment", me);
+            logger.debug(error);
             throw new VnfException (me);
         }
         // call method which handles the conversion from Map<String,Object> to Map<String,String> for our expected Object types
@@ -1184,19 +1214,18 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
         long subStartTime = System.currentTimeMillis ();
         try {
             cloudifyUtils.uninstallAndDeleteDeployment(cloudSiteId, tenantId, vnfName, 5);
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from DeleteDeployment", CLOUDIFY, "DeleteDeployment", vnfName);
         } catch (MsoException me) {
-            me.addContext ("DeleteVfModule");
+            me.addContext("DeleteVfModule");
             // Convert to a generic VnfException
             String error = "Delete VF: " + vnfName + " in " + cloudSiteId + "/" + tenantId + ": " + me;
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "DeleteDeployment", "DeleteDeployment", vnfName);
-            LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vnfName, cloudSiteId, tenantId, "DeleteDeployment", "DeleteDeployment", MsoLogger.ErrorCode.DataError, "Exception - DeleteDeployment: " + me.getMessage());
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
-            throw new VnfException (me);
+            logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vnfName, cloudSiteId,
+                tenantId, "DeleteDeployment", "DeleteDeployment", MsoLogger.ErrorCode.DataError.getValue(),
+                "Exception - DeleteDeployment: " + me.getMessage());
+            logger.debug(error);
+            throw new VnfException(me);
         }
 
         // On success, nothing is returned.
-        LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully delete VF");
         return;
     }
 
@@ -1218,8 +1247,8 @@ public class MsoVnfCloudifyAdapterImpl implements MsoVnfAdapter {
                            Holder <VnfRollback> rollback) throws VnfException
         {
                // This operation is not currently supported for Cloudify-orchestrated VF Modules.
-               LOGGER.debug ("Update VF Module command attempted but not supported");
+               logger.debug("Update VF Module command attempted but not supported");
                throw new VnfException ("UpdateVfModule:  Unsupported command", MsoExceptionCategory.USERDATA);
         }
 
-}
\ No newline at end of file
+}
index 13212be..cb1e350 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
  * 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
@@ -82,6 +84,8 @@ import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry;
 import org.onap.so.openstack.utils.MsoHeatUtils;
 import org.onap.so.openstack.utils.MsoKeystoneUtils;
 import org.onap.so.openstack.utils.MsoMulticloudUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.core.env.Environment;
 import org.springframework.stereotype.Component;
@@ -97,7 +101,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
 
     private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
-    private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoVnfPluginAdapterImpl.class);
+    private static Logger logger = LoggerFactory.getLogger(MsoVnfPluginAdapterImpl.class);
 
     private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters";
     private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
@@ -131,7 +135,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
      */
     @Override
     public void healthCheck () {
-        LOGGER.debug ("Health check call in VNF Plugin Adapter");
+        logger.debug("Health check call in VNF Plugin Adapter");
     }
 
     /**
@@ -165,9 +169,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                            Holder <VnfRollback> rollback)
        throws VnfException
     {
-       // This operation is no longer supported at the VNF level.  The adapter is only called to deploy modules.
-       LOGGER.debug ("CreateVNF command attempted but not supported");
-       throw new VnfException ("CreateVNF:  Unsupported command", MsoExceptionCategory.USERDATA);
+        // This operation is no longer supported at the VNF level.  The adapter is only called to deploy modules.
+        logger.debug("CreateVNF command attempted but not supported");
+        throw new VnfException("CreateVNF:  Unsupported command", MsoExceptionCategory.USERDATA);
     }
 
     /**
@@ -190,7 +194,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                throws VnfException
        {
        // This operation is no longer supported at the VNF level.  The adapter is only called to deploy modules.
-       LOGGER.debug ("UpdateVNF command attempted but not supported");
+       logger.debug("UpdateVNF command attempted but not supported");
        throw new VnfException ("UpdateVNF:  Unsupported command", MsoExceptionCategory.USERDATA);
     }
 
@@ -223,7 +227,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
     {
         MsoLogger.setLogContext (msoRequest);
        MsoLogger.setServiceName ("QueryVnf");
-        LOGGER.debug ("Querying VNF " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId);
+        logger.debug("Querying VNF " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId);
 
         // Will capture execution time for metrics
         long startTime = System.currentTimeMillis ();
@@ -236,36 +240,34 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
 
        try {
                vduInstance = vduPlugin.queryVdu (cloudInfo, vnfNameOrId);
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received VDU Query response", "VDU", "QueryVDU", vnfNameOrId);
        }
        catch (VduException e) {
-            // Failed to query the VDU due to a plugin exception.
-            // Convert to a generic VnfException
-            e.addContext ("QueryVNF");
-            String error = "Query VNF (VDU): " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId + ": " + e;
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "QueryVNF", vnfNameOrId);
-            LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vnfNameOrId, cloudSiteId, tenantId, "VDU", "QueryVNF", MsoLogger.ErrorCode.DataError, "Exception - queryVDU", e);
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
-            throw new VnfException (e);
-       }
+          // Failed to query the VDU due to a plugin exception.
+          // Convert to a generic VnfException
+          e.addContext("QueryVNF");
+          String error = "Query VNF (VDU): " + vnfNameOrId + " in " + cloudSiteId + "/" + tenantId + ": " + e;
+          logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudSiteId,
+              tenantId, "VDU", "QueryVNF", MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryVDU", e);
+          logger.debug(error);
+          throw new VnfException(e);
+      }
 
        if (vduInstance != null  &&  vduInstance.getStatus().getState() != VduStateType.NOTFOUND) {
-            vnfExists.value = Boolean.TRUE;
-            status.value = vduStatusToVnfStatus(vduInstance);
-            vnfId.value = vduInstance.getVduInstanceId();
-            outputs.value = copyStringOutputs (vduInstance.getOutputs ());
+          vnfExists.value = Boolean.TRUE;
+          status.value = vduStatusToVnfStatus(vduInstance);
+          vnfId.value = vduInstance.getVduInstanceId();
+          outputs.value = copyStringOutputs(vduInstance.getOutputs());
 
-            LOGGER.debug ("VNF " + vnfNameOrId + " found, ID = " + vnfId.value);
+          logger.debug("VNF {} found, ID = {}", vnfNameOrId, vnfId.value);
         }
         else {
-            vnfExists.value = Boolean.FALSE;
-            status.value = VnfStatus.NOTFOUND;
-            vnfId.value = null;
-            outputs.value = new HashMap <String, String> (); // Return as an empty map
+          vnfExists.value = Boolean.FALSE;
+          status.value = VnfStatus.NOTFOUND;
+          vnfId.value = null;
+          outputs.value = new HashMap<String, String>(); // Return as an empty map
 
-            LOGGER.debug ("VNF " + vnfNameOrId + " not found");
-       }
-        LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully query VNF");
+          logger.debug("VNF {} not found", vnfNameOrId);
+      }
         return;
     }
 
@@ -284,7 +286,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
        MsoLogger.setServiceName ("DeleteVnf");
 
        // This operation is no longer supported at the VNF level.  The adapter is only called to deploy modules.
-       LOGGER.debug ("DeleteVNF command attempted but not supported");
+       logger.debug("DeleteVNF command attempted but not supported");
        throw new VnfException ("DeleteVNF:  Unsupported command", MsoExceptionCategory.USERDATA);
     }
 
@@ -303,14 +305,13 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
         MsoLogger.setServiceName ("RollbackVnf");
        // rollback may be null (e.g. if stack already existed when Create was called)
         if (rollback == null) {
-            LOGGER.info (MessageEnum.RA_ROLLBACK_NULL, "OpenStack", "rollbackVnf", MsoLogger.getServiceName());
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "Rollback request content is null");
+            logger.info("{} {} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf",
+                MsoLogger.getServiceName());
             return;
         }
 
         // Don't rollback if nothing was done originally
         if (!rollback.getVnfCreated()) {
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Rollback VF Module - nothing to roll back");
             return;
         }
 
@@ -323,7 +324,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
 
         MsoLogger.setLogContext (rollback.getMsoRequest());
 
-        LOGGER.debug ("Rolling Back VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId);
+        logger.debug("Rolling Back VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId);
 
        VduInstance vduInstance = null;
 
@@ -335,20 +336,18 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                // TODO: Get a reasonable timeout.  Use a global property, or store the creation timeout in rollback object and use that.
             vduInstance = vduPlugin.deleteVdu(cloudInfo, vfModuleId, 5);
 
-            LOGGER.debug("Rolled back VDU instantiation: " + vduInstance.getVduInstanceId());
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from VDU Plugin", "VDU", "DeleteVdu", null);
+            logger.debug("Rolled back VDU instantiation: {}", vduInstance.getVduInstanceId());
         }
         catch (VduException ve) {
             // Failed to rollback the VF Module due to a plugin exception.
             // Convert to a generic VnfException
             ve.addContext ("RollbackVFModule");
             String error = "Rollback VF Module: " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + ve;
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "DeleteVdu", null);
-            LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vfModuleId, cloudSiteId, tenantId, "VDU", "DeleteVdu", MsoLogger.ErrorCode.DataError, "Exception - DeleteVdu", ve);
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+            logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudSiteId,
+                tenantId, "VDU", "DeleteVdu", MsoLogger.ErrorCode.DataError.getValue(), "Exception - DeleteVdu", ve);
+            logger.debug(error);
             throw new VnfException (ve);
         }
-        LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully roll back VF Module");
         return;
     }
 
@@ -382,14 +381,14 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
        private Object convertInputValue (Object inputValue, HeatTemplateParam templateParam)
        {
                String type = templateParam.getParamType();
-               LOGGER.debug("Parameter: " + templateParam.getParamName() + " is of type " + type);
+               logger.debug("Parameter: {} is of type ",  templateParam.getParamName(), type);
 
                if (type.equalsIgnoreCase("number")) {
                        try {
                                return Integer.valueOf(inputValue.toString());
                        }
                        catch (Exception e) {
-                               LOGGER.debug("Unable to convert " + inputValue + " to an integer!" , e);
+                               logger.debug("Unable to convert " + inputValue + " to an integer!" , e);
                                return null;
                        }
                } else if (type.equalsIgnoreCase("json")) {
@@ -398,7 +397,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                                return jsonNode;
                        }
                        catch (Exception e) {
-                               LOGGER.debug("Unable to convert " + inputValue + " to a JsonNode!", e);
+                               logger.debug("Unable to convert " + inputValue + " to a JsonNode!", e);
                                return null;
                        }
                } else if (type.equalsIgnoreCase("boolean")) {
@@ -419,29 +418,30 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                        String str = "" + stackOutputs.get(key);
                        stringOutputs.put(key, str);
                } catch (Exception e) {
-                       LOGGER.debug("Unable to add " + key + " to outputs", e);
+                       logger.debug("Unable to add " + key + " to outputs", e);
                }
             } else if (stackOutputs.get(key) instanceof JsonNode) {
                try {
                        String str = this.convertNode((JsonNode) stackOutputs.get(key));
                        stringOutputs.put(key, str);
                } catch (Exception e) {
-                       LOGGER.debug("Unable to add " + key + " to outputs - exception converting JsonNode", e);
+                       logger.debug("Unable to add " + key + " to outputs - exception converting JsonNode", e);
                }
             } else if (stackOutputs.get(key) instanceof java.util.LinkedHashMap) {
                try {
                                        String str = JSON_MAPPER.writeValueAsString(stackOutputs.get(key));
                        stringOutputs.put(key, str);
                } catch (Exception e) {
-                       LOGGER.debug("Unable to add " + key + " to outputs - exception converting LinkedHashMap", e);
-               }
+                  logger.debug("Unable to add " + key + " to outputs - exception converting LinkedHashMap", e);
+              }
             } else {
                try {
                        String str = stackOutputs.get(key).toString();
                        stringOutputs.put(key, str);
                } catch (Exception e) {
-                       LOGGER.debug("Unable to add " + key + " to outputs - unable to call .toString() " + e.getMessage(), e);
-               }
+                  logger
+                      .debug("Unable to add " + key + " to outputs - unable to call .toString() " + e.getMessage(), e);
+              }
             }
         }
         return stringOutputs;
@@ -467,7 +467,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                        sb.append("\t\nitem " + i++ + ": '" + str + "'='" + outputString + "'");
                }
        }
-       LOGGER.debug(sb.toString());
+      logger.debug(sb.toString());
        return;
     }
 
@@ -484,7 +484,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                        sb.append("\titem " + i++ + ": " + str + "=" + inputs.get(str));
                }
        }
-       LOGGER.debug(sb.toString());
+      logger.debug(sb.toString());
        return;
     }
 
@@ -494,9 +494,9 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
             final String json = JSON_MAPPER.writeValueAsString(obj);
             return json;
         } catch (JsonParseException jpe) {
-            LOGGER.debug("Error converting json to string " + jpe.getMessage());
+            logger.debug("Error converting json to string " + jpe.getMessage());
         } catch (Exception e) {
-            LOGGER.debug("Error converting json to string " + e.getMessage());
+            logger.debug("Error converting json to string " + e.getMessage());
         }
         return "[Error converting json to string]";
     }
@@ -518,30 +518,30 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                         String str = this.convertNode((JsonNode) obj);
                         stringMap.put(key, str);
                     } catch (Exception e) {
-                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for JsonNode "+ key, e);
+                                               logger.debug("DANGER WILL ROBINSON: unable to convert value for JsonNode "+ key, e);
                         //okay in this instance - only string values (fqdn) are expected to be needed
                     }
                 } else if (obj instanceof java.util.LinkedHashMap) {
-                    LOGGER.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode");
+                    logger.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode");
                     try {
                         String str = JSON_MAPPER.writeValueAsString(obj);
                         stringMap.put(key, str);
                     } catch (Exception e) {
-                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for LinkedHashMap "+ key, e);
+                        logger.debug("DANGER WILL ROBINSON: unable to convert value for LinkedHashMap "+ key, e);
                                        }
                                }  else if (obj instanceof Integer) {
                                        try {
                                                String str = "" + obj;
                                                stringMap.put(key, str);
                                        } catch (Exception e) {
-                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value for Integer "+ key, e);
+              logger.debug("DANGER WILL ROBINSON: unable to convert value for Integer "+ key, e);
                     }
                 } else {
                     try {
                                                String str = obj.toString();
                         stringMap.put(key, str);
                     } catch (Exception e) {
-                                               LOGGER.debug("DANGER WILL ROBINSON: unable to convert value "+ key + " (" + e.getMessage() + ")", e);
+                        logger.debug("DANGER WILL ROBINSON: unable to convert value "+ key + " (" + e.getMessage() + ")", e);
                     }
                 }
             }
@@ -626,11 +626,12 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
 
         // Require a model customization ID.  Every VF Module definition must have one.
         if (modelCustomizationUuid == null  ||  modelCustomizationUuid.isEmpty()) {
-                       LOGGER.debug("Missing required input: modelCustomizationUuid");
-                       String error = "Create vfModule error: Missing required input: modelCustomizationUuid";
-            LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM,
-                    "VF Module ModelCustomizationUuid", "null", "VDU", "", MsoLogger.ErrorCode.DataError, "Create VF Module: Missing required input: modelCustomizationUuid");
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+            logger.debug("Missing required input: modelCustomizationUuid");
+            String error = "Create vfModule error: Missing required input: modelCustomizationUuid";
+            logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+                "VF Module ModelCustomizationUuid", "VDU", MsoLogger.ErrorCode.DataError,
+                "Create VF Module: " + "Missing required input: modelCustomizationUuid");
+            logger.debug(error);
             throw new VnfException(error, MsoExceptionCategory.USERDATA);
         }
 
@@ -647,7 +648,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
         if (inputs == null) {
                // Create an empty set of inputs
                inputs = new HashMap<>();
-               LOGGER.debug("inputs == null - setting to empty");
+          logger.debug("inputs == null - setting to empty");
         } else {
                this.sendMapToDebug(inputs);
         }
@@ -658,7 +659,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                isVolumeRequest = true;
         }
 
-        LOGGER.debug("requestType = " + requestType + ", volumeGroupStackId = " + volumeGroupId + ", baseStackId = " + baseVfModuleId);
+        logger.debug("requestType = " + requestType + ", volumeGroupStackId = " + volumeGroupId + ", baseStackId = " +
+            baseVfModuleId);
 
         // Build a default rollback object (no actions performed)
         VnfRollback vfRollback = new VnfRollback();
@@ -682,17 +684,18 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
        VfModuleCustomization vfModuleCust = null;
 
         try {
-               vfModuleCust = vfModuleCustomRepo.findByModelCustomizationUUID(modelCustomizationUuid);
+            vfModuleCust = vfModuleCustomRepo.findByModelCustomizationUUID(modelCustomizationUuid);
 
             if (vfModuleCust == null) {
-                       String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid=" + modelCustomizationUuid;
-                       LOGGER.debug(error);
-                LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM,
-                            "VF Module ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb", "", MsoLogger.ErrorCode.DataError, error);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
+                String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid="
+                    + modelCustomizationUuid;
+                logger.debug(error);
+                logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+                    "VF Module ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb",
+                    MsoLogger.ErrorCode.DataError, error);
                 throw new VnfException(error, MsoExceptionCategory.USERDATA);
             } else {
-                       LOGGER.debug("Found vfModuleCust entry " + vfModuleCust.toString());
+                logger.debug("Found vfModuleCust entry {}", vfModuleCust.toString());
             }
 
             // Get the vfModule and vnfResource records
@@ -701,7 +704,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
         }
         catch (Exception e) {
 
-               LOGGER.debug("unhandled exception in create VF - [Query]" + e.getMessage());
+               logger.debug("unhandled exception in create VF - [Query]" + e.getMessage());
                throw new VnfException("Exception during create VF " + e.getMessage());
         }
 
@@ -719,16 +722,19 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                String vnfMin = vnfResource.getAicVersionMin();
                String vnfMax = vnfResource.getAicVersionMax();
 
-               if ( (vnfMin != null && !(aicV.isMoreRecentThan(vnfMin) || aicV.isTheSameVersion(vnfMin))) ||
-                    (vnfMax != null && aicV.isMoreRecentThan(vnfMax)))
-               {
-                       // ERROR
-                       String error = "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID() + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion();
-                       LOGGER.error(MessageEnum.RA_CONFIG_EXC, error, "OpenStack", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - setVersion");
-                       LOGGER.debug(error);
-                       throw new VnfException(error, MsoExceptionCategory.USERDATA);
-               }
-               // End Version check
+        if ((vnfMin != null && !(aicV.isMoreRecentThan(vnfMin) || aicV.isTheSameVersion(vnfMin))) || (vnfMax != null
+            && aicV.isMoreRecentThan(vnfMax))) {
+            // ERROR
+            String error =
+                "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID()
+                    + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: " + cloudSiteId
+                    + " with AIC_Version:" + cloudSite.getCloudVersion();
+            logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
+                MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - setVersion");
+            logger.debug(error);
+            throw new VnfException(error, MsoExceptionCategory.USERDATA);
+        }
+        // End Version check
 
 
         VduInstance vduInstance = null;
@@ -743,15 +749,14 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
         if (!usingMulticloud) {
             try {
                 vduInstance = vduPlugin.queryVdu (cloudInfo, vfModuleName);
-                LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from VduPlugin", "VDU", "QueryVDU", vfModuleName);
             }
             catch (VduException me) {
                 // Failed to query the VDU due to a plugin exception.
                 String error = "Create VF Module: Query " + vfModuleName + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
-                LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleName, cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError, "Exception - queryVdu", me);
-                LOGGER.recordMetricEvent (subStartTime1, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "QueryVdu", vfModuleName);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
-
+                logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
+                    cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(),
+                    "Exception - queryVdu", me);
+                logger.debug(error);
                 // Convert to a generic VnfException
                 me.addContext ("CreateVFModule");
                 throw new VnfException (me);
@@ -761,54 +766,70 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
         // More precise handling/messaging if the Module already exists
         if (vduInstance != null && !(vduInstance.getStatus().getState() == VduStateType.NOTFOUND)) {
                VduStateType status = vduInstance.getStatus().getState();
-                       LOGGER.debug ("Found Existing VDU, status=" + status);
-
-               if (status == VduStateType.INSTANTIATED) {
-                       if (failIfExists != null && failIfExists) {
-                       // fail - it exists
-                               String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId;
-                               LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError, "VF Module " + vfModuleName + " already exists");
-                    LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
-                               throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
-                       } else {
-                               // Found existing deployment and client has not requested "failIfExists".
-                               // Populate the outputs from the existing deployment.
-
-                               vnfId.value = vduInstance.getVduInstanceId();
-                               outputs.value = copyStringOutputs (vduInstance.getOutputs ());
-                    LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create VF Module (found existing)");
+            logger.debug("Found Existing VDU, status=" + status);
+
+            if (status == VduStateType.INSTANTIATED) {
+                if (failIfExists != null && failIfExists) {
+                    // fail - it exists
+                    String error =
+                        "Create VF: Deployment " + vfModuleName + " already exists in " + cloudSiteId + "/" + tenantId;
+                    logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+                        cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(),
+                        "VF Module " + vfModuleName + " already exists");
+                    logger.debug(error);
+                    throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
+                } else {
+                    // Found existing deployment and client has not requested "failIfExists".
+                    // Populate the outputs from the existing deployment.
+
+                    vnfId.value = vduInstance.getVduInstanceId();
+                    outputs.value = copyStringOutputs(vduInstance.getOutputs());
                     return;
-                       }
-               }
-               // Check through various detailed error cases
-               else if (status == VduStateType.INSTANTIATING || status == VduStateType.DELETING || status == VduStateType.UPDATING) {
-                       // fail - it's in progress - return meaningful error
-                String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually.";
-                LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError, "VF Module " + vfModuleName + " already exists");
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
-                throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
-               }
-               else if (status == VduStateType.FAILED) {
-                       // fail - it exists and is in a FAILED state
-                String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
-                LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError, "VF Module " + vfModuleName + " already exists and is in FAILED state");
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
-                throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
-               }
-               else if (status == VduStateType.UNKNOWN) {
-                       // fail - it exists and is in a UNKNOWN state
-                String error = "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
-                LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError, "VF Module " + vfModuleName + " already exists and is in " + status.toString() + " state");
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
-                throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
-               }
-               else {
-                       // Unexpected, since all known status values have been tested for
-                String error = "Create VF: Deployment " + vfModuleName + " already exists with unexpected status " + status.toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
-                LOGGER.error (MessageEnum.RA_VNF_ALREADY_EXIST, vfModuleName, cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError, "VF Module " + vfModuleName + " already exists and is in an unknown state");
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
-                throw new VnfAlreadyExists (vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
-               }
+                }
+            }
+            // Check through various detailed error cases
+            else if (status == VduStateType.INSTANTIATING || status == VduStateType.DELETING
+                || status == VduStateType.UPDATING) {
+                // fail - it's in progress - return meaningful error
+                String error =
+                    "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString()
+                        + " in " + cloudSiteId + "/" + tenantId + "; please wait for it to complete, or fix manually.";
+                logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+                    cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(),
+                    "VF Module " + vfModuleName + " already exists");
+                logger.debug(error);
+                throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
+            } else if (status == VduStateType.FAILED) {
+                // fail - it exists and is in a FAILED state
+                String error =
+                    "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in " + cloudSiteId
+                        + "/" + tenantId + "; requires manual intervention.";
+                logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+                    cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(),
+                    "VF Module " + vfModuleName + " already exists and is in FAILED state");
+                logger.debug(error);
+                throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
+            } else if (status == VduStateType.UNKNOWN) {
+                // fail - it exists and is in a UNKNOWN state
+                String error =
+                    "Create VF: Deployment " + vfModuleName + " already exists and has status " + status.toString()
+                        + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+                logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+                    cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(),
+                    "VF Module " + vfModuleName + " already exists and is in " + status.toString() + " state");
+                logger.debug(error);
+                throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
+            } else {
+                // Unexpected, since all known status values have been tested for
+                String error =
+                    "Create VF: Deployment " + vfModuleName + " already exists with unexpected status " + status
+                        .toString() + " in " + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+                logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+                    cloudSiteId, tenantId, "VDU", "queryVdu", MsoLogger.ErrorCode.DataError.getValue(),
+                    "VF Module " + vfModuleName + " already exists and is in an unknown state");
+                logger.debug(error);
+                throw new VnfAlreadyExists(vfModuleName, cloudSiteId, tenantId, vduInstance.getVduInstanceId());
+            }
         }
 
 
@@ -822,15 +843,14 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
             VduInstance volumeVdu = null;
             try {
                 volumeVdu = vduPlugin.queryVdu (cloudInfo, volumeGroupId);
-                LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Success response from VduPlugin", "VDU", "QueryVdu", volumeGroupId);
             }
             catch (VduException me) {
                 // Failed to query the Volume Group VDU due to a plugin exception.
                 String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
-                LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, volumeGroupId, cloudSiteId, tenantId, "VDU", "queryVdu(volume)", MsoLogger.ErrorCode.DataError, "Exception - queryVdu(volume)", me);
-                LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "QueryVdu(volume)", volumeGroupId);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
-
+                logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
+                    cloudSiteId, tenantId, "VDU", "queryVdu(volume)", MsoLogger.ErrorCode.DataError.getValue(),
+                    "Exception - queryVdu(volume)", me);
+                logger.debug(error);
                 // Convert to a generic VnfException
                 me.addContext ("CreateVFModule(QueryVolume)");
                 throw new VnfException (me);
@@ -838,12 +858,14 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
 
                if (volumeVdu == null || volumeVdu.getStatus().getState() == VduStateType.NOTFOUND) {
                    String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR"  ;
-                   LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, volumeGroupId, cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Attached Volume Group DOES NOT EXIST");
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
-                   LOGGER.debug(error);
+              logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
+                  cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)",
+                  MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+                  "Create VFModule: Attached Volume Group " + "DOES NOT EXIST");
+              logger.debug(error);
                    throw new VnfException (error, MsoExceptionCategory.USERDATA);
                } else {
-                       LOGGER.debug("Found nested volume group");
+                       logger.debug("Found nested volume group");
                        volumeGroupOutputs = volumeVdu.getOutputs();
                        this.sendMapToDebug(volumeGroupOutputs, "volumeGroupOutputs");
                }
@@ -854,15 +876,15 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
         //       Add-On Volume Group or Add-On VF Module
 
         if (vfModule.getIsBase()) {
-            LOGGER.debug("This is a BASE Module request");
+            logger.debug("This is a BASE Module request");
             vfRollback.setIsBase(true);
         } else {
-            LOGGER.debug("This is an Add-On Module request");
+            logger.debug("This is an Add-On Module request");
 
             // Add-On Modules should always have a Base, but just treat as a warning if not provided.
             // Add-on Volume requests may or may not specify a base.
             if (!isVolumeRequest && baseVfModuleId == null) {
-                LOGGER.debug ("WARNING:  Add-on Module request - no Base Module ID provided");
+                logger.debug("WARNING:  Add-on Module request - no Base Module ID provided");
             }
 
             // Need to verify if multicloud needs to have the vaseVfModuleId passed to it.  Ignoring this for now.
@@ -871,31 +893,34 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                    VduInstance baseVdu = null;
                    try {
                        baseVdu = vduPlugin.queryVdu (cloudInfo, baseVfModuleId);
-                       LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Success response from VduPlugin", "VDU", "QueryVdu(Base)", baseVfModuleId);
                    }
                    catch (MsoException me) {
                        // Failed to query the Base VF Module due to a Vdu Plugin exception.
                        String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + me ;
-                       LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, baseVfModuleId, cloudSiteId, tenantId, "VDU", "queryVdu(Base)", MsoLogger.ErrorCode.DataError, "Exception - queryVdu(Base)", me);
-                       LOGGER.recordMetricEvent (subStartTime2, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "QueryVdu(Base)", baseVfModuleId);
-                       LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
-
-                       // Convert to a generic VnfException
+                  logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
+                      cloudSiteId, tenantId, "VDU", "queryVdu(Base)", MsoLogger.ErrorCode.DataError.getValue(),
+                      "Exception - queryVdu(Base)", me);
+                  logger.debug(error);
+                  // Convert to a generic VnfException
                        me.addContext ("CreateVFModule(QueryBase)");
                        throw new VnfException (me);
                    }
 
-                       if (baseVdu == null || baseVdu.getStatus().getState() == VduStateType.NOTFOUND) {
-                           String error = "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudSiteId + "/" + tenantId + " USER ERROR"  ;
-                           LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, baseVfModuleId, cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)", MsoLogger.ErrorCode.BusinessProcesssError, "Create VFModule: Base Module DOES NOT EXIST");
-                       LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.Conflict, error);
-                           LOGGER.debug(error);
-                           throw new VnfException (error, MsoExceptionCategory.USERDATA);
-                       } else {
-                               LOGGER.debug("Found base module");
-                               baseModuleOutputs = baseVdu.getOutputs();
-                               this.sendMapToDebug(baseModuleOutputs, "baseModuleOutputs");
-                       }
+                if (baseVdu == null || baseVdu.getStatus().getState() == VduStateType.NOTFOUND) {
+                    String error =
+                        "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudSiteId + "/"
+                            + tenantId + " USER ERROR";
+                    logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
+                        cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)",
+                        MsoLogger.ErrorCode.BusinessProcesssError.getValue(),
+                        "Create VFModule: Base Module DOES NOT EXIST");
+                    logger.debug(error);
+                    throw new VnfException(error, MsoExceptionCategory.USERDATA);
+                } else {
+                    logger.debug("Found base module");
+                    baseModuleOutputs = baseVdu.getOutputs();
+                    this.sendMapToDebug(baseModuleOutputs, "baseModuleOutputs");
+                }
             }
         }
 
@@ -917,21 +942,23 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                }
 
                if (heatTemplate == null) {
-                       String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType=" + requestType;
-                       LOGGER.error(MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Template ID", vfModuleType, "VNF", "", MsoLogger.ErrorCode.DataError, error);
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);                       
-                       throw new VnfException(error, MsoExceptionCategory.INTERNAL);
-               } else {
-                       LOGGER.debug ("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate());
-               }
+        String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType + ", reqType="
+            + requestType;
+        logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID", vfModuleType,
+            "VNF", MsoLogger.ErrorCode.DataError.getValue(), error);
+        logger.debug(error);
+        throw new VnfException(error, MsoExceptionCategory.INTERNAL);
+    } else {
+        logger.debug("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate());
+    }
 
         if (heatEnvironment == null) {
-           String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
-                LOGGER.error (MessageEnum.RA_VNF_UNKNOWN_PARAM, "Heat Environment ID", "OpenStack", "", MsoLogger.ErrorCode.DataError, error);
-                LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, error);
-                throw new VnfException (error, MsoExceptionCategory.INTERNAL);
+            String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType;
+            logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
+                "OpenStack", MsoLogger.ErrorCode.DataError.getValue(), error);
+            throw new VnfException(error, MsoExceptionCategory.INTERNAL);
         } else {
-            LOGGER.debug ("Got Heat Environment from DB: " + heatEnvironment.getEnvironment());
+            logger.debug("Got Heat Environment from DB: " + heatEnvironment.getEnvironment());
         }
 
 
@@ -954,7 +981,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                        HashMap<String, HeatTemplateParam> params = new HashMap<String, HeatTemplateParam>();
 
                        Set<HeatTemplateParam> paramSet = heatTemplate.getParameters();
-                       LOGGER.debug("paramSet has " + paramSet.size() + " entries");
+                       logger.debug("paramSet has " + paramSet.size() + " entries");
 
                        for (HeatTemplateParam htp : paramSet) {
                                params.put(htp.getParamName(), htp);
@@ -974,7 +1001,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                                                goldenInputs.put(key, value);
                                        }
                                        else {
-                                               LOGGER.debug("Failed to convert input " + key + "='" + inputs.get(key) + "' to " + params.get(key).getParamType());
+                                               logger.debug("Failed to convert input " + key + "='" + inputs.get(key) + "' to " + params.get(key)
+                .getParamType());
                                        }
                                } else {
                                        extraInputs.add(key);
@@ -994,7 +1022,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                                                }
                                        }
                                }
-                               LOGGER.debug("Ignoring extra inputs: " + extraInputs);
+                               logger.debug("Ignoring extra inputs: " + extraInputs);
                        }
 
                        // Next add in Volume Group Outputs if there are any.  Copy directly without conversions.
@@ -1028,12 +1056,13 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                 String propertyString = this.environment.getProperty(MsoVnfPluginAdapterImpl.CHECK_REQD_PARAMS);
                 if ("false".equalsIgnoreCase (propertyString) || "n".equalsIgnoreCase (propertyString)) {
                     checkRequiredParameters = false;
-                    LOGGER.debug ("CheckRequiredParameters is FALSE. Will still check but then skip blocking..."
+                    logger.debug("CheckRequiredParameters is FALSE. Will still check but then skip blocking..."
                                   + MsoVnfPluginAdapterImpl.CHECK_REQD_PARAMS);
                 }
             } catch (Exception e) {
                 // No problem - default is true
-                LOGGER.debug ("An exception occured trying to get property " + MsoVnfPluginAdapterImpl.CHECK_REQD_PARAMS, e);
+                logger.debug ("An exception occured trying to get property " + MsoVnfPluginAdapterImpl.CHECK_REQD_PARAMS,
+                    e);
             }
 
             // Do the actual parameter checking.
@@ -1046,10 +1075,10 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
             for (HeatTemplateParam parm : heatTemplate.getParameters ()) {
                 if (parm.isRequired () && (!goldenInputs.containsKey (parm.getParamName ()))) {
                     if (mhee != null && mhee.containsParameter(parm.getParamName())) {
-                        LOGGER.debug ("Required parameter " + parm.getParamName ()
+                        logger.debug ("Required parameter " + parm.getParamName ()
                                       + " appears to be in environment - do not count as missing");
                     } else {
-                           LOGGER.debug ("adding to missing parameters list: " + parm.getParamName ());
+                           logger.debug("adding to missing parameters list: " + parm.getParamName ());
                            if (missingParams == null) {
                                missingParams = parm.getParamName ();
                            } else {
@@ -1059,19 +1088,22 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                 }
             }
 
-            if (missingParams != null) {
-               if (checkRequiredParameters) {
-                       // Problem - missing one or more required parameters
-                       String error = "Create VFModule: Missing Required inputs: " + missingParams;
-                       LOGGER.error (MessageEnum.RA_MISSING_PARAM, missingParams, "VDU", "", MsoLogger.ErrorCode.DataError, "Create VFModule: Missing Required inputs");
-                    LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, error);
-                       throw new VnfException (error, MsoExceptionCategory.USERDATA);
-               } else {
-                       LOGGER.debug ("found missing parameters [" + missingParams + "] - but checkRequiredParameters is false - will not block");
-               }
+        if (missingParams != null) {
+            if (checkRequiredParameters) {
+                // Problem - missing one or more required parameters
+                String error = "Create VFModule: Missing Required inputs: " + missingParams;
+                logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "VDU",
+                    MsoLogger.ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
+                logger.debug(error);
+                throw new VnfException(error, MsoExceptionCategory.USERDATA);
             } else {
-                LOGGER.debug ("No missing parameters found - ok to proceed");
+                logger.debug(
+                    "found missing parameters [" + missingParams + "] - but checkRequiredParameters is false - "
+                        + "will not block");
             }
+        } else {
+            logger.debug("No missing parameters found - ok to proceed");
+        }
 
                } // NOTE: END PARAMETER CHECKING
 
@@ -1080,45 +1112,41 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
         long instantiateVduStartTime = System.currentTimeMillis ();
         if (backout == null) backout = true;
 
-               try {
-                       // Construct the VDU Model structure to pass to the targeted VduPlugin
-                       VduModelInfo vduModel = null;
-                       if (! isVolumeRequest) {
-                               vduModel = vduMapper.mapVfModuleCustomizationToVdu(vfModuleCust);
-                       } else {
-                               vduModel = vduMapper.mapVfModuleCustVolumeToVdu(vfModuleCust);
-                       }
+        try {
+            // Construct the VDU Model structure to pass to the targeted VduPlugin
+            VduModelInfo vduModel = null;
+            if (!isVolumeRequest) {
+                vduModel = vduMapper.mapVfModuleCustomizationToVdu(vfModuleCust);
+            } else {
+                vduModel = vduMapper.mapVfModuleCustVolumeToVdu(vfModuleCust);
+            }
 
-                       // Invoke the VduPlugin to instantiate the VF Module
-                       vduInstance = vduPlugin.instantiateVdu(cloudInfo, vfModuleName, goldenInputs, vduModel, backout);
+            // Invoke the VduPlugin to instantiate the VF Module
+            vduInstance = vduPlugin.instantiateVdu(cloudInfo, vfModuleName, goldenInputs, vduModel, backout);
 
-            LOGGER.recordMetricEvent (instantiateVduStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from VduPlugin", "VDU", "instantiateVdu", vfModuleName);
-               }
-               catch (VduException me) {
+        } catch (VduException me) {
             // Failed to instantiate the VDU.
-            me.addContext ("CreateVFModule");
+            me.addContext("CreateVFModule");
             String error = "Create VF Module " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + me;
-            LOGGER.recordMetricEvent (instantiateVduStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "instantiateVdu", vfModuleName);
-            LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, "VDU", "", MsoLogger.ErrorCode.DataError, "MsoException - instantiateVdu", me);
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+            logger.error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
+                tenantId, "VDU", MsoLogger.ErrorCode.DataError.getValue(), "MsoException - instantiateVdu", me);
+            logger.debug(error);
             // Convert to a generic VnfException
-            throw new VnfException (me);
+            throw new VnfException(me);
+        } catch (NullPointerException npe) {
+            String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + npe;
+            logger.error("{} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudSiteId,
+                tenantId, "VDU", MsoLogger.ErrorCode.DataError.getValue(), "NullPointerException - instantiateVdu",
+                npe);
+            logger.debug(error);
+            logger.debug("NULL POINTER EXCEPTION at vduPlugin.instantiateVdu", npe);
+            throw new VnfException("NullPointerException during instantiateVdu");
+        } catch (Exception e) {
+            String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + e;
+            logger.debug("Unhandled exception at vduPlugin.instantiateVdu", e);
+            logger.debug(error);
+            throw new VnfException("Exception during instantiateVdu: " + e.getMessage());
         }
-           catch (NullPointerException npe) {
-               String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + npe;
-               LOGGER.recordMetricEvent (instantiateVduStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error, "VDU", "instantiateVdu", vfModuleName);
-               LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, vfModuleType, cloudSiteId, tenantId, "VDU", "", MsoLogger.ErrorCode.DataError, "NullPointerException - instantiateVdu", npe);
-               LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, error);
-               LOGGER.debug("NULL POINTER EXCEPTION at vduPlugin.instantiateVdu", npe);
-               throw new VnfException ("NullPointerException during instantiateVdu");
-           }
-               catch (Exception e) {
-               String error = "Create VFModule " + vfModuleType + " in " + cloudSiteId + "/" + tenantId + ": " + e;
-               LOGGER.recordMetricEvent (instantiateVduStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, error, "VDU", "instantiateVdu", vfModuleName);
-               LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, error);
-               LOGGER.debug("Unhandled exception at vduPlugin.instantiateVdu", e);
-               throw new VnfException("Exception during instantiateVdu: " + e.getMessage());
-           }
 
 
         // Reach this point if create is successful.
@@ -1130,8 +1158,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
 
         rollback.value = vfRollback;
 
-        LOGGER.debug ("VF Module " + vfModuleName + " successfully created");
-        LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully create VF Module");
+        logger.debug("VF Module " + vfModuleName + " successfully created");
         return;
     }
 
@@ -1145,7 +1172,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
         MsoLogger.setLogContext (msoRequest);
        MsoLogger.setServiceName ("DeleteVfModule");
 
-        LOGGER.debug ("Deleting VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId);
+        logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudSiteId + "/" + tenantId);
         // Will capture execution time for metrics
         long startTime = System.currentTimeMillis ();
 
@@ -1158,18 +1185,17 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
 
        try {
                vduInstance = vduPlugin.queryVdu (cloudInfo, vfModuleId);
-            LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received VDU Query response", "VDU", "QueryVDU", vfModuleId);
        }
        catch (VduException e) {
-            // Failed to query the VDU due to a plugin exception.
-            // Convert to a generic VnfException
-            e.addContext ("QueryVFModule");
-            String error = "Query VfModule (VDU): " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + e;
-            LOGGER.recordMetricEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "VDU", "QueryVNF", vfModuleId);
-            LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR, vfModuleId, cloudSiteId, tenantId, "VDU", "QueryVFModule", MsoLogger.ErrorCode.DataError, "Exception - queryVDU", e);
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
-            throw new VnfException (e);
-       }
+          // Failed to query the VDU due to a plugin exception.
+          // Convert to a generic VnfException
+          e.addContext("QueryVFModule");
+          String error = "Query VfModule (VDU): " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + e;
+          logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudSiteId,
+              tenantId, "VDU", "QueryVFModule", MsoLogger.ErrorCode.DataError.getValue(), "Exception - queryVDU", e);
+          logger.debug(error);
+          throw new VnfException(e);
+      }
 
         // call method which handles the conversion from Map<String,Object> to Map<String,String> for our expected Object types
         outputs.value = convertMapStringObjectToStringString(vduInstance.getOutputs());
@@ -1184,19 +1210,18 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
         try {
                // TODO:  Get an appropriate timeout value - require access to the model
             vduPlugin.deleteVdu(cloudInfo, vfModuleId, 5);
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from deleteVdu", "VDU", "DeleteVdu", vfModuleId);
         } catch (VduException me) {
             me.addContext ("DeleteVfModule");
             // Convert to a generic VnfException
             String error = "Delete VF: " + vfModuleId + " in " + cloudSiteId + "/" + tenantId + ": " + me;
-            LOGGER.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error, "DeleteVdu", "DeleteVdu", vfModuleId);
-            LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, vfModuleId, cloudSiteId, tenantId, "VDU", "DeleteVdu", MsoLogger.ErrorCode.DataError, "Exception - DeleteVdu: " + me.getMessage());
-            LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, error);
+            logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudSiteId,
+                tenantId, "VDU", "DeleteVdu", MsoLogger.ErrorCode.DataError.getValue(),
+                "Exception - DeleteVdu: " + me.getMessage());
+            logger.debug(error);
             throw new VnfException (me);
         }
 
         // On success, nothing is returned.
-        LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully delete VF");
         return;
     }
 
@@ -1218,8 +1243,8 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                            Holder <VnfRollback> rollback) throws VnfException
         {
                // This operation is not currently supported for VduPlugin-orchestrated VF Modules.
-               LOGGER.debug ("Update VF Module command attempted but not supported");
-               throw new VnfException ("UpdateVfModule:  Unsupported command", MsoExceptionCategory.USERDATA);
+            logger.debug("Update VF Module command attempted but not supported");
+            throw new VnfException ("UpdateVfModule:  Unsupported command", MsoExceptionCategory.USERDATA);
         }
 
     /*
@@ -1240,7 +1265,7 @@ public class MsoVnfPluginAdapterImpl implements MsoVnfAdapter {
                        return heatUtils;
                }
             if (orchestrator.equalsIgnoreCase("MULTICLOUD")) {
-                LOGGER.debug ("Got MulticloudUtils for vduPlugin");
+                logger.debug ("Got MulticloudUtils for vduPlugin");
                 return multicloudUtils; }
        }
         // Default - return HEAT plugin, though will fail later
index ef20738..1a11406 100644 (file)
@@ -6,6 +6,7 @@
  * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
  * ================================================================================
  * Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -60,6 +61,8 @@ import org.onap.so.logger.MsoLogger;
 import org.onap.so.openstack.beans.VnfRollback;
 import org.onap.so.openstack.beans.VnfStatus;
 import org.onap.so.openstack.exceptions.MsoExceptionCategory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
@@ -81,7 +84,7 @@ import io.swagger.annotations.ApiResponses;
 @Transactional
 @Component
 public class VnfAdapterRest {
-       private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, VnfAdapterRest.class);
+       private static Logger logger = LoggerFactory.getLogger(VnfAdapterRest.class);
        private static final String TESTING_KEYWORD = "___TESTING___";
        private static final String RESP=", resp=";
 
@@ -130,9 +133,9 @@ public class VnfAdapterRest {
                @ApiParam(value = "DeleteVfModuleRequest", required = true)
                final DeleteVfModuleRequest req)
        {
-               LOGGER.debug("Delete VfModule enter: " + req.toJsonString());
+               logger.debug("Delete VfModule enter: " + req.toJsonString());
                if (aaiVnfId == null || !aaiVnfId.equals(req.getVnfId())) {
-                       LOGGER.debug("Req rejected - aaiVnfId not provided or doesn't match URL");
+                       logger.debug("Req rejected - aaiVnfId not provided or doesn't match URL");
                        return Response
                                .status(HttpStatus.SC_BAD_REQUEST)
                                .type(MediaType.TEXT_PLAIN)
@@ -140,7 +143,7 @@ public class VnfAdapterRest {
                                .build();
                }
                if (aaiVfModuleId == null || !aaiVfModuleId.equals(req.getVfModuleId())) {
-                       LOGGER.debug("Req rejected - aaiVfModuleId not provided or doesn't match URL");
+                       logger.debug("Req rejected - aaiVfModuleId not provided or doesn't match URL");
                        return Response
                                .status(HttpStatus.SC_BAD_REQUEST)
                                .type(MediaType.TEXT_PLAIN)
@@ -162,11 +165,12 @@ public class VnfAdapterRest {
                                t1.start();
                        } catch (Exception e) {
                                // problem handling delete, send generic failure as sync resp to caller
-                               LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, "", "deleteVfModule", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in deleteVfModule", e);
+                               logger.error("", MessageEnum.RA_DELETE_VNF_ERR.toString(), "deleteVfModule",
+                                       MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in deleteVfModule", e);
                                return Response.serverError().build();
                        }
                        // send sync response (ACK) to caller
-                       LOGGER.debug ("deleteVNFVolumes exit");
+                       logger.debug("deleteVNFVolumes exit");
                        return Response.status(HttpStatus.SC_ACCEPTED).build();
                }
        }
@@ -208,14 +212,15 @@ public class VnfAdapterRest {
                                }
                                response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE, req.getMessageId(), outputs.value);
                        } catch (VnfException e) {
-                               LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "VnfException - Delete VNF Module", e);
+                               logger.error("{} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(),
+                                       MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "VnfException - Delete VNF Module", e);
                                eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId());
                        }
                        if (!req.isSynchronous()) {
                                BpelRestClient bpelClient = bpelRestClientProvider.get();
                                bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
                        }
-                       LOGGER.debug ("Delete vfModule exit: code=" + getStatusCode() + RESP+ getResponse());
+                       logger.debug("Delete vfModule exit: code=" + getStatusCode() + RESP + getResponse());
                }
        }
 
@@ -261,7 +266,7 @@ public class VnfAdapterRest {
                @QueryParam("msoRequest.serviceInstanceId") String serviceInstanceId)
        {
                //This request responds synchronously only
-               LOGGER.debug ("Query vfModule enter:" + vfModuleName);
+               logger.debug("Query vfModule enter:" + vfModuleName);
                MsoRequest msoRequest = new MsoRequest(requestId, serviceInstanceId);
 
                try {
@@ -273,21 +278,22 @@ public class VnfAdapterRest {
                        Holder<Map<String, String>> outputs = new Holder <> ();
                        vnfAdapter.queryVnf (cloudSiteId, tenantId, vfModuleName, msoRequest, vnfExists, vfModuleId, status, outputs);
                        if (!vnfExists.value) {
-                               LOGGER.debug ("vfModule not found");
+                               logger.debug("vfModule not found");
                                respStatus = HttpStatus.SC_NOT_FOUND;
                        } else {
-                               LOGGER.debug ("vfModule found" + vfModuleId.value + ", status=" + status.value);
+                               logger.debug("vfModule found" + vfModuleId.value + ", status=" + status.value);
                                qryResp.setVfModuleId(vfModuleId.value);
                                qryResp.setVnfStatus(status.value);
                                qryResp.setVfModuleOutputs(outputs.value);
                        }
-                       LOGGER.debug ("Query vfModule exit");
+                       logger.debug("Query vfModule exit");
                        return Response
                                .status(respStatus)
                                .entity(new GenericEntity<QueryVfModuleResponse>(qryResp) {})
                                .build();
                } catch (VnfException e) {
-                       LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR,  vfModuleName, "", "queryVfModule", MsoLogger.ErrorCode.BusinessProcesssError, "VnfException - queryVfModule", e);
+                       logger.error("{} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
+                               MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e);
                        VfModuleExceptionResponse excResp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null);
                        return Response
                                .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
@@ -340,9 +346,9 @@ public class VnfAdapterRest {
                @ApiParam(value = "CreateVfModuleRequest", required = true)
                final CreateVfModuleRequest req)
        {
-               LOGGER.debug("Create VfModule enter inside VnfAdapterRest: " + req.toJsonString());
+               logger.debug("Create VfModule enter inside VnfAdapterRest: " + req.toJsonString());
                if (aaiVnfId == null || !aaiVnfId.equals(req.getVnfId())) {
-                       LOGGER.debug("Req rejected - aaiVnfId not provided or doesn't match URL");
+                       logger.debug("Req rejected - aaiVnfId not provided or doesn't match URL");
                        return Response
                                .status(HttpStatus.SC_BAD_REQUEST)
                                .type(MediaType.TEXT_PLAIN)
@@ -364,11 +370,12 @@ public class VnfAdapterRest {
                                t1.start();
                        } catch (Exception e) {
                                // problem handling create, send generic failure as sync resp to caller
-                               LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, "", "createVfModule", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - createVfModule", e);
+                               logger.error("{} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR, "createVfModule",
+                                       MsoLogger.ErrorCode.BusinessProcesssError, "Exception - createVfModule", e);
                                return Response.serverError().build();
                        }
                        // send sync response (ACK) to caller
-                       LOGGER.debug ("createVfModule exit");
+                       logger.debug("createVfModule exit");
                        return Response.status(HttpStatus.SC_ACCEPTED).build();
                }
        }
@@ -401,14 +408,14 @@ public class VnfAdapterRest {
 
                @Override
                public void run() {
-                       LOGGER.debug ("CreateVfModuleTask start");
+                       logger.debug ("CreateVfModuleTask start");
                        try {
                                // Synchronous Web Service Outputs
                                Holder <String> vfModuleStackId = new Holder <> ();
                                Holder <Map <String, String>> outputs = new Holder <> ();
                                Holder <VnfRollback> vnfRollback = new Holder <> ();
                                String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
-                               LOGGER.debug("completeVnfVfModuleType=" + completeVnfVfModuleType);
+                               logger.debug("completeVnfVfModuleType=" + completeVnfVfModuleType);
                                String cloudsite = req.getCloudSiteId();
                                if (cloudsite != null && cloudsite.equals(TESTING_KEYWORD)) {
                                        String tenant = req.getTenantId();
@@ -460,14 +467,14 @@ public class VnfAdapterRest {
                                response = new CreateVfModuleResponse(req.getVnfId(), req.getVfModuleId(),
                                                vfModuleStackId.value, Boolean.TRUE, outputs.value, modRollback, req.getMessageId());
                        } catch (VnfException e) {
-                               LOGGER.debug("Exception :",e);
+                               logger.debug("Exception :",e);
                                eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId());
                        }
                        if (!req.isSynchronous()) {
                                BpelRestClient bpelClient = bpelRestClientProvider.get();
                                bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
                        }
-                       LOGGER.debug ("CreateVfModuleTask exit: code=" + getStatusCode() + RESP+ getResponse());
+                       logger.debug("CreateVfModuleTask exit: code=" + getStatusCode() + RESP + getResponse());
                }
        }
 
@@ -490,7 +497,7 @@ public class VnfAdapterRest {
                        @ApiParam(value = "UpdateVfModuleRequest", required = true)
                        final UpdateVfModuleRequest req)
        {
-               LOGGER.debug("Update VfModule enter: " + req.toJsonString());
+               logger.debug("Update VfModule enter: " + req.toJsonString());
                UpdateVfModulesTask task = new UpdateVfModulesTask(req);
                if (req.isSynchronous()) {
                        // This is a synchronous request
@@ -506,11 +513,12 @@ public class VnfAdapterRest {
                        t1.start();
                } catch (Exception e) {
                        // problem handling create, send generic failure as sync resp to caller
-                       LOGGER.error (MessageEnum.RA_UPDATE_VNF_ERR, "", "updateVfModule", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - updateVfModule", e);
-                       return Response.serverError().build();
+                                       logger.error("{} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule",
+                                               MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e);
+                                       return Response.serverError().build();
                }
                // send sync response (ACK) to caller
-               LOGGER.debug ("updateVfModules exit");
+               logger.debug("updateVfModules exit");
                return Response.status(HttpStatus.SC_ACCEPTED).build();
                }
        }
@@ -550,7 +558,7 @@ public class VnfAdapterRest {
                                Holder <Map <String, String>> outputs = new Holder <> ();
                                Holder <VnfRollback> vnfRollback = new Holder <> ();
                                String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
-                               LOGGER.debug("in updateVf - completeVnfVfModuleType=" + completeVnfVfModuleType);
+                               logger.debug("in updateVf - completeVnfVfModuleType=" + completeVnfVfModuleType);
 
                                vnfAdapter.updateVfModule (req.getCloudSiteId(),
                                                req.getTenantId(),
@@ -571,7 +579,7 @@ public class VnfAdapterRest {
                                response = new UpdateVfModuleResponse(req.getVnfId(), req.getVfModuleId(),
                                                vfModuleStackId.value, outputs.value, req.getMessageId());
                        } catch (VnfException e) {
-                               LOGGER.debug("Exception :",e);
+                               logger.debug("Exception :",e);
                                eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId());
                        }
                        if (!req.isSynchronous()) {
@@ -579,7 +587,7 @@ public class VnfAdapterRest {
                                BpelRestClient bpelClient = bpelRestClientProvider.get();
                                bpelClient.bpelPost (getResponse(), req.getNotificationUrl(), sendxml);
                        }
-                       LOGGER.debug ("Update VfModule exit: code=" + getStatusCode() + RESP+ getResponse());
+                       logger.debug("Update VfModule exit: code=" + getStatusCode() + RESP + getResponse());
                }
        }
        /*
@@ -620,7 +628,7 @@ public class VnfAdapterRest {
                        //@QueryParam("rollback") String rollback,
                        final RollbackVfModuleRequest req)
        {
-               LOGGER.debug("Rollback VfModule enter: " + req.toJsonString());
+               logger.debug("Rollback VfModule enter: " + req.toJsonString());
                RollbackVfModulesTask task = new RollbackVfModulesTask(req);
                if (req.isSynchronous()) {
                        // This is a synchronous request
@@ -636,11 +644,12 @@ public class VnfAdapterRest {
                        t1.start();
                } catch (Exception e) {
                        // problem handling create, send generic failure as sync resp to caller
-                       LOGGER.error (MessageEnum.RA_ROLLBACK_VNF_ERR, "", "rollbackVfModule", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - rollbackVfModule", e);
-                       return Response.serverError().build();
+                                       logger.error("{} {} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule",
+                                               MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e);
+                                       return Response.serverError().build();
                }
                // send sync response (ACK) to caller
-               LOGGER.debug ("rollbackVfModule exit");
+               logger.debug("rollbackVfModule exit");
                return Response.status(HttpStatus.SC_ACCEPTED).build();
                }
        }
@@ -680,7 +689,8 @@ public class VnfAdapterRest {
                                vnfAdapter.rollbackVnf (vrb);
                                response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId());
                        } catch (VnfException e) {
-                               LOGGER.error (MessageEnum.RA_ROLLBACK_VNF_ERR, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - rollbackVfModule", e);
+                               logger.error("{} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR, MsoLogger.ErrorCode.BusinessProcesssError,
+                                       "Exception" + " - " + "rollbackVfModule", e);
                                eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false, req.getMessageId());
                        }
                        if (!req.isSynchronous()) {
@@ -688,7 +698,7 @@ public class VnfAdapterRest {
                                BpelRestClient bpelClient = bpelRestClientProvider.get();
                                bpelClient.bpelPost (getResponse(), req.getNotificationUrl(), sendxml);
                        }
-                       LOGGER.debug ("RollbackVfModulesTask exit: code=" + getStatusCode() + RESP+ getResponse());
+                       logger.debug("RollbackVfModulesTask exit: code=" + getStatusCode() + RESP + getResponse());
                }
        }
-}
\ No newline at end of file
+}
index c332c49..8c96acc 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
  * 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
@@ -24,14 +26,15 @@ import java.util.Optional;
 
 import org.onap.so.cloud.CloudConfig;
 import org.onap.so.db.catalog.beans.CloudSite;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 @Component
 public class VnfAdapterRestUtils
 {
-       private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, VnfAdapterRestUtils.class);
+       private static Logger logger = LoggerFactory.getLogger(VnfAdapterRestUtils.class);
 
        private static final String HEAT_MODE = "HEAT";
        private static final String CLOUDIFY_MODE = "CLOUDIFY";
@@ -59,7 +62,7 @@ public class VnfAdapterRestUtils
                // If was explicitly provided as a parameter, use that.  Else if specified for the
                // cloudsite, use that.  Otherwise, the default is the (original) HEAT-based impl.
 
-               LOGGER.debug ("Entered GetVnfAdapterImpl: mode=" + mode + ", cloudSite=" + cloudSiteId);
+               logger.debug("Entered GetVnfAdapterImpl: mode=" + mode + ", cloudSite=" + cloudSiteId);
 
                if (mode == null) {
                        // Didn't get an explicit mode type requested.
@@ -67,7 +70,7 @@ public class VnfAdapterRestUtils
                        // has a CloudifyManager assigned to it
                        Optional<CloudSite> cloudSite = cloudConfig.getCloudSite(cloudSiteId);
                        if (cloudSite.isPresent()) {
-                               LOGGER.debug("Got CloudSite: " + cloudSite.toString());
+                               logger.debug("Got CloudSite: " + cloudSite.toString());
                                if (cloudConfig.getCloudifyManager(cloudSite.get().getCloudifyId()) != null) {
                                        mode = CLOUDIFY_MODE;
                                } else if (MULTICLOUD_MODE.equalsIgnoreCase(cloudSite.get().getOrchestrator())) {
@@ -79,26 +82,26 @@ public class VnfAdapterRestUtils
                        }
                }
 
-               LOGGER.debug ("GetVnfAdapterImpl: mode=" + mode);
+               logger.debug ("GetVnfAdapterImpl: mode=" + mode);
 
                MsoVnfAdapter vnfAdapter = null;
 
                // TODO:  Make this more dynamic (e.g. Service Loader)
                if (CLOUDIFY_MODE.equalsIgnoreCase(mode)) {
-                       LOGGER.debug ("GetVnfAdapterImpl: Return Cloudify Adapter");
+                       logger.debug("GetVnfAdapterImpl: Return Cloudify Adapter");
                        vnfAdapter = cloudifyImpl;
                }
                else if (HEAT_MODE.equalsIgnoreCase(mode)) {
-                       LOGGER.debug ("GetVnfAdapterImpl: Return Heat Adapter");
+                       logger.debug("GetVnfAdapterImpl: Return Heat Adapter");
                        vnfAdapter = vnfImpl;
                }
                else if (MULTICLOUD_MODE.equalsIgnoreCase(mode)) {
-                       LOGGER.debug ("GetVnfAdapterImpl: Return Plugin (multicloud) Adapter");
+                       logger.debug("GetVnfAdapterImpl: Return Plugin (multicloud) Adapter");
                        vnfAdapter = vnfPluginImpl;
                }
                else {
                        // Don't expect this, but default is the HEAT adapter
-                       LOGGER.debug ("GetVnfAdapterImpl: Return Default (Heat) Adapter");
+                       logger.debug("GetVnfAdapterImpl: Return Default (Heat) Adapter");
                        vnfAdapter = vnfImpl;
                }
 
index a3d7c59..81989a6 100644 (file)
@@ -5,6 +5,7 @@
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Modifications Copyright (C) 2018 IBM.
+ * Modifications Copyright (c) 2019 Samsung
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -59,6 +60,8 @@ import org.onap.so.logger.MsoLogger;
 import org.onap.so.openstack.beans.VnfRollback;
 import org.onap.so.openstack.beans.VnfStatus;
 import org.onap.so.openstack.exceptions.MsoExceptionCategory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -81,7 +84,7 @@ import io.swagger.annotations.ApiResponses;
 @Api(value = "/v2/vnfs", description = "root of vnf adapters restful web service v2")
 @Component
 public class VnfAdapterRestV2 {
-       private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, VnfAdapterRestV2.class);
+       private static Logger logger = LoggerFactory.getLogger(VnfAdapterRestV2.class);
        private static final String TESTING_KEYWORD = "___TESTING___";
        private static final String RESP=", resp=";
 
@@ -130,9 +133,9 @@ public class VnfAdapterRestV2 {
                @ApiParam(value = "DeleteVfModuleRequest", required = true)
                final DeleteVfModuleRequest req)
        {
-               LOGGER.debug("Delete VfModule enter: " + req.toJsonString());
+               logger.debug("Delete VfModule enter: " + req.toJsonString());
                if (aaiVnfId == null || !aaiVnfId.equals(req.getVnfId())) {
-                       LOGGER.debug("Req rejected - aaiVnfId not provided or doesn't match URL");
+                       logger.debug("Req rejected - aaiVnfId not provided or doesn't match URL");
                        return Response
                                .status(HttpStatus.SC_BAD_REQUEST)
                                .type(MediaType.TEXT_PLAIN)
@@ -140,7 +143,7 @@ public class VnfAdapterRestV2 {
                                .build();
                }
                if (aaiVfModuleId == null || !aaiVfModuleId.equals(req.getVfModuleId())) {
-                       LOGGER.debug("Req rejected - aaiVfModuleId not provided or doesn't match URL");
+                               logger.debug("Req rejected - aaiVfModuleId not provided or doesn't match URL");
                        return Response
                                .status(HttpStatus.SC_BAD_REQUEST)
                                .type(MediaType.TEXT_PLAIN)
@@ -163,11 +166,12 @@ public class VnfAdapterRestV2 {
                                t1.start();
                        } catch (Exception e) {
                                // problem handling delete, send generic failure as sync resp to caller
-                               LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, "", "deleteVfModule", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in deleteVfModule", e);
+                               logger.error("{} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), "deleteVfModule",
+                                       MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception in deleteVfModule", e);
                                return Response.serverError().build();
                        }
                        // send sync response (ACK) to caller
-                       LOGGER.debug ("deleteVNFVolumes exit");
+                       logger.debug("deleteVNFVolumes exit");
                        return Response.status(HttpStatus.SC_ACCEPTED).build();
                }
        }
@@ -213,14 +217,15 @@ public class VnfAdapterRestV2 {
                                }
                                response = new DeleteVfModuleResponse(req.getVnfId(), req.getVfModuleId(), Boolean.TRUE, req.getMessageId(), outputs.value);
                        } catch (VnfException e) {
-                               LOGGER.error (MessageEnum.RA_DELETE_VNF_ERR, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "VnfException - Delete VNF Module", e);
+                               logger.error("{} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(),
+                                       MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "VnfException - " + "Delete VNF Module", e);
                                eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.TRUE, req.getMessageId());
                        }
                        if (!req.isSynchronous()) {
                                BpelRestClient bpelClient = bpelRestClientProvider.get();
                                bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
                        }
-                       LOGGER.debug ("Delete vfModule exit: code=" + getStatusCode() + RESP+ getResponse());
+                       logger.debug("Delete vfModule exit: code=" + getStatusCode() + RESP + getResponse());
                }
        }
 
@@ -268,7 +273,7 @@ public class VnfAdapterRestV2 {
                @QueryParam("mode") String mode)
        {
                //This request responds synchronously only
-               LOGGER.debug ("Query vfModule enter:" + vfModuleName);
+               logger.debug("Query vfModule enter:" + vfModuleName);
                MsoRequest msoRequest = new MsoRequest(requestId, serviceInstanceId);
 
                try {
@@ -284,21 +289,22 @@ public class VnfAdapterRestV2 {
                        adapter.queryVnf (cloudSiteId, tenantId, vfModuleName, msoRequest, vnfExists, vfModuleId, status, outputs);
 
                        if (!vnfExists.value) {
-                               LOGGER.debug ("vfModule not found");
+                               logger.debug("vfModule not found");
                                respStatus = HttpStatus.SC_NOT_FOUND;
                        } else {
-                               LOGGER.debug ("vfModule found" + vfModuleId.value + ", status=" + status.value);
+                               logger.debug("vfModule found" + vfModuleId.value + ", status=" + status.value);
                                qryResp.setVfModuleId(vfModuleId.value);
                                qryResp.setVnfStatus(status.value);
                                qryResp.setVfModuleOutputs(outputs.value);
                        }
-                       LOGGER.debug ("Query vfModule exit");
+                       logger.debug ("Query vfModule exit");
                        return Response
                                .status(respStatus)
                                .entity(new GenericEntity<QueryVfModuleResponse>(qryResp) {})
                                .build();
                } catch (VnfException e) {
-                       LOGGER.error (MessageEnum.RA_QUERY_VNF_ERR,  vfModuleName, "", "queryVfModule", MsoLogger.ErrorCode.BusinessProcesssError, "VnfException - queryVfModule", e);
+                       logger.error("{} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, "queryVfModule",
+                               MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "VnfException - queryVfModule", e);
                        VfModuleExceptionResponse excResp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, Boolean.FALSE, null);
                        return Response
                                .status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
@@ -353,9 +359,9 @@ public class VnfAdapterRestV2 {
                @ApiParam(value = "CreateVfModuleRequest", required = true)
                final CreateVfModuleRequest req)
        {
-               LOGGER.debug("Create VfModule enter inside VnfAdapterRest: " + req.toJsonString());
+               logger.debug("Create VfModule enter inside VnfAdapterRest: " + req.toJsonString());
                if (aaiVnfId == null || !aaiVnfId.equals(req.getVnfId())) {
-                       LOGGER.debug("Req rejected - aaiVnfId not provided or doesn't match URL");
+                       logger.debug("Req rejected - aaiVnfId not provided or doesn't match URL");
                        return Response
                                .status(HttpStatus.SC_BAD_REQUEST)
                                .type(MediaType.TEXT_PLAIN)
@@ -378,11 +384,12 @@ public class VnfAdapterRestV2 {
                                t1.start();
                        } catch (Exception e) {
                                // problem handling create, send generic failure as sync resp to caller
-                               LOGGER.error (MessageEnum.RA_CREATE_VNF_ERR, "", "createVfModule", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - createVfModule", e);
+                               logger.error("{} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), "createVfModule",
+                                       MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - createVfModule", e);
                                return Response.serverError().build();
                        }
                        // send sync response (ACK) to caller
-                       LOGGER.debug ("createVfModule exit");
+                       logger.debug("createVfModule exit");
                        return Response.status(HttpStatus.SC_ACCEPTED).build();
                }
        }
@@ -417,14 +424,14 @@ public class VnfAdapterRestV2 {
 
                @Override
                public void run() {
-                       LOGGER.debug ("CreateVfModuleTask start");
+                       logger.debug("CreateVfModuleTask start");
                        try {
                                // Synchronous Web Service Outputs
                                Holder <String> vfModuleStackId = new Holder <String> ();
                                Holder <Map <String, String>> outputs = new Holder <Map <String, String>> ();
                                Holder <VnfRollback> vnfRollback = new Holder <VnfRollback> ();
                                String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
-                               LOGGER.debug("completeVnfVfModuleType=" + completeVnfVfModuleType);
+                               logger.debug("completeVnfVfModuleType=" + completeVnfVfModuleType);
 
                                String cloudsiteId = req.getCloudSiteId();
                                if (cloudsiteId != null && cloudsiteId.equals(TESTING_KEYWORD)) {
@@ -470,7 +477,7 @@ public class VnfAdapterRestV2 {
                                BpelRestClient bpelClient = bpelRestClientProvider.get();
                                bpelClient.bpelPost(getResponse(), req.getNotificationUrl(), sendxml);
                        }
-                       LOGGER.debug ("CreateVfModuleTask exit: code=" + getStatusCode() + RESP+ getResponse());
+                       logger.debug("CreateVfModuleTask exit: code=" + getStatusCode() + RESP + getResponse());
                }
        }
 
@@ -495,7 +502,7 @@ public class VnfAdapterRestV2 {
                        @ApiParam(value = "UpdateVfModuleRequest", required = true)
                        final UpdateVfModuleRequest req)
        {
-               LOGGER.debug("Update VfModule enter: " + req.toJsonString());
+               logger.debug("Update VfModule enter: " + req.toJsonString());
                UpdateVfModulesTask task = new UpdateVfModulesTask(req, mode);
                if (req.isSynchronous()) {
                        // This is a synchronous request
@@ -511,11 +518,12 @@ public class VnfAdapterRestV2 {
                        t1.start();
                } catch (Exception e) {
                        // problem handling create, send generic failure as sync resp to caller
-                       LOGGER.error (MessageEnum.RA_UPDATE_VNF_ERR, "", "updateVfModule", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - updateVfModule", e);
-                       return Response.serverError().build();
+                                       logger.error("{} {} {} {}", MessageEnum.RA_UPDATE_VNF_ERR.toString(), "updateVfModule",
+                                               MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - updateVfModule", e);
+                                       return Response.serverError().build();
                }
                // send sync response (ACK) to caller
-               LOGGER.debug ("updateVfModules exit");
+               logger.debug("updateVfModules exit");
                return Response.status(HttpStatus.SC_ACCEPTED).build();
                }
        }
@@ -557,7 +565,7 @@ public class VnfAdapterRestV2 {
                                Holder <Map <String, String>> outputs = new Holder <Map <String, String>> ();
                                Holder <VnfRollback> vnfRollback = new Holder <VnfRollback> ();
                                String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
-                               LOGGER.debug("in updateVf - completeVnfVfModuleType=" + completeVnfVfModuleType);
+                               logger.debug("in updateVf - completeVnfVfModuleType=" + completeVnfVfModuleType);
 
                                String cloudsiteId = req.getCloudSiteId();
 
@@ -588,7 +596,7 @@ public class VnfAdapterRestV2 {
                                BpelRestClient bpelClient = bpelRestClientProvider.get();
                                bpelClient.bpelPost (getResponse(), req.getNotificationUrl(), sendxml);
                        }
-                       LOGGER.debug ("Update VfModule exit: code=" + getStatusCode() + RESP+ getResponse());
+                       logger.debug("Update VfModule exit: code=" + getStatusCode() + RESP + getResponse());
                }
        }
        /*
@@ -629,7 +637,7 @@ public class VnfAdapterRestV2 {
                        //@QueryParam("rollback") String rollback,
                        final RollbackVfModuleRequest req)
        {
-               LOGGER.debug("Rollback VfModule enter: " + req.toJsonString());
+               logger.debug("Rollback VfModule enter: " + req.toJsonString());
                RollbackVfModulesTask task = new RollbackVfModulesTask(req);
                if (req.isSynchronous()) {
                        // This is a synchronous request
@@ -645,11 +653,12 @@ public class VnfAdapterRestV2 {
                        t1.start();
                } catch (Exception e) {
                        // problem handling create, send generic failure as sync resp to caller
-                       LOGGER.error (MessageEnum.RA_ROLLBACK_VNF_ERR, "", "rollbackVfModule", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - rollbackVfModule", e);
-                       return Response.serverError().build();
+                                       logger.error("{} {} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(), "rollbackVfModule",
+                                               MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e);
+                                       return Response.serverError().build();
                }
                // send sync response (ACK) to caller
-               LOGGER.debug ("rollbackVfModule exit");
+               logger.debug("rollbackVfModule exit");
                return Response.status(HttpStatus.SC_ACCEPTED).build();
                }
        }
@@ -693,7 +702,8 @@ public class VnfAdapterRestV2 {
 
                                response = new RollbackVfModuleResponse(Boolean.TRUE, req.getMessageId());
                        } catch (VnfException e) {
-                               LOGGER.error (MessageEnum.RA_ROLLBACK_VNF_ERR, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - rollbackVfModule", e);
+                               logger.error("{} {} {}", MessageEnum.RA_ROLLBACK_VNF_ERR.toString(),
+                                       MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Exception - rollbackVfModule", e);
                                eresp = new VfModuleExceptionResponse(e.getMessage(), MsoExceptionCategory.INTERNAL, false, req.getMessageId());
                        }
                        if (!req.isSynchronous()) {
@@ -701,7 +711,7 @@ public class VnfAdapterRestV2 {
                                BpelRestClient bpelClient = bpelRestClientProvider.get();
                                bpelClient.bpelPost (getResponse(), req.getNotificationUrl(), sendxml);
                        }
-                       LOGGER.debug ("RollbackVfModulesTask exit: code=" + getStatusCode() + RESP+ getResponse());
+                       logger.debug("RollbackVfModulesTask exit: code=" + getStatusCode() + RESP + getResponse());
                }
        }
 }
index 4e8d389..cdd04b8 100644 (file)
@@ -30,8 +30,19 @@ spring:
         ddl-auto: validate
         naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
         enable-lazy-load-no-trans: true
-  
-
+org:
+  onap:
+    so:
+      adapters:
+        default_keystone_url_version: /v2.0
+        default_keystone_reg_ex: "/[vV][0-9]"        
+        po:
+          retryCodes: 504
+          retryDelay: 5
+          retryCount: 3
+          pollTimeout: 7500
+          pollInterval: 15
+          
 #Actuator
 management:
   endpoints:
@@ -40,10 +40,10 @@ import org.springframework.core.env.Environment;
 import com.fasterxml.jackson.core.JsonParseException;
 import com.fasterxml.jackson.databind.JsonMappingException;
 
-public class AuditStackServiceDataTest extends AuditStackServiceData {
+public class AuditCreateStackServiceTest extends AuditCreateStackService {
 
        @InjectMocks
-       AuditStackServiceData auditStackService = new AuditStackServiceData();
+       AuditCreateStackService auditStackService = new AuditCreateStackService();
 
        @Mock
        HeatStackAudit heatStackAuditMock;
@@ -73,14 +73,14 @@ public class AuditStackServiceDataTest extends AuditStackServiceData {
 
        @Test
        public void execute_external_task_audit_success_Test() {
-               doReturn(true).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId", "stackName");
+               doReturn(true).when(heatStackAuditMock).auditHeatStackCreate("cloudRegion", "cloudOwner", "tenantId", "stackName");
                auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
                Mockito.verify(mockExternalTaskService).complete(mockExternalTask);
        }
 
        @Test
        public void execute_external_task_audit_first_failure_Test() {
-               doReturn(false).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId", "stackName");
+               doReturn(false).when(heatStackAuditMock).auditHeatStackCreate("cloudRegion", "cloudOwner", "tenantId", "stackName");
                doReturn(null).when(mockExternalTask).getRetries();
                auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService);
                Mockito.verify(mockExternalTaskService).handleFailure(mockExternalTask,
@@ -90,7 +90,7 @@ public class AuditStackServiceDataTest extends AuditStackServiceData {
 
        @Test
        public void execute_external_task_audit_intermediate_failure_Test() {
-               doReturn(false).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId", "stackName");
+               doReturn(false).when(heatStackAuditMock).auditHeatStackCreate("cloudRegion", "cloudOwner", "tenantId", "stackName");
                doReturn(6).when(mockExternalTask).getRetries();
                auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService);               
                Mockito.verify(mockExternalTaskService).handleFailure(mockExternalTask,
@@ -101,11 +101,11 @@ public class AuditStackServiceDataTest extends AuditStackServiceData {
 
        @Test
        public void execute_external_task_audit_final_failure_Test() {
-               doReturn(false).when(heatStackAuditMock).auditHeatStack("cloudRegion", "cloudOwner", "tenantId", "stackName");
+               doReturn(false).when(heatStackAuditMock).auditHeatStackCreate("cloudRegion", "cloudOwner", "tenantId", "stackName");
                doReturn(1).when(mockExternalTask).getRetries();
                auditStackService.executeExternalTask(mockExternalTask, mockExternalTaskService);               
                Mockito.verify(mockExternalTaskService).handleBpmnError(mockExternalTask,
-                               "AuditAAIInventoryFailure");
+                               "AuditAAIInventoryFailure", "Number of Retries Exceeded auditing inventory");
        }
 
        @Test
index 02557d8..9176b58 100644 (file)
@@ -58,8 +58,6 @@ import com.woorea.openstack.heat.model.Resources;
 @RunWith(MockitoJUnitRunner.Silent.class)
 public class AuditVServerTest extends AuditVServer {
 
-       private ObjectMapper objectMapper = new ObjectMapper();
-
        @InjectMocks
        private AuditVServer auditNova = new AuditVServer();
 
@@ -225,9 +223,13 @@ public class AuditVServerTest extends AuditVServer {
        
        @Test
        public void audit_Vserver_Empty_HashSet() throws JsonParseException, JsonMappingException, IOException {
-               boolean exists = auditNova.auditVservers(new HashSet<Vserver>(), tenantId, cloudOwner, cloudRegion);            
+               boolean exists = auditNova.auditAllVserversDoExist(new HashSet<Vserver>(), tenantId, cloudOwner, cloudRegion);
                assertEquals(false, exists);
+               
+               boolean doNotExist = auditNova.auditAllVserversDoNotExist(new HashSet<Vserver>(), tenantId, cloudOwner, cloudRegion);
+               assertEquals(true, doNotExist);
        }
+       
 
        @Test
        public void audit_Vserver_Found_Test() throws JsonParseException, JsonMappingException, IOException {
@@ -246,8 +248,11 @@ public class AuditVServerTest extends AuditVServer {
                doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri);
                doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri);
 
-               boolean exists = auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);           
+               boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);         
                assertEquals(true, exists);
+               
+               boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);          
+               assertEquals(false, doNotExist);
        }
 
        @Test
@@ -268,8 +273,11 @@ public class AuditVServerTest extends AuditVServer {
                doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri);
                doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri);
 
-               boolean exists = auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);           
+               boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);         
                assertEquals(false, exists);
+               
+               boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);          
+               assertEquals(false, doNotExist);
        }
 
        @Test
@@ -288,16 +296,23 @@ public class AuditVServerTest extends AuditVServer {
                doReturn(true).when(aaiResourcesMock).exists(service2_sub_1_uri);
                doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri);
                doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri);
-               boolean exists = auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
+               boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);
                assertEquals(false, exists);
+               
+               boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);          
+               assertEquals(false, doNotExist);
        }
 
        @Test
-       public void audit_Vserver_Not_Found_Test() throws JsonParseException, JsonMappingException, IOException {
+       public void audit_Vservers_Not_Found_Test() throws JsonParseException, JsonMappingException, IOException {
                doReturn(false).when(aaiResourcesMock).exists(vserverURI);
                doReturn(false).when(aaiResourcesMock).exists(vserverURI2);
-               boolean exists = auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);           
+               
+               boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);         
                assertEquals(false, exists);
+               
+               boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);          
+               assertEquals(true, doNotExist);
        }
 
        @Test
@@ -306,8 +321,11 @@ public class AuditVServerTest extends AuditVServer {
                doReturn(true).when(aaiResourcesMock).exists(vserverURI2);
                doReturn(Optional.of(test_port_1_plural)).when(aaiResourcesMock).get(LInterface.class,test_port_1_uri);
                doReturn(Optional.of(test_port_2_plural)).when(aaiResourcesMock).get(LInterface.class,test_port_2_uri);
-               boolean exists = auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);           
+               boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);         
                assertEquals(false, exists);
+               
+               boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);          
+               assertEquals(false, doNotExist);
        }
 
        @Test
@@ -325,8 +343,12 @@ public class AuditVServerTest extends AuditVServer {
                doReturn(true).when(aaiResourcesMock).exists(service1_sub_0_uri);
                doReturn(true).when(aaiResourcesMock).exists(service1_sub_1_uri);
                doReturn(false).when(aaiResourcesMock).exists(vserverURI2);
-               boolean exists = auditNova.auditVservers(vserversToAudit, tenantId, cloudOwner, cloudRegion);
+               
+               boolean exists = auditNova.auditAllVserversDoExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);
                assertEquals(false, exists);
+               
+               boolean doNotExist = auditNova.auditAllVserversDoNotExist(vserversToAudit, tenantId, cloudOwner, cloudRegion);          
+               assertEquals(false, doNotExist);
        }
 
 }
index 6967841..5eea46d 100644 (file)
@@ -203,7 +203,7 @@ public class HeatStackAuditTest extends HeatStackAudit {
                Resources getResource = objectMapper.readValue(new File("src/test/resources/Service1ResourceGroupResponse.json"), Resources.class);
                doReturn(getResource).when(msoHeatUtilsMock).queryStackResources(cloudRegion,   tenantId, "heatStackName");
                
-               boolean actual = heatStackAudit.auditHeatStack(cloudRegion, "cloudOwner", tenantId, "heatStackName");
+               boolean actual = heatStackAudit.auditHeatStackCreate(cloudRegion, "cloudOwner", tenantId, "heatStackName");
                assertEquals(true, actual);
        }
        
index 75cea9e..376076a 100644 (file)
@@ -65,7 +65,7 @@ public class MsoVnfMulticloudAdapterImplTest extends BaseRestTestUtils{
 
     @Test
     public void createVfModule() throws Exception {
-        //expectedException.expect(VnfException.class);
+        
         Map<String, Object> stackInputs = new HashMap<>();
         stackInputs.put("oof_directives", "{}");
         stackInputs.put("sdnc_directives", "{}");
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Tenant.java
new file mode 100644 (file)
index 0000000..a23f85b
--- /dev/null
@@ -0,0 +1,58 @@
+package org.onap.so.bpmn.servicedecomposition.bbobjects;
+
+import java.io.Serializable;
+
+import javax.persistence.Id;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public class Tenant implements Serializable {
+
+       /**
+        * 
+        */
+       private static final long serialVersionUID = -8704478668505531590L;
+       @Id
+       @JsonProperty("tenant-id")
+       private String tenantId;
+       @JsonProperty("tenant-name")
+       private String tenantName;
+       @JsonProperty("tenant-context")
+       private String tenantContext;
+       
+       @Override
+       public boolean equals(final Object other) {
+               if (!(other instanceof Tenant)) {
+                       return false;
+               }
+               Tenant castOther = (Tenant) other;
+               return new EqualsBuilder().append(tenantId, castOther.tenantId).isEquals();
+       }
+       @Override
+       public int hashCode() {
+               return new HashCodeBuilder().append(tenantId).toHashCode();
+       }
+       public String getTenantId() {
+               return tenantId;
+       }
+       public void setTenantId(String tenantId) {
+               this.tenantId = tenantId;
+       }
+       public String getTenantName() {
+               return tenantName;
+       }
+       public void setTenantName(String tenantName) {
+               this.tenantName = tenantName;
+       }
+       public String getTenantContext() {
+               return tenantContext;
+       }
+       public void setTenantContext(String tenantContext) {
+               this.tenantContext = tenantContext;
+       }
+
+       
+}
\ No newline at end of file
index adea99c..6d3be0f 100644 (file)
@@ -26,6 +26,7 @@ import java.util.Map;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
 import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
 
@@ -39,10 +40,20 @@ public class GeneralBuildingBlock implements Serializable {
        private OrchestrationContext orchContext;
        private Map<String, String> userInput;
        private CloudRegion cloudRegion;
+       private Tenant tenant;
 
        private Customer customer;
        private ServiceInstance serviceInstance;
 
+       
+       public Tenant getTenant() {
+               return tenant;
+       }
+
+       public void setTenant(Tenant tenant) {
+               this.tenant = tenant;
+       }
+
        public CloudRegion getCloudRegion() {
                return cloudRegion;
        }
index fb30946..77372bc 100644 (file)
@@ -49,6 +49,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
 import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
@@ -831,7 +832,7 @@ public class BBInputSetup implements JavaDelegate {
        }
 
        protected GeneralBuildingBlock populateGBBWithSIAndAdditionalInfo(RequestDetails requestDetails,
-                       ServiceInstance serviceInstance, ExecuteBuildingBlock executeBB, String requestAction, Customer customer) {
+                       ServiceInstance serviceInstance, ExecuteBuildingBlock executeBB, String requestAction, Customer customer) throws Exception {
                GeneralBuildingBlock outputBB = new GeneralBuildingBlock();
                OrchestrationContext orchContext = mapperLayer.mapOrchestrationContext(requestDetails);
                RequestContext requestContext = mapperLayer.mapRequestContext(requestDetails);
@@ -840,9 +841,11 @@ public class BBInputSetup implements JavaDelegate {
                org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils
                                .getCloudRegion(requestDetails.getCloudConfiguration());
                CloudRegion cloudRegion = mapperLayer.mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion);
+               Tenant tenant = getTenant(requestDetails.getCloudConfiguration(), aaiCloudRegion);
                outputBB.setOrchContext(orchContext);
                outputBB.setRequestContext(requestContext);
                outputBB.setCloudRegion(cloudRegion);
+               outputBB.setTenant(tenant);
                if(customer == null){
                        Map<String, String> uriKeys = bbInputSetupUtils.getURIKeysFromServiceInstance(serviceInstance.getServiceInstanceId());
                        String globalCustomerId = uriKeys.get("global-customer-id");
@@ -857,6 +860,23 @@ public class BBInputSetup implements JavaDelegate {
                return outputBB;
        }
 
+       protected Tenant getTenant(CloudConfiguration cloudConfiguration, org.onap.aai.domain.yang.CloudRegion aaiCloudRegion) throws Exception {
+               Tenant tenant = new Tenant();
+               if(cloudConfiguration != null && cloudConfiguration.getTenantId() != null 
+                               && aaiCloudRegion != null && aaiCloudRegion.getTenants() != null) {
+                       for(org.onap.aai.domain.yang.Tenant aaiTenant : aaiCloudRegion.getTenants().getTenant()) {
+                               if(aaiTenant.getTenantId().equalsIgnoreCase(cloudConfiguration.getTenantId())) {
+                                       tenant = mapperLayer.mapTenant(aaiTenant);
+                               }
+                       }
+                       if(tenant.getTenantId() == null || tenant.getTenantName() == null) { 
+                               throw new Exception("Invalid tenant information retrieved: tenantId = " + tenant.getTenantId() 
+                               + " tenantName = " + tenant.getTenantName()); 
+                       }
+               }
+               return tenant;
+       }
+
        protected ServiceSubscription getServiceSubscription(RequestDetails requestDetails, Customer customer) {
                org.onap.aai.domain.yang.ServiceSubscription aaiServiceSubscription = bbInputSetupUtils
                                .getAAIServiceSubscription(customer.getGlobalCustomerId(),
index 108fd66..a838ffd 100644 (file)
@@ -53,6 +53,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
@@ -383,6 +384,14 @@ public class BBInputSetupMapperLayer {
                        modelMapper.map(aaiCloudRegion, cloudRegion);
                return cloudRegion;
        }
+       
+       protected Tenant mapTenant(org.onap.aai.domain.yang.Tenant aaiTenant) {
+               Tenant tenant = new Tenant();
+               if(aaiTenant != null) {
+                       modelMapper.map(aaiTenant, tenant);
+               }
+               return tenant;
+       }
 
        protected Collection mapAAICollectionIntoCollection(org.onap.aai.domain.yang.Collection aaiCollection) {
                Collection collection = new Collection();
index b3b4559..486164e 100644 (file)
@@ -173,7 +173,7 @@ public class BBInputSetupUtils {
                        if (cloudRegionId != null && cloudOwner != null && !cloudRegionId.isEmpty() && !cloudOwner.isEmpty()) {
                                return injectionHelper.getAaiClient().get(CloudRegion.class,
                                                AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudOwner,
-                                                               cloudRegionId)).orElse(null);
+                                                               cloudRegionId).depth(Depth.TWO)).orElse(null);
                        
                        } else {
                                return null;
index b8ab588..dfdef74 100644 (file)
@@ -24,6 +24,7 @@ public class CDSPropertiesImpl implements CDSProperties {
 
     private static final String ENDPOINT = "cds.endpoint";
     private static final String PORT = "cds.port";
+    private static final String AUTH = "cds.auth";
 
     public CDSPropertiesImpl() {
         // Needed for service loader
@@ -39,6 +40,11 @@ public class CDSPropertiesImpl implements CDSProperties {
         return Integer.parseInt(Objects.requireNonNull(UrnPropertiesReader.getVariable(PORT)));
     }
 
+    @Override
+    public String getBasicAuth() {
+        return Objects.requireNonNull(UrnPropertiesReader.getVariable(AUTH));
+    }
+
     @Override
     public URL getEndpoint() {
         return null;
index 3cb7b24..7e4afb7 100644 (file)
@@ -50,6 +50,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
 import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
@@ -604,6 +605,23 @@ public class BBInputSetupMapperLayerTest {
 
                assertThat(actual, sameBeanAs(expected));
        }
+       
+       @Test
+       public void testMapTenant() {
+               Tenant expected = new Tenant();
+               expected.setTenantId("tenantId");
+               expected.setTenantName("tenantName");
+               expected.setTenantContext("tenantContext");
+
+               org.onap.aai.domain.yang.Tenant aaiTenant = new org.onap.aai.domain.yang.Tenant();
+               aaiTenant.setTenantId("tenantId");
+               aaiTenant.setTenantName("tenantName");
+               aaiTenant.setTenantContext("tenantContext");
+
+               Tenant actual = bbInputSetupMapperLayer.mapTenant(aaiTenant);
+
+               assertThat(actual, sameBeanAs(expected));
+       }
 
        @Test
        public void testMapCloudRegionWithNullCheck() {
index cea8fc3..d7c681b 100644 (file)
@@ -787,7 +787,9 @@ public class BBInputSetupTest {
                ServiceInstance serviceInstance = mapper.readValue(
                                new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"),
                                ServiceInstance.class);
-
+               CloudConfiguration cloudConfiguration = new CloudConfiguration();
+               cloudConfiguration.setTenantId("tenantId");
+               requestDetails.setCloudConfiguration(cloudConfiguration);
                OrchestrationContext orchestrationContext = new OrchestrationContext();
                orchestrationContext.setIsRollbackEnabled(false);
 
@@ -808,17 +810,30 @@ public class BBInputSetupTest {
                customer.setSubscriberName("subscriberName");
                customer.setSubscriberType("subscriberType");
                customer.setServiceSubscription(serviceSubscription);
+               
+               org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant tenant = new org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant();
+               tenant.setTenantContext("tenantContext");
+               tenant.setTenantId("tenantId");
+               tenant.setTenantName("tenantName");
 
                org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class);
+               org.onap.aai.domain.yang.Tenants aaiTenants = Mockito.mock(org.onap.aai.domain.yang.Tenants.class);
+               org.onap.aai.domain.yang.Tenant aaiTenant = new org.onap.aai.domain.yang.Tenant();
+               aaiTenant.setTenantId("tenantId");
+               List<org.onap.aai.domain.yang.Tenant> tenants = new ArrayList<>();
+               tenants.add(aaiTenant);
 
                String requestAction = "createInstance";
-
+               
                doReturn(uriKeys).when(SPY_bbInputSetupUtils).getURIKeysFromServiceInstance(serviceInstance.getServiceInstanceId());
                doReturn(customer).when(SPY_bbInputSetup).mapCustomer(uriKeys.get("global-customer-id"),uriKeys.get("service-type"));
                doReturn(aaiCloudRegion).when(SPY_bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration());
                doReturn(orchestrationContext).when(bbInputSetupMapperLayer).mapOrchestrationContext(requestDetails);
                doReturn(requestContext).when(bbInputSetupMapperLayer).mapRequestContext(requestDetails);
                doReturn(cloudRegion).when(bbInputSetupMapperLayer).mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion);
+               doReturn(tenant).when(bbInputSetupMapperLayer).mapTenant(aaiTenant);
+               doReturn(aaiTenants).when(aaiCloudRegion).getTenants();
+               doReturn(tenants).when(aaiTenants).getTenant();
 
                GeneralBuildingBlock actual = SPY_bbInputSetup.populateGBBWithSIAndAdditionalInfo(requestDetails,
                                serviceInstance, executeBB, requestAction, null);
index ae1af8f..d1d66ae 100644 (file)
@@ -181,10 +181,10 @@ public class BBInputSetupUtilsTest {
                expected.get().setCloudRegionId("lcpCloudRegionId");
                doReturn(expected).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.CloudRegion.class,
                                AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudConfig.getCloudOwner(),
-                                               cloudConfig.getLcpCloudRegionId()));
+                                               cloudConfig.getLcpCloudRegionId()).depth(Depth.TWO));
 
                AAIResourceUri expectedUri = AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION, cloudConfig.getCloudOwner(),
-                               cloudConfig.getLcpCloudRegionId());
+                               cloudConfig.getLcpCloudRegionId()).depth(Depth.TWO);
                bbInputSetupUtils.getCloudRegion(cloudConfig);
                
                verify(MOCK_aaiResourcesClient, times(1)).get(CloudRegion.class, expectedUri);
index 5eb9a26..b18cad0 100644 (file)
                "tenant-id": "tenantId",
                "complex": "complexName"
        },
+       "tenant": {
+               "tenant-name": "tenantName",
+               "tenant-context": "tenantContext",
+               "tenant-id": "tenantId"
+       },
        "userInput": null,
        "customer": {
                "global-customer-id": "globalCustomerId",
index 5ac07c6..f07f060 100644 (file)
                "complex": "complexName"
        },
        "userInput": null,
+         "tenant": {
+    "tenant-id": "tenantId",
+    "tenant-name": "tenantName",
+    "tenant-context": "tenantContext"
+  },
        "customer": {
                "global-customer-id": "globalCustomerId",
                "subscriber-name": "subscriberName",
index fd24be1..c841da3 100644 (file)
@@ -35,7 +35,7 @@
       <bpmn:incoming>SequenceFlow_0ghzwlo</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0xndboi</bpmn:outgoing>
     </bpmn:serviceTask>
-    <bpmn:serviceTask id="Audit_AAI_Inventory" name="Validate A&#38;AI Inventory" camunda:type="external" camunda:topic="InventoryAudit">
+    <bpmn:serviceTask id="Audit_AAI_Inventory" name="Validate A&#38;AI Inventory" camunda:type="external" camunda:topic="InventoryAddAudit">
       <bpmn:incoming>SequenceFlow_0xndboi</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0ee42yq</bpmn:outgoing>
     </bpmn:serviceTask>
@@ -54,7 +54,7 @@
     </bpmn:exclusiveGateway>
     <bpmn:sequenceFlow id="SequenceFlow_07ybdik" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="ActivateVfModule" />
     <bpmn:sequenceFlow id="SequenceFlow_0ghzwlo" sourceRef="ExclusiveGateway_1v8bmbu" targetRef="Setup_AAI_Inventory_Audit">
-      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditInventoryNeeded").equals("true")}]]></bpmn:conditionExpression>
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditInventoryNeeded") == true}]]></bpmn:conditionExpression>
     </bpmn:sequenceFlow>
     <bpmn:sequenceFlow id="SequenceFlow_0ee42yq" sourceRef="Audit_AAI_Inventory" targetRef="ActivateVfModule" />
     <bpmn:serviceTask id="CheckAuditVariable" name="Check Audit Variable" camunda:expression="${AuditTasks.isAuditNeeded(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
index 804ae70..e1b36cf 100644 (file)
@@ -1,14 +1,14 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1">
   <bpmn:process id="DeleteVfModuleBB" name="DeleteVfModuleBB" isExecutable="true">
     <bpmn:startEvent id="DeleteVfModuleBB_Start">
       <bpmn:outgoing>SequenceFlow_1537yw5</bpmn:outgoing>
     </bpmn:startEvent>
     <bpmn:serviceTask id="DeleteVfModuleVnfAdapter" name="Delete Vf Module VnfAdapter" camunda:expression="${VnfAdapterDeleteTasks.deleteVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
-      <bpmn:incoming>SequenceFlow_1537yw5</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_1n8gab5</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_08tvhtf</bpmn:outgoing>
     </bpmn:serviceTask>
-    <bpmn:sequenceFlow id="SequenceFlow_1537yw5" sourceRef="DeleteVfModuleBB_Start" targetRef="DeleteVfModuleVnfAdapter" />
+    <bpmn:sequenceFlow id="SequenceFlow_1537yw5" sourceRef="DeleteVfModuleBB_Start" targetRef="ExclusiveGateway_0xrgzm7" />
     <bpmn:serviceTask id="UpdateVfModuleDeleteStatus" name="&#10;AAI &#10;Update&#10;(vf module)&#10;" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusDeleteVfModule(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
       <bpmn:incoming>SequenceFlow_01vfwtp</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_09l7pcg</bpmn:outgoing>
@@ -32,7 +32,7 @@
       <bpmn:incoming>SequenceFlow_08tvhtf</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_02lpx87</bpmn:outgoing>
     </bpmn:callActivity>
-    <bpmn:sequenceFlow id="SequenceFlow_02lpx87" sourceRef="VnfAdapter" targetRef="DeleteNetworkPolicies" />
+    <bpmn:sequenceFlow id="SequenceFlow_02lpx87" sourceRef="VnfAdapter" targetRef="ExclusiveGateway_1yvh16a" />
     <bpmn:subProcess id="SubProcess_11p7mrh" name="Error Handling&#10;&#10;" triggeredByEvent="true">
       <bpmn:startEvent id="StartEvent_1xp6ewt">
         <bpmn:outgoing>SequenceFlow_0h607z0</bpmn:outgoing>
@@ -52,7 +52,7 @@
     <bpmn:sequenceFlow id="SequenceFlow_09l7pcg" sourceRef="UpdateVfModuleDeleteStatus" targetRef="DeleteVfModuleBB_End" />
     <bpmn:sequenceFlow id="SequenceFlow_0xyu3pk" sourceRef="DeleteNetworkPolicies" targetRef="UpdateVnfIpv4OamAddress" />
     <bpmn:serviceTask id="DeleteNetworkPolicies" name="AAI Delete (network policies)" camunda:expression="${AAIDeleteTasks.deleteNetworkPolicies(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
-      <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_14bu4ys</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0xyu3pk</bpmn:outgoing>
     </bpmn:serviceTask>
     <bpmn:serviceTask id="UpdateVnfManagementV6Address" name="AAI Update (VNF)" camunda:expression="${AAIUpdateTasks.updateManagementV6AddressVnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
       <bpmn:incoming>SequenceFlow_0khqfnc</bpmn:incoming>
       <bpmn:outgoing>SequenceFlow_0yuz21z</bpmn:outgoing>
     </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1n8gab5" sourceRef="ExclusiveGateway_0xrgzm7" targetRef="DeleteVfModuleVnfAdapter" />
+    <bpmn:parallelGateway id="ExclusiveGateway_0xrgzm7">
+      <bpmn:incoming>SequenceFlow_1537yw5</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1n8gab5</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_1v3jgqe</bpmn:outgoing>
+    </bpmn:parallelGateway>
+    <bpmn:sequenceFlow id="SequenceFlow_032jv5j" name="Yes&#10;" sourceRef="ExclusiveGateway_1h2ystu" targetRef="Setup_Audit_Variable">
+      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("auditInventoryNeeded") == true}]]></bpmn:conditionExpression>
+    </bpmn:sequenceFlow>
+    <bpmn:sequenceFlow id="SequenceFlow_0qfmmgt" sourceRef="Audit_Inventory" targetRef="ExclusiveGateway_1pydilb" />
+    <bpmn:sequenceFlow id="SequenceFlow_14bu4ys" sourceRef="ExclusiveGateway_1yvh16a" targetRef="DeleteNetworkPolicies" />
+    <bpmn:parallelGateway id="ExclusiveGateway_1yvh16a">
+      <bpmn:incoming>SequenceFlow_02lpx87</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_1ut7n32</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_14bu4ys</bpmn:outgoing>
+    </bpmn:parallelGateway>
+    <bpmn:sequenceFlow id="SequenceFlow_1mgunf3" name="No" sourceRef="ExclusiveGateway_1h2ystu" targetRef="ExclusiveGateway_1pydilb" />
+    <bpmn:serviceTask id="Check_Audit" name="Check Audit Variable" camunda:expression="${AuditTasks.isAuditNeeded(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>SequenceFlow_1v3jgqe</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1odt2wt</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1v3jgqe" sourceRef="ExclusiveGateway_0xrgzm7" targetRef="Check_Audit" />
+    <bpmn:sequenceFlow id="SequenceFlow_1odt2wt" sourceRef="Check_Audit" targetRef="ExclusiveGateway_1h2ystu" />
+    <bpmn:sequenceFlow id="SequenceFlow_1swistn" sourceRef="Setup_Audit_Variable" targetRef="Audit_Inventory" />
+    <bpmn:serviceTask id="Audit_Inventory" name="Audit Inventory For Delete in AAI" camunda:type="external" camunda:topic="InventoryDeleteAudit">
+      <bpmn:incoming>SequenceFlow_1swistn</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_0qfmmgt</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:serviceTask id="Setup_Audit_Variable" name="Setup Audit Variable" camunda:expression="${AuditTasks.setupAuditVariable(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+      <bpmn:incoming>SequenceFlow_032jv5j</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1swistn</bpmn:outgoing>
+    </bpmn:serviceTask>
+    <bpmn:sequenceFlow id="SequenceFlow_1ut7n32" sourceRef="ExclusiveGateway_1pydilb" targetRef="ExclusiveGateway_1yvh16a" />
+    <bpmn:exclusiveGateway id="ExclusiveGateway_1h2ystu" name="Audit&#10; Enabled?" default="SequenceFlow_1mgunf3">
+      <bpmn:incoming>SequenceFlow_1odt2wt</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_032jv5j</bpmn:outgoing>
+      <bpmn:outgoing>SequenceFlow_1mgunf3</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
+    <bpmn:exclusiveGateway id="ExclusiveGateway_1pydilb">
+      <bpmn:incoming>SequenceFlow_0qfmmgt</bpmn:incoming>
+      <bpmn:incoming>SequenceFlow_1mgunf3</bpmn:incoming>
+      <bpmn:outgoing>SequenceFlow_1ut7n32</bpmn:outgoing>
+    </bpmn:exclusiveGateway>
   </bpmn:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
     <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteVfModuleBB">
       <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="DeleteVfModuleBB_Start">
-        <dc:Bounds x="173" y="102" width="36" height="36" />
+        <dc:Bounds x="159" y="241" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="179" y="138" width="24" height="12" />
+          <dc:Bounds x="132" y="277" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ServiceTask_16798zf_di" bpmnElement="DeleteVfModuleVnfAdapter">
-        <dc:Bounds x="261" y="80" width="100" height="80" />
+        <dc:Bounds x="382" y="278" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_1537yw5_di" bpmnElement="SequenceFlow_1537yw5">
-        <di:waypoint xsi:type="dc:Point" x="209" y="120" />
-        <di:waypoint xsi:type="dc:Point" x="261" y="120" />
+        <di:waypoint xsi:type="dc:Point" x="195" y="259" />
+        <di:waypoint xsi:type="dc:Point" x="282" y="259" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="190" y="99" width="90" height="12" />
+          <dc:Bounds x="193.5" y="238" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_0pbhsub_di" bpmnElement="UpdateVfModuleDeleteStatus">
-        <dc:Bounds x="758" y="243" width="100" height="80" />
+        <dc:Bounds x="840" y="443" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_08tvhtf_di" bpmnElement="SequenceFlow_08tvhtf">
-        <di:waypoint xsi:type="dc:Point" x="361" y="120" />
-        <di:waypoint xsi:type="dc:Point" x="427" y="120" />
+        <di:waypoint xsi:type="dc:Point" x="482" y="318" />
+        <di:waypoint xsi:type="dc:Point" x="511" y="318" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="349" y="99" width="90" height="12" />
+          <dc:Bounds x="451.5" y="297" width="90" height="12" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="EndEvent_1rn6yvh_di" bpmnElement="DeleteVfModuleBB_End">
-        <dc:Bounds x="918" y="265" width="36" height="36" />
+        <dc:Bounds x="1087" y="465" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="936" y="305" width="0" height="0" />
+          <dc:Bounds x="1060" y="505" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="CallActivity_0whogn3_di" bpmnElement="VnfAdapter">
-        <dc:Bounds x="427" y="80" width="100" height="80" />
+        <dc:Bounds x="511" y="278" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_02lpx87_di" bpmnElement="SequenceFlow_02lpx87">
-        <di:waypoint xsi:type="dc:Point" x="527" y="120" />
-        <di:waypoint xsi:type="dc:Point" x="591" y="120" />
+        <di:waypoint xsi:type="dc:Point" x="611" y="318" />
+        <di:waypoint xsi:type="dc:Point" x="836" y="318" />
+        <di:waypoint xsi:type="dc:Point" x="836" y="284" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="559" y="105" width="0" height="0" />
+          <dc:Bounds x="678.5" y="303" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="SubProcess_11p7mrh_di" bpmnElement="SubProcess_11p7mrh" isExpanded="true">
-        <dc:Bounds x="295" y="412" width="231" height="135" />
+        <dc:Bounds x="294" y="618" width="231" height="135" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="StartEvent_1xp6ewt_di" bpmnElement="StartEvent_1xp6ewt">
-        <dc:Bounds x="338" y="474" width="36" height="36" />
+        <dc:Bounds x="337" y="680" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="311" y="510" width="0" height="0" />
+          <dc:Bounds x="265" y="716" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="EndEvent_0guhjau_di" bpmnElement="EndEvent_0guhjau">
-        <dc:Bounds x="467" y="474" width="36" height="36" />
+        <dc:Bounds x="466" y="680" width="36" height="36" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="440" y="510" width="0" height="0" />
+          <dc:Bounds x="394" y="716" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0h607z0_di" bpmnElement="SequenceFlow_0h607z0">
-        <di:waypoint xsi:type="dc:Point" x="374" y="492" />
-        <di:waypoint xsi:type="dc:Point" x="467" y="492" />
+        <di:waypoint xsi:type="dc:Point" x="373" y="698" />
+        <di:waypoint xsi:type="dc:Point" x="466" y="698" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="421" y="471" width="0" height="0" />
+          <dc:Bounds x="375" y="677" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_0vlgqod_di" bpmnElement="UpdateVfModuleHeatStackId">
-        <dc:Bounds x="591" y="243" width="100" height="80" />
+        <dc:Bounds x="706" y="443" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_01vfwtp_di" bpmnElement="SequenceFlow_01vfwtp">
-        <di:waypoint xsi:type="dc:Point" x="691" y="283" />
-        <di:waypoint xsi:type="dc:Point" x="758" y="283" />
+        <di:waypoint xsi:type="dc:Point" x="806" y="483" />
+        <di:waypoint xsi:type="dc:Point" x="840" y="483" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="725" y="268" width="0" height="0" />
+          <dc:Bounds x="778" y="468" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_09l7pcg_di" bpmnElement="SequenceFlow_09l7pcg">
-        <di:waypoint xsi:type="dc:Point" x="858" y="283" />
-        <di:waypoint xsi:type="dc:Point" x="918" y="283" />
+        <di:waypoint xsi:type="dc:Point" x="940" y="483" />
+        <di:waypoint xsi:type="dc:Point" x="1087" y="483" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="888" y="258" width="0" height="0" />
+          <dc:Bounds x="968.5" y="468" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0xyu3pk_di" bpmnElement="SequenceFlow_0xyu3pk">
-        <di:waypoint xsi:type="dc:Point" x="691" y="120" />
-        <di:waypoint xsi:type="dc:Point" x="751" y="120" />
+        <di:waypoint xsi:type="dc:Point" x="998" y="259" />
+        <di:waypoint xsi:type="dc:Point" x="1072" y="259" />
+        <di:waypoint xsi:type="dc:Point" x="1072" y="399" />
+        <di:waypoint xsi:type="dc:Point" x="233" y="399" />
+        <di:waypoint xsi:type="dc:Point" x="233" y="483" />
+        <di:waypoint xsi:type="dc:Point" x="280" y="483" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="721" y="105" width="0" height="0" />
+          <dc:Bounds x="607.5" y="384" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_0tty0ac_di" bpmnElement="DeleteNetworkPolicies">
-        <dc:Bounds x="591" y="80" width="100" height="80" />
+        <dc:Bounds x="898" y="219" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="ServiceTask_0lrrd16_di" bpmnElement="UpdateVnfManagementV6Address">
-        <dc:Bounds x="261" y="243" width="100" height="80" />
+        <dc:Bounds x="421" y="443" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0jtem3b_di" bpmnElement="SequenceFlow_0jtem3b">
-        <di:waypoint xsi:type="dc:Point" x="851" y="120" />
-        <di:waypoint xsi:type="dc:Point" x="941" y="120" />
-        <di:waypoint xsi:type="dc:Point" x="941" y="205" />
-        <di:waypoint xsi:type="dc:Point" x="182" y="205" />
-        <di:waypoint xsi:type="dc:Point" x="182" y="283" />
-        <di:waypoint xsi:type="dc:Point" x="261" y="283" />
+        <di:waypoint xsi:type="dc:Point" x="380" y="483" />
+        <di:waypoint xsi:type="dc:Point" x="421" y="483" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="562" y="190" width="0" height="0" />
+          <dc:Bounds x="355.5" y="468" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_0w9805b_di" bpmnElement="UpdateVnfIpv4OamAddress">
-        <dc:Bounds x="751" y="80" width="100" height="80" />
+        <dc:Bounds x="280" y="443" width="100" height="80" />
       </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="SequenceFlow_0khqfnc_di" bpmnElement="SequenceFlow_0khqfnc">
-        <di:waypoint xsi:type="dc:Point" x="361" y="283" />
-        <di:waypoint xsi:type="dc:Point" x="427" y="283" />
+        <di:waypoint xsi:type="dc:Point" x="521" y="483" />
+        <di:waypoint xsi:type="dc:Point" x="561" y="483" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="394" y="268" width="0" height="0" />
+          <dc:Bounds x="496" y="468" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNEdge id="SequenceFlow_0yuz21z_di" bpmnElement="SequenceFlow_0yuz21z">
-        <di:waypoint xsi:type="dc:Point" x="527" y="283" />
-        <di:waypoint xsi:type="dc:Point" x="591" y="283" />
+        <di:waypoint xsi:type="dc:Point" x="661" y="483" />
+        <di:waypoint xsi:type="dc:Point" x="706" y="483" />
         <bpmndi:BPMNLabel>
-          <dc:Bounds x="559" y="268" width="0" height="0" />
+          <dc:Bounds x="638.5" y="468" width="90" height="0" />
         </bpmndi:BPMNLabel>
       </bpmndi:BPMNEdge>
       <bpmndi:BPMNShape id="ServiceTask_0v8naz9_di" bpmnElement="UpdateVfModuleContrailServiceInstanceFqdn">
-        <dc:Bounds x="427" y="243" width="100" height="80" />
+        <dc:Bounds x="561" y="443" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1n8gab5_di" bpmnElement="SequenceFlow_1n8gab5">
+        <di:waypoint xsi:type="dc:Point" x="307" y="284" />
+        <di:waypoint xsi:type="dc:Point" x="307" y="318" />
+        <di:waypoint xsi:type="dc:Point" x="382" y="318" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="277" y="294.5" width="90" height="13" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ParallelGateway_18x6mx2_di" bpmnElement="ExclusiveGateway_0xrgzm7">
+        <dc:Bounds x="282" y="234" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="262" y="287" width="90" height="13" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_032jv5j_di" bpmnElement="SequenceFlow_032jv5j">
+        <di:waypoint xsi:type="dc:Point" x="492" y="149" />
+        <di:waypoint xsi:type="dc:Point" x="492" y="108" />
+        <di:waypoint xsi:type="dc:Point" x="531" y="108" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="499" y="114" width="18" height="25" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_0qfmmgt_di" bpmnElement="SequenceFlow_0qfmmgt">
+        <di:waypoint xsi:type="dc:Point" x="754" y="108" />
+        <di:waypoint xsi:type="dc:Point" x="784" y="108" />
+        <di:waypoint xsi:type="dc:Point" x="784" y="149" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="724" y="86.5" width="90" height="13" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_14bu4ys_di" bpmnElement="SequenceFlow_14bu4ys">
+        <di:waypoint xsi:type="dc:Point" x="861" y="259" />
+        <di:waypoint xsi:type="dc:Point" x="898" y="259" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="834.5" y="237.5" width="90" height="13" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ParallelGateway_02fjfb8_di" bpmnElement="ExclusiveGateway_1yvh16a">
+        <dc:Bounds x="811" y="234" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="790" y="287" width="90" height="13" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1mgunf3_di" bpmnElement="SequenceFlow_1mgunf3">
+        <di:waypoint xsi:type="dc:Point" x="492" y="199" />
+        <di:waypoint xsi:type="dc:Point" x="492" y="232" />
+        <di:waypoint xsi:type="dc:Point" x="784" y="232" />
+        <di:waypoint xsi:type="dc:Point" x="784" y="199" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="499" y="212" width="15" height="13" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ServiceTask_1vmz3zo_di" bpmnElement="Check_Audit">
+        <dc:Bounds x="339" y="134" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1v3jgqe_di" bpmnElement="SequenceFlow_1v3jgqe">
+        <di:waypoint xsi:type="dc:Point" x="307" y="234" />
+        <di:waypoint xsi:type="dc:Point" x="307" y="174" />
+        <di:waypoint xsi:type="dc:Point" x="339" y="174" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="277" y="197.5" width="90" height="13" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1odt2wt_di" bpmnElement="SequenceFlow_1odt2wt">
+        <di:waypoint xsi:type="dc:Point" x="439" y="174" />
+        <di:waypoint xsi:type="dc:Point" x="467" y="174" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="408" y="152.5" width="90" height="13" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNEdge id="SequenceFlow_1swistn_di" bpmnElement="SequenceFlow_1swistn">
+        <di:waypoint xsi:type="dc:Point" x="631" y="108" />
+        <di:waypoint xsi:type="dc:Point" x="654" y="108" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="597.5" y="86.5" width="90" height="13" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ServiceTask_1l8r2a6_di" bpmnElement="Audit_Inventory">
+        <dc:Bounds x="654" y="68" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ServiceTask_1gttdjr_di" bpmnElement="Setup_Audit_Variable">
+        <dc:Bounds x="531" y="68" width="100" height="80" />
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNEdge id="SequenceFlow_1ut7n32_di" bpmnElement="SequenceFlow_1ut7n32">
+        <di:waypoint xsi:type="dc:Point" x="809" y="174" />
+        <di:waypoint xsi:type="dc:Point" x="836" y="174" />
+        <di:waypoint xsi:type="dc:Point" x="836" y="234" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="777.5" y="152.5" width="90" height="13" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNEdge>
+      <bpmndi:BPMNShape id="ExclusiveGateway_1olwkdn_di" bpmnElement="ExclusiveGateway_1h2ystu" isMarkerVisible="true">
+        <dc:Bounds x="467" y="149" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="518" y="162" width="47" height="25" />
+        </bpmndi:BPMNLabel>
+      </bpmndi:BPMNShape>
+      <bpmndi:BPMNShape id="ExclusiveGateway_1d1pmqz_di" bpmnElement="ExclusiveGateway_1pydilb" isMarkerVisible="true">
+        <dc:Bounds x="759" y="149" width="50" height="50" />
+        <bpmndi:BPMNLabel>
+          <dc:Bounds x="694" y="202" width="0" height="13" />
+        </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
index 9ffcd9d..2dae117 100644 (file)
@@ -47,13 +47,13 @@ public class ActivateVfModuleBBTest extends BaseBPMNTest{
                mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
                ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables);
                List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
-                .topic("InventoryAudit", 60L * 1000L).execute();
+                .topic("InventoryAddAudit", 60L * 1000L).execute();
         while (!tasks.isEmpty()) {
             for (LockedExternalTask task : tasks) {
                 externalTaskService.complete(task.getId(), "externalWorkerId");
             }
             tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
-                    .topic("InventoryAudit", 60L * 1000L).execute();
+                    .topic("InventoryAddAudit", 60L * 1000L).execute();
         }
                
                assertThat(pi).isNotNull();
@@ -68,13 +68,13 @@ public class ActivateVfModuleBBTest extends BaseBPMNTest{
                doThrow(BpmnError.class).when(aaiUpdateTasks).updateOrchestrationStatusActivateVfModule(any(BuildingBlockExecution.class));
                ProcessInstance pi = runtimeService.startProcessInstanceByKey("ActivateVfModuleBB", variables);
                List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
-                .topic("InventoryAudit", 60L * 1000L).execute();
+                .topic("InventoryAddAudit", 60L * 1000L).execute();
         while (!tasks.isEmpty()) {
             for (LockedExternalTask task : tasks) {
                 externalTaskService.complete(task.getId(), "externalWorkerId");
             }
             tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
-                    .topic("InventoryAudit", 60L * 1000L).execute();
+                    .topic("InventoryAddAudit", 60L * 1000L).execute();
         }
 
                assertThat(pi).isNotNull().isStarted()
index cedffb7..48ae22c 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
@@ -23,21 +23,40 @@ import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doThrow;
 
 import java.io.IOException;
+import java.util.List;
 
 import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.externaltask.LockedExternalTask;
 import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Before;
 import org.junit.Test;
 import org.onap.so.bpmn.BaseBPMNTest;
 import org.onap.so.bpmn.common.BuildingBlockExecution;
 
 public class DeleteVfModuleBBTest extends BaseBPMNTest{
+
+       @Before
+       public void before() {
+               variables.put("auditInventoryNeeded", true);
+       }
+
        @Test
        public void sunnyDay() throws InterruptedException, IOException {
                mockSubprocess("SDNCHandler", "My Mock Process Name", "GenericStub");
                mockSubprocess("VnfAdapter", "Mocked VnfAdapter", "GenericStub");
                ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables);
+               List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
+                .topic("InventoryDeleteAudit", 60L * 1000L).execute();
+        while (!tasks.isEmpty()) {
+            for (LockedExternalTask task : tasks) {
+                externalTaskService.complete(task.getId(), "externalWorkerId");
+            }
+            tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
+                    .topic("InventoryDeleteAudit", 60L * 1000L).execute();
+        }
                assertThat(pi).isNotNull();
-               assertThat(pi).isStarted().hasPassedInOrder("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter", "VnfAdapter",
+               assertThat(pi).isStarted().hasPassed("DeleteVfModuleBB_Start","ExclusiveGateway_0xrgzm7","ExclusiveGateway_1yvh16a","Check_Audit",
+                               "Setup_Audit_Variable","Audit_Inventory","DeleteVfModuleVnfAdapter", "VnfAdapter",
                                "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address",
                                "UpdateVfModuleContrailServiceInstanceFqdn",
                                "UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus", "DeleteVfModuleBB_End");
@@ -48,10 +67,19 @@ public class DeleteVfModuleBBTest extends BaseBPMNTest{
        public void rainyDay() throws Exception {
                doThrow(BpmnError.class).when(vnfAdapterDeleteTasks).deleteVfModule(any(BuildingBlockExecution.class));
                ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVfModuleBB", variables);
+               List<LockedExternalTask> tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
+                .topic("InventoryDeleteAudit", 60L * 1000L).execute();
+        while (!tasks.isEmpty()) {
+            for (LockedExternalTask task : tasks) {
+                externalTaskService.complete(task.getId(), "externalWorkerId");
+            }
+            tasks = externalTaskService.fetchAndLock(100, "externalWorkerId")
+                    .topic("InventoryDeleteAudit", 60L * 1000L).execute();
+        }
                assertThat(pi).isNotNull();
                assertThat(pi).isStarted()
-                               .hasPassedInOrder("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter")
-                               .hasNotPassed("VnfAdapter", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address", 
+                               .hasPassed("DeleteVfModuleBB_Start", "DeleteVfModuleVnfAdapter")
+                               .hasNotPassed("VnfAdapter", "DeleteNetworkPolicies", "UpdateVnfIpv4OamAddress", "UpdateVnfManagementV6Address",
                                                "UpdateVfModuleContrailServiceInstanceFqdn","UpdateVfModuleHeatStackId", "UpdateVfModuleDeleteStatus",
                                                "DeleteVfModuleBB_End");
                assertThat(pi).isEnded();
index d8f6ba3..c080bc9 100644 (file)
@@ -21,7 +21,8 @@
        <logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
                <appender-ref ref="STDOUT" />
        </logger>
-  <root level="WARN">
+       
+  <root level="INFO">
     <appender-ref ref="STDOUT" />
   </root>
 
index 932558d..1815fcd 100644 (file)
@@ -9,9 +9,9 @@
  * 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.
@@ -43,6 +43,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
+import static org.apache.commons.lang3.StringUtils.*;
 
 @Component
 public class VnfAdapterCreateTasks {
@@ -91,25 +92,27 @@ public class VnfAdapterCreateTasks {
        public void createVfModule(BuildingBlockExecution execution) {
                try {
                        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
-                       
+
                        ServiceInstance serviceInstance = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0);
                        VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
                        GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
                        VolumeGroup volumeGroup = null;
                        try {
                                volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
-                       } catch(BBObjectNotFoundException bbException) {                                
+                       } catch(BBObjectNotFoundException bbException) {
                        }
                        CloudRegion cloudRegion = gBBInput.getCloudRegion();
                        RequestContext requestContext = gBBInput.getRequestContext();
                        OrchestrationContext orchestrationContext = gBBInput.getOrchContext();
                        String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId());
                        String sdncVnfQueryResponse = execution.getVariable("SDNCQueryResponse_" + genericVnf.getVnfId());
-                       
+
                        CreateVfModuleRequest createVfModuleRequest = vnfAdapterVfModuleResources.createVfModuleRequest(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, vfModule, volumeGroup, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
                        execution.setVariable(VNFREST_REQUEST, createVfModuleRequest.toXmlString());
                } catch (Exception ex) {
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
                }
        }
+
+       
 }
index aaa9e51..8cb7cbb 100644 (file)
@@ -7,9 +7,9 @@
  * 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.
@@ -38,22 +38,22 @@ import org.springframework.stereotype.Component;
 
 @Component
 public class AuditTasks {
-       
+
        private static final Logger logger = LoggerFactory.getLogger(AuditTasks.class);
 
        @Autowired
        private ExceptionBuilder exceptionUtil;
-       
+
        @Autowired
        private ExtractPojosForBB extractPojosForBB;
-       
+
        @Autowired
        private Environment env;
-       
+
        public void isAuditNeeded(BuildingBlockExecution execution) {
-               try {                   
+               try {
                        logger.debug("auditInventoryNeeded Value: {}", env.getProperty("mso.infra.auditInventory"));
-                       execution.setVariable("auditInventoryNeeded",env.getProperty("mso.infra.auditInventory"));
+                       execution.setVariable("auditInventoryNeeded", Boolean.parseBoolean(env.getProperty("mso.infra.auditInventory")));
                } catch (Exception ex) {
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
                }
@@ -66,14 +66,14 @@ public class AuditTasks {
                        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
                }
        }
-       
+
        private AuditInventory createAuditInventory(BuildingBlockExecution execution) throws BBObjectNotFoundException {
                        AuditInventory auditInventory = new AuditInventory();
-                       
+
                        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
                        VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
                        CloudRegion cloudRegion = gBBInput.getCloudRegion();
-                       
+
                        auditInventory.setCloudOwner(cloudRegion.getCloudOwner());
                        auditInventory.setCloudRegion(cloudRegion.getLcpCloudRegionId());
                        auditInventory.setTenantId(cloudRegion.getTenantId());
index bba883e..752c39a 100644 (file)
@@ -4,6 +4,8 @@
  * ================================================================================
  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
  * 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
@@ -25,14 +27,15 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
 import org.onap.so.client.exception.ExceptionBuilder;
 import org.onap.so.db.catalog.client.CatalogDbClient;
 import org.onap.so.db.catalog.beans.CloudSite;
-import org.onap.so.logger.MsoLogger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 @Component
 public class CloudSiteCatalogUtils {
 
-       private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CloudSiteCatalogUtils.class);
+       private static final Logger logger = LoggerFactory.getLogger(CloudSiteCatalogUtils.class);
        @Autowired
        private ExceptionBuilder exceptionUtil;
        
@@ -46,17 +49,17 @@ public class CloudSiteCatalogUtils {
                if (cloudRegionId != null) {
                        Optional<CloudSite> cloudSite = getCloudSite(cloudRegionId);
                        if (!cloudSite.isPresent()) {
-                               msoLogger.debug("Cloud Region with cloudRegionId " + cloudRegionId + " not found in Catalog DB");
+                               logger.debug("Cloud Region with cloudRegionId {} not found in Catalog DB", cloudRegionId);
                                exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Cloud Region with cloudRegionId " + cloudRegionId + " not found in Catalog DB");
                        }
                        
                        if (cloudSite.get().getIdentityService() == null)        {
-                               msoLogger.debug("No identityService found for Cloud Region with cloudRegionId " + cloudRegionId + " in Catalog DB");
+                               logger.debug("No identityService found for Cloud Region with cloudRegionId {} in Catalog DB", cloudRegionId);
                                exceptionUtil.buildAndThrowWorkflowException(execution, 404, "No identityService found for Cloud Region with cloudRegionId " + cloudRegionId + " in Catalog DB");
                        }                       
                        String identityUrl = cloudSite.get().getIdentityService().getIdentityUrl();
                        
-                       msoLogger.debug("identityUrl from Catalog DB is: " + identityUrl);
+                       logger.debug("identityUrl from Catalog DB is: {}", identityUrl);
                        execution.setVariable("identityUrl", identityUrl);
                }
        }
@@ -73,4 +76,4 @@ public class CloudSiteCatalogUtils {
                        return(Optional.of(catalogDbClient.getCloudSiteByClliAndAicVersion(id,"2.5")));                 
                }
        }
-}
\ No newline at end of file
+}
index 76134a4..4284cea 100644 (file)
@@ -262,6 +262,10 @@ public abstract class RestClient {
        public <T> T put(Object obj, Class<T> resultClass) {
                return format(method("PUT", obj), resultClass).orElse(null);
        }
+       
+       public <T> T put(Object obj, GenericType<T> resultClass) {
+               return format(method("PUT", obj), resultClass).orElse(null);
+       }
 
        public <T> T delete(Class<T> resultClass) {
                return format(method("DELETE", null), resultClass).orElse(null);
index 4cee4f3..5f2c623 100644 (file)
 
 package org.onap.so.client.aai;
 
+import org.onap.so.client.aai.entities.AAIResultWrapper;
 import org.onap.so.client.aai.entities.uri.AAIUriFactory;
 import org.onap.so.client.graphinventory.GraphInventoryQueryClient;
 import org.onap.so.client.graphinventory.entities.DSLQuery;
 import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
 
-public class AAIDSLQueryClient extends GraphInventoryQueryClient<AAIDSLQueryClient, DSLQuery> {
+public class AAIDSLQueryClient extends GraphInventoryQueryClient<AAIDSLQueryClient, DSLQuery, AAIResultWrapper, AAIObjectType> {
 
        public AAIDSLQueryClient() {
                super(new AAIClient());
@@ -40,4 +41,15 @@ public class AAIDSLQueryClient extends GraphInventoryQueryClient<AAIDSLQueryClie
                return AAIUriFactory.createResourceUri(AAIObjectType.DSL);
        }
        
+
+       @Override
+       public AAIResultWrapper createWrapper(String json) {
+               return new AAIResultWrapper(json);
+       }
+
+       @Override
+       public AAIObjectType createType(String name) {
+               return AAIObjectType.fromTypeName(name);
+       }
+       
 }
index 66d5d1f..cc855e4 100644 (file)
 
 package org.onap.so.client.aai;
 
+import org.onap.so.client.aai.entities.AAIResultWrapper;
 import org.onap.so.client.aai.entities.CustomQuery;
 import org.onap.so.client.aai.entities.uri.AAIUriFactory;
 import org.onap.so.client.graphinventory.GraphInventoryQueryClient;
 import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
 
-public class AAIQueryClient extends GraphInventoryQueryClient<AAIQueryClient, CustomQuery> {
+public class AAIQueryClient extends GraphInventoryQueryClient<AAIQueryClient, CustomQuery, AAIResultWrapper, AAIObjectType> {
 
        public AAIQueryClient() {
                super(new AAIClient());
@@ -44,5 +45,15 @@ public class AAIQueryClient extends GraphInventoryQueryClient<AAIQueryClient, Cu
        protected GraphInventoryUri setupQueryParams(GraphInventoryUri uri) {
                return super.setupQueryParams(uri);
        }
+
+       @Override
+       public AAIResultWrapper createWrapper(String json) {
+               return new AAIResultWrapper(json);
+       }
+
+       @Override
+       public AAIObjectType createType(String name) {
+               return AAIObjectType.fromTypeName(name);
+       }
        
 }
index 324bb8a..a627480 100644 (file)
@@ -33,6 +33,7 @@ import org.onap.so.client.aai.AAIObjectType;
 import org.onap.so.client.aai.AAIResourcesClient;
 import org.onap.so.client.aai.entities.Results;
 import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.graphinventory.entities.Pathed;
 import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri;
 import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException;
 import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException;
@@ -82,9 +83,9 @@ public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri
                Optional<String> result;
                ObjectMapper mapper = new ObjectMapper();
                
-               Results<Map<String, String>> results = mapper.readValue(jsonString, new TypeReference<Results<Map<String, String>>>(){});
+               Results<Pathed> results = mapper.readValue(jsonString, new TypeReference<Results<Pathed>>(){});
                if (results.getResult().size() == 1) {
-                       String uriString = results.getResult().get(0).get("resource-link");
+                       String uriString = results.getResult().get(0).getResourceLink();
                        URI uri = UriBuilder.fromUri(uriString).build();
                        String rawPath = uri.getRawPath();
                        result = Optional.of(rawPath.replaceAll("/aai/v\\d+", ""));
diff --git a/common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java b/common/src/main/java/org/onap/so/client/cds/BasicAuthClientInterceptor.java
new file mode 100644 (file)
index 0000000..384d479
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2019 Bell Canada.
+ *
+ * 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.
+ */
+package org.onap.so.client.cds;
+
+import io.grpc.CallOptions;
+import io.grpc.Channel;
+import io.grpc.ClientCall;
+import io.grpc.ClientCall.Listener;
+import io.grpc.ClientInterceptor;
+import io.grpc.ForwardingClientCall;
+import io.grpc.Metadata;
+import io.grpc.Metadata.Key;
+import io.grpc.MethodDescriptor;
+
+public class BasicAuthClientInterceptor implements ClientInterceptor {
+
+    private CDSProperties props;
+
+    public BasicAuthClientInterceptor(CDSProperties props) {
+        this.props = props;
+    }
+
+    @Override
+    public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(
+        MethodDescriptor<ReqT, RespT> method,
+        CallOptions callOptions,
+        Channel channel) {
+
+        Key<String> authHeader = Key.of("Authorization", Metadata.ASCII_STRING_MARSHALLER);
+
+        return new ForwardingClientCall.SimpleForwardingClientCall<ReqT, RespT>(
+            channel.newCall(method, callOptions)) {
+            @Override
+            public void start(Listener<RespT> responseListener, Metadata headers) {
+                headers.put(authHeader, props.getBasicAuth());
+                super.start(responseListener, headers);
+            }
+        };
+    }
+}
index 0901cf5..1e37211 100644 (file)
@@ -73,6 +73,7 @@ public class CDSProcessingClient implements AutoCloseable {
             .forAddress(props.getHost(), props.getPort())
             .nameResolverFactory(new DnsNameResolverProvider())
             .loadBalancerFactory(new PickFirstLoadBalancerProvider())
+            .intercept(new BasicAuthClientInterceptor(props))
             .usePlaintext()
             .build();
         this.handler = new CDSProcessingHandler(listener);
index bb2a54e..52d1d61 100644 (file)
@@ -21,5 +21,8 @@ import org.onap.so.client.RestProperties;
 public interface CDSProperties extends RestProperties {
 
     String getHost();
+
     int getPort();
+
+    String getBasicAuth();
 }
index c4bf0f0..152e9d7 100644 (file)
 
 package org.onap.so.client.graphinventory;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Optional;
+import java.util.stream.Collectors;
 
-import org.onap.so.client.aai.entities.CustomQuery;
+import javax.ws.rs.core.GenericType;
+
+import org.onap.so.client.aai.entities.Results;
+import org.onap.so.client.graphinventory.entities.GraphInventoryResultWrapper;
+import org.onap.so.client.graphinventory.entities.Pathed;
+import org.onap.so.client.graphinventory.entities.ResourceAndUrl;
 import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri;
 
-public abstract class GraphInventoryQueryClient<S, I> {
+import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public abstract class GraphInventoryQueryClient<S, I, Wrapper extends GraphInventoryResultWrapper<?>, Type extends GraphInventoryObjectType> {
 
        private Optional<String> depth = Optional.empty();
        private boolean nodesOnly = false;
        private Optional<GraphInventorySubgraphType> subgraph = Optional.empty();
        private GraphInventoryClient client;
+       private GraphInventoryCommonObjectMapperProvider mapperProvider = new GraphInventoryCommonObjectMapperProvider();
        
        public GraphInventoryQueryClient(GraphInventoryClient client) {
                this.client = client;
@@ -42,6 +58,58 @@ public abstract class GraphInventoryQueryClient<S, I> {
                return client.createClient(setupQueryParams(getQueryUri().queryParam("format", format.toString()))).put(query, String.class);
        }
        
+       protected <R> List<R> querySingleType(Format format, I query, Class<R> clazz) {
+               return client.createClient(
+                               setupQueryParams(getQueryUri().queryParam("format", format.toString()))).put(
+                                               query, new GenericType<Results<Object>>(){}).getResult()
+                               .stream().map(item -> {
+                                       try {
+                                               return mapperProvider.getMapper().readValue(mapperProvider.getMapper().writeValueAsString(item), clazz);
+                                       } catch (IOException e) {
+                                               throw new IllegalArgumentException("could not map values from json", e);
+                                       }
+                               }).collect(Collectors.toList());
+       }
+       
+       public List<Pathed> queryPathed(I query) {
+               return querySingleType(Format.PATHED, query, Pathed.class);
+       }
+       
+       public List<Id> queryId(I query) {
+               return querySingleType(Format.ID, query, Id.class);
+       }
+       
+       public <R> List<R> querySingleResource(I query, Class<R> clazz) {
+               try {
+                       return getResourceAndUrl(query).stream().map(item -> item.getWrapper().asBean(clazz).get()).collect(Collectors.toList());
+               } catch (IOException e) {
+                       throw new IllegalArgumentException("could not map values from json", e);
+               }
+       }
+       
+       public List<ResourceAndUrl<Wrapper>> getResourceAndUrl(I query) throws IOException {
+               List<ResourceAndUrl<Wrapper>> result = new ArrayList<>();
+               ObjectMapper mapper = mapperProvider.getMapper();
+               Results<Map<String, Object>> resultsFromJson = mapper.readValue(query(Format.RESOURCE_AND_URL, query),
+                               new TypeReference<Results<Map<String, Object>>>() {
+               });
+               for (Map<String, Object> m : resultsFromJson.getResult()) {
+                       for(Entry<String, Object> entrySet : m.entrySet()) {
+                               if (!entrySet.getKey().equals("url")) {
+                                       String url = (String)m.get("url");
+                                       String stringJson = mapper.writeValueAsString(entrySet.getValue());
+                                       result.add(new ResourceAndUrl<Wrapper>(url, createType(entrySet.getKey()), createWrapper(stringJson)));
+                               }
+                       }
+               }
+
+               return result;
+       }
+
+       public abstract Wrapper createWrapper(String json);
+       
+       public abstract Type createType(String name);
+       
        public S depth (String depth) {
                this.depth = Optional.of(depth);
                return (S) this;
index 7da1408..1e4750d 100644 (file)
@@ -64,13 +64,14 @@ public class DSLNode implements QueryStep {
        
        @Override
        public String build() {
+               StringBuilder result = new StringBuilder(query);
                if (output) {
-                       query.append("*");
+                       result.append("*");
                }
                for (DSLNodeKey key : nodeKeys) {
-                       query.append(key.build());
+                       result.append(key.build());
                }
                
-               return query.toString();
+               return result.toString();
        }
 }
index 159bfb1..c40a3e6 100644 (file)
@@ -49,11 +49,12 @@ public class DSLNodeKey implements QueryStep {
        
        @Override
        public String build() {
-               
+               StringBuilder result = new StringBuilder(query);
+
                if (not) {
-                       query.append(" !");
+                       result.append(" !");
                }
-               query.append("('").append(keyName).append("', ");
+               result.append("('").append(keyName).append("', ");
                List<String> temp = new ArrayList<>();
                for (String item : values) {
                        if (item.equals("null")) {
@@ -64,8 +65,8 @@ public class DSLNodeKey implements QueryStep {
                                temp.add(String.format("'%s'", item));
                        }
                }
-               query.append(Joiner.on(", ").join(temp)).append(")");
+               result.append(Joiner.on(", ").join(temp)).append(")");
                
-               return query.toString();
+               return result.toString();
        }
 }
index 73dccea..3a47c38 100644 (file)
@@ -26,6 +26,7 @@ import java.util.List;
 import java.util.stream.Collectors;
 
 import org.onap.so.client.aai.entities.QueryStep;
+import org.onap.so.client.graphinventory.GraphInventoryObjectName;
 
 import com.google.common.base.Joiner;
 
@@ -33,7 +34,7 @@ import com.google.common.base.Joiner;
 public class DSLQueryBuilder<S, E> implements QueryStep {
 
        private List<QueryStep> steps = new ArrayList<>();
-       
+       private String suffix = "";
        
        public DSLQueryBuilder() {
                
@@ -94,8 +95,17 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
                return this;
        }
        
-       public String limit(int limit) {
-               return compile() + " LIMIT " + limit;
+       public DSLQueryBuilder<S, E> to(GraphInventoryObjectName name) {
+               return to(__.node(name));
+       }
+       
+       public DSLQueryBuilder<S, E> to(GraphInventoryObjectName name, DSLNodeKey... key) {
+               return to(__.node(name, key));
+       }
+       
+       public DSLQueryBuilder<S, E> limit(int limit) {
+               suffix = " LIMIT " + limit;
+               return this;
        }
        
        @Override
@@ -103,8 +113,31 @@ public class DSLQueryBuilder<S, E> implements QueryStep {
                return compile();
        }
        
+       @Override
+       public String toString() {
+               return build();
+       }
+       
+       @Override
+       public boolean equals(Object o) {
+               if (o != null) {
+                       if (o instanceof QueryStep) {
+                               return ((QueryStep)o).build().equals(this.build());
+                       } else if (o instanceof String) {
+                               return o.equals(this.build());
+                       }
+               }
+               return false;
+       }
+       
+       @Override
+       public int hashCode() {
+               
+               return build().hashCode();
+       }
+       
        private String compile() {
-               return Joiner.on(" ").join(steps.stream().map(item -> item.build()).collect(Collectors.toList()));
+               return Joiner.on(" ").join(steps.stream().map(item -> item.build()).collect(Collectors.toList())) + suffix;
        }
        
        protected QueryStep getFirst() {
index 759fad7..752a743 100644 (file)
@@ -126,7 +126,7 @@ public abstract class GraphInventoryRelationships<Wrapper extends GraphInventory
        protected List<String> getRelatedLinks(Optional<GraphInventoryObjectName> type) {
                String matcher = "";
                if (type.isPresent()) {
-                       matcher = "[?(@.related-to=='" + type.get() + "')]";
+                       matcher = "[?(@.related-to=='" + type.get().typeName() + "')]";
                }
                return JsonPathUtil.getInstance().locateResultList(this.jsonBody, String.format("$.relationship%s.related-link", matcher));
        }
index c5651c0..c0b29e4 100644 (file)
@@ -86,22 +86,27 @@ public abstract class GraphInventoryResultWrapper<R extends GraphInventoryRelati
        }
        
        public Map<String, Object> asMap() {
+               
+               return asBean(new TypeReference<Map<String, Object>>(){}).orElse(new HashMap<>());
+       }
+       
+       public <T> Optional<T> asBean(Class<T> clazz) {
                if (isEmpty()) {
-                       return new HashMap<>();
+                       return Optional.empty();
                }
                try {
-                       return mapper.readValue(this.jsonBody, new TypeReference<Map<String, Object>>(){});
+                       return Optional.of(mapper.readValue(this.jsonBody, clazz));
                } catch (IOException e) {
-                       return new HashMap<>();
+                       return Optional.empty();
                }
        }
        
-       public <T> Optional<T> asBean(Class<T> clazz) {
+       public <T> Optional<T> asBean(TypeReference<T> reference) {
                if (isEmpty()) {
                        return Optional.empty();
                }
                try {
-                       return Optional.of(mapper.readValue(this.jsonBody, clazz));
+                       return Optional.of(mapper.readValue(this.jsonBody, reference));
                } catch (IOException e) {
                        return Optional.empty();
                }
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Id.java
new file mode 100644 (file)
index 0000000..76492dc
--- /dev/null
@@ -0,0 +1,5 @@
+package org.onap.so.client.graphinventory.entities;
+
+public class Id extends Resource {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Pathed.java
new file mode 100644 (file)
index 0000000..a53bdc0
--- /dev/null
@@ -0,0 +1,5 @@
+package org.onap.so.client.graphinventory.entities;
+
+public class Pathed extends Resource {
+
+}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/Resource.java
new file mode 100644 (file)
index 0000000..5c53f2c
--- /dev/null
@@ -0,0 +1,40 @@
+package org.onap.so.client.graphinventory.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+       "resource-type",
+       "resource-link"
+})
+public class Resource {
+
+       @JsonProperty("resource-type")
+       private String resourceType;
+       @JsonProperty("resource-link")
+       private String resourceLink;
+
+       @JsonProperty("resource-type")
+       public String getResourceType() {
+               return resourceType;
+       }
+
+       @JsonProperty("resource-type")
+       public void setResourceType(String resourceType) {
+               this.resourceType = resourceType;
+       }
+
+       @JsonProperty("resource-link")
+       public String getResourceLink() {
+               return resourceLink;
+       }
+
+       @JsonProperty("resource-link")
+       public void setResourceLink(String resourceLink) {
+               this.resourceLink = resourceLink;
+       }
+
+}
+
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/ResourceAndUrl.java
new file mode 100644 (file)
index 0000000..e53fc02
--- /dev/null
@@ -0,0 +1,36 @@
+package org.onap.so.client.graphinventory.entities;
+
+import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+
+public class ResourceAndUrl<Wrapper extends GraphInventoryResultWrapper> {
+
+       private String url;
+       private GraphInventoryObjectType type;
+       private Wrapper wrapper;
+       
+       public ResourceAndUrl(String url, GraphInventoryObjectType type, Wrapper wrapper) {
+               this.url = url;
+               this.type = type;
+               this.wrapper = wrapper;
+       }
+       public String getUrl() {
+               return url;
+       }
+       public void setUrl(String url) {
+               this.url = url;
+       }
+       public Wrapper getWrapper() {
+               return wrapper;
+       }
+       public void setWrapper(Wrapper wrapper) {
+               this.wrapper = wrapper;
+       }
+       public GraphInventoryObjectType getType() {
+               return type;
+       }
+       
+       public void setType(GraphInventoryObjectType type) {
+               this.type = type;
+       }
+       
+}
index 84c3cad..e648ea3 100644 (file)
 
 package org.onap.so.client.aai;
 
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.ArgumentMatchers.isA;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.spy;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 
-import javax.ws.rs.core.Response;
+import javax.ws.rs.core.GenericType;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
+import org.mockito.Spy;
 import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.Complex;
 import org.onap.so.client.RestClient;
+import org.onap.so.client.aai.entities.AAIResultWrapper;
 import org.onap.so.client.aai.entities.CustomQuery;
+import org.onap.so.client.aai.entities.Results;
 import org.onap.so.client.aai.entities.uri.AAIResourceUri;
 import org.onap.so.client.aai.entities.uri.AAIUri;
 import org.onap.so.client.aai.entities.uri.AAIUriFactory;
 import org.onap.so.client.graphinventory.Format;
 import org.onap.so.client.graphinventory.GraphInventoryClient;
 import org.onap.so.client.graphinventory.GraphInventorySubgraphType;
+import org.onap.so.client.graphinventory.entities.Pathed;
+import org.onap.so.client.graphinventory.entities.ResourceAndUrl;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
 
 
 @RunWith(MockitoJUnitRunner.class) 
 public class AAIQueryClientTest {
        
        @Mock
-       Response response;
-       
-       @Mock
-       RestClient restClient;
+       private RestClient restClient;
        
        @Mock
-       GraphInventoryClient client;
+       private GraphInventoryClient client;
        
        @InjectMocks
-       AAIQueryClient aaiQueryClient = new AAIQueryClient();
+       @Spy
+       private AAIQueryClient aaiQueryClient = new AAIQueryClient();
        
+       private String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/query/";
+       
+       private ObjectMapper mapper = new ObjectMapper();
        @Test
        public void testQuery() {
                List<AAIResourceUri> uris = Arrays.asList(AAIUriFactory.createResourceUri(AAIObjectType.CUSTOM_QUERY));
@@ -91,4 +109,37 @@ public class AAIQueryClientTest {
                verify(aaiUri, times(1)).queryParam("nodesOnly", "");
                verify(aaiUri, times(1)).queryParam("subgraph", subgraph.toString());
        }
+       
+       @Test
+       public void querySingleResourceTest() throws IOException {
+               doReturn(getJson("single-query-result.json")).when(aaiQueryClient).query(eq(Format.RESOURCE_AND_URL), any(CustomQuery.class));
+               List<Complex> result = aaiQueryClient.querySingleResource(new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test"))), Complex.class);
+               assertEquals(2, result.size());
+               assertEquals("complex-id-15100-jc689q2", result.get(1).getPhysicalLocationId());
+       }
+       
+       @Test
+       public void getResourceAndUrlTest() throws IOException {
+               doReturn(getJson("single-query-result.json")).when(aaiQueryClient).query(eq(Format.RESOURCE_AND_URL), any(CustomQuery.class));
+               List<ResourceAndUrl<AAIResultWrapper>> result = aaiQueryClient.getResourceAndUrl(new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test"))));
+               assertEquals(2, result.size());
+               
+               assertEquals(1, result.get(1).getWrapper().getRelationships().get().getRelatedUris(AAIObjectType.PSERVER).size());
+       }
+       
+       @Test
+       public void querySingleTypeTest() throws IOException {
+               when(client.createClient(isA(AAIUri.class))).thenReturn(restClient);
+               when(restClient.put(any(Object.class), any(GenericType.class))).thenReturn(mapper.readValue(getJson("pathed-result.json"), new TypeReference<Results<Map<String, Object>>>(){}));
+               
+               
+               List<Pathed> results = aaiQueryClient.queryPathed(new CustomQuery(Arrays.asList(AAIUriFactory.createNodesUri(AAIObjectType.COMPLEX, "test"))));
+
+               assertEquals(2, results.size());
+               assertEquals("service-instance", results.get(1).getResourceType());
+       }
+       
+       private String getJson(String filename) throws IOException {
+                return new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + filename)));
+       }
 }
index 73fbff6..174c76b 100644 (file)
@@ -33,9 +33,9 @@ import static org.hamcrest.CoreMatchers.containsString;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertThat;
 import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
 
 import javax.ws.rs.BadRequestException;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -50,7 +50,6 @@ import org.onap.so.client.aai.entities.AAIResultWrapper;
 import org.onap.so.client.aai.entities.uri.AAIResourceUri;
 import org.onap.so.client.aai.entities.uri.AAIUriFactory;
 import org.onap.so.client.defaultproperties.DefaultAAIPropertiesImpl;
-import org.onap.so.client.graphinventory.GraphInventoryClient;
 
 import com.github.tomakehurst.wiremock.admin.NotFoundException;
 import com.github.tomakehurst.wiremock.junit.WireMockRule;
@@ -60,7 +59,7 @@ public class AAIResourcesClientTest {
 
 
        @Rule
-       public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8443));
+       public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
        
        @Rule
        public ExpectedException thrown = ExpectedException.none();
@@ -72,9 +71,11 @@ public class AAIResourcesClientTest {
        @InjectMocks
        public AAIResourcesClient aaiClient = new AAIResourcesClient();
        
+       private String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/query/";
+
        @Before
        public void beforeTest() {
-               doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties();
+               doReturn(new DefaultAAIPropertiesImpl(wireMockRule.port())).when(client).getRestProperties();
        }
        
        @Test
index 69d46de..a5bbc64 100644 (file)
@@ -21,6 +21,7 @@
 package org.onap.so.client.aai;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
 import org.onap.so.client.graphinventory.entities.DSLNode;
@@ -80,4 +81,32 @@ public class DSLQueryBuilderTest {
                
                assertEquals("cloud-region* !('cloud-owner', ' ', ' null ')", builder.build());
        }
+       
+       @Test
+       public void shortCutToTest() {
+               DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.PSERVER,
+                               __.key("hostname", "my-hostname")).output());
+               
+               builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
+               assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')", builder.build());
+       }
+       
+       @Test
+       public void limitTest() {
+               DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.PSERVER,
+                               __.key("hostname", "my-hostname")).output());
+               
+               builder.to(AAIObjectType.P_INTERFACE).limit(2).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
+               assertEquals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id') LIMIT 2", builder.build());
+       }
+       
+       @Test
+       public void equalsTest() {
+               DSLQueryBuilder<DSLNode, DSLNode> builder = new DSLQueryBuilder<>(new DSLNode(AAIObjectType.PSERVER,
+                               __.key("hostname", "my-hostname")).output());
+               
+               builder.to(AAIObjectType.P_INTERFACE).to(AAIObjectType.SRIOV_PF, __.key("pf-pci-id", "my-id"));
+               assertTrue(builder.equals("pserver*('hostname', 'my-hostname') > p-interface > sriov-pf('pf-pci-id', 'my-id')"));
+               assertTrue(builder.equals(builder));
+       }
 }
index 1ce6e43..8d11f69 100644 (file)
@@ -44,7 +44,7 @@ public class RelationshipsTest {
                AAIResultWrapper wrapper = new AAIResultWrapper(content);
                Relationships relationships = wrapper.getRelationships().get();
                
-               List<AAIResourceUri> test = relationships.getRelatedAAIUris(AAIObjectType.VCE);
+               List<AAIResourceUri> test = relationships.getRelatedUris(AAIObjectType.VCE);
                
                System.out.println(test.get(0).build());
                List<AAIResourceUri> uris = Arrays.asList(
index 15c1c24..979ca39 100644 (file)
@@ -69,7 +69,7 @@ public class ServiceInstanceUriTest {
        private final static String AAI_JSON_FILE_LOCATION = "src/test/resources/__files/aai/resources/";
        
        @Rule
-       public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(8443));
+       public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
        
        @Rule
        public final ExpectedException exception = ExpectedException.none();
@@ -82,7 +82,7 @@ public class ServiceInstanceUriTest {
        
        @Before
        public void beforeTest() {
-               doReturn(new DefaultAAIPropertiesImpl()).when(client).getRestProperties();
+               doReturn(new DefaultAAIPropertiesImpl(wireMockRule.port())).when(client).getRestProperties();
        }
        @Test
        public void found() throws IOException {
index efb9b07..a293786 100644 (file)
@@ -26,12 +26,17 @@ public class TestCDSPropertiesImpl implements CDSProperties {
 
     @Override
     public String getHost() {
-        return "endpoint";
+        return "localhost";
     }
 
     @Override
     public int getPort() {
-        return 9999;
+        return 9111;
+    }
+
+    @Override
+    public String getBasicAuth() {
+        return "Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==";
     }
 
     @Override
index 77e1dfe..65c7656 100644 (file)
@@ -49,6 +49,21 @@ public class DefaultAAIPropertiesImpl implements AAIProperties {
                }
                this.props = temp;
 
+       }
+       
+       public DefaultAAIPropertiesImpl(int port) {
+               File initialFile = new File("src/test/resources/aai.properties");
+               Map<Object, Object> temp;
+               try (InputStream targetStream = new FileInputStream(initialFile)) {
+                       Properties properties = new Properties();
+                       properties.load(targetStream);
+                       temp = properties;
+               } catch (IOException e) {
+                       temp = new HashMap<>();
+               }
+               this.props = temp;
+               this.props.put("aai.endpoint", this.props.get("aai.endpoint").toString().replaceFirst(":\\d+", ":" + port));
+
        }
        @Override
        public URL getEndpoint() throws MalformedURLException {
diff --git a/common/src/test/resources/__files/aai/query/pathed-result.json b/common/src/test/resources/__files/aai/query/pathed-result.json
new file mode 100644 (file)
index 0000000..e9a3e65
--- /dev/null
@@ -0,0 +1,12 @@
+{
+  "results": [
+    {
+      "resource-type": "service-instance",
+      "resource-link": "https://localhost:8443/aai/v9/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"
+    },
+    {
+      "resource-type": "service-instance",
+      "resource-link": "https://localhost:8443/aai/v9/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/common/src/test/resources/__files/aai/query/single-query-result.json b/common/src/test/resources/__files/aai/query/single-query-result.json
new file mode 100644 (file)
index 0000000..eb12dea
--- /dev/null
@@ -0,0 +1,80 @@
+{
+    "results": [
+        {
+            "url": "/aai/v14/cloud-infrastructure/complexes/complex/complex-id-15100-jc689q",
+            "complex": {
+                "physical-location-id": "complex-id-15100-jc689q",
+                "resource-version": "1541786379243",
+                "physical-location-type": "lvXHWJC",
+                "street1": "uAAi5qjc1",
+                "street2": "vkK6XQjc2",
+                "city": "3Ec8JSW0JC",
+                "state": "COczHmeJC",
+                "postal-code": "D4J1",
+                "country": "K0JC1",
+                "region": "JzHqJC1",
+                "relationship-list": {
+                    "relationship": [
+                        {
+                            "related-to": "pserver",
+                            "relationship-label": "org.onap.relationships.inventory.LocatedIn",
+                            "related-link": "/aai/v14/cloud-infrastructure/pservers/pserver/pserver-15100-jc689q",
+                            "relationship-data": [
+                                {
+                                    "relationship-key": "pserver.hostname",
+                                    "relationship-value": "pserver-15100-jc689q"
+                                }
+                            ],
+                            "related-to-property": [
+                                {
+                                    "property-key": "pserver.pserver-name2"
+                                },
+                                {
+                                    "property-key": "pserver.fqdn"
+                                }
+                            ]
+                        }
+                    ]
+                }
+            }
+        },
+        {
+            "url": "/aai/v14/cloud-infrastructure/complexes/complex/complex-id-15100-jc689q2",
+            "complex": {
+                "physical-location-id": "complex-id-15100-jc689q2",
+                "resource-version": "1541786379243",
+                "physical-location-type": "lvXHWJC",
+                "street1": "uAAi5qjc1",
+                "street2": "vkK6XQjc2",
+                "city": "3Ec8JSW0JC",
+                "state": "COczHmeJC",
+                "postal-code": "D4J1",
+                "country": "K0JC1",
+                "region": "JzHqJC1",
+                "relationship-list": {
+                    "relationship": [
+                        {
+                            "related-to": "pserver",
+                            "relationship-label": "org.onap.relationships.inventory.LocatedIn",
+                            "related-link": "/aai/v14/cloud-infrastructure/pservers/pserver/pserver-15100-jc689q",
+                            "relationship-data": [
+                                {
+                                    "relationship-key": "pserver.hostname",
+                                    "relationship-value": "pserver-15100-jc689q"
+                                }
+                            ],
+                            "related-to-property": [
+                                {
+                                    "property-key": "pserver.pserver-name2"
+                                },
+                                {
+                                    "property-key": "pserver.fqdn"
+                                }
+                            ]
+                        }
+                    ]
+                }
+            }
+        }
+    ]
+}
\ No newline at end of file
index e6bbc4d..182e398 100644 (file)
@@ -29,6 +29,7 @@ import org.onap.so.apihandler.filters.RequestUriFilter;
 import org.onap.so.apihandlerinfra.exceptions.ApiExceptionMapper;
 import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestration;
 import org.onap.so.apihandlerinfra.tenantisolation.CloudResourcesOrchestration;
+import org.onap.so.apihandlerinfra.tenantisolation.ModelDistributionRequest;
 import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
 import org.onap.so.web.exceptions.RuntimeExceptionMapper;
 import org.springframework.context.annotation.Configuration;
@@ -64,6 +65,7 @@ public class JerseyConfiguration extends ResourceConfig {
                // this registration seems to be needed to get predictable
                // execution behavior for the above JSON Exception Mappers
                register(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.class);
+               register(ModelDistributionRequest.class);
                property(ServletProperties.FILTER_FORWARD_ON_404, true);
                BeanConfig beanConfig = new BeanConfig();
                beanConfig.setVersion("1.0.2");
index 411a5e5..886e0d5 100644 (file)
@@ -699,7 +699,6 @@ public class MsoRequest {
        String vfModuleType = null;
        String vfModuleModelName = null;
                ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
-           MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, MsoRequest.class);
                RelatedInstanceList[] instanceList = sir.getRequestDetails().getRelatedInstanceList();
                String serviceModelName = null;
         String vnfModelName = null;
index 1f9f5f5..0b2b1e7 100644 (file)
@@ -1249,6 +1249,7 @@ public class ServiceInstances {
                try {
                        msoRequest.parse(sir, instanceIdMap, action, version, requestJSON, reqVersion, aLaCarte);
                } catch (Exception e) {
+                       logger.error("failed to parse request", e);
                        ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
                ValidateException validateException = new ValidateException.Builder("Error parsing request: " + e.getMessage(), HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
                  .errorInfo(errorLoggerInfo).build();
index ace0fb6..3ec3ade 100644 (file)
@@ -28,7 +28,7 @@ import java.util.List;
 import javax.inject.Provider;
 import javax.transaction.Transactional;
 import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
+import javax.ws.rs.PATCH;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
@@ -53,6 +53,7 @@ import org.onap.so.serviceinstancebeans.ServiceException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
 
 import com.fasterxml.jackson.annotation.JsonInclude.Include;
 import com.fasterxml.jackson.core.JsonProcessingException;
@@ -61,7 +62,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 
-
+@Component
 @Path("/onap/so/infra/modelDistributions")
 @Api(value="/onap/so/infra/modelDistributions",description="API Requests for Model Distributions")
 public class ModelDistributionRequest {
@@ -70,7 +71,7 @@ public class ModelDistributionRequest {
        @Autowired
        private Provider<TenantIsolationRunnable> tenantIsolationRunnable;
        
-       @POST
+       @PATCH
        @Path("/{version:[vV][1]}/distributions/{distributionId}")
        @Consumes(MediaType.APPLICATION_JSON)
        @Produces(MediaType.APPLICATION_JSON)
index 9303e12..31c65e1 100644 (file)
@@ -82,6 +82,7 @@ public class SDCClientHelper {
 
                try {
                        String urlString = this.buildUriBuilder(serviceModelVersionId, operationalEnvironmentId);
+                       logger.debug("Url ASDC Activate request: {}", urlString);
                        String jsonPayload = this.buildJsonWorkloadContext(workloadContext);
                        String basicAuthCred = getBasicAuth();
 
@@ -157,6 +158,7 @@ public class SDCClientHelper {
                        enhancedAsdcResponseJsonObj.put("statusCode", Integer.toString(statusCode));
                        enhancedAsdcResponseJsonObj.put("messageId", "");
                        enhancedAsdcResponseJsonObj.put("message", "Success");
+                       logger.debug("Url ASDC Activate response: {} {}", "distributionId ", sdcResponseJsonObj.get("distributionId"));
 
                } else {  // error
                        if (sdcResponseJsonObj.has("requestError") ) {
index 9a8f488..4e5cfab 100644 (file)
@@ -24,13 +24,15 @@ import static org.hamcrest.Matchers.hasProperty;
 import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.startsWith;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyString;
 import static org.mockito.ArgumentMatchers.contains;
 import static org.mockito.Mockito.doNothing;
 
+import java.io.IOException;
+
 import javax.inject.Provider;
+import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import org.apache.http.HttpStatus;
@@ -38,21 +40,23 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
 import org.mockito.InjectMocks;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnitRunner;
 import org.onap.so.apihandler.common.ErrorNumbers;
-import org.onap.so.apihandlerinfra.ApiHandlerApplication;
 import org.onap.so.apihandlerinfra.BaseTest;
 import org.onap.so.apihandlerinfra.exceptions.ApiException;
 import org.onap.so.apihandlerinfra.exceptions.ValidateException;
 import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.test.context.ActiveProfiles;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.util.UriComponentsBuilder;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
 
 public class ModelDistributionRequestTest extends BaseTest{
 
@@ -111,4 +115,22 @@ public class ModelDistributionRequestTest extends BaseTest{
                assertEquals(200, response.getStatus());
        }
 
+       @Test
+       public void testSuccess_PATCH() throws ApiException, IOException{
+               String path = "/onap/so/infra/modelDistributions/v1/distributions/ff3514e3-5a33-55df-13ab-12abad84e7fa";
+               ObjectMapper mapper = new ObjectMapper();
+               Distribution distRequest = mapper.readValue(requestJSON, Distribution.class);
+               HttpHeaders headers = new HttpHeaders();
+               headers.set("Accept", MediaType.APPLICATION_JSON);
+               headers.set("Content-Type", MediaType.APPLICATION_JSON);
+               HttpEntity<Distribution>  entity = new HttpEntity<Distribution>(distRequest, headers);
+       
+               UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(path));
+               ResponseEntity<String> response = restTemplate.exchange(
+                               builder.toUriString(),
+                               HttpMethod.PATCH, entity, String.class);                
+               assertEquals(200, response.getStatusCodeValue());
+               
+       }
+       
 }
index 39cccd8..761aaa1 100644 (file)
 
 package org.onap.so.db.request.data.repository;
 
-import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.persistence.EntityManager;
-import javax.persistence.NonUniqueResultException;
-import javax.persistence.Query;
-import javax.persistence.TypedQuery;
-import javax.persistence.criteria.CriteriaBuilder;
-import javax.persistence.criteria.CriteriaQuery;
-import javax.persistence.criteria.Order;
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
 import java.sql.Timestamp;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
@@ -52,6 +35,24 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.concurrent.TimeUnit;
 
+import javax.persistence.EntityManager;
+import javax.persistence.NonUniqueResultException;
+import javax.persistence.Query;
+import javax.persistence.TypedQuery;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Order;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+
+import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
 
 @Repository
 @Transactional(readOnly = true)
@@ -219,17 +220,17 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
                 }
             }
         }
-        if(!predicates.isEmpty()){
-               predicates.add(tableRoot.get(REQUEST_STATUS)
-                .in(Arrays.asList("PENDING", "IN_PROGRESS", "TIMEOUT", "PENDING_MANUAL_TASK")));
-
-               final Order order = cb.desc(tableRoot.get(START_TIME));
-       
-               final List<InfraActiveRequests> dupList = executeInfraQuery(crit, predicates, order);
-       
-               if (dupList != null && !dupList.isEmpty()) {
-                   infraActiveRequests = dupList.get(0);
-               }
+        if (!predicates.isEmpty()) {
+            predicates.add(tableRoot.get(REQUEST_STATUS)
+                    .in(Arrays.asList("PENDING", "IN_PROGRESS", "TIMEOUT", "PENDING_MANUAL_TASK")));
+
+            final Order order = cb.desc(tableRoot.get(START_TIME));
+
+            final List<InfraActiveRequests> dupList = executeInfraQuery(crit, predicates, order);
+
+            if (dupList != null && !dupList.isEmpty()) {
+                infraActiveRequests = dupList.get(0);
+            }
         }
 
         return infraActiveRequests;
@@ -560,7 +561,14 @@ public class InfraActiveRequestsRepositoryImpl implements InfraActiveRequestsRep
             predicates.add(criteriaBuilder.greaterThanOrEqualTo(tableRoot.get(START_TIME), minTime));
             predicates.add(criteriaBuilder.lessThanOrEqualTo(tableRoot.get(END_TIME), maxTime));
 
-            criteriaQuery.where(criteriaBuilder.and(predicates.toArray(new Predicate[predicates.size()])));
+            final Predicate basePredicate = criteriaBuilder.and(predicates.toArray(new Predicate[predicates.size()]));
+            
+            final Predicate additionalPredicate = criteriaBuilder.and(tableRoot.get(END_TIME).isNull(),
+                    criteriaBuilder.greaterThanOrEqualTo(tableRoot.get(START_TIME), minTime),
+                    criteriaBuilder.lessThanOrEqualTo(tableRoot.get(START_TIME), maxTime));
+
+            criteriaQuery.where(criteriaBuilder.or(basePredicate, additionalPredicate));
+
             if (maxResult != null) {
                 return entityManager.createQuery(criteriaQuery).setMaxResults(maxResult).getResultList();
             }
index 4097aee..def999b 100644 (file)
@@ -49,9 +49,26 @@ import org.springframework.test.context.junit4.SpringRunner;
 @ActiveProfiles("test")
 public class InfraActiveRequestsRepositoryImplTest {
 
+    /**
+     * January 1, 2019 2:00:00 PM
+     */
+    private static final long END_TIME = 1546351200000l;
+
+    /**
+     * January 1, 2019 12:45:00 PM
+     */
+    private static final long START_TIME = 1546346700000l;
     private static final int MAX_LIMIT = 1;
-    private static final long END_TIME_IN_MILISEC = 1482580740000l;      // December 23, 2016 23:59 PM
-    private static final long START_TIME_IN_MILISEC = 1482282000000l;    // December 21, 2016 01:00 AM
+
+    /**
+     * December 23, 2016 23:59 PM
+     */
+    private static final long END_TIME_IN_MILISEC = 1482580740000l;
+
+    /**
+     * December 21, 2016 01:00 AM
+     */
+    private static final long START_TIME_IN_MILISEC = 1482282000000l;
     private static final String REQUEST_ID_VALUE = "00032ab7-3fb3-42e5-965d-8ea592502017";
     private static final String SERVICE_INSTANCE_ID_VALUE = "e3b5744d-2ad1-4cdd-8390-c999a38829bc";
 
@@ -96,7 +113,6 @@ public class InfraActiveRequestsRepositoryImplTest {
         assertEquals(SERVICE_INSTANCE_ID_VALUE, actualRequests.get(0).getServiceInstanceId());
     }
 
-
     @Test
     public void test_GetInfraActiveRequestsData_withLikeRequestID() {
         final Map<String, String[]> values = new HashMap<>();
@@ -182,12 +198,34 @@ public class InfraActiveRequestsRepositoryImplTest {
                 objUnderTest.getInfraActiveRequests(null, START_TIME_IN_MILISEC, END_TIME_IN_MILISEC, MAX_LIMIT);
         assertTrue(actualRequests.isEmpty());
     }
-    
+
     @Test
-    public void checkInstanceNameDuplicateNullInstanceNameTest(){
-       Map<String, String> instanceIdMap = new HashMap<>();
+    public void checkInstanceNameDuplicateNullInstanceNameTest() {
+        final Map<String, String> instanceIdMap = new HashMap<>();
         instanceIdMap.put("serviceInstanceId", "e05864f0-ab35-47d0-8be4-56fd9619ba3b");
-       InfraActiveRequests results = objUnderTest.checkInstanceNameDuplicate((HashMap<String, String>)instanceIdMap, null, "vnf");
-       assertNull(results);
+        final InfraActiveRequests results =
+                objUnderTest.checkInstanceNameDuplicate((HashMap<String, String>) instanceIdMap, null, "vnf");
+        assertNull(results);
     }
+
+    @Test
+    public void test_GetInfraActiveRequestsData_returnRecordWithNullEndTime() {
+        final Map<String, String[]> values = new HashMap<>();
+        values.put(SERVICE_INSTANCE_ID,
+                new String[] {QueryOperationType.EQ.name(), "f7712652-b516-4925-a243-64550d26fd84"});
+        final List<InfraActiveRequests> actualRequests =
+                objUnderTest.getInfraActiveRequests(values, START_TIME, END_TIME, null);
+        assertFalse(actualRequests.isEmpty());
+
+        assertEquals(3, actualRequests.size());
+        final Map<String, InfraActiveRequests> result = new HashMap<>();
+        for (final InfraActiveRequests actualActiveRequests : actualRequests) {
+            result.put(actualActiveRequests.getRequestId(), actualActiveRequests);
+
+        }
+        final InfraActiveRequests actualInfraActiveRequests = result.get("9383dc81-7a6c-4673-8082-650d50a82a1a");
+        assertNull(actualInfraActiveRequests.getEndTime());
+        assertEquals("IN_PROGRESS", actualInfraActiveRequests.getRequestStatus());
+    }
+
 }
index 541f356..3358d77 100644 (file)
@@ -105,7 +105,14 @@ INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, CLIENT_REQUEST_ID, ACTION,
 INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, STATUS_MESSAGE, PROGRESS, START_TIME, END_TIME, SOURCE, VNF_ID, VNF_NAME, VNF_TYPE, SERVICE_TYPE, AIC_NODE_CLLI, TENANT_ID, PROV_STATUS, VNF_PARAMS, VNF_OUTPUTS, REQUEST_BODY, RESPONSE_BODY, LAST_MODIFIED_BY, MODIFY_TIME, REQUEST_TYPE, VOLUME_GROUP_ID, VOLUME_GROUP_NAME, VF_MODULE_ID, VF_MODULE_NAME, VF_MODULE_MODEL_NAME, AAI_SERVICE_ID, AIC_CLOUD_REGION, CALLBACK_URL, CORRELATOR, NETWORK_ID, NETWORK_NAME, NETWORK_TYPE, REQUEST_SCOPE, REQUEST_ACTION, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME, REQUESTOR_ID, CONFIGURATION_ID, CONFIGURATION_NAME, OPERATIONAL_ENV_ID, OPERATIONAL_ENV_NAME, REQUEST_URL) VALUES
 ('00164b9e-784d-48a8-8973-bbad6ef818ed', null, 'createInstance', 'COMPLETE', 'Service Instance was created successfully.', '100', '2017-09-28 12:45:51', '2017-09-28 12:45:53', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f","modelType":"service","modelNameVersionId":null,"modelName":"MSO Test Network","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DEV-MTN6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"aicNodeClli":null,"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarte":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'CreateGenericALaCarteServiceInstance', '2017-09-28 12:45:52', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'service', 'createInstance', 'b2f59173-b7e5-4e0f-8440-232fd601b865', 'DEV-MTN6-3100-0927-1', 'md5621', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
 ('00173cc9-5ce2-4673-a810-f87fefb2829e', null, 'createInstance', 'FAILED', 'Error parsing request.  No valid instanceName is specified', '100', '2017-04-14 21:08:46', '2017-04-14 21:08:46', 'VID', null, null, null, null, null, 'a259ae7b7c3f493cb3d91f95a7c18149', null, null, null, '{"modelInfo":{"modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51","modelType":"service","modelName":"ConstraintsSrvcVID","modelVersion":"2.0","modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656"},"requestInfo":{"productFamilyId":"LRSI-OSPF","source":"VID","requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"},"cloudConfiguration":{"tenantId":"a259ae7b7c3f493cb3d91f95a7c18149","lcpCloudRegionId":"mtn16"},"requestParameters":{"subscriptionServiceType":"Mobility","userParams":[{"name":"neutronport6_name","value":"8"},{"name":"neutronnet5_network_name","value":"8"},{"name":"contrailv2vlansubinterface3_name","value":"false"}]}}', null, 'APIH', null, null, null, null, null, null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
-('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', null, null, null, null, null, null, null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelNameVersionId":null,"modelName":null,"modelVersion":null,"modelCustomizationUuid":null,"modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671","modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":null,"suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelCustomizationName":null,"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelNameVersionId":null,"modelName":"MSOTADevInfra_Configuration_Service","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"instanceDirection":null}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":null,"lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarte":false},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances');        
+('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', null, null, null, null, null, null, null, null, null, '{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelNameVersionId":null,"modelName":null,"modelVersion":null,"modelCustomizationUuid":null,"modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671","modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":null,"suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelCustomizationName":null,"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelNameVersionId":null,"modelName":"MSOTADevInfra_Configuration_Service","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"instanceDirection":null}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":null,"lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarte":false},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances');
+INSERT INTO PUBLIC.INFRA_ACTIVE_REQUESTS(REQUEST_ID, CLIENT_REQUEST_ID, ACTION, REQUEST_STATUS, START_TIME, END_TIME, SERVICE_INSTANCE_ID, SERVICE_INSTANCE_NAME ) VALUES
+('a5294d37-21db-4e3a-ae04-57412adcb4ac', null, 'createInstance', 'COMPLETE', '2019-01-01 12:45:00', '2019-01-01 12:50:00', 'f7712652-b516-4925-a243-64550d26fd84', 'ShouldReturnInSearchQuery_1'),
+('9383dc81-7a6c-4673-8082-650d50a82a1a', null, 'createInstance', 'IN_PROGRESS', '2019-01-01 12:55:00', null, 'f7712652-b516-4925-a243-64550d26fd84', 'ShouldReturnInSearchQuery_2'),
+('a1abeab2-f8ef-43ab-b76c-9c3c2cb9980f', null, 'activateInstance', 'FAILED', '2019-01-01 13:00:00', '2019-01-01 14:00:00', 'f7712652-b516-4925-a243-64550d26fd84', 'ShouldReturnInSearchQuery_3'),
+('81b8e152-ee89-49f4-b82b-08b0dcae27cd', null, 'createInstance', 'COMPLETE', '2019-01-01 14:10:00', '2019-01-01 15:00:00', 'f7712652-b516-4925-a243-64550d26fd84', 'SHOULD_NOT_RETURN_1'),
+('0c28cad2-ff79-4dfa-a04a-9e44996fd7f7', null, 'createInstance', 'IN_PROGRESS', '2019-01-01 13:30:00', '2019-01-01 15:00:00', 'f7712652-b516-4925-a243-64550d26fd84', 'SHOULD_NOT_RETURN_2'),
+('d0d995a7-549b-4e7e-9101-2bab17ec24ea', null, 'createInstance', 'IN_PROGRESS', '2019-01-01 14:15:00', null, 'f7712652-b516-4925-a243-64550d26fd84', 'SHOULD_NOT_RETURN_3');
 
 CREATE CACHED TABLE PUBLIC.ARCHIVED_INFRA_REQUESTS(
     REQUEST_ID VARCHAR NOT NULL SELECTIVITY 100,
index 557e2a6..0bcf24d 100644 (file)
 
 package org.onap.so.monitoring.configuration.rest;
 
-import org.springframework.boot.web.servlet.FilterRegistrationBean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.core.Ordered;
 import org.springframework.web.cors.CorsConfiguration;
 import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
 import org.springframework.web.filter.CorsFilter;
 
-import java.util.concurrent.TimeUnit;
-
 /**
  * @author waqas.ikram@ericsson, eoin.hanan@ericsson.com
  */
@@ -38,8 +34,8 @@ public class CorsConfigurer  {
 
     @Bean
     public CorsFilter corsFilter() {
-        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
-        CorsConfiguration config = new CorsConfiguration();
+        final UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
+        final CorsConfiguration config = new CorsConfiguration();
         config.setAllowCredentials(true);
         config.addAllowedOrigin("*");
         config.addAllowedHeader("*");
index 31ef747..5866667 100644 (file)
@@ -79,7 +79,6 @@ public class DatabaseServiceProviderTest {
         assertTrue(objUnderTest.getSoInfraRequest(Collections.emptyMap(), 0, 0, null).isEmpty());
     }
 
-
     @Test
     public void test_GetSoInfraRequest_WithFilters_InfraActiveRequestsList() {
         final String searchUrl = URL_PROVIDER.getSearchUrl(0, 0, null);
@@ -87,7 +86,7 @@ public class DatabaseServiceProviderTest {
         final Map<String, String[]> filters = new HashMap<>();
         filters.put("requestId", new String[] {"EQ", requestID});
 
-        SoActiveInfraRequests soActiveInfraRequests = new SoActiveInfraRequests();
+        final SoActiveInfraRequests soActiveInfraRequests = new SoActiveInfraRequests();
         soActiveInfraRequests.setRequestId(requestID);
 
         final Optional<SoActiveInfraRequests[]> response =
diff --git a/so-monitoring/so-monitoring-service/src/test/java/org/onap/so/monitoring/rest/api/Constants.java b/so-monitoring/so-monitoring-service/src/test/java/org/onap/so/monitoring/rest/api/Constants.java
new file mode 100644 (file)
index 0000000..aef8234
--- /dev/null
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ *  Copyright (C) 2019 Ericsson. 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.
+ * 
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.monitoring.rest.api;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.UUID;
+
+/**
+ * @author andrei.barcovschi@ericsson.com
+ *
+ */
+public class Constants {
+
+    public static final String PROCRESS_DEF_ID = "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb";
+
+    public static final String EMPTY_ARRAY_RESPONSE = "[]";
+
+    public static final String PROCESS_INSTACE_ID = "5956a99d-9736-11e8-8caf-022ac9304eeb";
+
+    public static final String EMPTY_STRING = "";
+
+    public static final String SOURCE_TEST_FOLDER = "src/test/resources/camundaResponses/";
+
+    public static final Path PROCESS_DEF_RESPONSE_JSON_FILE = Paths.get(SOURCE_TEST_FOLDER + "processDefinition.json");
+
+    public static final Path ACTIVITY_INSTANCE_RESPONSE_JSON_FILE =
+            Paths.get(SOURCE_TEST_FOLDER + "activityInstance.json");
+
+    public static final Path PROCESS_INSTANCE_VARIABLES_RESPONSE_JSON_FILE =
+            Paths.get(SOURCE_TEST_FOLDER + "processInstanceVariables.json");
+
+    public static final Path PROCCESS_INSTANCE_RESPONSE_JSON_FILE =
+            Paths.get(SOURCE_TEST_FOLDER + "processInstance.json");
+
+    public static final Path SINGLE_PROCCESS_INSTANCE_RESPONSE_JSON_FILE =
+            Paths.get(SOURCE_TEST_FOLDER + "singleprocessInstance.json");
+
+    public static final Path SEARCH_RESULT_RESPONSE_JSON_FILE =
+            Paths.get("src/test/resources/databaseResponses/searchResult.json");
+
+    public static final String ID = UUID.randomUUID().toString();
+
+    public static final long END_TIME_IN_MS = 1546351200000l;
+
+    public static final long START_TIME_IN_MS = 1546346700000l;
+
+    private Constants() {}
+
+}
index ca2a88d..3ca184e 100644 (file)
@@ -23,6 +23,20 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.onap.so.monitoring.configuration.rest.RestTemplateConfiguration.CAMUNDA_REST_TEMPLATE;
+import static org.onap.so.monitoring.configuration.rest.RestTemplateConfiguration.DATABASE_REST_TEMPLATE;
+import static org.onap.so.monitoring.rest.api.Constants.ACTIVITY_INSTANCE_RESPONSE_JSON_FILE;
+import static org.onap.so.monitoring.rest.api.Constants.EMPTY_ARRAY_RESPONSE;
+import static org.onap.so.monitoring.rest.api.Constants.EMPTY_STRING;
+import static org.onap.so.monitoring.rest.api.Constants.END_TIME_IN_MS;
+import static org.onap.so.monitoring.rest.api.Constants.ID;
+import static org.onap.so.monitoring.rest.api.Constants.PROCCESS_INSTANCE_RESPONSE_JSON_FILE;
+import static org.onap.so.monitoring.rest.api.Constants.PROCESS_DEF_RESPONSE_JSON_FILE;
+import static org.onap.so.monitoring.rest.api.Constants.PROCESS_INSTACE_ID;
+import static org.onap.so.monitoring.rest.api.Constants.PROCESS_INSTANCE_VARIABLES_RESPONSE_JSON_FILE;
+import static org.onap.so.monitoring.rest.api.Constants.PROCRESS_DEF_ID;
+import static org.onap.so.monitoring.rest.api.Constants.SEARCH_RESULT_RESPONSE_JSON_FILE;
+import static org.onap.so.monitoring.rest.api.Constants.SINGLE_PROCCESS_INSTANCE_RESPONSE_JSON_FILE;
+import static org.onap.so.monitoring.rest.api.Constants.START_TIME_IN_MS;
 import static org.springframework.test.web.client.match.MockRestRequestMatchers.requestTo;
 import static org.springframework.test.web.client.response.MockRestResponseCreators.withBadRequest;
 import static org.springframework.test.web.client.response.MockRestResponseCreators.withSuccess;
@@ -31,9 +45,10 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
-import java.util.UUID;
+import java.util.Map;
 
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.Status;
@@ -42,11 +57,13 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.onap.so.monitoring.configuration.camunda.CamundaRestUrlProvider;
+import org.onap.so.monitoring.configuration.database.DatabaseUrlProvider;
 import org.onap.so.monitoring.model.ActivityInstanceDetail;
 import org.onap.so.monitoring.model.ProcessDefinitionDetail;
 import org.onap.so.monitoring.model.ProcessInstanceDetail;
 import org.onap.so.monitoring.model.ProcessInstanceIdDetail;
 import org.onap.so.monitoring.model.ProcessInstanceVariableDetail;
+import org.onap.so.monitoring.model.SoInfraRequest;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -57,56 +74,39 @@ import org.springframework.test.web.client.MockRestServiceServer;
 import org.springframework.web.client.RestTemplate;
 
 
-
 /**
- * @author waqas.ikram@ericsson.com
+ * @author waqas.ikram@ericsson.com, andrei.barcovschi@ericsson.com
  */
 @RunWith(SpringJUnit4ClassRunner.class)
 @ActiveProfiles("test")
 @SpringBootTest
 public class SoMonitoringControllerTest {
 
-    private static final String PROCRESS_DEF_ID = "AFRFLOW:1:c6eea1b7-9722-11e8-8caf-022ac9304eeb";
-
-    private static final String EMPTY_ARRAY_RESPONSE = "[]";
-
-    private static final String PROCESS_INSTACE_ID = "5956a99d-9736-11e8-8caf-022ac9304eeb";
-
-    private static final String EMPTY_STRING = "";
-
-    private static final String SOURCE_TEST_FOLDER = "src/test/resources/camundaResponses/";
-
-    private static final Path PROCESS_DEF_RESPONSE_JSON_FILE = Paths.get(SOURCE_TEST_FOLDER + "processDefinition.json");
-
-    private static final Path ACTIVITY_INSTANCE_RESPONSE_JSON_FILE =
-            Paths.get(SOURCE_TEST_FOLDER + "activityInstance.json");
-
-    private static final Path PROCESS_INSTANCE_VARIABLES_RESPONSE_JSON_FILE =
-            Paths.get(SOURCE_TEST_FOLDER + "processInstanceVariables.json");
-
-    private static final Path PROCCESS_INSTANCE_RESPONSE_JSON_FILE =
-            Paths.get(SOURCE_TEST_FOLDER + "processInstance.json");
-
-    private static final Path SINGLE_PROCCESS_INSTANCE_RESPONSE_JSON_FILE =
-            Paths.get(SOURCE_TEST_FOLDER + "singleprocessInstance.json");
-
-    private static final String ID = UUID.randomUUID().toString();
-
     @Autowired
     @Qualifier(CAMUNDA_REST_TEMPLATE)
     private RestTemplate restTemplate;
 
+    @Autowired
+    @Qualifier(DATABASE_REST_TEMPLATE)
+    private RestTemplate dataBaseRestTemplate;
+
     @Autowired
     private CamundaRestUrlProvider urlProvider;
 
+    @Autowired
+    private DatabaseUrlProvider databaseUrlProvider;
+
     private MockRestServiceServer camundaMockServer;
 
+    private MockRestServiceServer databaseMockServer;
+
     @Autowired
     private SoMonitoringController objUnderTest;
 
     @Before
     public void setUp() throws Exception {
         camundaMockServer = MockRestServiceServer.bindTo(restTemplate).build();
+        databaseMockServer = MockRestServiceServer.bindTo(dataBaseRestTemplate).build();
     }
 
     @Test
@@ -339,7 +339,7 @@ public class SoMonitoringControllerTest {
         final List<ProcessInstanceVariableDetail> actual = (List<ProcessInstanceVariableDetail>) response.getEntity();
         assertEquals(230, actual.size());
 
-        ProcessInstanceVariableDetail variableDetail = actual.get(0);
+        final ProcessInstanceVariableDetail variableDetail = actual.get(0);
         assertEquals("serviceType", variableDetail.getName());
         assertEquals("String", variableDetail.getType());
         assertEquals("PNFSERVICE", variableDetail.getValue());
@@ -393,6 +393,30 @@ public class SoMonitoringControllerTest {
 
     }
 
+    @Test
+    public void test_GetInfraActiveRequests_SuccessResponseWithSoInfraRequestList() throws Exception {
+        final String jsonString = getJsonResponse(SEARCH_RESULT_RESPONSE_JSON_FILE);
+        this.databaseMockServer
+                .expect(requestTo(databaseUrlProvider.getSearchUrl(START_TIME_IN_MS, END_TIME_IN_MS, null)))
+                .andRespond(withSuccess(jsonString, MediaType.APPLICATION_JSON));
+
+        final Response response =
+                objUnderTest.getInfraActiveRequests(Collections.emptyMap(), START_TIME_IN_MS, END_TIME_IN_MS, null);
+
+        assertEquals(Status.OK.getStatusCode(), response.getStatus());
+        @SuppressWarnings("unchecked")
+        final List<SoInfraRequest> actual = (List<SoInfraRequest>) response.getEntity();
+        assertEquals(3, actual.size());
+
+        final Map<String, SoInfraRequest> actualRequests = new HashMap<>();
+        for (final SoInfraRequest soInfraRequest : actual) {
+            actualRequests.put(soInfraRequest.getRequestId(), soInfraRequest);
+        }
+        final SoInfraRequest infraRequest = actualRequests.get("9383dc81-7a6c-4673-8082-650d50a82a1a");
+        assertNull(infraRequest.getEndTime());
+        assertEquals("IN_PROGRESS", infraRequest.getRequestStatus());
+    }
+
     private String getJsonResponse(final Path path) throws IOException {
         return new String(Files.readAllBytes(path));
     }
index 857266d..8d930fe 100644 (file)
@@ -13,3 +13,12 @@ camunda:
       url: http://localhost:8080/engine-rest/engine/
       engine: default
       auth: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==
+
+mso:
+  database:
+    rest:
+      api:
+        url: http://localhost:8083/infraActiveRequests/
+        auth: Basic YnBlbDpwYXNzd29yZDEk
+
+      
\ No newline at end of file
diff --git a/so-monitoring/so-monitoring-service/src/test/resources/databaseResponses/searchResult.json b/so-monitoring/so-monitoring-service/src/test/resources/databaseResponses/searchResult.json
new file mode 100644 (file)
index 0000000..90c27ef
--- /dev/null
@@ -0,0 +1,161 @@
+[
+    {
+        "requestId": "a5294d37-21db-4e3a-ae04-57412adcb4ac",
+        "clientRequestId": null,
+        "action": "createInstance",
+        "requestStatus": "COMPLETE",
+        "statusMessage": null,
+        "rollbackStatusMessage": null,
+        "flowStatus": null,
+        "retryStatusMessage": null,
+        "progress": null,
+        "startTime": 1546346700000,
+        "endTime": 1546347000000,
+        "source": null,
+        "vnfId": null,
+        "vnfName": null,
+        "vnfType": null,
+        "serviceType": null,
+        "aicNodeClli": null,
+        "tenantId": null,
+        "provStatus": null,
+        "vnfParams": null,
+        "vnfOutputs": null,
+        "requestBody": null,
+        "responseBody": null,
+        "lastModifiedBy": null,
+        "modifyTime": null,
+        "requestType": null,
+        "volumeGroupId": null,
+        "volumeGroupName": null,
+        "vfModuleId": null,
+        "vfModuleName": null,
+        "vfModuleModelName": null,
+        "aaiServiceId": null,
+        "aicCloudRegion": null,
+        "callBackUrl": null,
+        "correlator": null,
+        "serviceInstanceId": "f7712652-b516-4925-a243-64550d26fd84",
+        "serviceInstanceName": "ShouldReturnInSearchQuery_1",
+        "requestScope": null,
+        "requestAction": null,
+        "networkId": null,
+        "networkName": null,
+        "networkType": null,
+        "requestorId": null,
+        "configurationId": null,
+        "configurationName": null,
+        "operationalEnvId": null,
+        "operationalEnvName": null,
+        "instanceGroupId": null,
+        "instanceGroupName": null,
+        "requestUrl": null,
+        "requestURI": "a5294d37-21db-4e3a-ae04-57412adcb4ac"
+    },
+    {
+        "requestId": "9383dc81-7a6c-4673-8082-650d50a82a1a",
+        "clientRequestId": null,
+        "action": "createInstance",
+        "requestStatus": "IN_PROGRESS",
+        "statusMessage": null,
+        "rollbackStatusMessage": null,
+        "flowStatus": null,
+        "retryStatusMessage": null,
+        "progress": null,
+        "startTime": 1546347300000,
+        "endTime": null,
+        "source": null,
+        "vnfId": null,
+        "vnfName": null,
+        "vnfType": null,
+        "serviceType": null,
+        "aicNodeClli": null,
+        "tenantId": null,
+        "provStatus": null,
+        "vnfParams": null,
+        "vnfOutputs": null,
+        "requestBody": null,
+        "responseBody": null,
+        "lastModifiedBy": null,
+        "modifyTime": null,
+        "requestType": null,
+        "volumeGroupId": null,
+        "volumeGroupName": null,
+        "vfModuleId": null,
+        "vfModuleName": null,
+        "vfModuleModelName": null,
+        "aaiServiceId": null,
+        "aicCloudRegion": null,
+        "callBackUrl": null,
+        "correlator": null,
+        "serviceInstanceId": "f7712652-b516-4925-a243-64550d26fd84",
+        "serviceInstanceName": "ShouldReturnInSearchQuery_2",
+        "requestScope": null,
+        "requestAction": null,
+        "networkId": null,
+        "networkName": null,
+        "networkType": null,
+        "requestorId": null,
+        "configurationId": null,
+        "configurationName": null,
+        "operationalEnvId": null,
+        "operationalEnvName": null,
+        "instanceGroupId": null,
+        "instanceGroupName": null,
+        "requestUrl": null,
+        "requestURI": "9383dc81-7a6c-4673-8082-650d50a82a1a"
+    },
+    {
+        "requestId": "a1abeab2-f8ef-43ab-b76c-9c3c2cb9980f",
+        "clientRequestId": null,
+        "action": "activateInstance",
+        "requestStatus": "FAILED",
+        "statusMessage": null,
+        "rollbackStatusMessage": null,
+        "flowStatus": null,
+        "retryStatusMessage": null,
+        "progress": null,
+        "startTime": 1546347600000,
+        "endTime": 1546351200000,
+        "source": null,
+        "vnfId": null,
+        "vnfName": null,
+        "vnfType": null,
+        "serviceType": null,
+        "aicNodeClli": null,
+        "tenantId": null,
+        "provStatus": null,
+        "vnfParams": null,
+        "vnfOutputs": null,
+        "requestBody": null,
+        "responseBody": null,
+        "lastModifiedBy": null,
+        "modifyTime": null,
+        "requestType": null,
+        "volumeGroupId": null,
+        "volumeGroupName": null,
+        "vfModuleId": null,
+        "vfModuleName": null,
+        "vfModuleModelName": null,
+        "aaiServiceId": null,
+        "aicCloudRegion": null,
+        "callBackUrl": null,
+        "correlator": null,
+        "serviceInstanceId": "f7712652-b516-4925-a243-64550d26fd84",
+        "serviceInstanceName": "ShouldReturnInSearchQuery_3",
+        "requestScope": null,
+        "requestAction": null,
+        "networkId": null,
+        "networkName": null,
+        "networkType": null,
+        "requestorId": null,
+        "configurationId": null,
+        "configurationName": null,
+        "operationalEnvId": null,
+        "operationalEnvName": null,
+        "instanceGroupId": null,
+        "instanceGroupName": null,
+        "requestUrl": null,
+        "requestURI": "a1abeab2-f8ef-43ab-b76c-9c3c2cb9980f"
+    }
+]
\ No newline at end of file