Merge "improvements to audit inventory feature"
authorSteve Smokowski <ss835w@att.com>
Wed, 6 Mar 2019 17:26:20 +0000 (17:26 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 6 Mar 2019 17:26:20 +0000 (17:26 +0000)
35 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/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/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
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java

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 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 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 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();