summaryrefslogtreecommitdiffstats
path: root/bpmn/mso-infrastructure-bpmn
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-07-30 15:56:09 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-07-31 11:09:25 -0400
commit5a6a6de6f1a26a1897e4917a0df613e25a24eb70 (patch)
tree59a968f27b4b603aacc9d5e7b51fb598aeec5321 /bpmn/mso-infrastructure-bpmn
parentb6dc38501f3b746426b42d9de4cc883d894149e8 (diff)
Containerization feature of SO
Change-Id: I95381232eeefcd247a66a5cec370a8ce1c288e18 Issue-ID: SO-670 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/mso-infrastructure-bpmn')
-rw-r--r--bpmn/mso-infrastructure-bpmn/pom.xml207
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy62
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy425
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/CallbackHeader.java139
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactory.java91
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/RequestHeader.java223
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java130
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java111
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java51
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java53
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/package-info.java22
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/CreateVnfNotification.java462
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java198
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoExceptionCategory.java61
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoRequest.java112
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/ObjectFactory.java208
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/QueryVnfNotification.java488
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/RollbackVnfNotification.java175
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/UpdateVnfNotification.java412
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify.java177
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java108
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java210
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfStatus.java61
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/package-info.java22
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java425
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java68
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java91
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java255
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java33
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java244
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java124
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java155
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java630
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java353
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java172
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java122
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java117
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java52
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java57
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java422
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/META-INF/processes.xml31
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml275
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml30
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateActivateSDNCResource.bpmn393
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateCustom3rdONAPServiceInstance.bpmn389
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/process/DeleteCustom3rdONAPServiceInstance.bpmn381
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn162
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/DeActivateNetworkResource.bpmn258
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java46
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java45
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java41
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java54
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java72
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java32
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java357
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java183
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java116
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java88
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java267
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java132
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java95
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java288
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java224
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java78
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetServiceIT.java560
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetVnfIT.java190
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java96
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java39
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java53
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java340
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java35
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java761
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java771
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java208
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java69
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java145
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java84
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java120
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java69
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java549
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java174
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java142
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java386
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java84
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java69
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java2215
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java41
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java25
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java73
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java39
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java57
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java132
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java50
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java59
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java94
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java84
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java150
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java197
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java47
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java381
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java291
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java266
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java323
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java276
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java323
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java145
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java140
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/GenericVnf.xml16
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/oofCallbackInfraVnf.json50
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestRollback.json60
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml208
111 files changed, 22251 insertions, 0 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml
new file mode 100644
index 0000000000..fbfe831fd2
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/pom.xml
@@ -0,0 +1,207 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.onap.so</groupId>
+ <artifactId>bpmn</artifactId>
+ <version>1.3.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>mso-infrastructure-bpmn</artifactId>
+ <packaging>jar</packaging>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack</id>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.onap.so</groupId>
+ <artifactId>MSOCommonBPMN</artifactId>
+ <version>${project.version}</version>
+ <type>jar</type>
+ <overWrite>false</overWrite>
+ <outputDirectory>${project.build.outputDirectory}</outputDirectory>
+ <includes>**/*.bpmn</includes>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.onap.so</groupId>
+ <artifactId>so-bpmn-building-blocks</artifactId>
+ <version>${project.version}</version>
+ <type>jar</type>
+ <overWrite>false</overWrite>
+ <outputDirectory>${project.build.outputDirectory}</outputDirectory>
+ <includes>**/*.bpmn</includes>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.onap.so</groupId>
+ <artifactId>so-bpmn-infrastructure-flows</artifactId>
+ <version>${project.version}</version>
+ <type>jar</type>
+ <overWrite>false</overWrite>
+ <outputDirectory>${project.build.outputDirectory}</outputDirectory>
+ <includes>**/*.bpmn</includes>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>test-compile</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>testCompile</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>tests</id>
+ </execution>
+ <execution>
+ <id>original</id>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-maven-plugin</artifactId>
+ <version>${springboot.version}</version>
+ <configuration>
+ <mainClass>org.onap.so.adapters.requestsdb.application.MSOInfrastructureApplication</mainClass>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>repackage</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>extract-docker-file</id>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>io.fabric8</groupId>
+ <artifactId>fabric8-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>start</id>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <!-- Import dependency management from Spring Boot -->
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${springboot.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.camunda.bpm.springboot</groupId>
+ <artifactId>camunda-bpm-spring-boot-starter</artifactId>
+ <version>2.3.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.camunda.bpm.extension</groupId>
+ <artifactId>camunda-bpm-assert</artifactId>
+ <version>2.0-alpha2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.camunda.bpm.springboot</groupId>
+ <artifactId>camunda-bpm-spring-boot-starter-rest</artifactId>
+ <version>2.3.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-web</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-jpa</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>so-bpmn-infrastructure-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>MSOCommonBPMN</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>MSOCommonBPMN</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.cloud</groupId>
+ <artifactId>spring-cloud-contract-wiremock</artifactId>
+ <version>1.2.4.RELEASE</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>ch.vorburger.mariaDB4j</groupId>
+ <artifactId>mariaDB4j</artifactId>
+ <version>2.2.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>io.micrometer</groupId>
+ <artifactId>micrometer-spring-legacy</artifactId>
+ <version>1.0.5</version>
+ </dependency>
+ <dependency>
+ <groupId>io.micrometer</groupId>
+ <artifactId>micrometer-registry-prometheus</artifactId>
+ <version>1.0.5</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
new file mode 100644
index 0000000000..9262954917
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.infrastructure.scripts
+
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
+
+/**
+ * This groovy class supports the <class>ActivateSDNCCNetworkResource.bpmn</class> process.
+ * flow for SDNC Network Resource Activate
+ */
+public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
+
+ String Prefix = "ACTSDNCRES_"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ JsonUtils jsonUtil = new JsonUtils()
+
+ SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
+
+ public void preProcessRequest(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** Started preProcessRequest *****", isDebugEnabled)
+ }
+
+ public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** started prepareUpdateAfterActivateSDNCResource *****", isDebugEnabled)
+ }
+
+ public void postCreateSDNCCall(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** started postCreateSDNCCall *****", isDebugEnabled)
+ }
+
+ public void sendSyncResponse(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** started sendSyncResponse *****", isDebugEnabled)
+ }
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy b/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy
new file mode 100644
index 0000000000..bb58030683
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateActivateSDNCResource.groovy
@@ -0,0 +1,425 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Technologies Co., Ltd. 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.bpmn.infrastructure.scripts
+
+import org.json.JSONObject
+import org.json.XML;
+
+import static org.apache.commons.lang3.StringUtils.*;
+import groovy.xml.XmlUtil
+import groovy.json.*
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.recipe.ResourceInput;
+import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder
+import org.onap.so.rest.APIResponse
+import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
+import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory
+import java.util.UUID;
+
+import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.apache.commons.lang3.*
+import org.apache.commons.codec.binary.Base64;
+import org.springframework.web.util.UriUtils
+import org.onap.so.rest.RESTClient
+import org.onap.so.rest.RESTConfig
+
+/**
+ * This groovy class supports the <class>CreateActivateSDNCResource.bpmn</class> process.
+ * flow for SDNC Network Resource Create
+ */
+public class CreateActivateSDNCResource extends AbstractServiceTaskProcessor {
+
+ String Prefix="CRESDNCRES_"
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ JsonUtils jsonUtil = new JsonUtils()
+
+ SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
+
+ public void preProcessRequest(DelegateExecution execution){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** Started preProcessRequest *****", isDebugEnabled)
+ try {
+
+ //get bpmn inputs from resource request.
+ String requestId = execution.getVariable("mso-request-id")
+ String requestAction = execution.getVariable("requestAction")
+ utils.log("INFO","The requestAction is: " + requestAction, isDebugEnabled)
+ String recipeParamsFromRequest = execution.getVariable("recipeParams")
+ utils.log("INFO","The recipeParams is: " + recipeParamsFromRequest, isDebugEnabled)
+ String resourceInput = execution.getVariable("resourceInput")
+ utils.log("INFO","The resourceInput is: " + resourceInput, isDebugEnabled)
+ //Get ResourceInput Object
+ ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
+ execution.setVariable(Prefix + "resourceInput", resourceInputObj)
+
+ //Deal with recipeParams
+ String recipeParamsFromWf = execution.getVariable("recipeParamXsd")
+ String resourceName = resourceInputObj.getResourceInstanceName()
+ //For sdnc requestAction default is "createNetworkInstance"
+ String operationType = "Network"
+ String apiType = "network"
+ if(!StringUtils.isBlank(recipeParamsFromRequest)){
+ //the operationType from worflow(first node) is second priority.
+ operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType")
+ apiType = jsonUtil.getJsonValue(recipeParamsFromRequest, "apiType")
+ }
+ if(!StringUtils.isBlank(recipeParamsFromWf)){
+ //the operationType from worflow(first node) is highest priority.
+ operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType")
+ apiType = jsonUtil.getJsonValue(recipeParamsFromRequest, "apiType")
+ }
+
+ execution.setVariable(Prefix + "operationType", operationType)
+ execution.setVariable(Prefix + "apiType", apiType)
+ execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId())
+ execution.setVariable("mso-request-id", requestId)
+ execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId())
+ //TODO Here build networkrequest
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex){
+ String msg = "Exception in preProcessRequest " + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
+ String customizeResourceParam(String netowrkInputParametersJson) {
+ List<Map<String, Object>> paramList = new ArrayList();
+ JSONObject jsonObject = new JSONObject(netowrkInputParametersJson);
+ Iterator iterator = jsonObject.keys();
+ while (iterator.hasNext()) {
+ String key = iterator.next();
+ HashMap<String, String> hashMap = new HashMap();
+ hashMap.put("name", key);
+ hashMap.put("value", jsonObject.get(key))
+ paramList.add(hashMap)
+ }
+ Map<String, List<Map<String, Object>>> paramMap = new HashMap();
+ paramMap.put("param", paramList);
+
+ return new JSONObject(paramMap).toString();
+ }
+
+ public void prepareSDNCRequest (DelegateExecution execution) {
+ String svcAction = "create"
+ prepareSDNCRequestReq(execution, svcAction, "")
+ }
+
+
+ public void prepareSDNCActivateRequest (DelegateExecution execution) {
+ String svcAction = "activate"
+ String sndcResourceId = execution.getVariable(Prefix + "sdncResourceId")
+ prepareSDNCRequestReq(execution, svcAction, sndcResourceId)
+ }
+ /**
+ * Pre Process the BPMN Flow Request
+ * Inclouds:
+ * generate the nsOperationKey
+ * generate the nsParameters
+ */
+ public void prepareSDNCRequestReq (DelegateExecution execution, String svcAction, String sdncResourceId) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled)
+
+ try {
+ // get variables
+ String operationType = execution.getVariable(Prefix + "operationType")
+ String sdnc_apiType = execution.getVariable(Prefix + "apiType")
+ String sdnc_svcAction = svcAction
+ String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance"
+
+ String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback")
+ String createNetworkInput = execution.getVariable(Prefix + "networkRequest")
+
+ String hdrRequestId = execution.getVariable("mso-request-id")
+ String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId")
+ String source = execution.getVariable("source")
+ String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId")
+ ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput")
+ String serviceType = resourceInputObj.getServiceType()
+ String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid()
+ String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid()
+ String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelVersion()
+ String serviceModelName = resourceInputObj.getServiceModelInfo().getModelName()
+ String globalCustomerId = resourceInputObj.getGlobalSubscriberId()
+ String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid();
+ String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
+ String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid()
+ String modelName = resourceInputObj.getResourceModelInfo().getModelName()
+ String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion()
+ String resourceInputPrameters = resourceInputObj.getResourceParameters()
+ String netowrkInputParametersJson = jsonUtil.getJsonValue(resourceInputPrameters, "requestInputs")
+ //here convert json string to xml string
+ String netowrkInputParameters = XML.toString(new JSONObject(customizeResourceParam(netowrkInputParametersJson)))
+
+ // 1. prepare assign topology via SDNC Adapter SUBFLOW call
+ String sndcTopologyCreateRequest =
+ """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:sdncadapter="http://org.openecomp.mso/workflow/sdnc/adapter/schema/v1"
+ xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${serviceInstanceId}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${sdnc_svcAction}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>${sdnc_apiType}-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-information>
+ <request-id>${hdrRequestId}</request-id>
+ <request-action>${sdnc_requestAction}</request-action>
+ <source>${source}</source>
+ <notification-url></notification-url>
+ <order-number></order-number>
+ <order-version></order-version>
+ </request-information>
+ <service-information>
+ <service-id>${serviceInstanceId}</service-id>
+ <subscription-service-type>${serviceType}</subscription-service-type>
+ <onap-model-information>
+ <model-invariant-uuid>${serviceModelInvariantUuid}</model-invariant-uuid>
+ <model-uuid>${serviceModelUuid}</model-uuid>
+ <model-version>${serviceModelVersion}</model-version>
+ <model-name>${serviceModelName}</model-name>
+ </onap-model-information>
+ <service-instance-id>${serviceInstanceId}</service-instance-id>
+ <global-customer-id>${globalCustomerId}</global-customer-id>
+ </service-information>
+ <${sdnc_apiType}-information>
+ <${sdnc_apiType}-id>${sdncResourceId}</${sdnc_apiType}-id>
+ <onap-model-information>
+ <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
+ <model-customization-uuid>${modelCustomizationUuid}</model-customization-uuid>
+ <model-uuid>${modelUuid}</model-uuid>
+ <model-version>${modelVersion}</model-version>
+ <model-name>${modelName}</model-name>
+ </onap-model-information>
+ </${sdnc_apiType}-information>
+ <${sdnc_apiType}-request-input>
+ <${sdnc_apiType}-input-parameters>${netowrkInputParameters}</${sdnc_apiType}-input-parameters>
+ </${sdnc_apiType}-request-input>
+ </sdncadapterworkflow:SDNCRequestData>
+ </aetgt:SDNCAdapterWorkflowRequest>""".trim()
+
+ String sndcTopologyCreateRequesAsString = utils.formatXml(sndcTopologyCreateRequest)
+ utils.logAudit(sndcTopologyCreateRequesAsString)
+ execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString)
+ utils.log("INFO","sdncAdapterWorkflowRequest :" + sndcTopologyCreateRequesAsString, isDebugEnabled)
+ utils.log("DEBUG","sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString, isDebugEnabled)
+
+ } catch (Exception ex) {
+ String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage()
+ utils.log("DEBUG", exceptionMessage, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+
+ }
+ utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled)
+ }
+
+ private void setProgressUpdateVariables(DelegateExecution execution, String body) {
+ def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+ execution.setVariable("CVFMI_updateResOperStatusRequest", body)
+ }
+
+ public void prepareUpdateBeforeCreateSDNCResource(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** Started prepareUpdateBeforeCreateSDNCResource *****", isDebugEnabled)
+
+ ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput")
+ String operType = resourceInputObj.getOperationType()
+ String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
+ String ServiceInstanceId = resourceInputObj.getServiceInstanceId()
+ String operationId = resourceInputObj.getOperationId()
+ String modelName = resourceInputObj.getResourceModelInfo().getModelName()
+ String progress = "20"
+ String status = "processing"
+ String statusDescription = "Create " + modelName
+
+ execution.getVariable("operationId")
+
+ String body = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:updateResourceOperationStatus>
+ <operType>${operType}</operType>
+ <operationId>${operationId}</operationId>
+ <progress>${progress}</progress>
+ <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID>
+ <serviceId>${ServiceInstanceId}</serviceId>
+ <status>${status}</status>
+ <statusDescription>${statusDescription}</statusDescription>
+ </ns:updateResourceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>""";
+
+ setProgressUpdateVariables(execution, body)
+ utils.log("INFO"," ***** End prepareUpdateBeforeCreateSDNCResource *****", isDebugEnabled)
+ }
+
+ public void postCreateSDNC(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ ServicePluginFactory.getInstance().test()
+ utils.log("INFO"," ***** Started postCreateSDNC *****", isDebugEnabled)
+ String sdnc_apiType = execution.getVariable(Prefix + "apiType")
+ String sdncAdapterResponse = execution.getVariable("sdncAdapterResponse")
+ utils.log("INFO","sdncAdapterResponse for create:" + sdncAdapterResponse , isDebugEnabled)
+ sdncAdapterResponse = sdncAdapterResponse.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
+ sdncAdapterResponse = sdncAdapterResponse.replaceAll('tag0:', '').replaceAll(':tag0', '')
+ utils.log("INFO","sdncAdapterResponse for create after replace:" + sdncAdapterResponse , isDebugEnabled)
+ //if it is vnf we need to query the vnf-id,if it is network , we need to query the network-id
+ String sdncRespData = utils.getNodeText1(sdncAdapterResponse, "RequestData")
+ utils.log("INFO","sdncRespData:" + sdncRespData , isDebugEnabled)
+ String objectKey = "/" + sdnc_apiType + "/"
+ String objectDataKey = "/" + sdnc_apiType + "-data/"
+ String objectPath = utils.getNodeText1(sdncRespData, "object-path")
+
+ String resourceObjId = objectPath.substring(objectPath.indexOf(objectKey) + objectKey.length(), objectPath.indexOf(objectDataKey))
+ utils.log("INFO", "resourceObjId:" + resourceObjId, isDebugEnabled)
+ execution.setVariable(Prefix + "sdncResourceId", resourceObjId)
+
+ utils.log("INFO"," ***** End postCreateSDNC *****", isDebugEnabled)
+
+ }
+
+ public void postActivateSDNC(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** Started postActivateSDNC *****", isDebugEnabled)
+ String sdncAdapterResponse = execution.getVariable("sdncAdapterResponse")
+ utils.log("INFO","sdncAdapterResponse for activate:" + sdncAdapterResponse , isDebugEnabled)
+ utils.log("INFO"," ***** End postActivateSDNC *****", isDebugEnabled)
+ }
+
+ public void prepareUpdateAfterCreateSDNCResource(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** Started prepareUpdateAfterCreateSDNCResource *****", isDebugEnabled)
+ ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput")
+ String operType = resourceInputObj.getOperationType()
+ String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
+ String ServiceInstanceId = resourceInputObj.getServiceInstanceId()
+ String modelName = resourceInputObj.getResourceModelInfo().getModelName()
+ String operationId = resourceInputObj.getOperationId()
+ String progress = "50"
+ String status = "processing"
+ String statusDescription = "Instantiate " + modelName
+
+ execution.getVariable("operationId")
+
+ String body = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:updateResourceOperationStatus>
+ <operType>${operType}</operType>
+ <operationId>${operationId}</operationId>
+ <progress>${progress}</progress>
+ <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID>
+ <serviceId>${ServiceInstanceId}</serviceId>
+ <status>${status}</status>
+ <statusDescription>${statusDescription}</statusDescription>
+ </ns:updateResourceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>""";
+
+ setProgressUpdateVariables(execution, body)
+ utils.log("INFO"," ***** End prepareUpdateAfterCreateSDNCResource *****", isDebugEnabled)
+ }
+
+ public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** Started prepareUpdateAfterActivateSDNCResource *****", isDebugEnabled)
+ ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput")
+ String operType = resourceInputObj.getOperationType()
+ String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
+ String ServiceInstanceId = resourceInputObj.getServiceInstanceId()
+ String modelName = resourceInputObj.getResourceModelInfo().getModelName()
+ String operationId = resourceInputObj.getOperationId()
+ String progress = "100"
+ String status = "finished"
+ String statusDescription = "Instantiate " + modelName + " finished"
+
+ execution.getVariable("operationId")
+
+ String body = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:updateResourceOperationStatus>
+ <operType>${operType}</operType>
+ <operationId>${operationId}</operationId>
+ <progress>${progress}</progress>
+ <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID>
+ <serviceId>${ServiceInstanceId}</serviceId>
+ <status>${status}</status>
+ <statusDescription>${statusDescription}</statusDescription>
+ </ns:updateResourceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>""";
+
+ setProgressUpdateVariables(execution, body)
+ utils.log("INFO"," ***** End prepareUpdateAfterActivateSDNCResource *****", isDebugEnabled)
+ }
+
+ public void postCreateSDNCCall(DelegateExecution execution){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled)
+ String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode")
+ String responseObj = execution.getVariable(Prefix + "SuccessIndicator")
+
+ utils.log("INFO","response from sdnc, response code :" + responseCode + " response object :" + responseObj, isDebugEnabled)
+ utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled)
+ }
+
+ public void sendSyncResponse (DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)
+
+ try {
+ String operationStatus = "finished"
+ // RESTResponse for main flow
+ String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
+ utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled)
+ sendWorkflowResponse(execution, 202, resourceOperationResp)
+ execution.setVariable("sentSyncResponse", true)
+
+ } catch (Exception ex) {
+ String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled)
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/CallbackHeader.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/CallbackHeader.java
new file mode 100644
index 0000000000..bf4c59ca09
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/CallbackHeader.java
@@ -0,0 +1,139 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.sdnc;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="ResponseCode" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="ResponseMessage" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "requestId",
+ "responseCode",
+ "responseMessage"
+}, namespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+@XmlRootElement(name = "CallbackHeader")
+public class CallbackHeader {
+
+ @XmlElement(name = "RequestId", required = true, namespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+ protected String requestId;
+ @XmlElement(name = "ResponseCode", required = true,namespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+ protected String responseCode;
+ @XmlElement(name = "ResponseMessage", required = true,namespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+ protected String responseMessage;
+
+ /**
+ * Gets the value of the requestId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the value of the requestId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setRequestId(String value) {
+ this.requestId = value;
+ }
+
+ /**
+ * Gets the value of the responseCode property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getResponseCode() {
+ return responseCode;
+ }
+
+ /**
+ * Sets the value of the responseCode property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setResponseCode(String value) {
+ this.responseCode = value;
+ }
+
+ /**
+ * Gets the value of the responseMessage property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getResponseMessage() {
+ return responseMessage;
+ }
+
+ /**
+ * Sets the value of the responseMessage property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setResponseMessage(String value) {
+ this.responseMessage = value;
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactory.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactory.java
new file mode 100644
index 0000000000..a72e23e57f
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactory.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.sdnc;
+
+import javax.xml.bind.annotation.XmlRegistry;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.openecomp.domain2.workflow.sdnc.adapter.schema.v1 package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.domain2.workflow.sdnc.adapter.schema.v1
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link RequestHeader }
+ *
+ */
+ public RequestHeader createRequestHeader() {
+ return new RequestHeader();
+ }
+
+ /**
+ * Create an instance of {@link SDNCAdapterResponse }
+ *
+ */
+ public SDNCAdapterResponse createSDNCAdapterResponse() {
+ return new SDNCAdapterResponse();
+ }
+
+ /**
+ * Create an instance of {@link SDNCAdapterCallbackRequest }
+ *
+ */
+ public SDNCAdapterCallbackRequest createSDNCAdapterCallbackRequest() {
+ return new SDNCAdapterCallbackRequest();
+ }
+
+ /**
+ * Create an instance of {@link CallbackHeader }
+ *
+ */
+ public CallbackHeader createCallbackHeader() {
+ return new CallbackHeader();
+ }
+
+ /**
+ * Create an instance of {@link SDNCAdapterRequest }
+ *
+ */
+ public SDNCAdapterRequest createSDNCAdapterRequest() {
+ return new SDNCAdapterRequest();
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/RequestHeader.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/RequestHeader.java
new file mode 100644
index 0000000000..2c56a110db
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/RequestHeader.java
@@ -0,0 +1,223 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.sdnc;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="RequestId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="SvcInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="SvcAction" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="SvcOperation" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="CallbackUrl" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="MsoAction" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "requestId",
+ "svcInstanceId",
+ "svcAction",
+ "svcOperation",
+ "callbackUrl",
+ "msoAction"
+})
+@XmlRootElement(name = "RequestHeader")
+public class RequestHeader {
+
+ @XmlElement(name = "RequestId", required = true)
+ protected String requestId;
+ @XmlElement(name = "SvcInstanceId")
+ protected String svcInstanceId;
+ @XmlElement(name = "SvcAction", required = true)
+ protected String svcAction;
+ @XmlElement(name = "SvcOperation", required = true)
+ protected String svcOperation;
+ @XmlElement(name = "CallbackUrl", required = true)
+ protected String callbackUrl;
+ @XmlElement(name = "MsoAction")
+ protected String msoAction;
+
+ /**
+ * Gets the value of the requestId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the value of the requestId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setRequestId(String value) {
+ this.requestId = value;
+ }
+
+ /**
+ * Gets the value of the svcInstanceId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSvcInstanceId() {
+ return svcInstanceId;
+ }
+
+ /**
+ * Sets the value of the svcInstanceId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSvcInstanceId(String value) {
+ this.svcInstanceId = value;
+ }
+
+ /**
+ * Gets the value of the svcAction property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSvcAction() {
+ return svcAction;
+ }
+
+ /**
+ * Sets the value of the svcAction property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSvcAction(String value) {
+ this.svcAction = value;
+ }
+
+ /**
+ * Gets the value of the svcOperation property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getSvcOperation() {
+ return svcOperation;
+ }
+
+ /**
+ * Sets the value of the svcOperation property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setSvcOperation(String value) {
+ this.svcOperation = value;
+ }
+
+ /**
+ * Gets the value of the callbackUrl property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCallbackUrl() {
+ return callbackUrl;
+ }
+
+ /**
+ * Sets the value of the callbackUrl property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCallbackUrl(String value) {
+ this.callbackUrl = value;
+ }
+
+ /**
+ * Gets the value of the msoAction property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMsoAction() {
+ return msoAction;
+ }
+
+ /**
+ * Sets the value of the msoAction property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMsoAction(String value) {
+ this.msoAction = value;
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java
new file mode 100644
index 0000000000..e77232510a
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterCallbackRequest.java
@@ -0,0 +1,130 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.sdnc;
+
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element ref="{http://org.onap/workflow/sdnc/adapter/schema/v1}CallbackHeader"/>
+ * &lt;element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", namespace="http://org.onap/workflow/sdnc/adapter/schema/v1", propOrder = {
+ "callbackHeader",
+ "requestData"
+})
+@XmlRootElement(name = "SDNCAdapterCallbackRequest", namespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+public class SDNCAdapterCallbackRequest {
+
+ @XmlElement(name = "CallbackHeader", required = true, namespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+ protected CallbackHeader callbackHeader;
+ @XmlElement(name = "RequestData", required=false, namespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+ protected Object requestData;
+
+ /**
+ * Gets the value of the callbackHeader property.
+ *
+ * @return
+ * possible object is
+ * {@link CallbackHeader }
+ *
+ */
+ public CallbackHeader getCallbackHeader() {
+ return callbackHeader;
+ }
+
+ /**
+ * Sets the value of the callbackHeader property.
+ *
+ * @param value
+ * allowed object is
+ * {@link CallbackHeader }
+ *
+ */
+ public void setCallbackHeader(CallbackHeader value) {
+ this.callbackHeader = value;
+ }
+
+ /**
+ * Gets the value of the requestData property.
+ *
+ * @return
+ * possible object is
+ * {@link Object }
+ *
+ */
+ public Object getRequestData() {
+ return requestData;
+ }
+
+ /**
+ * Sets the value of the requestData property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Object }
+ *
+ */
+ public void setRequestData(Object value) {
+ this.requestData = value;
+ }
+
+ @Override
+ public String toString() {
+ StringWriter writer = new StringWriter();
+ try {
+ JAXBContext context = JAXBContext
+ .newInstance(SDNCAdapterCallbackRequest.class);
+ Marshaller m = context.createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ m.marshal(this, writer);
+ return writer.getBuffer().toString();
+ } catch (JAXBException e) {
+ return "";
+ }
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java
new file mode 100644
index 0000000000..179776d95d
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterRequest.java
@@ -0,0 +1,111 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.sdnc;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element ref="{http://org.onap/workflow/sdnc/adapter/schema/v1}RequestHeader"/>
+ * &lt;element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "", propOrder = {
+ "requestHeader",
+ "requestData"
+})
+@XmlRootElement(name = "SDNCAdapterRequest")
+public class SDNCAdapterRequest {
+
+ @XmlElement(name = "RequestHeader", required = true)
+ protected RequestHeader requestHeader;
+ @XmlElement(name = "RequestData", required = true)
+ protected Object requestData;
+
+ /**
+ * Gets the value of the requestHeader property.
+ *
+ * @return
+ * possible object is
+ * {@link RequestHeader }
+ *
+ */
+ public RequestHeader getRequestHeader() {
+ return requestHeader;
+ }
+
+ /**
+ * Sets the value of the requestHeader property.
+ *
+ * @param value
+ * allowed object is
+ * {@link RequestHeader }
+ *
+ */
+ public void setRequestHeader(RequestHeader value) {
+ this.requestHeader = value;
+ }
+
+ /**
+ * Gets the value of the requestData property.
+ *
+ * @return
+ * possible object is
+ * {@link Object }
+ *
+ */
+ public Object getRequestData() {
+ return requestData;
+ }
+
+ /**
+ * Sets the value of the requestData property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Object }
+ *
+ */
+ public void setRequestData(Object value) {
+ this.requestData = value;
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java
new file mode 100644
index 0000000000..3666cb56a6
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCAdapterResponse.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.sdnc;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "")
+@XmlRootElement(name = "SDNCAdapterResponse")
+public class SDNCAdapterResponse {
+
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java
new file mode 100644
index 0000000000..eff70f5b12
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/SDNCCallbackAdapterPortType.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.sdnc;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.2.4-b01
+ * Generated source version: 2.2
+ *
+ */
+@WebService(name = "SDNCCallbackAdapterPortType", targetNamespace = "http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1")
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+public interface SDNCCallbackAdapterPortType {
+
+
+ /**
+ *
+ * @param sdncAdapterCallbackRequest
+ * @return
+ * returns org.openecomp.domain2.workflow.sdnc.adapter.schema.v1.SDNCAdapterResponse
+ */
+ @WebMethod(operationName = "SDNCAdapterCallback")
+ @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse")
+ public SDNCAdapterResponse sdncAdapterCallback(
+ @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest")
+ SDNCAdapterCallbackRequest sdncAdapterCallbackRequest);
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/package-info.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/package-info.java
new file mode 100644
index 0000000000..ec341d82b5
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/sdnc/package-info.java
@@ -0,0 +1,22 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.onap.so.bpmn.common.adapter.sdnc;
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/CreateVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/CreateVnfNotification.java
new file mode 100644
index 0000000000..aa348c7765
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/CreateVnfNotification.java
@@ -0,0 +1,462 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.vnf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for createVnfNotification complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="createVnfNotification">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;element name="exception" type="{http://org.onap.so/vnfNotify}msoExceptionCategory" minOccurs="0"/>
+ * &lt;element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="outputs" minOccurs="0">
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="entry" maxOccurs="unbounded" minOccurs="0">
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * &lt;/element>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * &lt;/element>
+ * &lt;element name="rollback" type="{http://org.onap.so/vnfNotify}vnfRollback" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "createVnfNotification1", propOrder = {
+ "messageId",
+ "completed",
+ "exception",
+ "errorMessage",
+ "vnfId",
+ "outputs",
+ "rollback"
+})
+public class CreateVnfNotification {
+
+ @XmlElement(required = true)
+ protected String messageId;
+ protected boolean completed;
+ protected MsoExceptionCategory exception;
+ protected String errorMessage;
+ protected String vnfId;
+ protected Outputs outputs;
+ protected VnfRollback rollback;
+
+ /**
+ * Gets the value of the messageId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMessageId() {
+ return messageId;
+ }
+
+ /**
+ * Sets the value of the messageId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMessageId(String value) {
+ this.messageId = value;
+ }
+
+ /**
+ * Gets the value of the completed property.
+ *
+ */
+ public boolean isCompleted() {
+ return completed;
+ }
+
+ /**
+ * Sets the value of the completed property.
+ *
+ */
+ public void setCompleted(boolean value) {
+ this.completed = value;
+ }
+
+ /**
+ * Gets the value of the exception property.
+ *
+ * @return
+ * possible object is
+ * {@link MsoExceptionCategory }
+ *
+ */
+ public MsoExceptionCategory getException() {
+ return exception;
+ }
+
+ /**
+ * Sets the value of the exception property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MsoExceptionCategory }
+ *
+ */
+ public void setException(MsoExceptionCategory value) {
+ this.exception = value;
+ }
+
+ /**
+ * Gets the value of the errorMessage property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ /**
+ * Sets the value of the errorMessage property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setErrorMessage(String value) {
+ this.errorMessage = value;
+ }
+
+ /**
+ * Gets the value of the vnfId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ /**
+ * Sets the value of the vnfId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVnfId(String value) {
+ this.vnfId = value;
+ }
+
+ /**
+ * Gets the value of the outputs property.
+ *
+ * @return
+ * possible object is
+ * {@link CreateVnfNotification.Outputs }
+ *
+ */
+ public CreateVnfNotification.Outputs getOutputs() {
+ return outputs;
+ }
+
+ /**
+ * Sets the value of the outputs property.
+ *
+ * @param value
+ * allowed object is
+ * {@link CreateVnfNotification.Outputs }
+ *
+ */
+ public void setOutputs(CreateVnfNotification.Outputs value) {
+ this.outputs = value;
+ }
+
+ /**
+ * Gets the value of the rollback property.
+ *
+ * @return
+ * possible object is
+ * {@link VnfRollback }
+ *
+ */
+ public VnfRollback getRollback() {
+ return rollback;
+ }
+
+ /**
+ * Sets the value of the rollback property.
+ *
+ * @param value
+ * allowed object is
+ * {@link VnfRollback }
+ *
+ */
+ public void setRollback(VnfRollback value) {
+ this.rollback = value;
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="entry" maxOccurs="unbounded" minOccurs="0">
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * &lt;/element>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "entry"
+ })
+ public static class Outputs {
+
+ protected List<CreateVnfNotification.Outputs.Entry> entry;
+
+ /**
+ * Gets the value of the entry property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the entry property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getEntry().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link CreateVnfNotification.Outputs.Entry }
+ *
+ *
+ */
+ public List<CreateVnfNotification.Outputs.Entry> getEntry() {
+ if (entry == null) {
+ entry = new ArrayList<>();
+ }
+ return this.entry;
+ }
+
+ // Not a generated method
+ @Override
+ public String toString() {
+ StringBuilder out = new StringBuilder();
+ out.append("<outputs>\n");
+ if (entry != null) {
+ for (Entry e : entry) {
+ out.append(e.toString());
+ out.append('\n');
+ }
+ }
+ out.append("</outputs>");
+ return out.toString();
+ }
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "key",
+ "value"
+ })
+ public static class Entry {
+
+ protected String key;
+ protected String value;
+
+ /**
+ * Gets the value of the key property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getKey() {
+ return key;
+ }
+
+ /**
+ * Sets the value of the key property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setKey(String value) {
+ this.key = value;
+ }
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+
+ }
+
+ // Not a generated method
+ @Override
+ public String toString() {
+ String entrystr;
+ entrystr =
+ "<entry>"+ '\n' +
+ " <key>"+key+"</key>" + '\n' +
+ " <value>"+value+"</value>" + '\n' +
+ "</entry>";
+ return entrystr;
+ }
+
+ }
+
+ }
+
+ // Not a generated method
+ @Override
+ public String toString() {
+ String createVnfNotification;
+ if (exception==null) {
+ createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
+ " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
+ " <messageId>"+messageId+"</messageId>" + '\n' +
+ " <completed>"+completed+"</completed>" + '\n' +
+ " <vnfId>"+vnfId+"</vnfId>" + '\n' +
+ (outputs == null ? "" : outputs.toString() + '\n') +
+ " <rollback>"+rollback+"</rollback>" + '\n' +
+ "</ns2:createVnfNotification>";
+ } else {
+ createVnfNotification = "<ns2:createVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
+ " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
+ " <messageId>"+messageId+"</messageId>" + '\n' +
+ " <completed>"+completed+"</completed>" + '\n' +
+ (outputs == null ? "" : outputs.toString() + '\n') +
+ " <exception>"+exception+"</exception>" + '\n' +
+ " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
+ "</ns2:createVnfNotification>";
+ }
+ return createVnfNotification;
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java
new file mode 100644
index 0000000000..3ad217306d
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/DeleteVnfNotification.java
@@ -0,0 +1,198 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.vnf;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for deleteVnfNotification complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="deleteVnfNotification">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;element name="exception" type="{http://org.onap.so/vnfNotify}msoExceptionCategory" minOccurs="0"/>
+ * &lt;element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "deleteVnfNotification1", propOrder = {
+ "messageId",
+ "completed",
+ "exception",
+ "errorMessage"
+})
+public class DeleteVnfNotification {
+
+ @XmlElement(required = true)
+ protected String messageId;
+ protected boolean completed;
+ protected MsoExceptionCategory exception;
+ protected String errorMessage;
+
+ /**
+ * Gets the value of the messageId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMessageId() {
+ return messageId;
+ }
+
+ /**
+ * Sets the value of the messageId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMessageId(String value) {
+ this.messageId = value;
+ }
+
+ /**
+ * Gets the value of the completed property.
+ *
+ */
+ public boolean isCompleted() {
+ return completed;
+ }
+
+ /**
+ * Sets the value of the completed property.
+ *
+ */
+ public void setCompleted(boolean value) {
+ this.completed = value;
+ }
+
+ /**
+ * Gets the value of the exception property.
+ *
+ * @return
+ * possible object is
+ * {@link MsoExceptionCategory }
+ *
+ */
+ public MsoExceptionCategory getException() {
+ return exception;
+ }
+
+ /**
+ * Sets the value of the exception property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MsoExceptionCategory }
+ *
+ */
+ public void setException(MsoExceptionCategory value) {
+ this.exception = value;
+ }
+
+ /**
+ * Gets the value of the errorMessage property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ /**
+ * Sets the value of the errorMessage property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setErrorMessage(String value) {
+ this.errorMessage = value;
+ }
+
+ /**
+ * Overrides toString() method
+ * @return String type (deleteVnfNotification)
+ */
+
+ @Override
+ public String toString() {
+ String deleteVnfNotification;
+ if (exception == null) {
+ deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
+ " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
+ " <messageId>"+messageId+"</messageId>" + '\n' +
+ " <completed>"+completed+"</completed>" + '\n' +
+ "</ns2:deleteVnfNotification>";
+ } else {
+ deleteVnfNotification = "<ns2:deleteVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
+ " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
+ " <messageId>"+messageId+"</messageId>" + '\n' +
+ " <completed>"+completed+"</completed>" + '\n' +
+ " <exception>"+exception+"</exception>" + '\n' +
+ " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
+ "</ns2:deleteVnfNotification>";
+ }
+ return deleteVnfNotification;
+ }
+
+/*
+ public String toString() {
+ StringWriter writer = new StringWriter();
+ try {
+ JAXBContext context = JAXBContext
+ .newInstance(DeleteVnfNotification.class);
+ Marshaller m = context.createMarshaller();
+ m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
+ m.marshal(this, writer);
+ //System.out.println("toString() - " + writer.getBuffer().toString());
+ return writer.getBuffer().toString();
+ } catch (JAXBException e) {
+ //System.out.println("JAXBException - " + e.getStackTrace());
+ return "";
+ }
+ }
+*/
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoExceptionCategory.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoExceptionCategory.java
new file mode 100644
index 0000000000..e4c95e82cd
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoExceptionCategory.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.vnf;
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for msoExceptionCategory.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * <pre>
+ * &lt;simpleType name="msoExceptionCategory">
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ * &lt;enumeration value="OPENSTACK"/>
+ * &lt;enumeration value="IO"/>
+ * &lt;enumeration value="INTERNAL"/>
+ * &lt;enumeration value="USERDATA"/>
+ * &lt;/restriction>
+ * &lt;/simpleType>
+ * </pre>
+ *
+ */
+@XmlType(name = "msoExceptionCategory")
+@XmlEnum
+public enum MsoExceptionCategory {
+
+ OPENSTACK,
+ IO,
+ INTERNAL,
+ USERDATA;
+
+ public String value() {
+ return name();
+ }
+
+ public static MsoExceptionCategory fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoRequest.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoRequest.java
new file mode 100644
index 0000000000..6830109097
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/MsoRequest.java
@@ -0,0 +1,112 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.vnf;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for msoRequest complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="msoRequest">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="requestId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="serviceInstanceId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "msoRequest", propOrder = {
+ "requestId",
+ "serviceInstanceId"
+})
+public class MsoRequest {
+
+ protected String requestId;
+ protected String serviceInstanceId;
+
+ /**
+ * Gets the value of the requestId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getRequestId() {
+ return requestId;
+ }
+
+ /**
+ * Sets the value of the requestId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setRequestId(String value) {
+ this.requestId = value;
+ }
+
+ /**
+ * Gets the value of the serviceInstanceId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getServiceInstanceId() {
+ return serviceInstanceId;
+ }
+
+ /**
+ * Sets the value of the serviceInstanceId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setServiceInstanceId(String value) {
+ this.serviceInstanceId = value;
+ }
+
+ @Override
+ public String toString() {
+ return "<requestId>" + requestId + "</requestId>" + '\n' + "<serviceInstanceId>" + serviceInstanceId
+ + "</serviceInstanceId>";
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/ObjectFactory.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/ObjectFactory.java
new file mode 100644
index 0000000000..21bd08fae7
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/ObjectFactory.java
@@ -0,0 +1,208 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.vnf;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.onap.so.adapters.vnf.async.client package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+ private static final String VNF_NOTIFY = "http://org.onap.so/vnfNotify";
+ private static final QName _RollbackVnfNotification_QNAME = new QName(VNF_NOTIFY, "rollbackVnfNotification");
+ private static final QName _DeleteVnfNotification_QNAME = new QName(VNF_NOTIFY, "deleteVnfNotification");
+ private static final QName _CreateVnfNotification_QNAME = new QName(VNF_NOTIFY, "createVnfNotification");
+ private static final QName _UpdateVnfNotification_QNAME = new QName(VNF_NOTIFY, "updateVnfNotification");
+ private static final QName _QueryVnfNotification_QNAME = new QName(VNF_NOTIFY, "queryVnfNotification");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.onap.so.adapters.vnf.async.client
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link UpdateVnfNotification }
+ *
+ */
+ public UpdateVnfNotification createUpdateVnfNotification() {
+ return new UpdateVnfNotification();
+ }
+
+ /**
+ * Create an instance of {@link UpdateVnfNotification.Outputs }
+ *
+ */
+ public UpdateVnfNotification.Outputs createUpdateVnfNotificationOutputs() {
+ return new UpdateVnfNotification.Outputs();
+ }
+
+ /**
+ * Create an instance of {@link QueryVnfNotification }
+ *
+ */
+ public QueryVnfNotification createQueryVnfNotification() {
+ return new QueryVnfNotification();
+ }
+
+ /**
+ * Create an instance of {@link QueryVnfNotification.Outputs }
+ *
+ */
+ public QueryVnfNotification.Outputs createQueryVnfNotificationOutputs() {
+ return new QueryVnfNotification.Outputs();
+ }
+
+ /**
+ * Create an instance of {@link CreateVnfNotification }
+ *
+ */
+ public CreateVnfNotification createCreateVnfNotification() {
+ return new CreateVnfNotification();
+ }
+
+ /**
+ * Create an instance of {@link CreateVnfNotification.Outputs }
+ *
+ */
+ public CreateVnfNotification.Outputs createCreateVnfNotificationOutputs() {
+ return new CreateVnfNotification.Outputs();
+ }
+
+ /**
+ * Create an instance of {@link DeleteVnfNotification }
+ *
+ */
+ public DeleteVnfNotification createDeleteVnfNotification() {
+ return new DeleteVnfNotification();
+ }
+
+ /**
+ * Create an instance of {@link RollbackVnfNotification }
+ *
+ */
+ public RollbackVnfNotification createRollbackVnfNotification() {
+ return new RollbackVnfNotification();
+ }
+
+ /**
+ * Create an instance of {@link MsoRequest }
+ *
+ */
+ public MsoRequest createMsoRequest() {
+ return new MsoRequest();
+ }
+
+ /**
+ * Create an instance of {@link VnfRollback }
+ *
+ */
+ public VnfRollback createVnfRollback() {
+ return new VnfRollback();
+ }
+
+ /**
+ * Create an instance of {@link UpdateVnfNotification.Outputs.Entry }
+ *
+ */
+ public UpdateVnfNotification.Outputs.Entry createUpdateVnfNotificationOutputsEntry() {
+ return new UpdateVnfNotification.Outputs.Entry();
+ }
+
+ /**
+ * Create an instance of {@link QueryVnfNotification.Outputs.Entry }
+ *
+ */
+ public QueryVnfNotification.Outputs.Entry createQueryVnfNotificationOutputsEntry() {
+ return new QueryVnfNotification.Outputs.Entry();
+ }
+
+ /**
+ * Create an instance of {@link CreateVnfNotification.Outputs.Entry }
+ *
+ */
+ public CreateVnfNotification.Outputs.Entry createCreateVnfNotificationOutputsEntry() {
+ return new CreateVnfNotification.Outputs.Entry();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link RollbackVnfNotification }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://org.onap.so/vnfNotify", name = "rollbackVnfNotification")
+ public JAXBElement<RollbackVnfNotification> createRollbackVnfNotification(RollbackVnfNotification value) {
+ return new JAXBElement<>(_RollbackVnfNotification_QNAME, RollbackVnfNotification.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link DeleteVnfNotification }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://org.onap.so/vnfNotify", name = "deleteVnfNotification")
+ public JAXBElement<DeleteVnfNotification> createDeleteVnfNotification(DeleteVnfNotification value) {
+ return new JAXBElement<>(_DeleteVnfNotification_QNAME, DeleteVnfNotification.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link CreateVnfNotification }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://org.onap.so/vnfNotify", name = "createVnfNotification")
+ public JAXBElement<CreateVnfNotification> createCreateVnfNotification(CreateVnfNotification value) {
+ return new JAXBElement<>(_CreateVnfNotification_QNAME, CreateVnfNotification.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link UpdateVnfNotification }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://org.onap.so/vnfNotify", name = "updateVnfNotification")
+ public JAXBElement<UpdateVnfNotification> createUpdateVnfNotification(UpdateVnfNotification value) {
+ return new JAXBElement<>(_UpdateVnfNotification_QNAME, UpdateVnfNotification.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link QueryVnfNotification }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://org.onap.so/vnfNotify", name = "queryVnfNotification")
+ public JAXBElement<QueryVnfNotification> createQueryVnfNotification(QueryVnfNotification value) {
+ return new JAXBElement<>(_QueryVnfNotification_QNAME, QueryVnfNotification.class, null, value);
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/QueryVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/QueryVnfNotification.java
new file mode 100644
index 0000000000..e7496b8028
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/QueryVnfNotification.java
@@ -0,0 +1,488 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.vnf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for queryVnfNotification complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="queryVnfNotification">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;element name="exception" type="{http://org.onap.so/vnfNotify}msoExceptionCategory" minOccurs="0"/>
+ * &lt;element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="vnfExists" type="{http://www.w3.org/2001/XMLSchema}boolean" minOccurs="0"/>
+ * &lt;element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="status" type="{http://org.onap.so/vnfNotify}vnfStatus" minOccurs="0"/>
+ * &lt;element name="outputs" minOccurs="0">
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="entry" maxOccurs="unbounded" minOccurs="0">
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * &lt;/element>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * &lt;/element>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "queryVnfNotification1", propOrder = {
+ "messageId",
+ "completed",
+ "exception",
+ "errorMessage",
+ "vnfExists",
+ "vnfId",
+ "status",
+ "outputs"
+})
+public class QueryVnfNotification {
+
+ @XmlElement(required = true)
+ protected String messageId;
+ protected boolean completed;
+ protected MsoExceptionCategory exception;
+ protected String errorMessage;
+ protected Boolean vnfExists;
+ protected String vnfId;
+ protected VnfStatus status;
+ protected QueryVnfNotification.Outputs outputs;
+
+ /**
+ * Gets the value of the messageId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMessageId() {
+ return messageId;
+ }
+
+ /**
+ * Sets the value of the messageId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMessageId(String value) {
+ this.messageId = value;
+ }
+
+ /**
+ * Gets the value of the completed property.
+ *
+ */
+ public boolean isCompleted() {
+ return completed;
+ }
+
+ /**
+ * Sets the value of the completed property.
+ *
+ */
+ public void setCompleted(boolean value) {
+ this.completed = value;
+ }
+
+ /**
+ * Gets the value of the exception property.
+ *
+ * @return
+ * possible object is
+ * {@link MsoExceptionCategory }
+ *
+ */
+ public MsoExceptionCategory getException() {
+ return exception;
+ }
+
+ /**
+ * Sets the value of the exception property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MsoExceptionCategory }
+ *
+ */
+ public void setException(MsoExceptionCategory value) {
+ this.exception = value;
+ }
+
+ /**
+ * Gets the value of the errorMessage property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ /**
+ * Sets the value of the errorMessage property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setErrorMessage(String value) {
+ this.errorMessage = value;
+ }
+
+ /**
+ * Gets the value of the vnfExists property.
+ *
+ * @return
+ * possible object is
+ * {@link Boolean }
+ *
+ */
+ public Boolean isVnfExists() {
+ return vnfExists;
+ }
+
+ /**
+ * Sets the value of the vnfExists property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Boolean }
+ *
+ */
+ public void setVnfExists(Boolean value) {
+ this.vnfExists = value;
+ }
+
+ /**
+ * Gets the value of the vnfId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ /**
+ * Sets the value of the vnfId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVnfId(String value) {
+ this.vnfId = value;
+ }
+
+ /**
+ * Gets the value of the status property.
+ *
+ * @return
+ * possible object is
+ * {@link VnfStatus }
+ *
+ */
+ public VnfStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * Sets the value of the status property.
+ *
+ * @param value
+ * allowed object is
+ * {@link VnfStatus }
+ *
+ */
+ public void setStatus(VnfStatus value) {
+ this.status = value;
+ }
+
+ /**
+ * Gets the value of the outputs property.
+ *
+ * @return
+ * possible object is
+ * {@link QueryVnfNotification.Outputs }
+ *
+ */
+ public QueryVnfNotification.Outputs getOutputs() {
+ return outputs;
+ }
+
+ /**
+ * Sets the value of the outputs property.
+ *
+ * @param value
+ * allowed object is
+ * {@link QueryVnfNotification.Outputs }
+ *
+ */
+ public void setOutputs(QueryVnfNotification.Outputs value) {
+ this.outputs = value;
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="entry" maxOccurs="unbounded" minOccurs="0">
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * &lt;/element>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "entry"
+ })
+ public static class Outputs {
+
+ protected List<QueryVnfNotification.Outputs.Entry> entry;
+
+ /**
+ * Gets the value of the entry property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the entry property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getEntry().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link QueryVnfNotification.Outputs.Entry }
+ *
+ *
+ */
+ public List<QueryVnfNotification.Outputs.Entry> getEntry() {
+ if (entry == null) {
+ entry = new ArrayList<>();
+ }
+ return this.entry;
+ }
+
+ // Not a generated method
+ public String toString() {
+ StringBuilder out = new StringBuilder();
+ out.append("<outputs>\n");
+ if (entry != null) {
+ for (Entry e : entry) {
+ out.append(e.toString());
+ out.append('\n');
+ }
+ }
+ out.append("</outputs>");
+ return out.toString();
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "key",
+ "value"
+ })
+ public static class Entry {
+
+ protected String key;
+ protected String value;
+
+ /**
+ * Gets the value of the key property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getKey() {
+ return key;
+ }
+
+ /**
+ * Sets the value of the key property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setKey(String value) {
+ this.key = value;
+ }
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ // Not a generated method
+ public String toString() {
+ String entry = "";
+ entry =
+ "<entry>"+ '\n' +
+ " <key>"+key+"</key>" + '\n' +
+ " <value>"+value+"</value>" + '\n' +
+ "</entry>";
+ return entry;
+ }
+
+ }
+
+ }
+
+ // Not a generated method
+ public String toString() {
+ String queryVnfNotification = "";
+ if (exception==null) {
+ queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
+ " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
+ " <messageId>"+messageId+"</messageId>" + '\n' +
+ " <completed>"+completed+"</completed>" + '\n' +
+ " <vnfExists>"+vnfExists+"</vnfExists>" + '\n' +
+ " <vnfId>"+vnfId+"</vnfId>" + '\n' +
+ " <status>"+status+"</status>" + '\n' +
+ (outputs == null ? "" : outputs.toString() + '\n') +
+ "</ns2:queryVnfNotification>";
+ } else {
+ queryVnfNotification = "<ns2:queryVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
+ " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
+ " <messageId>"+messageId+"</messageId>" + '\n' +
+ " <completed>"+completed+"</completed>" + '\n' +
+ (outputs == null ? "" : outputs.toString() + '\n') +
+ " <exception>"+exception+"</exception>" + '\n' +
+ " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
+ "</ns2:queryVnfNotification>";
+ }
+ return queryVnfNotification;
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/RollbackVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/RollbackVnfNotification.java
new file mode 100644
index 0000000000..6b143a2494
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/RollbackVnfNotification.java
@@ -0,0 +1,175 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.vnf;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for rollbackVnfNotification complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="rollbackVnfNotification">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;element name="exception" type="{http://org.onap.so/vnfNotify}msoExceptionCategory" minOccurs="0"/>
+ * &lt;element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "rollbackVnfNotification1", propOrder = {
+ "messageId",
+ "completed",
+ "exception",
+ "errorMessage"
+})
+public class RollbackVnfNotification {
+
+ @XmlElement(required = true)
+ protected String messageId;
+ protected boolean completed;
+ protected MsoExceptionCategory exception;
+ protected String errorMessage;
+
+ /**
+ * Gets the value of the messageId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMessageId() {
+ return messageId;
+ }
+
+ /**
+ * Sets the value of the messageId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMessageId(String value) {
+ this.messageId = value;
+ }
+
+ /**
+ * Gets the value of the completed property.
+ *
+ */
+ public boolean isCompleted() {
+ return completed;
+ }
+
+ /**
+ * Sets the value of the completed property.
+ *
+ */
+ public void setCompleted(boolean value) {
+ this.completed = value;
+ }
+
+ /**
+ * Gets the value of the exception property.
+ *
+ * @return
+ * possible object is
+ * {@link MsoExceptionCategory }
+ *
+ */
+ public MsoExceptionCategory getException() {
+ return exception;
+ }
+
+ /**
+ * Sets the value of the exception property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MsoExceptionCategory }
+ *
+ */
+ public void setException(MsoExceptionCategory value) {
+ this.exception = value;
+ }
+
+ /**
+ * Gets the value of the errorMessage property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ /**
+ * Sets the value of the errorMessage property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setErrorMessage(String value) {
+ this.errorMessage = value;
+ }
+
+ public String toString() {
+ String rollbackVnfNotification = "";
+ if (exception==null) {
+ rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
+ " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
+ " <messageId>"+messageId+"</messageId>" + '\n' +
+ " <completed>"+completed+"</completed>" + '\n' +
+ "</ns2:rollbackVnfNotification>";
+ } else {
+ rollbackVnfNotification = "<ns2:rollbackVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
+ " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
+ " <messageId>"+messageId+"</messageId>" + '\n' +
+ " <completed>"+completed+"</completed>" + '\n' +
+ " <exception>"+exception+"</exception>" + '\n' +
+ " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
+ "</ns2:rollbackVnfNotification>";
+ }
+ return rollbackVnfNotification;
+
+ }
+
+ }
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/UpdateVnfNotification.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/UpdateVnfNotification.java
new file mode 100644
index 0000000000..b89135b865
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/UpdateVnfNotification.java
@@ -0,0 +1,412 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.vnf;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for updateVnfNotification complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="updateVnfNotification">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="messageId" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * &lt;element name="completed" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;element name="exception" type="{http://org.onap.so/vnfNotify}msoExceptionCategory" minOccurs="0"/>
+ * &lt;element name="errorMessage" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="outputs" minOccurs="0">
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="entry" maxOccurs="unbounded" minOccurs="0">
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * &lt;/element>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * &lt;/element>
+ * &lt;element name="rollback" type="{http://org.onap.so/vnfNotify}vnfRollback" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "updateVnfNotification1", propOrder = {
+ "messageId",
+ "completed",
+ "exception",
+ "errorMessage",
+ "outputs",
+ "rollback"
+})
+public class UpdateVnfNotification {
+
+ @XmlElement(required = true)
+ protected String messageId;
+ protected boolean completed;
+ protected MsoExceptionCategory exception;
+ protected String errorMessage;
+ protected UpdateVnfNotification.Outputs outputs;
+ protected VnfRollback rollback;
+
+ /**
+ * Gets the value of the messageId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMessageId() {
+ return messageId;
+ }
+
+ /**
+ * Sets the value of the messageId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMessageId(String value) {
+ this.messageId = value;
+ }
+
+ /**
+ * Gets the value of the completed property.
+ *
+ */
+ public boolean isCompleted() {
+ return completed;
+ }
+
+ /**
+ * Sets the value of the completed property.
+ *
+ */
+ public void setCompleted(boolean value) {
+ this.completed = value;
+ }
+
+ /**
+ * Gets the value of the exception property.
+ *
+ * @return
+ * possible object is
+ * {@link MsoExceptionCategory }
+ *
+ */
+ public MsoExceptionCategory getException() {
+ return exception;
+ }
+
+ /**
+ * Sets the value of the exception property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MsoExceptionCategory }
+ *
+ */
+ public void setException(MsoExceptionCategory value) {
+ this.exception = value;
+ }
+
+ /**
+ * Gets the value of the errorMessage property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+
+ /**
+ * Sets the value of the errorMessage property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setErrorMessage(String value) {
+ this.errorMessage = value;
+ }
+
+ /**
+ * Gets the value of the outputs property.
+ *
+ * @return
+ * possible object is
+ * {@link UpdateVnfNotification.Outputs }
+ *
+ */
+ public UpdateVnfNotification.Outputs getOutputs() {
+ return outputs;
+ }
+
+ /**
+ * Sets the value of the outputs property.
+ *
+ * @param value
+ * allowed object is
+ * {@link UpdateVnfNotification.Outputs }
+ *
+ */
+ public void setOutputs(UpdateVnfNotification.Outputs value) {
+ this.outputs = value;
+ }
+
+ /**
+ * Gets the value of the rollback property.
+ *
+ * @return
+ * possible object is
+ * {@link VnfRollback }
+ *
+ */
+ public VnfRollback getRollback() {
+ return rollback;
+ }
+
+ /**
+ * Sets the value of the rollback property.
+ *
+ * @param value
+ * allowed object is
+ * {@link VnfRollback }
+ *
+ */
+ public void setRollback(VnfRollback value) {
+ this.rollback = value;
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="entry" maxOccurs="unbounded" minOccurs="0">
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * &lt;/element>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "entry"
+ })
+ public static class Outputs {
+
+ protected List<UpdateVnfNotification.Outputs.Entry> entry;
+
+ /**
+ * Gets the value of the entry property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the entry property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getEntry().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link UpdateVnfNotification.Outputs.Entry }
+ *
+ *
+ */
+ public List<UpdateVnfNotification.Outputs.Entry> getEntry() {
+ if (entry == null) {
+ entry = new ArrayList<>();
+ }
+ return this.entry;
+ }
+
+
+ /**
+ * <p>Java class for anonymous complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType>
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="key" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+ @XmlAccessorType(XmlAccessType.FIELD)
+ @XmlType(name = "", propOrder = {
+ "key",
+ "value"
+ })
+ public static class Entry {
+
+ protected String key;
+ protected String value;
+
+ /**
+ * Gets the value of the key property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getKey() {
+ return key;
+ }
+
+ /**
+ * Sets the value of the key property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setKey(String value) {
+ this.key = value;
+ }
+
+ /**
+ * Gets the value of the value property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Sets the value of the value property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String toString() {
+ String entry = "";
+ entry =
+ " <key>"+key+"</key>" + '\n' +
+ " <value>"+value+"</value>";
+ return entry;
+ }
+ }
+
+ }
+
+ public String toString(){
+ String updateVnfNotification = "";
+ if (exception==null) {
+ updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
+ " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
+ " <messageId>"+messageId+"</messageId>" + '\n' +
+ " <completed>"+completed+"</completed>" + '\n' +
+ " <rollback>"+rollback+"</rollback>" + '\n' +
+ "</ns2:updateVnfNotification>";
+ } else {
+ updateVnfNotification = "<ns2:updateVnfNotification xmlns:ns2=\"http://org.onap.so/vnfNotify\"" + '\n' +
+ " xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" + '\n' +
+ " <messageId>"+messageId+"</messageId>" + '\n' +
+ " <completed>"+completed+"</completed>" + '\n' +
+ " <exception>"+exception+"</exception>" + '\n' +
+ " <errorMessage>"+errorMessage+"</errorMessage>" + '\n' +
+ "</ns2:updateVnfNotification>";
+ }
+
+ return updateVnfNotification;
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify.java
new file mode 100644
index 0000000000..adedca9ac5
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify.java
@@ -0,0 +1,177 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.vnf;
+
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.ws.Action;
+import javax.xml.ws.RequestWrapper;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.2.8
+ * Generated source version: 2.2
+ *
+ */
+@WebService(name = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify")
+@XmlSeeAlso({
+ ObjectFactory.class
+})
+public interface VnfAdapterNotify {
+
+
+ /**
+ *
+ * @param errorMessage
+ * @param exception
+ * @param messageId
+ * @param completed
+ */
+ @WebMethod
+ @Oneway
+ @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.RollbackVnfNotification")
+ @Action(input = "http://org.onap.so/notify/adapterNotify/rollbackVnfNotificationRequest")
+ public void rollbackVnfNotification(
+ @WebParam(name = "messageId", targetNamespace = "")
+ String messageId,
+ @WebParam(name = "completed", targetNamespace = "")
+ boolean completed,
+ @WebParam(name = "exception", targetNamespace = "")
+ MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "")
+ String errorMessage);
+
+ /**
+ *
+ * @param errorMessage
+ * @param vnfExists
+ * @param status
+ * @param exception
+ * @param outputs
+ * @param messageId
+ * @param vnfId
+ * @param completed
+ */
+ @WebMethod
+ @Oneway
+ @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.QueryVnfNotification")
+ @Action(input = "http://org.onap.so/notify/adapterNotify/queryVnfNotificationRequest")
+ public void queryVnfNotification(
+ @WebParam(name = "messageId", targetNamespace = "")
+ String messageId,
+ @WebParam(name = "completed", targetNamespace = "")
+ boolean completed,
+ @WebParam(name = "exception", targetNamespace = "")
+ MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "")
+ String errorMessage,
+ @WebParam(name = "vnfExists", targetNamespace = "")
+ Boolean vnfExists,
+ @WebParam(name = "vnfId", targetNamespace = "")
+ String vnfId,
+ @WebParam(name = "status", targetNamespace = "")
+ VnfStatus status,
+ @WebParam(name = "outputs", targetNamespace = "")
+ org.onap.so.bpmn.common.adapter.vnf.QueryVnfNotification.Outputs outputs);
+
+ /**
+ *
+ * @param errorMessage
+ * @param exception
+ * @param rollback
+ * @param outputs
+ * @param messageId
+ * @param vnfId
+ * @param completed
+ */
+ @WebMethod
+ @Oneway
+ @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.CreateVnfNotification")
+ @Action(input = "http://org.onap.so/notify/adapterNotify/createVnfNotificationRequest")
+ public void createVnfNotification(
+ @WebParam(name = "messageId", targetNamespace = "")
+ String messageId,
+ @WebParam(name = "completed", targetNamespace = "")
+ boolean completed,
+ @WebParam(name = "exception", targetNamespace = "")
+ MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "")
+ String errorMessage,
+ @WebParam(name = "vnfId", targetNamespace = "")
+ String vnfId,
+ @WebParam(name = "outputs", targetNamespace = "")
+ org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs outputs,
+ @WebParam(name = "rollback", targetNamespace = "")
+ VnfRollback rollback);
+
+ /**
+ *
+ * @param errorMessage
+ * @param exception
+ * @param rollback
+ * @param outputs
+ * @param messageId
+ * @param completed
+ */
+ @WebMethod
+ @Oneway
+ @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.UpdateVnfNotification")
+ @Action(input = "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest")
+ public void updateVnfNotification(
+ @WebParam(name = "messageId", targetNamespace = "")
+ String messageId,
+ @WebParam(name = "completed", targetNamespace = "")
+ boolean completed,
+ @WebParam(name = "exception", targetNamespace = "")
+ MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "")
+ String errorMessage,
+ @WebParam(name = "outputs", targetNamespace = "")
+ org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs outputs,
+ @WebParam(name = "rollback", targetNamespace = "")
+ VnfRollback rollback);
+
+ /**
+ *
+ * @param errorMessage
+ * @param exception
+ * @param messageId
+ * @param completed
+ */
+ @WebMethod
+ @Oneway
+ @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.DeleteVnfNotification")
+ @Action(input = "http://org.onap.so/notify/adapterNotify/deleteVnfNotificationRequest")
+ public void deleteVnfNotification(
+ @WebParam(name = "messageId", targetNamespace = "")
+ String messageId,
+ @WebParam(name = "completed", targetNamespace = "")
+ boolean completed,
+ @WebParam(name = "exception", targetNamespace = "")
+ MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "")
+ String errorMessage);
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java
new file mode 100644
index 0000000000..667545d855
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfAdapterNotify_Service.java
@@ -0,0 +1,108 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.vnf;
+
+import java.net.URL;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.WebServiceFeature;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.2.8
+ * Generated source version: 2.2
+ *
+ */
+@WebServiceClient(name = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify", wsdlLocation = "/VnfAdapterNotify.wsdl")
+public class VnfAdapterNotify_Service extends Service
+{
+
+ private final static URL VNFADAPTERNOTIFY_WSDL_LOCATION;
+ private final static WebServiceException VNFADAPTERNOTIFY_EXCEPTION;
+ private final static QName VNFADAPTERNOTIFY_QNAME = new QName("http://org.onap.so/vnfNotify", "vnfAdapterNotify");
+
+ static {
+ VNFADAPTERNOTIFY_WSDL_LOCATION = org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify_Service.class.getResource("/VnfAdapterNotify.wsdl");
+ WebServiceException e = null;
+ if (VNFADAPTERNOTIFY_WSDL_LOCATION == null) {
+ e = new WebServiceException("Cannot find '/VnfAdapterNotify.wsdl' wsdl. Place the resource correctly in the classpath.");
+ }
+ VNFADAPTERNOTIFY_EXCEPTION = e;
+ }
+
+ public VnfAdapterNotify_Service() {
+ super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME);
+ }
+
+ public VnfAdapterNotify_Service(WebServiceFeature... features) {
+ super(__getWsdlLocation(), VNFADAPTERNOTIFY_QNAME, features);
+ }
+
+ public VnfAdapterNotify_Service(URL wsdlLocation) {
+ super(wsdlLocation, VNFADAPTERNOTIFY_QNAME);
+ }
+
+ public VnfAdapterNotify_Service(URL wsdlLocation, WebServiceFeature... features) {
+ super(wsdlLocation, VNFADAPTERNOTIFY_QNAME, features);
+ }
+
+ public VnfAdapterNotify_Service(URL wsdlLocation, QName serviceName) {
+ super(wsdlLocation, serviceName);
+ }
+
+ public VnfAdapterNotify_Service(URL wsdlLocation, QName serviceName, WebServiceFeature... features) {
+ super(wsdlLocation, serviceName, features);
+ }
+
+ /**
+ *
+ * @return
+ * returns VnfAdapterNotify
+ */
+ @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort")
+ public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort() {
+ return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class);
+ }
+
+ /**
+ *
+ * @param features
+ * A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy. Supported features not in the <code>features</code> parameter will have their default values.
+ * @return
+ * returns VnfAdapterNotify
+ */
+ @WebEndpoint(name = "MsoVnfAdapterAsyncImplPort")
+ public VnfAdapterNotify getMsoVnfAdapterAsyncImplPort(WebServiceFeature... features) {
+ return super.getPort(new QName("http://org.onap.so/vnfNotify", "MsoVnfAdapterAsyncImplPort"), VnfAdapterNotify.class, features);
+ }
+
+ private static URL __getWsdlLocation() {
+ if (VNFADAPTERNOTIFY_EXCEPTION!= null) {
+ throw VNFADAPTERNOTIFY_EXCEPTION;
+ }
+ return VNFADAPTERNOTIFY_WSDL_LOCATION;
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java
new file mode 100644
index 0000000000..194ce58fe9
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfRollback.java
@@ -0,0 +1,210 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.vnf;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for vnfRollback complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="vnfRollback">
+ * &lt;complexContent>
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * &lt;sequence>
+ * &lt;element name="cloudSiteId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="msoRequest" type="{http://org.onap.so/vnfNotify}msoRequest" minOccurs="0"/>
+ * &lt;element name="tenantCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;element name="tenantId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;element name="vnfCreated" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
+ * &lt;element name="vnfId" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * &lt;/sequence>
+ * &lt;/restriction>
+ * &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "vnfRollback", propOrder = {
+ "cloudSiteId",
+ "msoRequest",
+ "tenantCreated",
+ "tenantId",
+ "vnfCreated",
+ "vnfId"
+})
+public class VnfRollback {
+
+ protected String cloudSiteId;
+ protected MsoRequest msoRequest;
+ protected boolean tenantCreated;
+ protected String tenantId;
+ protected boolean vnfCreated;
+ protected String vnfId;
+
+ /**
+ * Gets the value of the cloudSiteId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getCloudSiteId() {
+ return cloudSiteId;
+ }
+
+ /**
+ * Sets the value of the cloudSiteId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setCloudSiteId(String value) {
+ this.cloudSiteId = value;
+ }
+
+ /**
+ * Gets the value of the msoRequest property.
+ *
+ * @return
+ * possible object is
+ * {@link MsoRequest }
+ *
+ */
+ public MsoRequest getMsoRequest() {
+ return msoRequest;
+ }
+
+ /**
+ * Sets the value of the msoRequest property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MsoRequest }
+ *
+ */
+ public void setMsoRequest(MsoRequest value) {
+ this.msoRequest = value;
+ }
+
+ /**
+ * Gets the value of the tenantCreated property.
+ *
+ */
+ public boolean isTenantCreated() {
+ return tenantCreated;
+ }
+
+ /**
+ * Sets the value of the tenantCreated property.
+ *
+ */
+ public void setTenantCreated(boolean value) {
+ this.tenantCreated = value;
+ }
+
+ /**
+ * Gets the value of the tenantId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getTenantId() {
+ return tenantId;
+ }
+
+ /**
+ * Sets the value of the tenantId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setTenantId(String value) {
+ this.tenantId = value;
+ }
+
+ /**
+ * Gets the value of the vnfCreated property.
+ *
+ */
+ public boolean isVnfCreated() {
+ return vnfCreated;
+ }
+
+ /**
+ * Sets the value of the vnfCreated property.
+ *
+ */
+ public void setVnfCreated(boolean value) {
+ this.vnfCreated = value;
+ }
+
+ /**
+ * Gets the value of the vnfId property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getVnfId() {
+ return vnfId;
+ }
+
+ /**
+ * Sets the value of the vnfId property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setVnfId(String value) {
+ this.vnfId = value;
+ }
+
+ public String toString() {
+ String msoRequestElement = msoRequest == null ? ""
+ : "<msoRequest>"+msoRequest+"</msoRequest>" + '\n';
+
+ return
+ "<cloudSiteId>"+cloudSiteId+"</cloudSiteId>" + '\n' +
+ msoRequestElement +
+ "<tenantCreated>"+tenantCreated+"</tenantCreated>" + '\n' +
+ "<tenantId>"+tenantId+"</tenantId>" + '\n' +
+ "<vnfCreated>"+vnfCreated+"</vnfCreated>" + '\n' +
+ "<vnfId>"+vnfId+"</vnfId>";
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfStatus.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfStatus.java
new file mode 100644
index 0000000000..d093f79e03
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/VnfStatus.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.adapter.vnf;
+
+import javax.xml.bind.annotation.XmlEnum;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for vnfStatus.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * <p>
+ * <pre>
+ * &lt;simpleType name="vnfStatus">
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ * &lt;enumeration value="ACTIVE"/>
+ * &lt;enumeration value="FAILED"/>
+ * &lt;enumeration value="NOTFOUND"/>
+ * &lt;enumeration value="UNKNOWN"/>
+ * &lt;/restriction>
+ * &lt;/simpleType>
+ * </pre>
+ *
+ */
+@XmlType(name = "vnfStatus")
+@XmlEnum
+public enum VnfStatus {
+
+ ACTIVE,
+ FAILED,
+ NOTFOUND,
+ UNKNOWN;
+
+ public String value() {
+ return name();
+ }
+
+ public static VnfStatus fromValue(String v) {
+ return valueOf(v);
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/package-info.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/package-info.java
new file mode 100644
index 0000000000..654673ad4a
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/adapter/vnf/package-info.java
@@ -0,0 +1,22 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.onap.so/vnfNotify")
+package org.onap.so.bpmn.common.adapter.vnf;
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
new file mode 100644
index 0000000000..f274850b8d
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java
@@ -0,0 +1,425 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.workflow.service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.camunda.bpm.engine.MismatchingMessageCorrelationException;
+import org.camunda.bpm.engine.OptimisticLockingException;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.runtime.Execution;
+import org.camunda.bpm.engine.runtime.MessageCorrelationResult;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+
+/**
+ * Abstract base class for callback services.
+ */
+@Service
+public class CallbackHandlerService {
+ public static final long DEFAULT_TIMEOUT_SECONDS = 60;
+ public static final long FAST_POLL_DUR_SECONDS = 5;
+ public static final long FAST_POLL_INT_MS = 100;
+ public static final long SLOW_POLL_INT_MS = 1000;
+
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CallbackHandlerService.class);
+
+ @Autowired
+ RuntimeService runtimeService;
+
+ /**
+ * Parameterized callback handler.
+ */
+ @Async
+ protected CallbackResult handleCallback(String method, Object message,
+ String messageEventName, String messageVariable,
+ String correlationVariable, String correlationValue,
+ String logMarker) {
+
+ return handleCallback(method, message, messageEventName, messageVariable,
+ correlationVariable, correlationValue, logMarker, null);
+ }
+
+ /**
+ * Parameterized callback handler.
+ */
+ protected CallbackResult handleCallback(String method, Object message,
+ String messageEventName, String messageVariable,
+ String correlationVariable, String correlationValue,
+ String logMarker, Map<String, Object> injectedVariables) {
+
+ long startTime = System.currentTimeMillis();
+
+ LOGGER.debug(logMarker + " " + method + " received message: "
+ + (message == null ? "" : System.lineSeparator()) + message);
+
+ try {
+ Map<String, Object> variables = new HashMap<>();
+
+ if (injectedVariables != null) {
+ variables.putAll(injectedVariables);
+ }
+
+ variables.put(correlationVariable, correlationValue);
+ variables.put(messageVariable, message == null ? null : message.toString());
+
+ boolean ok = correlate(messageEventName, correlationVariable,
+ correlationValue, variables, logMarker);
+
+ if (!ok) {
+ String msg = "No process is waiting for " + messageEventName
+ + " with " + correlationVariable + " = '" + correlationValue + "'";
+ logCallbackError(method, startTime, msg);
+ return new CallbackError(msg);
+ }
+
+ logCallbackSuccess(method, startTime);
+ return new CallbackSuccess();
+ } catch (Exception e) {
+ LOGGER.debug("Exception :",e);
+ String msg = "Caught " + e.getClass().getSimpleName()
+ + " processing " + messageEventName + " with " + correlationVariable
+ + " = '" + correlationValue + "'";
+ logCallbackError(method, startTime, msg);
+ return new CallbackError(msg);
+ }
+ }
+
+ /**
+ * Performs message correlation. Waits a limited amount of time for
+ * a process to become ready for correlation. The return value indicates
+ * whether or not a process was found to receive the message. Due to the
+ * synchronous nature of message injection in Camunda, by the time this
+ * method returns, one of 3 things will have happened: (1) the process
+ * received the message and ended, (2) the process received the message
+ * and reached an activity that suspended, or (3) an exception occurred
+ * during correlation or while the process was executing. Correlation
+ * exceptions are handled differently from process execution exceptions.
+ * Correlation exceptions are thrown so the client knows something went
+ * wrong with the delivery of the message. Process execution exceptions
+ * are logged but not thrown.
+ * @param messageEventName the message event name
+ * @param correlationVariable the process variable used as the correlator
+ * @param correlationValue the correlation value
+ * @param variables variables to inject into the process
+ * @param logMarker a marker for debug logging
+ * @return true if a process could be found, false if not
+ * @throws Exception for correlation errors
+ */
+ protected boolean correlate(String messageEventName, String correlationVariable,
+ String correlationValue, Map<String, Object> variables, String logMarker)
+ throws Exception {
+ try{
+ LOGGER.debug(logMarker + " Attempting to find process waiting"
+ + " for " + messageEventName + " with " + correlationVariable
+ + " = '" + correlationValue + "'");
+
+
+
+ long timeout = DEFAULT_TIMEOUT_SECONDS;
+
+ // The code is here in case we ever need to change the default.
+ String correlationTimemout = UrnPropertiesReader.getVariable("mso.correlation.timeout");
+ if (correlationTimemout != null) {
+ try {
+ timeout = Long.parseLong(correlationTimemout);
+ } catch (NumberFormatException e) {
+ // Ignore
+ }
+ }
+
+ long now = System.currentTimeMillis();
+ long fastPollEndTime = now + (FAST_POLL_DUR_SECONDS * 1000);
+ long endTime = now + (timeout * 1000);
+ long sleep = FAST_POLL_INT_MS;
+
+ List<Execution> waitingProcesses = null;
+ Exception queryException = null;
+ int queryCount = 0;
+ int queryFailCount = 0;
+
+ while (true) {
+ try {
+ ++queryCount;
+ waitingProcesses = runtimeService.createExecutionQuery()
+ .messageEventSubscriptionName(messageEventName)
+ .processVariableValueEquals(correlationVariable, correlationValue)
+ .list();
+ } catch (Exception e) {
+ ++queryFailCount;
+ queryException = e;
+ }
+
+ if (waitingProcesses != null && waitingProcesses.size() > 0) {
+ break;
+ }
+
+ if (now > endTime - sleep) {
+ break;
+ }
+
+ Thread.sleep(sleep);
+ now = System.currentTimeMillis();
+
+ if (now > fastPollEndTime) {
+ sleep = SLOW_POLL_INT_MS;
+ }
+ }
+
+ if (waitingProcesses == null) {
+ waitingProcesses = new ArrayList<Execution>(0);
+ }
+
+ int count = waitingProcesses.size();
+
+ List<ExecInfo> execInfoList = new ArrayList<>(count);
+ for (Execution execution : waitingProcesses) {
+ execInfoList.add(new ExecInfo(execution));
+ }
+
+ LOGGER.debug(logMarker + " Found " + count + " process(es) waiting"
+ + " for " + messageEventName + " with " + correlationVariable
+ + " = '" + correlationValue + "': " + execInfoList);
+
+ if (count == 0) {
+ if (queryFailCount > 0) {
+ String msg = queryFailCount + "/" + queryCount
+ + " execution queries failed attempting to correlate "
+ + messageEventName + " with " + correlationVariable
+ + " = '" + correlationValue + "'; last exception was:"
+ + queryException;
+ LOGGER.debug(msg);
+ LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, msg, queryException);
+ }
+
+ return false;
+ }
+
+ if (count > 1) {
+ // Only one process should be waiting. Throw an exception back to the client.
+ throw new MismatchingMessageCorrelationException(messageEventName,
+ "more than 1 process is waiting with " + correlationVariable
+ + " = '" + correlationValue + "'");
+ }
+
+ // We prototyped an asynchronous solution, i.e. resuming the process
+ // flow in a separate thread, but this affected too many existing tests,
+ // and we went back to the synchronous solution. The synchronous solution
+ // has some troublesome characteristics though. For example, the
+ // resumed flow may send request #2 to a remote system before MSO has
+ // acknowledged the notification associated with request #1.
+
+ try {
+ LOGGER.debug(logMarker + " Running " + execInfoList.get(0) + " to receive "
+ + messageEventName + " with " + correlationVariable + " = '"
+ + correlationValue + "'");
+
+ @SuppressWarnings("unused")
+ MessageCorrelationResult result = runtimeService
+ .createMessageCorrelation(messageEventName)
+ .setVariables(variables)
+ .processInstanceVariableEquals(correlationVariable, correlationValue)
+ .correlateWithResult();
+
+ } catch (MismatchingMessageCorrelationException e) {
+ // A correlation exception occurred even after we identified
+ // one waiting process. Throw it back to the client.
+ throw e;
+ } catch (OptimisticLockingException ole) {
+
+ String msg = "Caught " + ole.getClass().getSimpleName() + " after receiving " + messageEventName
+ + " with " + correlationVariable + " = '" + correlationValue
+ + "': " + ole;
+ LOGGER.debug(msg);
+ LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, msg, ole);
+
+ //Retry for OptimisticLocking Exceptions
+ int retryCount = 0;
+ String retryStr = UrnPropertiesReader.getVariable("mso.bpmn.optimisticlockingexception.retrycount");
+ if (retryStr != null) {
+ try {
+ retryCount = Integer.parseInt(retryStr);
+ } catch (NumberFormatException e) {
+ // Ignore
+ }
+ }
+
+ LOGGER.debug("Retry correlate for OptimisticLockingException, retryCount:" + retryCount);
+
+ for (; retryCount >0 ; retryCount--) {
+
+ try{
+ Thread.sleep(SLOW_POLL_INT_MS);
+
+ @SuppressWarnings("unused")
+ MessageCorrelationResult result = runtimeService
+ .createMessageCorrelation(messageEventName)
+ .setVariables(variables)
+ .processInstanceVariableEquals(correlationVariable, correlationValue)
+ .correlateWithResult();
+ retryCount = 0;
+ LOGGER.debug("OptimisticLockingException retry was successful, seting retryCount: " + retryCount);
+ } catch (OptimisticLockingException olex) {
+ //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException;
+ String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + olex;
+ LOGGER.debug(strMsg);
+ LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, strMsg, olex);
+ } catch (Exception excep) {
+ retryCount = 0;
+ //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException;
+ String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + excep;
+ LOGGER.debug(strMsg);
+ LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, strMsg, excep);
+ }
+
+ }
+
+ }catch (Exception e) {
+ // This must be an exception from the flow itself. Log it, but don't
+ // report it back to the client.
+ String msg = "Caught " + e.getClass().getSimpleName() + " running "
+ + execInfoList.get(0) + " after receiving " + messageEventName
+ + " with " + correlationVariable + " = '" + correlationValue
+ + "': " + e;
+ LOGGER.debug(msg);
+ LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, msg, e);
+ }
+ } catch (Exception e) {
+ // This must be an exception from the flow itself. Log it, but don't
+ // report it back to the client.
+ String msg = "Caught " + e.getClass().getSimpleName() + " after receiving " + messageEventName
+ + " with " + correlationVariable + " = '" + correlationValue
+ + "': " + e;
+ LOGGER.debug(msg);
+ LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, msg, e);
+ }
+
+ return true;
+ }
+
+ /**
+ * Records audit and metric events in the log for a callback success.
+ * @param method the method name
+ * @param startTime the request start time
+ */
+ protected void logCallbackSuccess(String method, long startTime) {
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.Suc, "Completed " + method);
+
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.Suc, "Completed " + method,
+ "BPMN", MsoLogger.getServiceName(), null);
+ }
+
+ /**
+ * Records error, audit and metric events in the log for a callback
+ * internal error.
+ * @param method the method name
+ * @param startTime the request start time
+ * @param msg the error message
+ */
+ protected void logCallbackError(String method, long startTime, String msg) {
+ logCallbackError(method, startTime, msg, null);
+ }
+
+ /**
+ * Records error, audit and metric events in the log for a callback
+ * internal error.
+ * @param method the method name
+ * @param startTime the request start time
+ * @param msg the error message
+ * @param e the exception
+ */
+ protected void logCallbackError(String method, long startTime, String msg, Exception e) {
+ if (e == null) {
+ LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, msg);
+ } else {
+ LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, msg, e);
+ }
+
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.InternalError, "Completed " + method);
+
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.InternalError, "Completed " + method,
+ "BPMN", MsoLogger.getServiceName(), null);
+ }
+
+ /**
+ * Abstract callback result object.
+ */
+ protected abstract class CallbackResult {
+ }
+
+ /**
+ * Indicates that callback handling was successful.
+ */
+ protected class CallbackSuccess extends CallbackResult {
+ }
+
+ /**
+ * Indicates that callback handling failed.
+ */
+ protected class CallbackError extends CallbackResult {
+ private final String errorMessage;
+
+ public CallbackError(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+ /**
+ * Gets the error message.
+ */
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+ }
+
+ private static class ExecInfo {
+ private final Execution execution;
+
+ public ExecInfo(Execution execution) {
+ this.execution = execution;
+ }
+
+ @Override
+ public String toString() {
+ return "Process[" + execution.getProcessInstanceId()
+ + ":" + execution.getId() + "]";
+ }
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java
new file mode 100644
index 0000000000..0e9e1425a6
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/ProcessEngineAwareService.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.bpmn.common.workflow.service;
+
+import java.util.Optional;
+
+import javax.ws.rs.ext.Provider;
+
+import org.camunda.bpm.engine.ProcessEngineServices;
+import org.camunda.bpm.engine.ProcessEngines;
+import org.springframework.stereotype.Service;
+
+/**
+ * Base class for services that must be process-engine aware. The only
+ * process engine currently supported is the "default" process engine.
+ */
+@Service
+public class ProcessEngineAwareService {
+
+ private final String processEngineName = "default";
+ private volatile Optional<ProcessEngineServices> pes4junit = Optional.empty();
+
+ /**
+ * Gets the process engine name.
+ * @return the process engine name
+ */
+ public String getProcessEngineName() {
+ return processEngineName;
+ }
+
+ /**
+ * Gets process engine services.
+ * @return process engine services
+ */
+ public ProcessEngineServices getProcessEngineServices() {
+ return pes4junit.orElse(ProcessEngines.getProcessEngine(
+ getProcessEngineName()));
+ }
+
+ /**
+ * Allows a particular process engine to be specified, overriding the
+ * usual process engine lookup by name. Intended primarily for the
+ * unit test environment.
+ * @param pes process engine services
+ */
+ public void setProcessEngineServices4junit(ProcessEngineServices pes) {
+ pes4junit = Optional.ofNullable(pes);
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
new file mode 100644
index 0000000000..710144dbb9
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
@@ -0,0 +1,91 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.workflow.service;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.ws.rs.core.Context;
+import javax.xml.ws.WebServiceContext;
+
+import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest;
+import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterResponse;
+import org.onap.so.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType;
+import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError;
+import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * Implementation of SDNCAdapterCallbackService.
+ */
+@WebService(serviceName="SDNCAdapterCallbackService", targetNamespace="http://org.onap/workflow/sdnc/adapter/schema/v1")
+@Service
+public class SDNCAdapterCallbackServiceImpl extends ProcessEngineAwareService implements SDNCCallbackAdapterPortType {
+
+ private final static String logMarker = "[SDNC-CALLBACK]";
+
+ @Context WebServiceContext wsContext;
+
+ @Autowired
+ CallbackHandlerService callback;
+
+ @WebMethod(operationName = "SDNCAdapterCallback")
+ @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse")
+ public SDNCAdapterResponse sdncAdapterCallback(
+ @WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest")
+ SDNCAdapterCallbackRequest sdncAdapterCallbackRequest) {
+
+ String method = "sdncAdapterCallback";
+ Object message = sdncAdapterCallbackRequest;
+ String messageEventName = "sdncAdapterCallbackRequest";
+ String messageVariable = "sdncAdapterCallbackRequest";
+ String correlationVariable = "SDNCA_requestId";
+ String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId();
+
+ MsoLogger.setServiceName("MSO." + method);
+ MsoLogger.setLogContext(correlationValue, "N/A");
+
+ CallbackResult result = callback.handleCallback(method, message, messageEventName,
+ messageVariable, correlationVariable, correlationValue, logMarker);
+
+ if (result instanceof CallbackError) {
+ return new SDNCAdapterErrorResponse(((CallbackError)result).getErrorMessage());
+ } else {
+ return new SDNCAdapterResponse();
+ }
+ }
+
+ // This subclass allows unit tests to extract the error
+ public class SDNCAdapterErrorResponse extends SDNCAdapterResponse {
+ private String error;
+
+ public SDNCAdapterErrorResponse(String error) {
+ this.error = error;
+ }
+
+ public String getError() {
+ return error;
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
new file mode 100644
index 0000000000..ae9cec9476
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
@@ -0,0 +1,255 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.workflow.service;
+
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.ws.rs.core.Context;
+import javax.xml.ws.Action;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.WebServiceContext;
+
+import org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.DeleteVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.MsoExceptionCategory;
+import org.onap.so.bpmn.common.adapter.vnf.QueryVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.RollbackVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify;
+import org.onap.so.bpmn.common.adapter.vnf.VnfRollback;
+import org.onap.so.bpmn.common.adapter.vnf.VnfStatus;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * Implementation of the VnfAdapterNotify service.
+ */
+@WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://org.onap.so/vnfNotify")
+@Service
+public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService implements VnfAdapterNotify{
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterNotifyServiceImpl.class);
+
+ private final String logMarker = "[VNF-NOTIFY]";
+
+ @Autowired
+ CallbackHandlerService callback;
+
+ @Context WebServiceContext wsContext;
+
+ @WebMethod(operationName = "rollbackVnfNotification")
+ @Oneway
+ @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.RollbackVnfNotification")
+ @Action(input = "http://org.onap.so/notify/adapterNotify/rollbackVnfNotificationRequest")
+ public void rollbackVnfNotification(
+ @WebParam(name = "messageId", targetNamespace = "")
+ String messageId,
+ @WebParam(name = "completed", targetNamespace = "")
+ boolean completed,
+ @WebParam(name = "exception", targetNamespace = "")
+ MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "")
+ String errorMessage) {
+
+ RollbackVnfNotification rollbackVnfNotification = new RollbackVnfNotification();
+
+ rollbackVnfNotification.setMessageId(messageId);
+ rollbackVnfNotification.setCompleted(completed);
+ rollbackVnfNotification.setException(exception);
+ rollbackVnfNotification.setErrorMessage(errorMessage);
+
+ String method = "rollbackVnfNotification";
+ Object message = rollbackVnfNotification;
+ String messageEventName = "rollbackVnfNotificationCallback";
+ String messageVariable = "rollbackVnfNotificationCallback";
+ String correlationVariable = "VNFRB_messageId";
+ String correlationValue = messageId;
+
+ callback.handleCallback(method, message, messageEventName, messageVariable,
+ correlationVariable, correlationValue, logMarker);
+ }
+
+ @WebMethod(operationName = "queryVnfNotification")
+ @Oneway
+ @RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.QueryVnfNotification")
+ @Action(input = "http://org.onap.so/notify/adapterNotify/queryVnfNotificationRequest")
+ public void queryVnfNotification(
+ @WebParam(name = "messageId", targetNamespace = "")
+ String messageId,
+ @WebParam(name = "completed", targetNamespace = "")
+ boolean completed,
+ @WebParam(name = "exception", targetNamespace = "")
+ MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "")
+ String errorMessage,
+ @WebParam(name = "vnfExists", targetNamespace = "")
+ Boolean vnfExists,
+ @WebParam(name = "vnfId", targetNamespace = "")
+ String vnfId,
+ @WebParam(name = "status", targetNamespace = "")
+ VnfStatus status,
+ @WebParam(name = "outputs", targetNamespace = "")
+ QueryVnfNotification.Outputs outputs){
+
+ String method = "queryVnfNotification";
+ String messageEventName = "queryVnfNotificationCallback";
+ String messageVariable = "queryVnfNotificationCallback";
+ String correlationVariable = "VNFQ_messageId";
+ String correlationValue = messageId;
+
+ MsoLogger.setServiceName("MSO." + method);
+ MsoLogger.setLogContext(correlationValue, "N/A");
+
+ QueryVnfNotification message = new QueryVnfNotification();
+
+ message.setMessageId(messageId);
+ message.setCompleted(completed);
+ message.setException(exception);
+ message.setErrorMessage(errorMessage);
+ message.setVnfExists(vnfExists);
+ message.setVnfId(vnfId);
+ message.setStatus(status);
+ message.setOutputs(outputs);
+
+ callback.handleCallback(method, message, messageEventName, messageVariable,
+ correlationVariable, correlationValue, logMarker);
+ }
+
+ @WebMethod(operationName = "createVnfNotification")
+ @Oneway
+ @RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.CreateVnfNotification")
+ @Action(input = "http://org.onap.so/notify/adapterNotify/createVnfNotificationRequest")
+ public void createVnfNotification(
+ @WebParam(name = "messageId", targetNamespace = "")
+ String messageId,
+ @WebParam(name = "completed", targetNamespace = "")
+ boolean completed,
+ @WebParam(name = "exception", targetNamespace = "")
+ MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "")
+ String errorMessage,
+ @WebParam(name = "vnfId", targetNamespace = "")
+ String vnfId,
+ @WebParam(name = "outputs", targetNamespace = "")
+ CreateVnfNotification.Outputs outputs,
+ @WebParam(name = "rollback", targetNamespace = "")
+ VnfRollback rollback){
+
+ String method = "createVnfNotification";
+ String messageEventName = "createVnfNotificationCallback";
+ String messageVariable = "createVnfNotificationCallback";
+ String correlationVariable = "VNFC_messageId";
+ String correlationValue = messageId;
+
+ MsoLogger.setServiceName("MSO." + method);
+ MsoLogger.setLogContext(correlationValue, "N/A");
+
+ CreateVnfNotification message = new CreateVnfNotification();
+
+ message.setMessageId(messageId);
+ message.setCompleted(completed);
+ message.setException(exception);
+ message.setErrorMessage(errorMessage);
+ message.setVnfId(vnfId);
+ message.setOutputs(outputs);
+ message.setRollback(rollback);
+
+ callback.handleCallback(method, message, messageEventName, messageVariable,
+ correlationVariable, correlationValue, logMarker);
+ }
+
+ @WebMethod(operationName = "updateVnfNotification")
+ @Oneway
+ @RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.UpdateVnfNotification")
+ @Action(input = "http://org.onap.so/notify/adapterNotify/updateVnfNotificationRequest")
+ public void updateVnfNotification(
+ @WebParam(name = "messageId", targetNamespace = "")
+ String messageId,
+ @WebParam(name = "completed", targetNamespace = "")
+ boolean completed,
+ @WebParam(name = "exception", targetNamespace = "")
+ MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "")
+ String errorMessage,
+ @WebParam(name = "outputs", targetNamespace = "")
+ UpdateVnfNotification.Outputs outputs,
+ @WebParam(name = "rollback", targetNamespace = "")
+ VnfRollback rollback){
+
+ String method = "updateVnfNotification";
+ String messageEventName = "updateVnfNotificationCallback";
+ String messageVariable = "updateVnfNotificationCallback";
+ String correlationVariable = "VNFU_messageId";
+ String correlationValue = messageId;
+
+ MsoLogger.setServiceName("MSO." + method);
+ MsoLogger.setLogContext(correlationValue, "N/A");
+
+ UpdateVnfNotification message = new UpdateVnfNotification();
+
+ message.setMessageId(messageId);
+ message.setCompleted(completed);
+ message.setException(exception);
+ message.setErrorMessage(errorMessage);
+ message.setOutputs(outputs);
+ message.setRollback(rollback);
+
+ callback.handleCallback(method, message, messageEventName, messageVariable,
+ correlationVariable, correlationValue, logMarker);
+ }
+
+ @WebMethod(operationName = "deleteVnfNotification")
+ @Oneway
+ @RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.onap.so/vnfNotify", className = "org.onap.so.adapters.vnf.async.client.DeleteVnfNotification")
+ @Action(input = "http://org.onap.so/notify/adapterNotify/deleteVnfNotificationRequest")
+ public void deleteVnfNotification(
+ @WebParam(name = "messageId", targetNamespace = "")
+ String messageId,
+ @WebParam(name = "completed", targetNamespace = "")
+ boolean completed,
+ @WebParam(name = "exception", targetNamespace = "")
+ MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "")
+ String errorMessage) {
+
+ String method = "deleteVnfNotification";
+ String messageEventName = "deleteVnfACallback";
+ String messageVariable = "deleteVnfACallback";
+ String correlationVariable = "VNFDEL_uuid";
+ String correlationValue = messageId;
+
+ MsoLogger.setServiceName("MSO." + method);
+ MsoLogger.setLogContext(correlationValue, "N/A");
+
+ DeleteVnfNotification message = new DeleteVnfNotification();
+
+ message.setMessageId(messageId);
+ message.setCompleted(completed);
+ message.setException(exception);
+ message.setErrorMessage(errorMessage);
+
+ callback.handleCallback(method, message, messageEventName, messageVariable,
+ correlationVariable, correlationValue, logMarker);
+ }
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java
new file mode 100644
index 0000000000..a9a3a63f2f
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncCommonResource.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.workflow.service;
+
+import org.camunda.bpm.engine.ProcessEngineServices;
+import org.camunda.bpm.engine.ProcessEngines;
+
+
+public class WorkflowAsyncCommonResource extends WorkflowAsyncResource {
+
+ @Override
+ public String getProcessEngineName() {
+ return "default";
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
new file mode 100644
index 0000000000..cfd07d8c39
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
@@ -0,0 +1,244 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.workflow.service;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.UUID;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.Provider;
+
+import org.camunda.bpm.engine.ProcessEngineServices;
+import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
+import org.onap.so.bpmn.common.workflow.context.WorkflowContext;
+import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
+import org.onap.so.logger.MsoLogger;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+
+/**
+ *
+ * @version 1.0
+ * Asynchronous Workflow processing using JAX RS RESTeasy implementation
+ * Both Synchronous and Asynchronous BPMN process can benefit from this implementation since the workflow gets executed in the background
+ * and the server thread is freed up, server scales better to process more incoming requests
+ *
+ * Usage: For synchronous process, when you are ready to send the response invoke the callback to write the response
+ * For asynchronous process - the activity may send a acknowledgement response and then proceed further on executing the process
+ */
+@Path("/async")
+@Api(value = "/async", description = "Provides asynchronous starting of a bpmn process")
+@Provider
+@Component
+public class WorkflowAsyncResource extends ProcessEngineAwareService {
+
+ private static final WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
+
+
+ protected Optional<ProcessEngineServices> pes4junit = Optional.empty();
+
+ long workflowPollInterval=1000;
+
+ @Autowired
+ private WorkflowProcessor processor;
+
+ @Autowired
+ private WorkflowContextHolder workflowContext;
+
+ public WorkflowProcessor getProcessor() {
+ return processor;
+ }
+
+
+
+ public void setProcessor(WorkflowProcessor processor) {
+ this.processor = processor;
+ }
+
+ protected static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,WorkflowAsyncResource.class);
+ protected static final long DEFAULT_WAIT_TIME = 60000; //default wait time
+
+ /**
+ * Asynchronous JAX-RS method that starts a process instance.
+ * @param asyncResponse an object that will receive the asynchronous response
+ * @param processKey the process key
+ * @param variableMap input variables to the process
+ * @return
+ */
+
+ @POST
+ @Path("/services/{processKey}")
+ @ApiOperation(
+ value = "Starts a new process with the appropriate process Key",
+ notes = "Aysnc fall outs are only logged"
+ )
+ @Produces("application/json")
+ @Consumes("application/json")
+ public Response startProcessInstanceByKey (
+ @PathParam("processKey") String processKey, VariableMapImpl variableMap){
+ Map<String, Object> inputVariables = getInputVariables(variableMap);
+ try {
+ MDC.put(MsoLogger.REQUEST_ID, getRequestId(inputVariables));
+ processor.startProcess(processKey, variableMap);
+ WorkflowResponse response = waitForResponse(getRequestId(inputVariables));
+ return Response.status(202).entity(response).build();
+ } catch (Exception e) {
+ WorkflowResponse response = buildUnkownError(getRequestId(inputVariables),e.getMessage());
+ return Response.status(500).entity(response).build();
+ }
+ }
+
+ private WorkflowResponse waitForResponse(String requestId) throws Exception {
+ long currentWaitTime = 0;
+ while (DEFAULT_WAIT_TIME > currentWaitTime ) {
+ Thread.sleep(workflowPollInterval);
+ currentWaitTime = currentWaitTime + workflowPollInterval;
+ WorkflowContext foundContext = contextHolder.getWorkflowContext(requestId);
+ if(foundContext!=null){
+ contextHolder.remove(foundContext);
+ return buildResponse(foundContext);
+ }
+ }
+ throw new Exception("TimeOutOccured");
+ }
+
+ private WorkflowResponse buildTimeoutResponse(String requestId) {
+ WorkflowResponse response = new WorkflowResponse();
+ response.setMessage("Fail");
+ response.setResponse("Request timedout, request id:" + requestId);
+ response.setMessageCode(500);
+ return response;
+ }
+
+ private WorkflowResponse buildUnkownError(String requestId,String error) {
+ WorkflowResponse response = new WorkflowResponse();
+ response.setMessage(error);
+ response.setResponse("UnknownError, request id:" + requestId);
+ response.setMessageCode(500);
+ return response;
+ }
+
+ private WorkflowResponse buildResponse(WorkflowContext foundContext) {
+ return foundContext.getWorkflowResponse();
+ }
+
+ protected static String getOrCreate(Map<String, Object> inputVariables, String key) {
+ String value = Objects.toString(inputVariables.get(key), null);
+ if (value == null) {
+ value = UUID.randomUUID().toString();
+ inputVariables.put(key, value);
+ }
+ return value;
+ }
+
+ // Note: the business key is used to identify the process in unit tests
+ protected static String getBusinessKey(Map<String, Object> inputVariables) {
+ return getOrCreate(inputVariables, "mso-business-key");
+ }
+
+ protected static String getRequestId(Map<String, Object> inputVariables) {
+ return getOrCreate(inputVariables, "mso-request-id");
+ }
+
+
+
+ protected void recordEvents(String processKey, WorkflowResponse response,
+ long startTime) {
+
+ msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ response.getMessage() + " for processKey: "
+ + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ response.getMessage() + "for processKey: " + processKey + " with response: " + response.getResponse());
+
+ }
+
+ protected static void setLogContext(String processKey,
+ Map<String, Object> inputVariables) {
+ MsoLogger.setServiceName("MSO." + processKey);
+ if (inputVariables != null) {
+ MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"mso-request-id"), getKeyValueFromInputVariables(inputVariables,"serviceInstanceId"));
+ }
+ }
+
+ protected static String getKeyValueFromInputVariables(Map<String,Object> inputVariables, String key) {
+ if (inputVariables == null) {
+ return "";
+ }
+
+ return Objects.toString(inputVariables.get(key), "N/A");
+ }
+
+ protected boolean isProcessEnded(String processInstanceId) {
+ ProcessEngineServices pes = getProcessEngineServices();
+ return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null;
+ }
+
+ protected static Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
+ Map<String, Object> inputVariables = new HashMap<>();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
+ for (Map.Entry<String, Object> entry : vMap.entrySet()) {
+ String vName = entry.getKey();
+ Object value = entry.getValue();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> valueMap = (Map<String,Object>)value; // value, type
+ inputVariables.put(vName, valueMap.get("value"));
+ }
+ return inputVariables;
+ }
+
+
+ protected long getWaitTime(Map<String, Object> inputVariables)
+ {
+
+ String timeout = Objects.toString(inputVariables.get("mso-service-request-timeout"), null);
+
+ if (timeout != null) {
+ try {
+ return Long.parseLong(timeout)*1000;
+ } catch (NumberFormatException nex) {
+ msoLogger.debug("Invalid input for mso-service-request-timeout");
+ }
+ }
+
+ return DEFAULT_WAIT_TIME;
+ }
+
+
+
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
new file mode 100644
index 0000000000..02cda8009f
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java
@@ -0,0 +1,124 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.workflow.service;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackError;
+import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * Generalized REST interface that injects a message event into a waiting BPMN process.
+ * Examples:
+ * <pre>
+ * /WorkflowMessage/SDNCAResponse/6d10d075-100c-42d0-9d84-a52432681cae-1478486185286
+ * /WorkflowMessage/SDNCAEvent/USOSTCDALTX0101UJZZ01
+ * </pre>
+ */
+@Path("/")
+@Api(description = "Provides a generic service to inject messages into a waiting BPMN Proccess")
+@Component
+public class WorkflowMessageResource{
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowMessageResource.class);
+ private static final String LOGMARKER = "[WORKFLOW-MESSAGE]";
+
+ @Autowired
+ CallbackHandlerService callback;
+
+ @POST
+ @Path("/WorkflowMessage/{messageType}/{correlator}")
+ @ApiOperation(
+ value = "Workflow message correlator",
+ notes = ""
+ )
+ @Consumes("*/*")
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response deliver(
+ @HeaderParam("Content-Type") String contentType,
+ @PathParam("messageType") String messageType,
+ @PathParam("correlator") String correlator,
+ String message) {
+
+ String method = "receiveWorkflowMessage";
+ MsoLogger.setServiceName("MSO." + method);
+ MsoLogger.setLogContext(correlator, "N/A");
+
+ LOGGER.debug(LOGMARKER + " Received workflow message"
+ + " type='" + messageType + "'"
+ + " correlator='" + correlator + "'"
+ + (contentType == null ? "" : " contentType='" + contentType + "'")
+ + " message=" + System.lineSeparator() + message);
+
+ if (messageType == null || messageType.isEmpty()) {
+ String msg = "Missing message type";
+ LOGGER.debug(LOGMARKER + " " + msg);
+ LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg);
+ return Response.status(400).entity(msg).build();
+ }
+
+ if (correlator == null || correlator.isEmpty()) {
+ String msg = "Missing correlator";
+ LOGGER.debug(LOGMARKER + " " + msg);
+ LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg);
+ return Response.status(400).entity(msg).build();
+ }
+
+ String messageEventName = "WorkflowMessage";
+ String messageVariable = messageType + "_MESSAGE";
+ String correlationVariable = messageType + "_CORRELATOR";
+ String correlationValue = correlator;
+ String contentTypeVariable = messageType + "_CONTENT_TYPE";
+
+ Map<String, Object> variables = new HashMap<>();
+
+ if (contentType != null) {
+ variables.put(contentTypeVariable, contentType);
+ }
+
+ CallbackResult result = callback.handleCallback(method, message, messageEventName,
+ messageVariable, correlationVariable, correlationValue, LOGMARKER, variables);
+
+ if (result instanceof CallbackError) {
+ return Response.status(500).entity(((CallbackError)result).getErrorMessage()).build();
+ } else {
+ return Response.status(204).build();
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
new file mode 100644
index 0000000000..edc05afba2
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
@@ -0,0 +1,155 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common.workflow.service;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.UUID;
+
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
+import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
+import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
+import org.onap.so.logger.MsoLogger;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+@Service
+public class WorkflowProcessor extends ProcessEngineAwareService {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowProcessor.class);
+
+ protected static final String logMarker = "[WRKFLOW-RESOURCE]";
+ protected static final long DEFAULT_WAIT_TIME = 30000; //default wait time
+
+ @Async
+ public void startProcess( String processKey, VariableMapImpl variableMap) throws InterruptedException
+ {
+ MDC.getCopyOfContextMap();
+ long startTime = System.currentTimeMillis();
+ Map<String, Object> inputVariables = null;
+ String processInstanceId = null;
+ try {
+ inputVariables = getInputVariables(variableMap);
+ setLogContext(processKey, inputVariables);
+
+ // This variable indicates that the flow was invoked asynchronously
+ inputVariables.put("isAsyncProcess", "true");
+
+
+ setLogContext(processKey, inputVariables);
+
+ // Note: this creates a random businessKey if it wasn't specified.
+ String businessKey = getBusinessKey(inputVariables);
+
+ msoLogger.debug("***Received MSO startProcessInstanceByKey with processKey: " + processKey
+ + " and variables: " + inputVariables);
+
+ RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
+ ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processKey, businessKey,
+ inputVariables);
+ processInstanceId = processInstance.getId();
+
+ msoLogger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " "
+ + (processInstance.isEnded() ? "ENDED" : "RUNNING"));
+ } catch (Exception e) {
+
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
+ logMarker + "Error in starting the process: " + e.getMessage());
+
+ WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
+ callbackResponse.setStatusCode(500);
+ callbackResponse.setMessage("Fail");
+ callbackResponse.setResponse("Error occurred while executing the process: " + e);
+
+ WorkflowContextHolder.getInstance().processCallback(processKey, processInstanceId,
+ getRequestId(inputVariables), callbackResponse);
+ }
+ }
+
+ protected static void setLogContext(String processKey,
+ Map<String, Object> inputVariables) {
+ MsoLogger.setServiceName("MSO." + processKey);
+ if (inputVariables != null) {
+ MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"mso-request-id"), getKeyValueFromInputVariables(inputVariables,"mso-service-instance-id"));
+ }
+ }
+
+ protected static String getKeyValueFromInputVariables(Map<String,Object> inputVariables, String key) {
+ if (inputVariables == null) {
+ return "";
+ }
+
+ return Objects.toString(inputVariables.get(key), "N/A");
+ }
+
+ // Note: the business key is used to identify the process in unit tests
+ protected static String getBusinessKey(Map<String, Object> inputVariables) {
+ return getOrCreate(inputVariables, "mso-business-key");
+ }
+
+ protected static String getRequestId(Map<String, Object> inputVariables) {
+ return getOrCreate(inputVariables, "mso-request-id");
+ }
+
+ protected static Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
+ Map<String, Object> inputVariables = new HashMap<>();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
+ for (Map.Entry<String, Object> entry : vMap.entrySet()) {
+ String vName = entry.getKey();
+ Object value = entry.getValue();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> valueMap = (Map<String,Object>)value; // value, type
+ inputVariables.put(vName, valueMap.get("value"));
+ }
+ return inputVariables;
+ }
+
+ protected static String getOrCreate(Map<String, Object> inputVariables, String key) {
+ String value = Objects.toString(inputVariables.get(key), null);
+ if (value == null) {
+ value = UUID.randomUUID().toString();
+ inputVariables.put(key, value);
+ }
+ return value;
+ }
+
+ protected long getWaitTime(Map<String, Object> inputVariables)
+ {
+
+ String timeout = Objects.toString(inputVariables.get("mso-service-request-timeout"), null);
+
+ if (timeout != null) {
+ try {
+ return Long.parseLong(timeout)*1000;
+ } catch (NumberFormatException nex) {
+ msoLogger.debug("Invalid input for mso-service-request-timeout");
+ }
+ }
+
+ return DEFAULT_WAIT_TIME;
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java
new file mode 100644
index 0000000000..c2a7f41140
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java
@@ -0,0 +1,630 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.bpmn.common.workflow.service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicLong;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.camunda.bpm.engine.HistoryService;
+import org.camunda.bpm.engine.ProcessEngineException;
+import org.camunda.bpm.engine.ProcessEngineServices;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.history.HistoricVariableInstance;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.variable.VariableMap;
+import org.camunda.bpm.engine.variable.Variables;
+import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats;
+import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.slf4j.MDC;
+import org.springframework.stereotype.Component;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+@Path("/workflow")
+@Api(value = "/workflow", description = "Root of workflow services")
+@Component
+public class WorkflowResource extends ProcessEngineAwareService {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowResource.class);
+ private static final String LOGMARKER = "[WRKFLOW-RESOURCE]";
+
+ private static final int DEFAULT_WAIT_TIME = 30000;
+
+ @Context
+ private UriInfo uriInfo = null;
+
+ /**
+ * Starts the process instance and responds to client synchronously
+ * If the request does not contain mso-service-request-timeout then it waits for the value specified in DEFAULT_WAIT_TIME
+ * Note: value specified in mso-service-request-timeout is in seconds
+ * During polling time, if there is an exception encountered in the process execution then polling is stopped and the error response is
+ * returned to the client
+ * @param processKey
+ * @param variableMap
+ * @return
+ */
+ @POST
+ @Path("/services/{processKey}")
+ @ApiOperation(
+ value = "Starts a new process with the appropriate process synchronously",
+ notes = "d"
+ )
+ @Produces("application/json")
+ @Consumes("application/json")
+ public Response startProcessInstanceByKey(@PathParam("processKey") String processKey,
+ VariableMapImpl variableMap) {
+
+ Map<String, Object> inputVariables = getInputVariables(variableMap);
+ setLogContext(processKey, inputVariables);
+
+ WorkflowResponse workflowResponse = new WorkflowResponse();
+ long startTime = System.currentTimeMillis();
+ ProcessInstance processInstance = null;
+
+ try {
+ //Kickoff the process
+ ProcessThread thread = new ProcessThread(inputVariables,processKey,msoLogger);
+ thread.start();
+
+ Map<String, Object> responseMap = null;
+
+ //wait for process to be completed
+ long waitTime = getWaitTime(inputVariables);
+ long now = System.currentTimeMillis();
+ long start = now;
+ long endTime = start + waitTime;
+ long pollingInterval = 500;
+
+ // TEMPORARY LOGIC FOR UNIT TEST REFACTORING
+ // If this is a unit test (method is invoked directly), wait a max
+ // of 5 seconds after process ended for a result. In production,
+ // wait up to 60 seconds.
+ long timeToWaitAfterProcessEnded = uriInfo == null ? 5000 : 60000;
+ AtomicLong timeProcessEnded = new AtomicLong(0);
+ boolean endedWithNoResponse = false;
+
+ while (now <= endTime) {
+ Thread.sleep(pollingInterval);
+
+ now = System.currentTimeMillis();
+
+ // Increase the polling interval over time
+
+ long elapsed = now - start;
+
+ if (elapsed > 60000) {
+ pollingInterval = 5000;
+ } else if (elapsed > 10000) {
+ pollingInterval = 1000;
+ }
+ Exception exception = thread.getException();
+ if (exception != null) {
+ throw new Exception(exception);
+ }
+
+ processInstance = thread.getProcessInstance();
+
+ if (processInstance == null) {
+ msoLogger.debug(LOGMARKER + processKey + " process has not been created yet");
+ continue;
+ }
+
+ String processInstanceId = processInstance.getId();
+ workflowResponse.setProcessInstanceID(processInstanceId);
+
+ responseMap = getResponseMap(processInstance, processKey, timeProcessEnded);
+
+ if (responseMap == null) {
+ msoLogger.debug(LOGMARKER + processKey + " has not produced a response yet");
+
+ if (timeProcessEnded.longValue() != 0) {
+ long elapsedSinceEnded = System.currentTimeMillis() - timeProcessEnded.longValue();
+
+ if (elapsedSinceEnded > timeToWaitAfterProcessEnded) {
+ endedWithNoResponse = true;
+ break;
+ }
+ }
+ } else {
+ processResponseMap(workflowResponse, responseMap);
+ recordEvents(processKey, workflowResponse, startTime);
+ return Response.status(workflowResponse.getMessageCode()).entity(workflowResponse).build();
+ }
+ }
+
+ //if we dont get response after waiting then send timeout response
+
+ String state;
+ String processInstanceId;
+
+ if (processInstance == null) {
+ processInstanceId = "N/A";
+ state = "NOT STARTED";
+ } else {
+ processInstanceId = processInstance.getProcessInstanceId();
+ state = isProcessEnded(processInstanceId) ? "ENDED" : "NOT ENDED";
+ }
+
+ workflowResponse.setMessage("Fail");
+ if (endedWithNoResponse) {
+ workflowResponse.setResponse("Process ended without producing a response");
+ } else {
+ workflowResponse.setResponse("Request timed out, process state: " + state);
+ }
+ workflowResponse.setProcessInstanceID(processInstanceId);
+ recordEvents(processKey, workflowResponse, startTime);
+ workflowResponse.setMessageCode(500);
+ return Response.status(500).entity(workflowResponse).build();
+ } catch (Exception ex) {
+ msoLogger.debug(LOGMARKER + "Exception in startProcessInstance by key",ex);
+ workflowResponse.setMessage("Fail" );
+ workflowResponse.setResponse("Error occurred while executing the process: " + ex.getMessage());
+ if (processInstance != null) workflowResponse.setProcessInstanceID(processInstance.getId());
+
+ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey),
+ MsoLogger.ErrorCode.UnknownError, LOGMARKER + workflowResponse.getMessage()
+ + " for processKey: " + processKey + " with response: " + workflowResponse.getResponse());
+
+ workflowResponse.setMessageCode(500);
+ recordEvents(processKey, workflowResponse, startTime);
+ return Response.status(500).entity(workflowResponse).build();
+ }
+ }
+
+ /**
+ * Returns the wait time, this is used by the resource on how long it should wait to send a response
+ * If none specified DEFAULT_WAIT_TIME is used
+ * @param inputVariables
+ * @return
+ */
+ private int getWaitTime(Map<String, Object> inputVariables)
+ {
+ String timeout = inputVariables.get("mso-service-request-timeout") == null
+ ? null : inputVariables.get("mso-service-request-timeout").toString();
+
+ if (timeout != null) {
+ try {
+ return Integer.parseInt(timeout)*1000;
+ } catch (NumberFormatException nex) {
+ msoLogger.debug("Invalid input for mso-service-request-timeout");
+ }
+ }
+ return DEFAULT_WAIT_TIME;
+ }
+
+ private void recordEvents(String processKey, WorkflowResponse response, long startTime) {
+
+ msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ LOGMARKER + response.getMessage() + " for processKey: "
+ + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ LOGMARKER + response.getMessage() + " for processKey: "
+ + processKey + " with response: " + response.getResponse());
+ }
+
+ private void setLogContext(String processKey, Map<String, Object> inputVariables) {
+ MsoLogger.setServiceName("MSO." + processKey);
+ if (inputVariables != null) {
+ MsoLogger.setLogContext(getValueFromInputVariables(inputVariables, "mso-request-id"),
+ getValueFromInputVariables(inputVariables, "mso-service-instance-id"));
+ }
+ }
+
+ private String getValueFromInputVariables(Map<String,Object> inputVariables, String key) {
+ Object value = inputVariables.get(key);
+ if (value == null) {
+ return "N/A";
+ } else {
+ return value.toString();
+ }
+ }
+
+ /**
+ * Checks to see if the specified process is ended.
+ * @param processInstanceId the process instance ID
+ * @return true if the process is ended
+ */
+ private boolean isProcessEnded(String processInstanceId) {
+ ProcessEngineServices pes = getProcessEngineServices();
+ try {
+ return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null ? true : false ;
+ } catch (Exception e) {
+ msoLogger.debug("Exception :",e);
+ return true;
+ }
+ }
+
+ private void processResponseMap(WorkflowResponse workflowResponse, Map<String, Object> responseMap) {
+ Object object = responseMap.get("Response");
+ String response = object == null ? null : String.valueOf(object);
+ if(response == null){
+ object = responseMap.get("WorkflowResponse");
+ response = object == null ? null : String.valueOf(object);
+ }
+
+ workflowResponse.setResponse(response);
+
+ object = responseMap.get("ResponseCode");
+ String responseCode = object == null ? null : String.valueOf(object);
+
+ try {
+ workflowResponse.setMessageCode(Integer.parseInt(responseCode));
+ } catch(NumberFormatException nex) {
+ msoLogger.debug(LOGMARKER + "Failed to parse ResponseCode: " + responseCode);
+ workflowResponse.setMessageCode(-1);
+ }
+
+ Object status = responseMap.get("Status");
+
+ if ("Success".equalsIgnoreCase(String.valueOf(status))) {
+ workflowResponse.setMessage("Success");
+ } else if ("Fail".equalsIgnoreCase(String.valueOf(status))) {
+ workflowResponse.setMessage("Fail");
+ } else {
+ msoLogger.debug(LOGMARKER + "Unrecognized Status: " + responseCode);
+ workflowResponse.setMessage("Fail");
+ }
+ }
+
+ /**
+ * @version 1.0
+ * Triggers the workflow in a separate thread
+ */
+ private class ProcessThread extends Thread {
+ private final Map<String,Object> inputVariables;
+ private final String processKey;
+ private final MsoLogger msoLogger;
+ private final String businessKey;
+ private ProcessInstance processInstance = null;
+ private Exception exception = null;
+
+ public ProcessThread(Map<String, Object> inputVariables, String processKey, MsoLogger msoLogger) {
+ this.inputVariables = inputVariables;
+ this.processKey = processKey;
+ this.msoLogger = msoLogger;
+ this.businessKey = UUID.randomUUID().toString();
+ }
+
+ /**
+ * If an exception occurs when starting the process instance, it may
+ * be obtained by calling this method. Note that exceptions are only
+ * recorded while the process is executing in its original thread.
+ * Once a process is suspended, exception recording stops.
+ * @return the exception, or null if none has occurred
+ */
+ public Exception getException() {
+ return exception;
+ }
+
+
+ public ProcessInstance getProcessInstance() {
+ return this.processInstance;
+ }
+
+ /**
+ * Sets the process instance exception.
+ * @param exception the exception
+ */
+ private void setException(Exception exception) {
+ this.exception = exception;
+ }
+
+ public void run() {
+ setLogContext(processKey, inputVariables);
+
+ long startTime = System.currentTimeMillis();
+
+ try {
+ msoLogger.debug(LOGMARKER + "***Received MSO startProcessInstanceByKey with processKey:"
+ + processKey + " and variables: " + inputVariables);
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER
+ + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with"
+ + " processKey:" + processKey
+ + " businessKey:" + businessKey
+ + " variables: " + inputVariables);
+
+ RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
+
+ // Note that this method doesn't return until the process suspends
+ // itself or finishes. We provide a business key so we can identify
+ // the process instance immediately.
+ processInstance = runtimeService.startProcessInstanceByKey(
+ processKey, inputVariables);
+
+ } catch (Exception e) {
+ msoLogger.debug(LOGMARKER + "ProcessThread caught an exception executing "
+ + processKey + ": " + e);
+ setException(e);
+ }
+ }
+
+ }
+
+ private Map<String, Object> getInputVariables(VariableMapImpl variableMap) {
+ VariableMap inputVariables = Variables.createVariables();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
+ for (String key : vMap.keySet()) { //variabe name vn
+ @SuppressWarnings("unchecked")
+ Map<String, Object> valueMap = (Map<String,Object>)vMap.get(key); //value, type
+ inputVariables.putValueTyped(key, Variables
+ .objectValue(valueMap.get("value"))
+ .serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value
+ .create());
+ }
+ return inputVariables;
+ }
+
+ /**
+ * Attempts to get a response map from the specified process instance.
+ * @return the response map, or null if it is unavailable
+ */
+ private Map<String, Object> getResponseMap(ProcessInstance processInstance,
+ String processKey, AtomicLong timeProcessEnded) {
+
+ String responseMapVariable = processKey + "ResponseMap";
+ String processInstanceId = processInstance.getId();
+
+ // Query the runtime service to see if a response map is ready.
+
+/* RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
+ List<Execution> executions = runtimeService.createExecutionQuery()
+ .processInstanceId(processInstanceId).list();
+
+ for (Execution execution : executions) {
+ @SuppressWarnings("unchecked")
+ Map<String, Object> responseMap = (Map<String, Object>)
+ getVariableFromExecution(runtimeService, execution.getId(),
+ responseMapVariable);
+
+ if (responseMap != null) {
+ msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable
+ + " from process " + processInstanceId + " execution "
+ + execution.getId());
+ return responseMap;
+ }
+ }
+*/
+ //Querying history seem to return consistent results compared to querying the runtime service
+
+ boolean alreadyEnded = timeProcessEnded.longValue() != 0;
+
+ if (alreadyEnded || isProcessEnded(processInstance.getId())) {
+ if (!alreadyEnded) {
+ timeProcessEnded.set(System.currentTimeMillis());
+ }
+
+ // Query the history service to see if a response map exists.
+
+ HistoryService historyService = getProcessEngineServices().getHistoryService();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> responseMap = (Map<String, Object>)
+ getVariableFromHistory(historyService, processInstance.getId(),
+ responseMapVariable);
+
+ if (responseMap != null) {
+ msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable
+ + " from process " + processInstanceId + " history");
+ return responseMap;
+ }
+
+ // Query the history service for old-style response variables.
+
+ String prefix = (String) getVariableFromHistory(historyService, processInstanceId, "prefix");
+
+ if (prefix != null) {
+
+ // Check for 'WorkflowResponse' variable
+ Object workflowResponseObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowResponse");
+ String workflowResponse = workflowResponseObject == null ? null : String.valueOf(workflowResponseObject);
+ msoLogger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse);
+
+ if (workflowResponse != null) {
+ Object responseCodeObject = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
+ String responseCode = responseCodeObject == null ? null : String.valueOf(responseCodeObject);
+ msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
+ responseMap = new HashMap<>();
+ responseMap.put("WorkflowResponse", workflowResponse);
+ responseMap.put("ResponseCode", responseCode);
+ responseMap.put("Status", "Success");
+ return responseMap;
+ }
+
+
+ // Check for 'WorkflowException' variable
+ WorkflowException workflowException = null;
+ String workflowExceptionText = null;
+
+ Object workflowExceptionObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowException");
+ if(workflowExceptionObject != null) {
+ if(workflowExceptionObject instanceof WorkflowException) {
+ workflowException = (WorkflowException) workflowExceptionObject;
+ workflowExceptionText = workflowException.toString();
+ responseMap = new HashMap<>();
+ responseMap.put("WorkflowException", workflowExceptionText);
+ responseMap.put("ResponseCode", workflowException.getErrorCode());
+ responseMap.put("Status", "Fail");
+ return responseMap;
+ }
+ else if (workflowExceptionObject instanceof String) {
+ Object object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
+ String responseCode = object == null ? null : String.valueOf(object);
+ workflowExceptionText = (String) workflowExceptionObject;
+ responseMap = new HashMap<>();
+ responseMap.put("WorkflowException", workflowExceptionText);
+ responseMap.put("ResponseCode", responseCode);
+ responseMap.put("Status", "Fail");
+ return responseMap;
+ }
+
+ }
+ msoLogger.debug(LOGMARKER + "WorkflowException: " + workflowExceptionText);
+
+ // BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE
+ Object object = getVariableFromHistory(historyService, processInstanceId, processKey + "Response");
+ String response = object == null ? null : String.valueOf(object);
+ msoLogger.debug(LOGMARKER + processKey + "Response: " + response);
+
+ if (response != null) {
+ object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
+ String responseCode = object == null ? null : String.valueOf(object);
+ msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
+ responseMap = new HashMap<>();
+ responseMap.put("Response", response);
+ responseMap.put("ResponseCode", responseCode);
+ responseMap.put("Status", "Success");
+ return responseMap;
+ }
+
+ object = getVariableFromHistory(historyService, processInstanceId, prefix + "ErrorResponse");
+ String errorResponse = object == null ? null : String.valueOf(object);
+ msoLogger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse);
+
+ if (errorResponse != null) {
+ object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode");
+ String responseCode = object == null ? null : String.valueOf(object);
+ msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode);
+ responseMap = new HashMap<>();
+ responseMap.put("Response", errorResponse);
+ responseMap.put("ResponseCode", responseCode);
+ responseMap.put("Status", "Fail");
+ return responseMap;
+ }
+ // END LEGACY SUPPORT. TODO: REMOVE THIS CODE
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets a variable value from the specified execution.
+ * @return the variable value, or null if the variable could not be
+ * obtained
+ */
+ private Object getVariableFromExecution(RuntimeService runtimeService,
+ String executionId, String variableName) {
+ try {
+ return runtimeService.getVariable(executionId, variableName);
+ } catch (ProcessEngineException e) {
+ // Most likely cause is that the execution no longer exists.
+ msoLogger.debug("Error retrieving execution " + executionId
+ + " variable " + variableName + ": " + e);
+ return null;
+ }
+ }
+ /**
+ * Gets a variable value from specified historical process instance.
+ * @return the variable value, or null if the variable could not be
+ * obtained
+ */
+ private Object getVariableFromHistory(HistoryService historyService,
+ String processInstanceId, String variableName) {
+ try {
+ HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery()
+ .processInstanceId(processInstanceId).variableName(variableName).singleResult();
+ return v == null ? null : v.getValue();
+ } catch (Exception e) {
+ msoLogger.debug("Error retrieving process " + processInstanceId
+ + " variable " + variableName + " from history: " + e);
+ return null;
+ }
+ }
+
+ @POST
+ @Path("/services/{processKey}/{processInstanceId}")
+ @Produces("application/json")
+ @Consumes("application/json")
+ @ApiOperation(
+ value = "Allows for retrieval of the variables for a given process",
+ notes = ""
+ )
+ public WorkflowResponse getProcessVariables(@PathParam("processKey") String processKey, @PathParam("processInstanceId") String processInstanceId) {
+ //TODO filter only set of variables
+ WorkflowResponse response = new WorkflowResponse();
+
+ long startTime = System.currentTimeMillis();
+ try {
+ ProcessEngineServices engine = getProcessEngineServices();
+ List<HistoricVariableInstance> variables = engine.getHistoryService().createHistoricVariableInstanceQuery().processInstanceId(processInstanceId).list();
+ Map<String,String> variablesMap = new HashMap<>();
+ for (HistoricVariableInstance variableInstance: variables) {
+ variablesMap.put(variableInstance.getName(), variableInstance.getValue().toString());
+ }
+
+ msoLogger.debug(LOGMARKER + "***Received MSO getProcessVariables with processKey:" + processKey + " and variables: " + variablesMap.toString());
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER
+ + "Call to MSO workflow/services in Camunda. Received MSO getProcessVariables with processKey:"
+ + processKey + " and variables: "
+ + variablesMap.toString());
+
+
+ response.setVariables(variablesMap);
+ response.setMessage("Success");
+ response.setResponse("Successfully retrieved the variables");
+ response.setProcessInstanceID(processInstanceId);
+
+ msoLogger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response.getResponse());
+ } catch (Exception ex) {
+ response.setMessage("Fail");
+ response.setResponse("Failed to retrieve the variables," + ex.getMessage());
+ response.setProcessInstanceID(processInstanceId);
+
+ msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), MsoLogger.ErrorCode.UnknownError, LOGMARKER
+ + response.getMessage()
+ + " for processKey: "
+ + processKey
+ + " with response: "
+ + response.getResponse());
+ msoLogger.debug("Exception :",ex);
+ }
+
+ msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ LOGMARKER + response.getMessage() + " for processKey: "
+ + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null);
+
+ msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ LOGMARKER + response.getMessage() + " for processKey: "
+ + processKey + " with response: " + response.getResponse());
+
+ return response;
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
new file mode 100644
index 0000000000..00ee6eb235
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
@@ -0,0 +1,353 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.core.plugins;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.camunda.bpm.engine.RepositoryService;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.ExecutionListener;
+import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener;
+import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener;
+import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin;
+import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
+import org.camunda.bpm.engine.impl.context.Context;
+import org.camunda.bpm.engine.impl.interceptor.Command;
+import org.camunda.bpm.engine.impl.interceptor.CommandContext;
+import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity;
+import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl;
+import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl;
+import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl;
+import org.camunda.bpm.engine.impl.util.xml.Element;
+import org.camunda.bpm.engine.impl.variable.VariableDeclaration;
+import org.camunda.bpm.model.bpmn.impl.instance.FlowNodeImpl;
+import org.camunda.bpm.model.bpmn.instance.EndEvent;
+import org.camunda.bpm.model.bpmn.instance.FlowNode;
+import org.camunda.bpm.model.bpmn.instance.StartEvent;
+import org.onap.so.bpmn.core.BPMNLogger;
+
+
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.AbstractEnvironment;
+import org.springframework.core.env.Environment;
+import org.springframework.core.env.MapPropertySource;
+import org.springframework.core.env.PropertySource;
+import org.springframework.stereotype.Component;
+
+
+
+/**
+ * Plugin for MSO logging and URN mapping.
+ */
+@Component
+public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
+ private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, LoggingAndURNMappingPlugin.class);
+ private static final String FSPROPKEY = "URNMapping.FileSystemLoading.Enabled";
+
+ @Autowired
+ private LoggingParseListener loggingParseListener;
+
+ @Override
+ public void preInit(
+ ProcessEngineConfigurationImpl processEngineConfiguration) {
+ List<BpmnParseListener> preParseListeners = processEngineConfiguration
+ .getCustomPreBPMNParseListeners();
+ if (preParseListeners == null) {
+ preParseListeners = new ArrayList<>();
+ processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners);
+ }
+ preParseListeners.add(loggingParseListener);
+ }
+
+ /**
+ * Called when a process flow is parsed so we can inject listeners.
+ */
+ @Component
+ public class LoggingParseListener extends AbstractBpmnParseListener {
+
+
+ private void injectLogExecutionListener(ActivityImpl activity) {
+ activity.addListener(
+ ExecutionListener.EVENTNAME_END,
+ new LoggingExecutionListener("END"));
+
+ activity.addListener(
+ ExecutionListener.EVENTNAME_START,
+ new LoggingExecutionListener("START"));
+
+ activity.addListener(
+ ExecutionListener.EVENTNAME_TAKE,
+ new LoggingExecutionListener("TAKE"));
+ }
+
+ @Override
+ public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) {
+ }
+
+ @Override
+ public void parseStartEvent(Element startEventElement, ScopeImpl scope, ActivityImpl startEventActivity) {
+ // Inject these listeners only on the main start event for the flow, not on any embedded subflow start events
+
+ injectLogExecutionListener(startEventActivity);
+ }
+
+ @Override
+ public void parseServiceTask(Element serviceTaskElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseExclusiveGateway(Element exclusiveGwElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseInclusiveGateway(Element inclusiveGwElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseParallelGateway(Element parallelGwElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseScriptTask(Element scriptTaskElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseBusinessRuleTask(Element businessRuleTaskElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseTask(Element taskElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseManualTask(Element manualTaskElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseUserTask(Element userTaskElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseEndEvent(Element endEventElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseBoundaryTimerEventDefinition(Element timerEventDefinition, boolean interrupting, ActivityImpl timerActivity) {
+ injectLogExecutionListener(timerActivity);
+ }
+
+ @Override
+ public void parseBoundaryErrorEventDefinition(Element errorEventDefinition, boolean interrupting, ActivityImpl activity, ActivityImpl nestedErrorEventActivity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseSubProcess(Element subProcessElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseCallActivity(Element callActivityElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseProperty(Element propertyElement, VariableDeclaration variableDeclaration, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseSequenceFlow(Element sequenceFlowElement, ScopeImpl scopeElement, TransitionImpl transition) {
+ //injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseSendTask(Element sendTaskElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseMultiInstanceLoopCharacteristics(Element activityElement, Element multiInstanceLoopCharacteristicsElement, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseIntermediateTimerEventDefinition(Element timerEventDefinition, ActivityImpl timerActivity) {
+ injectLogExecutionListener(timerActivity);
+ }
+
+ @Override
+ public void parseRootElement(Element rootElement, List<ProcessDefinitionEntity> processDefinitions) {
+ //injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseReceiveTask(Element receiveTaskElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseIntermediateSignalCatchEventDefinition(Element signalEventDefinition, ActivityImpl signalActivity) {
+ injectLogExecutionListener(signalActivity);
+ }
+
+ @Override
+ public void parseBoundarySignalEventDefinition(Element signalEventDefinition, boolean interrupting, ActivityImpl signalActivity) {
+ injectLogExecutionListener(signalActivity);
+ }
+
+ @Override
+ public void parseEventBasedGateway(Element eventBasedGwElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseTransaction(Element transactionElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseCompensateEventDefinition(Element compensateEventDefinition, ActivityImpl compensationActivity) {
+ injectLogExecutionListener(compensationActivity);
+ }
+
+ @Override
+ public void parseIntermediateThrowEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseIntermediateCatchEvent(Element intermediateEventElement, ScopeImpl scope, ActivityImpl activity) {
+ injectLogExecutionListener(activity);
+ }
+
+ @Override
+ public void parseBoundaryEvent(Element boundaryEventElement, ScopeImpl scopeElement, ActivityImpl nestedActivity) {
+ injectLogExecutionListener(nestedActivity);
+ }
+
+ @Override
+ public void parseIntermediateMessageCatchEventDefinition(Element messageEventDefinition, ActivityImpl nestedActivity) {
+ injectLogExecutionListener(nestedActivity);
+ }
+
+ @Override
+ public void parseBoundaryMessageEventDefinition(Element element, boolean interrupting, ActivityImpl messageActivity) {
+ injectLogExecutionListener(messageActivity);
+ }
+ }
+
+ /**
+ * Logs details about the current activity.
+ */
+ public class LoggingExecutionListener implements ExecutionListener {
+ private final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,LoggingExecutionListener.class);
+
+ private String event;
+
+ public LoggingExecutionListener() {
+ this.event = "";
+ }
+
+ public LoggingExecutionListener(String event) {
+ this.event = event;
+ }
+
+ public String getEvent() {
+ return event;
+ }
+
+ @Override
+ public void notify(DelegateExecution execution) throws Exception {
+ logger.trace("Logging for activity---------------:" + event + ":"
+ + execution.getCurrentActivityName()
+ + ", processDefinitionId="
+ + execution.getProcessDefinitionId() + ", activtyId="
+ + execution.getCurrentActivityId() + ", activtyName='"
+ + execution.getCurrentActivityName() + "'"
+ + ", processInstanceId="
+ + execution.getProcessInstanceId() + ", businessKey="
+ + execution.getProcessBusinessKey() + ", executionId="
+ + execution.getId());
+ //required for legacy groovy processing in camunda
+ execution.setVariable("isDebugLogEnabled", "true");
+ if (!isBlank(execution.getCurrentActivityName())) {
+ try {
+
+ String id = execution.getId();
+ if (id != null ) {
+ RepositoryService repositoryService = execution.getProcessEngineServices().getRepositoryService();
+ String processName = repositoryService.createProcessDefinitionQuery()
+ .processDefinitionId(execution.getProcessDefinitionId())
+ .singleResult()
+ .getName();
+
+ if (execution.getBpmnModelElementInstance() instanceof StartEvent) {
+ logger.debug("Starting process: " + processName);
+ }
+ if (execution.getBpmnModelElementInstance() instanceof EndEvent) {
+ logger.debug("Ending process: " + processName);
+ }
+
+ String serviceName = MDC.get(MsoLogger.SERVICE_NAME);
+
+ if(serviceName != null && !serviceName.contains(processName))
+ MsoLogger.setServiceName( serviceName + "." + processName);
+ else if(serviceName == null)
+ MsoLogger.setServiceName(processName);
+
+ String requestId = (String) execution.getVariable("mso-request-id");
+ String svcid = (String) execution.getVariable("mso-service-instance-id");
+ MsoLogger.setLogContext(requestId, svcid);
+ }
+ } catch(Exception e) {
+ logger.error(e);
+ }
+ }
+ }
+
+ private boolean isBlank(Object object) {
+ return object == null || "".equals(object.toString().trim());
+ }
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java
new file mode 100644
index 0000000000..9b8f6cd5cc
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/WorkflowExceptionPlugin.java
@@ -0,0 +1,172 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.core.plugins;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.ExecutionListener;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.camunda.bpm.engine.impl.bpmn.behavior.ClassDelegateActivityBehavior;
+import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener;
+import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener;
+import org.camunda.bpm.engine.impl.bpmn.parser.FieldDeclaration;
+import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin;
+import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
+import org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity;
+import org.camunda.bpm.engine.impl.pvm.PvmTransition;
+import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl;
+import org.camunda.bpm.engine.impl.pvm.process.TransitionImpl;
+import org.camunda.bpm.engine.impl.util.xml.Element;
+
+import org.onap.so.bpmn.core.BPMNLogger;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.springframework.stereotype.Component;
+
+/**
+ * This plugin does the following:
+ * <ol>
+ * <li>
+ * Adds logic at the start of every Call Activity to remove any existing
+ * WorkflowException object from the execution (saving a copy of it in a
+ * different variable).
+ * </li>
+ * <li>
+ * Adds logic at the end of every Call Activity to generate a MSOWorkflowException
+ * event if there is a WorkflowException object in the execution.
+ * </li>
+ * </ol>
+ */
+@Component
+public class WorkflowExceptionPlugin extends AbstractProcessEnginePlugin {
+
+ @Override
+ public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
+ List<BpmnParseListener> preParseListeners =
+ processEngineConfiguration.getCustomPreBPMNParseListeners();
+
+ if (preParseListeners == null) {
+ preParseListeners = new ArrayList<>();
+ processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners);
+ }
+
+ preParseListeners.add(new WorkflowExceptionParseListener());
+ }
+
+ public static class WorkflowExceptionParseListener extends AbstractBpmnParseListener {
+ @Override
+ public void parseProcess(Element processElement, ProcessDefinitionEntity processDefinition) {
+ AtomicInteger triggerTaskIndex = new AtomicInteger(1);
+ List<ActivityImpl> activities = new ArrayList<>(processDefinition.getActivities());
+ recurse(activities, triggerTaskIndex);
+ }
+
+ /**
+ * Helper method that recurses (into subprocesses) over all the listed activities.
+ * @param activities a list of workflow activities
+ * @param triggerTaskIndex the index of the next trigger task (mutable)
+ */
+ private void recurse(List<ActivityImpl> activities, AtomicInteger triggerTaskIndex) {
+ for (ActivityImpl activity : activities) {
+ String type = (String) activity.getProperty("type");
+
+ if ("callActivity".equals(type)) {
+ // Add a WorkflowExceptionResetListener to clear the WorkflowException
+ // variable when each Call Activity starts.
+
+ activity.addListener(
+ ExecutionListener.EVENTNAME_START,
+ new WorkflowExceptionResetListener());
+
+ // Add a WorkflowExceptionTriggerTask after the call activity.
+ // It must be a task because a listener cannot be used to generate
+ // an event. Throwing BpmnError from an execution listener will
+ // cause the process to die.
+
+ List<PvmTransition> outTransitions =
+ new ArrayList<>(activity.getOutgoingTransitions());
+
+ for (PvmTransition transition : outTransitions) {
+ String triggerTaskId = "WorkflowExceptionTriggerTask_" + triggerTaskIndex;
+
+ ActivityImpl triggerTask = activity.getFlowScope().createActivity(triggerTaskId);
+
+ ClassDelegateActivityBehavior behavior = new ClassDelegateActivityBehavior(
+ WorkflowExceptionTriggerTask.class.getName(),
+ new ArrayList<>(0));
+
+ triggerTask.setActivityBehavior(behavior);
+ triggerTask.setName("Workflow Exception Trigger Task " + triggerTaskIndex);
+ triggerTaskIndex.getAndIncrement();
+
+ TransitionImpl transitionImpl = (TransitionImpl) transition;
+ TransitionImpl triggerTaskOutTransition = triggerTask.createOutgoingTransition();
+ triggerTaskOutTransition.setDestination((ActivityImpl)transitionImpl.getDestination());
+ transitionImpl.setDestination(triggerTask);
+ }
+ } else if ("subProcess".equals(type)) {
+ recurse(new ArrayList<>(activity.getActivities()), triggerTaskIndex);
+ }
+ }
+ }
+ }
+
+ /**
+ * If there is a WorkflowException object in the execution, this method
+ * removes it (saving a copy of it in a different variable).
+ */
+ public static class WorkflowExceptionResetListener implements ExecutionListener {
+ public void notify(DelegateExecution execution) throws Exception {
+ Object workflowException = execution.getVariable("WorkflowException");
+
+ if (workflowException instanceof WorkflowException) {
+ int index = 1;
+ String saveName = "SavedWorkflowException" + index;
+ while (execution.getVariable(saveName) != null) {
+ saveName = "SavedWorkflowException" + (++index);
+ }
+
+ BPMNLogger.debug((String)execution.getVariable("isDebugLogEnabled"),
+ "WorkflowExceptionResetTask is moving WorkflowException to " + saveName);
+
+ execution.setVariable(saveName, workflowException);
+ execution.setVariable("WorkflowException", null);
+ }
+ }
+ }
+
+ /**
+ * Generates an MSOWorkflowException event if there is a WorkflowException
+ * object in the execution.
+ */
+ public static class WorkflowExceptionTriggerTask implements JavaDelegate {
+ public void execute(DelegateExecution execution) throws Exception {
+ if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
+ BPMNLogger.debug((String)execution.getVariable("isDebugLogEnabled"),
+ "WorkflowExceptionTriggerTask is generating a MSOWorkflowException event");
+ throw new BpmnError("MSOWorkflowException");
+ }
+ }
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
new file mode 100644
index 0000000000..8fe7ebe93a
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
@@ -0,0 +1,122 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure;
+
+import java.util.Arrays;
+
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.feature.LoggingFeature;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.transport.servlet.CXFServlet;
+import org.onap.so.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType;
+import org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify;
+import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource;
+import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource;
+import org.onap.so.bpmn.common.workflow.service.WorkflowResource;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.web.servlet.ServletRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+
+@Configuration
+public class CXFConfiguration {
+
+ private static final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CXFConfiguration.class);
+
+ @Autowired
+ private Bus bus;
+
+ @Autowired
+ private WorkflowMessageResource wmr;
+
+ @Autowired
+ private WorkflowResource workflowResource;
+
+ @Autowired
+ private WorkflowAsyncResource workflowAsyncResource;
+
+ @Autowired
+ private JaxRsFilterLogging jaxRsFilterLogging;
+
+ @Autowired
+ private ObjectMapper mapper;
+
+ @Autowired
+ private SDNCCallbackAdapterPortType sdncAdapterCallbackServiceImpl;
+
+ @Autowired
+ private VnfAdapterNotify vnfAdapterNotifyServiceImpl;
+
+ @Bean
+ public ServletRegistrationBean cxfServlet() {
+ return new ServletRegistrationBean(new CXFServlet(), "/mso/*");
+ }
+
+ @Bean
+ public Endpoint vnfAdapterCallback() {
+ EndpointImpl endpoint = new EndpointImpl(bus, vnfAdapterNotifyServiceImpl);
+ endpoint.publish("/VNFAdaptercallback");
+ return endpoint;
+ }
+
+ @Bean
+ public Endpoint sndcAdapterCallback() {
+ EndpointImpl endpoint = new EndpointImpl(bus, sdncAdapterCallbackServiceImpl);
+ endpoint.publish("/SDNCAdapterCallbackService");
+ return endpoint;
+ }
+
+ @Bean
+ public Server rsServer() {
+ JAXRSServerFactoryBean endpoint = new JAXRSServerFactoryBean();
+ endpoint.setBus(bus);
+ endpoint.setServiceBeans(Arrays.<Object>asList(wmr, workflowResource, workflowAsyncResource));
+ endpoint.setAddress("/");
+ endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature()));
+ endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper),jaxRsFilterLogging));
+
+ return endpoint.create();
+ }
+
+ @Bean
+ public Swagger2Feature createSwaggerFeature() {
+ Swagger2Feature swagger2Feature= new Swagger2Feature();
+ swagger2Feature.setPrettyPrint(true);
+ swagger2Feature.setTitle("SO Orchestration Application");
+ swagger2Feature.setContact("The ONAP SO team");
+ swagger2Feature.setDescription("This project is the SO Orchestration Engine");
+ swagger2Feature.setVersion("1.0.0");
+ swagger2Feature.setResourcePackage("org.onap.so.bpmn.common.workflow.service");
+ swagger2Feature.setScan(true);
+ return swagger2Feature;
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
new file mode 100644
index 0000000000..c263fe636c
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure;
+
+import java.util.List;
+import java.util.concurrent.Executor;
+
+import org.camunda.bpm.application.PostDeploy;
+import org.camunda.bpm.application.PreUndeploy;
+import org.camunda.bpm.application.ProcessApplicationInfo;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
+import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
+import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.requestsdb.RequestsDBHelper;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.ComponentScan.Filter;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.context.annotation.Primary;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+/**
+ * @since Version 1.0
+ *
+ */
+
+@SpringBootApplication
+@EnableProcessApplication("MSO Infrastructure Application")
+@EnableAsync
+@ComponentScan(basePackages = { "org.onap" }, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
+ @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class),
+ @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class),
+ @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) })
+public class MSOInfrastructureApplication {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
+ MSOInfrastructureApplication.class);
+
+ @Value("${mso.async.core-pool-size}")
+ private int corePoolSize;
+
+ @Value("${mso.async.max-pool-size}")
+ private int maxPoolSize;
+
+ @Value("${mso.async.queue-capacity}")
+ private int queueCapacity;
+
+ private static final String LOGS_DIR = "logs_dir";
+
+
+ private static void setLogsDir() {
+ if (System.getProperty(LOGS_DIR) == null) {
+ System.getProperties().setProperty(LOGS_DIR, "./logs/bpmn/");
+ }
+ }
+
+ public static void main(String... args) {
+ SpringApplication.run(MSOInfrastructureApplication.class, args);
+ System.getProperties().setProperty("mso.config.path", ".");
+ setLogsDir();
+ }
+
+ @PostDeploy
+ public void postDeploy(ProcessEngine processEngineInstance) {
+ long startTime = System.currentTimeMillis();
+
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "Post deployment complete...");
+ }
+
+ @PreUndeploy
+ public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo,
+ List<ProcessEngine> processEngines) {
+ long startTime = System.currentTimeMillis();
+
+ msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+ "Pre Undeploy complete...");
+
+ }
+
+ @Bean
+ @Primary
+ public Executor asyncExecutor() {
+ ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+
+ executor.setCorePoolSize(corePoolSize);
+ executor.setMaxPoolSize(maxPoolSize);
+ executor.setQueueCapacity(queueCapacity);
+ executor.setThreadNamePrefix("Camunda-");
+ executor.initialize();
+ return executor;
+ }
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java
new file mode 100644
index 0000000000..ad9e210452
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/WebSecurityConfigImpl.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.bpmn.infrastructure;
+
+import org.onap.so.security.MSOSpringFirewall;
+import org.onap.so.security.WebSecurityConfig;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.web.firewall.StrictHttpFirewall;
+import org.springframework.util.StringUtils;
+
+@EnableWebSecurity
+public class WebSecurityConfigImpl extends WebSecurityConfig {
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ http.csrf().disable()
+ .authorizeRequests()
+ .antMatchers("/manage/health","/manage/info").permitAll()
+ .antMatchers("/async/services/**", "/workflow/services/*", "/SDNCAdapterCallbackService", "/WorkflowMessage", "/vnfAdapterNotify", "/vnfAdapterRestNotify")
+ .hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",").toString())
+ .and()
+ .httpBasic();
+ }
+
+ @Override
+ public void configure(WebSecurity web) throws Exception {
+ super.configure(web);
+ StrictHttpFirewall firewall = new MSOSpringFirewall();
+ web.httpFirewall(firewall);
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
new file mode 100644
index 0000000000..e4866f5334
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputs.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.so.bpmn.common.scripts.ExceptionUtil;
+import org.onap.so.logger.MsoLogger;
+
+public class PnfCheckInputs implements JavaDelegate {
+
+ private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.GENERAL, PnfCheckInputs.class);
+
+ private String defaultTimeout;
+
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ String correlationId = (String) execution.getVariable(CORRELATION_ID);
+ if (correlationId == null) {
+ new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "correlationId variable not defined");
+ }
+ String timeout = (String) execution.getVariable(TIMEOUT_FOR_NOTIFICATION);
+ if (timeout == null) {
+ LOGGER.debug("timeoutForPnfEntryNotification variable not found, setting default");
+ if (defaultTimeout == null) {
+ new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999,
+ "default timeoutForPnfEntryNotification value not defined");
+ }
+ execution.setVariable(TIMEOUT_FOR_NOTIFICATION, defaultTimeout);
+ }
+ }
+
+ public void setDefaultTimeout(String defaultTimeout) {
+ this.defaultTimeout = defaultTimeout;
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
new file mode 100644
index 0000000000..bd781756a5
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
@@ -0,0 +1,422 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Huawei Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.workflow.service;
+
+import java.io.IOException;
+import java.net.SocketTimeoutException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.apache.http.HttpResponse;
+import org.apache.http.ParseException;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.config.RequestConfig;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.client.methods.HttpRequestBase;
+import org.apache.http.conn.ConnectTimeoutException;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.HttpClientBuilder;
+import org.apache.http.util.EntityUtils;
+import org.camunda.bpm.engine.runtime.Execution;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.onap.so.bpmn.core.domain.ServiceDecomposition;
+import org.onap.so.bpmn.core.json.JsonUtils;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
+public class ServicePluginFactory {
+
+ // SOTN calculate route
+ public static final String OOF_Default_EndPoint = "http://192.168.1.223:8443/oof/sotncalc";
+
+ public static final String Third_SP_Default_EndPoint = "http://192.168.1.223:8443/sp/resourcemgr/querytps";
+
+ private static final int DEFAULT_TIME_OUT = 60000;
+
+ static JsonUtils jsonUtil = new JsonUtils();
+
+ private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ServicePluginFactory.class);
+
+ private static ServicePluginFactory instance;
+
+
+ public static synchronized ServicePluginFactory getInstance() {
+ if (null == instance) {
+ instance = new ServicePluginFactory();
+ }
+ return instance;
+ }
+
+ private String getThirdSPEndPoint(){
+ return UrnPropertiesReader.getVariable("mso.service-plugin.third-sp-endpoint", Third_SP_Default_EndPoint);
+ }
+
+ private String getOOFCalcEndPoint(){
+ return UrnPropertiesReader.getVariable("mso.service-plugin.oof-calc-endpoint", OOF_Default_EndPoint);
+ }
+
+
+ public String preProcessService(ServiceDecomposition serviceDecomposition, String uuiRequest) {
+
+ // now only for sotn
+ if (isSOTN(serviceDecomposition, uuiRequest)) {
+ // We Need to query the terminalpoint of the VPN by site location
+ // info
+ return preProcessSOTNService(serviceDecomposition, uuiRequest);
+ }
+ return uuiRequest;
+ }
+
+ public String doServiceHoming(ServiceDecomposition serviceDecomposition, String uuiRequest) {
+ // now only for sotn
+ if (isSOTN(serviceDecomposition, uuiRequest)) {
+ return doSOTNServiceHoming(serviceDecomposition, uuiRequest);
+ }
+ return uuiRequest;
+ }
+
+ private boolean isSOTN(ServiceDecomposition serviceDecomposition, String uuiRequest) {
+ // there should be a register platform , we check it very simple here.
+ return uuiRequest.contains("clientSignal") && uuiRequest.contains("vpnType");
+ }
+
+ private String preProcessSOTNService(ServiceDecomposition serviceDecomposition, String uuiRequest) {
+ Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
+ Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.get("service");
+ Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.get("parameters");
+ Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.get("requestInputs");
+ List<Object> resources = (List<Object>) serviceParametersObject.get("resources");
+ // This is a logic for demo , it could not be finalized to community.
+ String srcLocation = "";
+ String dstLocation = "";
+ String srcClientSignal = "";
+ String dstClientSignal = "";
+ // support R2 uuiReq and R1 uuiReq
+ // logic for R2 uuiRequest params in service level
+ for (Entry<String, Object> entry : serviceRequestInputs.entrySet()) {
+ if (entry.getKey().toLowerCase().contains("location")) {
+ if ("".equals(srcLocation)) {
+ srcLocation = (String) entry.getValue();
+ } else if ("".equals(dstLocation)) {
+ dstLocation = (String) entry.getValue();
+ }
+ }
+ if (entry.getKey().toLowerCase().contains("clientsignal")) {
+ if ("".equals(srcClientSignal)) {
+ srcClientSignal = (String) entry.getValue();
+ } else if ("".equals(dstClientSignal)) {
+ dstClientSignal = (String) entry.getValue();
+ }
+ }
+ }
+
+ // logic for R1 uuiRequest, params in resource level
+ for (Object resource : resources) {
+ Map<String, Object> resourceObject = (Map<String, Object>) resource;
+ Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters");
+ Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject
+ .get("requestInputs");
+ for (Entry<String, Object> entry : resourceRequestInputs.entrySet()) {
+ if (entry.getKey().toLowerCase().contains("location")) {
+ if ("".equals(srcLocation)) {
+ srcLocation = (String) entry.getValue();
+ } else if ("".equals(dstLocation)) {
+ dstLocation = (String) entry.getValue();
+ }
+ }
+ if (entry.getKey().toLowerCase().contains("clientsignal")) {
+ if ("".equals(srcClientSignal)) {
+ srcClientSignal = (String) entry.getValue();
+ } else if ("".equals(dstClientSignal)) {
+ dstClientSignal = (String) entry.getValue();
+ }
+ }
+ }
+ }
+
+ Map<String, Object> vpnRequestInputs = getVPNResourceRequestInputs(resources);
+ // here we put client signal to vpn resource inputs
+ vpnRequestInputs.put("src-client-signal", srcClientSignal);
+ vpnRequestInputs.put("dst-client-signal", dstClientSignal);
+
+ // Now we need to query terminal points from SP resourcemgr system.
+ List<Object> locationTerminalPointList = queryTerminalPointsFromServiceProviderSystem(srcLocation, dstLocation);
+ Map<String, Object> tpInfoMap = (Map<String, Object>) locationTerminalPointList.get(0);
+
+ serviceRequestInputs.put("inner-src-access-provider-id", tpInfoMap.get("access-provider-id"));
+ serviceRequestInputs.put("inner-src-access-client-id", tpInfoMap.get("access-client-id"));
+ serviceRequestInputs.put("inner-src-access-topology-id", tpInfoMap.get("access-topology-id"));
+ serviceRequestInputs.put("inner-src-access-node-id", tpInfoMap.get("access-node-id"));
+ serviceRequestInputs.put("inner-src-access-ltp-id", tpInfoMap.get("access-ltp-id"));
+ tpInfoMap = (Map<String, Object>) locationTerminalPointList.get(1);
+
+ serviceRequestInputs.put("inner-dst-access-provider-id", tpInfoMap.get("access-provider-id"));
+ serviceRequestInputs.put("inner-dst-access-client-id", tpInfoMap.get("access-client-id"));
+ serviceRequestInputs.put("inner-dst-access-topology-id", tpInfoMap.get("access-topology-id"));
+ serviceRequestInputs.put("inner-dst-access-node-id", tpInfoMap.get("access-node-id"));
+ serviceRequestInputs.put("inner-dst-access-ltp-id", tpInfoMap.get("access-ltp-id"));
+
+ String newRequest = getJsonString(uuiObject);
+ return newRequest;
+ }
+
+ private List<Object> queryTerminalPointsFromServiceProviderSystem(String srcLocation, String dstLocation) {
+ Map<String, String> locationSrc = new HashMap<>();
+ locationSrc.put("location", srcLocation);
+ Map<String, String> locationDst = new HashMap<>();
+ locationDst.put("location", dstLocation);
+ List<Map<String, String>> locations = new ArrayList<>();
+ locations.add(locationSrc);
+ locations.add(locationDst);
+ List<Object> returnList = new ArrayList<>();
+ String reqContent = getJsonString(locations);
+ String url = getThirdSPEndPoint();
+ String responseContent = sendRequest(url, "POST", reqContent);
+ if (null != responseContent) {
+ returnList = getJsonObject(responseContent, List.class);
+ }
+ return returnList;
+ }
+
+ private Map<String, Object> getVPNResourceRequestInputs(List<Object> resources) {
+ for (Object resource : resources) {
+ Map<String, Object> resourceObject = (Map<String, Object>) resource;
+ Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters");
+ Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject
+ .get("requestInputs");
+ for (Entry<String, Object> entry : resourceRequestInputs.entrySet()) {
+ if (entry.getKey().toLowerCase().contains("vpntype")) {
+ return resourceRequestInputs;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static void main(String args[]){
+ String str = "restconf/config/GENERIC-RESOURCE-API:services/service/eca7e542-12ba-48de-8544-fac59303b14e/service-data/networks/network/aec07806-1671-4af2-b722-53c8e320a633/network-data/";
+
+ int index1 = str.indexOf("/network/");
+ int index2 = str.indexOf("/network-data");
+
+ String str1 = str.substring(index1 + "/network/".length(), index2);
+ System.out.println(str1);
+
+ }
+
+ private String doSOTNServiceHoming(ServiceDecomposition serviceDecomposition, String uuiRequest) {
+ // query the route for the service.
+ Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
+ Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.get("service");
+ Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.get("parameters");
+ Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.get("requestInputs");
+ Map<String, Object> oofQueryObject = new HashMap<>();
+ List<Object> resources = (List<Object>) serviceParametersObject.get("resources");
+ oofQueryObject.put("src-access-provider-id", serviceRequestInputs.get("inner-src-access-provider-id"));
+ oofQueryObject.put("src-access-client-id", serviceRequestInputs.get("inner-src-access-client-id"));
+ oofQueryObject.put("src-access-topology-id", serviceRequestInputs.get("inner-src-access-topology-id"));
+ oofQueryObject.put("src-access-node-id", serviceRequestInputs.get("inner-src-access-node-id"));
+ oofQueryObject.put("src-access-ltp-id", serviceRequestInputs.get("inner-src-access-ltp-id"));
+ oofQueryObject.put("dst-access-provider-id", serviceRequestInputs.get("inner-dst-access-provider-id"));
+ oofQueryObject.put("dst-access-client-id", serviceRequestInputs.get("inner-dst-access-client-id"));
+ oofQueryObject.put("dst-access-topology-id", serviceRequestInputs.get("inner-dst-access-topology-id"));
+ oofQueryObject.put("dst-access-node-id", serviceRequestInputs.get("inner-dst-access-node-id"));
+ oofQueryObject.put("dst-access-ltp-id", serviceRequestInputs.get("inner-dst-access-ltp-id"));
+ String oofRequestReq = getJsonString(oofQueryObject);
+ String url = getOOFCalcEndPoint();
+ String responseContent = sendRequest(url, "POST", oofRequestReq);
+
+ List<Object> returnList = new ArrayList<>();
+ if (null != responseContent) {
+ returnList = getJsonObject(responseContent, List.class);
+ }
+ // in demo we have only one VPN. no cross VPNs, so get first item.
+ Map<String, Object> returnRoute = getReturnRoute(returnList);
+ Map<String, Object> vpnRequestInputs = getVPNResourceRequestInputs(resources);
+ vpnRequestInputs.putAll(returnRoute);
+ String newRequest = getJsonString(uuiObject);
+ return newRequest;
+ }
+
+ private Map<String, Object> getReturnRoute(List<Object> returnList){
+ Map<String, Object> returnRoute = new HashMap<>();
+ for(Object returnVpn :returnList){
+ Map<String, Object> returnVpnInfo = (Map<String, Object>) returnVpn;
+ String accessTopoId = (String)returnVpnInfo.get("access-topology-id");
+ if("100".equals(accessTopoId)){
+ returnRoute.putAll(returnVpnInfo);
+ }
+ else if("101".equals(accessTopoId)){
+ for(String key : returnVpnInfo.keySet()){
+ returnRoute.put("domain1-" + key, returnVpnInfo.get(key));
+ }
+ }
+ else if("102".equals(accessTopoId)){
+ for(String key : returnVpnInfo.keySet()){
+ returnRoute.put("domain2-" + key, returnVpnInfo.get(key));
+ }
+ }
+ else{
+ for(String key : returnVpnInfo.keySet()){
+ returnRoute.put("domain" + accessTopoId +"-" + key, returnVpnInfo.get(key));
+ }
+ }
+ }
+ return returnRoute;
+ }
+
+ private Map<String, Object> getResourceParams(Execution execution, String resourceCustomizationUuid,
+ String serviceParameters) {
+ List<String> resourceList = jsonUtil.StringArrayToList(execution,
+ (String) JsonUtils.getJsonValue(serviceParameters, "resources"));
+ // Get the right location str for resource. default is an empty array.
+ String resourceInputsFromUui = "";
+ for (String resource : resourceList) {
+ String resCusUuid = (String) JsonUtils.getJsonValue(resource, "resourceCustomizationUuid");
+ if (resourceCustomizationUuid.equals(resCusUuid)) {
+ String resourceParameters = JsonUtils.getJsonValue(resource, "parameters");
+ resourceInputsFromUui = JsonUtils.getJsonValue(resourceParameters, "requestInputs");
+ }
+ }
+ Map<String, Object> resourceInputsFromUuiMap = getJsonObject(resourceInputsFromUui, Map.class);
+ return resourceInputsFromUuiMap;
+ }
+
+ public static <T> T getJsonObject(String jsonstr, Class<T> type) {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
+ try {
+ return mapper.readValue(jsonstr, type);
+ } catch (IOException e) {
+ LOGGER.error(MessageEnum.RA_NS_EXC, "", "", MsoLogger.ErrorCode.BusinessProcesssError,
+ "fail to unMarshal json", e);
+ }
+ return null;
+ }
+
+ public static String getJsonString(Object srcObj) {
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
+ String jsonStr = null;
+ try {
+ jsonStr = mapper.writeValueAsString(srcObj);
+ } catch (JsonProcessingException e) {
+ LOGGER.debug("SdcToscaParserException", e);
+ e.printStackTrace();
+ }
+ return jsonStr;
+ }
+
+ private static String sendRequest(String url, String methodType, String content) {
+
+ String msbUrl = url;
+ HttpRequestBase method = null;
+ HttpResponse httpResponse = null;
+
+ try {
+ int timeout = DEFAULT_TIME_OUT;
+
+ RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(timeout).setConnectTimeout(timeout)
+ .setConnectionRequestTimeout(timeout).build();
+
+ HttpClient client = HttpClientBuilder.create().build();
+
+ if ("POST".equals(methodType.toUpperCase())) {
+ HttpPost httpPost = new HttpPost(msbUrl);
+ httpPost.setConfig(requestConfig);
+ httpPost.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
+ method = httpPost;
+ } else if ("PUT".equals(methodType.toUpperCase())) {
+ HttpPut httpPut = new HttpPut(msbUrl);
+ httpPut.setConfig(requestConfig);
+ httpPut.setEntity(new StringEntity(content, ContentType.APPLICATION_JSON));
+ method = httpPut;
+ } else if ("GET".equals(methodType.toUpperCase())) {
+ HttpGet httpGet = new HttpGet(msbUrl);
+ httpGet.setConfig(requestConfig);
+ method = httpGet;
+ } else if ("DELETE".equals(methodType.toUpperCase())) {
+ HttpDelete httpDelete = new HttpDelete(msbUrl);
+ httpDelete.setConfig(requestConfig);
+ method = httpDelete;
+ }
+
+ // now have no auth
+ // String userCredentials =
+ // SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP,
+ // Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY);
+ // String authorization = "Basic " +
+ // DatatypeConverter.printBase64Binary(userCredentials.getBytes());
+ // method.setHeader("Authorization", authorization);
+
+ httpResponse = client.execute(method);
+ String responseContent = null;
+ if (null != httpResponse && httpResponse.getEntity() != null) {
+ try {
+ responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
+ } catch (ParseException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ if (null != method) {
+ method.reset();
+ }
+ method = null;
+ return responseContent;
+
+ } catch (SocketTimeoutException | ConnectTimeoutException e) {
+ return null;
+
+ } catch (Exception e) {
+ return null;
+
+ } finally {
+ if (httpResponse != null) {
+ try {
+ EntityUtils.consume(httpResponse.getEntity());
+ } catch (Exception e) {
+ }
+ }
+ if (method != null) {
+ try {
+ method.reset();
+ } catch (Exception e) {
+
+ }
+ }
+ }
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/META-INF/processes.xml b/bpmn/mso-infrastructure-bpmn/src/main/resources/META-INF/processes.xml
new file mode 100644
index 0000000000..35235b8539
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/META-INF/processes.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ ============LICENSE_START=======================================================
+ ONAP SO
+ ================================================================================
+ 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=========================================================
+ -->
+
+<process-application
+ xmlns="http://www.camunda.org/schema/1.0/ProcessApplication"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
+ <process-archive name="att-services-bpmn">
+ <properties>
+ <property name="isDeleteUponUndeploy">false</property>
+ <property name="isScanForProcessDefinitions">true</property>
+ </properties>
+ </process-archive>
+
+</process-application>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml
new file mode 100644
index 0000000000..92e8f588a6
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application-local.yml
@@ -0,0 +1,275 @@
+aai:
+ auth: asdf
+ dme2:
+ timeout: '30000'
+ endpoint: http://localhost:8443
+camunda:
+ bpm:
+ admin-user:
+ id: admin
+ password: admin
+ history-level: full
+ job-execution:
+ max-pool-size: 30
+ core-pool-size: 3
+entitymanager:
+ packagesToScan: com
+
+mso:
+ correlation:
+ timeout: 60
+ logPath: logs
+ async:
+ core-pool-size: 50
+ max-pool-size: 50
+ queue-capacity: 500
+ adapters:
+ completemsoprocess:
+ endpoint: http://localhost:30253/CompleteMsoProcess
+ db:
+ auth: 26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764
+ password: wLg4sjrAFUS8rfVfdvTXeQ==
+ endpoint: http://localhost:30257/services/RequestsDbAdapter
+ spring:
+ endpoint: http://localhost:30257
+ network:
+ endpoint: http://localhost:30253/services/NetworkAdapter
+ rest:
+ endpoint: http://localhost:30253/services/rest/v1/networks
+ openecomp:
+ db:
+ endpoint: http://localhost:30257/services/RequestsDbAdapter
+ po:
+ auth: 757A94191D685FD2092AC1490730A4FC
+ password: 3141634BF7E070AA289CF2892C986C0B
+ sdnc:
+ endpoint: http://localhost:30254/adapters/SDNCAdapter
+ rest:
+ endpoint: http://localhost:30254/adapters/rest/v1/sdnc
+ timeout: PT60S
+ tenant:
+ endpoint: http://localhost:30253/services/TenantAdapter
+ vnf:
+ endpoint: http://localhost:30253/services/VnfAdapter
+ rest:
+ endpoint: http://localhost:30253/services/rest/vnfs/v1/vnfs
+ volume-groups:
+ rest:
+ endpoint: http://localhost:30253/services/rest/v1/volume-groups
+ vnf-async:
+ endpoint: http://localhost:30253/services/VnfAdapterAsync
+ bpmn:
+ process:
+ historyTimeToLive: '30'
+ callbackRetryAttempts: '5'
+ catalog:
+ db:
+ endpoint: http://localhost:30258/ecomp/mso/catalog
+ spring:
+ endpoint: http://localhost:30258
+ db:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ default:
+ adapter:
+ namespace: http://com.att.mso
+ healthcheck:
+ log:
+ debug: 'false'
+ infra:
+ customer:
+ id: testCustIdInfra
+ msoKey: 07a7159d3bf51a0e53be7a8f89699be7
+ po:
+ timeout: PT60S
+ request:
+ db:
+ endpoint: http://localhost:28090/
+ rollback: 'true'
+ sdnc:
+ password: 3141634BF7E070AA289CF2892C986C0B
+ service:
+ agnostic:
+ sniro:
+ endpoint: /sniro/api/v2/placement
+ host: http://localhost:30253
+ site-name: CamundaEngine
+ sniro:
+ auth: test:testpwd
+ callback: http://localhost:28090/adapters/rest/SDNCNotify
+ endpoint: http://localhost:28090/optimizationInstance/V1/create
+ timeout: PT30M
+ workflow:
+ CreateGenericVNFV1:
+ aai:
+ volume-group:
+ uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group
+ default:
+ aai:
+ version: '8'
+ cloud-region:
+ version: '9'
+ generic-vnf:
+ version: '9'
+ v11:
+ customer:
+ uri: /aai/v11/business/customers/customer
+ generic-query:
+ uri: /aai/v11/search/generic-query
+ generic-vnf:
+ uri: /aai/v11/network/generic-vnfs/generic-vnf
+ l3-network:
+ uri: /aai/v11/network/l3-networks/l3-network
+ network-policy:
+ uri: /aai/v11/network/network-policies/network-policy
+ nodes-query:
+ uri: /aai/v11/search/nodes-query
+ route-table-reference:
+ uri: /aai/v11/network/route-table-references/route-table-reference
+ tenant:
+ uri: /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant
+ vce:
+ uri: /aai/v11/network/vces/vce
+ vpn-binding:
+ uri: /aai/v11/network/vpn-bindings/vpn-binding
+ v8:
+ configuration:
+ uri: /aai/v11/network/configurations/configuration
+ customer:
+ uri: /aai/v8/business/customers/customer
+ generic-query:
+ uri: /aai/v8/search/generic-query
+ l3-network:
+ uri: /aai/v8/network/l3-networks/l3-network
+ network-policy:
+ uri: /aai/v8/network/network-policies/network-policy
+ nodes-query:
+ uri: /aai/v8/search/nodes-query
+ route-table-reference:
+ uri: /aai/v8/network/route-table-references/route-table-reference
+ tenant:
+ uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant
+ vce:
+ uri: /aai/v8/network/vces/vce
+ vpn-binding:
+ uri: /aai/v8/network/vpn-bindings/vpn-binding
+ v9:
+ cloud-region:
+ uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic
+ generic-vnf:
+ uri: /aai/v9/network/generic-vnfs/generic-vnf
+ retry:
+ attempts: '1'
+ deleteCinderVolumeV1:
+ aai:
+ volume-group:
+ uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group
+ global:
+ default:
+ aai:
+ namespace: http://org.openecomp.aai.inventory/
+ message:
+ endpoint: http://localhost:30252/mso/WorkflowMessage
+ notification:
+ name: GenericNotificationServiceATT
+ sdncadapter:
+ callback: http://localhost:30254/mso/SDNCAdapterCallbackService
+ vnfadapter:
+ create:
+ callback: http://localhost:30253/mso/vnfAdapterNotify
+ delete:
+ callback: http://localhost:30253/mso/vnfAdapterNotify
+ query:
+ callback: http://localhost:30253/mso/vnfAdapterNotify
+ rollback:
+ callback: http://localhost:30253/mso/vnfAdapterNotify
+ global:
+ dmaap:
+ username: testuser
+ password: alRyMzJ3NUNeakxl
+ host: http://localhost:3904
+ publisher:
+ topic: com.att.mso.dev.25239-asyncStatusUpdate-v1
+policy:
+ auth: Basic dGVzdHBkcDphbHBoYTEyMw==
+ client:
+ auth: Basic bTAzNzQzOnBvbGljeVIwY2sk
+ endpoint: https://localhost:8081/pdp/api/
+ environment: TEST
+sdnc:
+ auth: Basic YWRtaW46YWRtaW4=
+ host: https://localhost:8443
+ path: /restconf/operations/GENERIC-RESOURCE-API
+
+appc:
+ client:
+ topic:
+ read:
+ name: APPC-TEST-AMDOCS2
+ timeout: 360000
+ write: APPC-TEST-AMDOCS1-IST
+ response:
+ timeout: 360000
+ key: LSl8QKolmKcC0yJR
+ secret: lgjXraD1HutKxv8jEN6tVouu
+ service: ueb
+ poolMembers: localhost:3904
+server:
+ port: 8080
+ tomcat:
+ max-threads: 50
+spring:
+ h2:
+ console:
+ enabled: true
+ path: /h2
+ datasource:
+ url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
+ username: sa
+ password: sa
+ driverClassName: org.h2.Driver
+ security:
+ usercredentials:
+ -
+ username: apihBpmn
+ password: '$2a$12$chgDUKcdlf1t41CtS/kjIOwRuq0zWdvCcYYXtyL5TqNdPW0GhN4e6'
+ role: BPMN-Client
+ -
+ username: sdncaBpmn
+ password: '$2a$12$1TeeS2hAXtqXgdL7f2jCWeF5on7/lrrVZqRmqUqYijOTfrlS2CZae'
+ role: BPMN-Client
+ -
+ username: poBpmn
+ password: '$2a$12$TixZE5fK3YkTzWcpktm.Uuk5ePFOD2n9sj2ugGRybfsz0QQ0TKLAS'
+ role: BPMN-Client
+ -
+ username: wmaBpmn
+ password: '$2a$12$WucJSJD5iUD9MuEzhfuSmeF1W/zPMbcu.384Lh8gCkB7SPtKqZQna'
+ role: BPMN-Client
+ -
+ username: sniro
+ password: '$2a$12$lbOQWS1iDmdQPxW2Mb6OiuTzGaPUrkrvoKVn2zwpFWb6n5Y86Lf1y'
+ role: SNIRO-Client
+ -
+ username: mso_admin
+ password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
+ role: ACTUATOR
+request:
+ datasource:
+ url: jdbc:h2:mem:AZ;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
+ username: sa
+ password: sa
+ driver-class-name: org.h2.Driver
+ intialize: true
+
+# Hibernate
+hibernate:
+ dialect: org.hibernate.dialect.MySQL5Dialect
+ show_sql: true
+ hbm2ddl:
+ auto: create
+
+#Actuator
+management:
+ context-path: /manage
+
+
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml
new file mode 100644
index 0000000000..c1f58e9db0
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/application.yaml
@@ -0,0 +1,30 @@
+server:
+ port: 8080
+ tomcat:
+ max-threads: 50
+
+spring:
+ datasource:
+ driver-class-name: org.mariadb.jdbc.Driver
+ url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/camundabpmn
+ username: ${DB_USERNAME}
+ password: ${DB_PASSWORD}
+ dbcp2:
+ initial-size: 5
+ max-total: 20
+ validation-query: select 1
+ test-on-borrow: true
+ http:
+ multipart:
+ enabled: false
+ jersey:
+ application-path: /sobpmnengine
+#Actuator
+management:
+ context-path: /manage
+ metrics:
+ se-global-registry: false
+ export:
+ prometheus:
+ enabled: true # Whether exporting of metrics to Prometheus is enabled.
+ step: 1m # Step size (i.e. reporting frequency) to use. \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateActivateSDNCResource.bpmn b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateActivateSDNCResource.bpmn
new file mode 100644
index 0000000000..29d7a11175
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateActivateSDNCResource.bpmn
@@ -0,0 +1,393 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
+ <bpmn:process id="CreateActivateSDNCResource" name="CreateActivateSDNCResource" isExecutable="true">
+ <bpmn:startEvent id="createSDNCRES_StartEvent" name="createSDNCRES_StartEvent">
+ <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="createSDNCRES_StartEvent" targetRef="Task_1dlrfiw" />
+ <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="Task_0tezqd4" />
+ <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="prepare SDNC Create Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_18l3crb</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new CreateActivateSDNCResource()
+dcsi.prepareSDNCRequest(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:endEvent id="EndEvent_1x6k78c" name="create SDNC call end">
+ <bpmn:incoming>SequenceFlow_17md60u</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:callActivity id="CallActivity_1600xlj" name="Call SDNC RSRC Create&#10; Adapter V1&#10;" calledElement="sdncAdapter">
+ <bpmn:extensionElements>
+ <camunda:in source="CRESDNCRES_activateSDNCRequest" target="sdncAdapterWorkflowRequest" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
+ <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+ <camunda:out source="sdncAdapterResponse" target="sdncAdapterResponse" />
+ <camunda:out source="SDNCA_ResponseCode" target="SDNCA_ResponseCode" />
+ <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_15mvedq</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1xk5xed</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_1xk5xed" sourceRef="CallActivity_1600xlj" targetRef="Task_0mszkkr" />
+ <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred" targetRef="ScriptTask_1g5zyi6" />
+ <bpmn:scriptTask id="Task_023hred" name="post SDNC create call">
+ <bpmn:incoming>SequenceFlow_1afu5al</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0ow44q0</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new CreateActivateSDNCResource()
+dcsi.postCreateSDNCCall(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0w2es8j" sourceRef="Task_1dlrfiw" targetRef="Task_13sx2bp" />
+ <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp" targetRef="PreprocessIncomingRequest_task" />
+ <bpmn:scriptTask id="Task_1dlrfiw" name="Set the Recipe DesignTimeParam" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0w2es8j</bpmn:outgoing>
+ <bpmn:script><![CDATA[String recipeParamXsdDemo="""{"operationType":"VPN","apiType":"network"}"""
+String recipeParamXsd=""
+execution.setVariable("recipeParamXsd", recipeParamXsd)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Task_13sx2bp" name="Pre Process Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0w2es8j</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_18l3crb</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new CreateActivateSDNCResource()
+dcsi.preProcessRequest(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1mz0vdx" sourceRef="Task_0tezqd4" targetRef="Task_18tomkl" />
+ <bpmn:sequenceFlow id="SequenceFlow_15mvedq" sourceRef="Task_18tomkl" targetRef="CallActivity_1600xlj" />
+ <bpmn:scriptTask id="Task_0tezqd4" name="Create progress update parameters before create" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1mz0vdx</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new CreateActivateSDNCResource()
+dcsi.prepareUpdateBeforeCreateSDNCResource(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Task_0uwlr22" name="Create progress update parameters After create" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0ruppyi</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1jr6zi0</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new CreateActivateSDNCResource()
+dcsi.prepareUpdateAfterCreateSDNCResource(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="Task_18tomkl" name="update progress update">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1mz0vdx</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_15mvedq</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="ServiceTask_1cm8iwr" name="update progress update">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1jr6zi0</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_10cy2nu</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1jr6zi0" sourceRef="Task_0uwlr22" targetRef="ServiceTask_1cm8iwr" />
+ <bpmn:scriptTask id="ScriptTask_1g5zyi6" name="Send Sync Ack Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_17md60u</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def csi = new CreateActivateSDNCResource()
+csi.sendSyncResponse(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_17md60u" sourceRef="ScriptTask_1g5zyi6" targetRef="EndEvent_1x6k78c" />
+ <bpmn:scriptTask id="ScriptTask_0a98d9a" name="prepare SDNC Activate Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_10cy2nu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0rp0tdn</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new CreateActivateSDNCResource()
+dcsi.prepareSDNCActivateRequest(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_10cy2nu" sourceRef="ServiceTask_1cm8iwr" targetRef="ScriptTask_0a98d9a" />
+ <bpmn:scriptTask id="ScriptTask_1toiss1" name="Create progress update parameters After Activate" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0s3vc50</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_05adaey</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new CreateActivateSDNCResource()
+dcsi.prepareUpdateAfterActivateSDNCResource(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="ServiceTask_10e6vjg" name="update progress update">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_05adaey</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1afu5al</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_05adaey" sourceRef="ScriptTask_1toiss1" targetRef="ServiceTask_10e6vjg" />
+ <bpmn:sequenceFlow id="SequenceFlow_1afu5al" sourceRef="ServiceTask_10e6vjg" targetRef="Task_023hred" />
+ <bpmn:callActivity id="CallActivity_0pr0s2y" name="Call SDNC RSRCActivate&#10; Adapter V1&#10;" calledElement="sdncAdapter">
+ <bpmn:extensionElements>
+ <camunda:in source="CRESDNCRES_activateSDNCRequest" target="sdncAdapterWorkflowRequest" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
+ <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+ <camunda:out source="sdncAdapterResponse" target="sdncAdapterResponse" />
+ <camunda:out source="SDNCA_ResponseCode" target="SDNCA_ResponseCode" />
+ <camunda:out source="SDNCA_SuccessIndicator" target="SDNCA_SuccessIndicator" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0rp0tdn</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1efgf9m</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_1efgf9m" sourceRef="CallActivity_0pr0s2y" targetRef="Task_0p200y6" />
+ <bpmn:sequenceFlow id="SequenceFlow_0ruppyi" sourceRef="Task_0mszkkr" targetRef="Task_0uwlr22" />
+ <bpmn:scriptTask id="Task_0mszkkr" name="post create SDNC call" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1xk5xed</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0ruppyi</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new CreateActivateSDNCResource()
+dcsi.postCreateSDNC(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Task_0p200y6" name="post activate SDNC call" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1efgf9m</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0s3vc50</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new CreateActivateSDNCResource()
+dcsi.postActivateSDNC(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0s3vc50" sourceRef="Task_0p200y6" targetRef="ScriptTask_1toiss1" />
+ <bpmn:sequenceFlow id="SequenceFlow_0rp0tdn" sourceRef="ScriptTask_0a98d9a" targetRef="CallActivity_0pr0s2y" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateActivateSDNCResource">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createSDNCRES_StartEvent">
+ <dc:Bounds x="-111" y="111" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="-134" y="147" width="85" height="28" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln">
+ <di:waypoint xsi:type="dc:Point" x="-75" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="-10" y="129" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="-87.5" y="108" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova">
+ <di:waypoint xsi:type="dc:Point" x="413" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="460" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="500" y="129" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="391.5" y="108" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task">
+ <dc:Bounds x="313" y="89" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c">
+ <dc:Bounds x="1049" y="544" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1013" y="586" width="81" height="28" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj">
+ <dc:Bounds x="109" y="295" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1xk5xed_di" bpmnElement="SequenceFlow_1xk5xed">
+ <di:waypoint xsi:type="dc:Point" x="209" y="335" />
+ <di:waypoint xsi:type="dc:Point" x="257" y="335" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="188" y="314" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0">
+ <di:waypoint xsi:type="dc:Point" x="896" y="562" />
+ <di:waypoint xsi:type="dc:Point" x="915" y="562" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="860.5" y="541" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred">
+ <dc:Bounds x="796" y="522" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0w2es8j_di" bpmnElement="SequenceFlow_0w2es8j">
+ <di:waypoint xsi:type="dc:Point" x="90" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="148" y="129" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="74" y="108" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb">
+ <di:waypoint xsi:type="dc:Point" x="248" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="313" y="129" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="235.5" y="108" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0lc6l7a_di" bpmnElement="Task_1dlrfiw">
+ <dc:Bounds x="-10" y="89" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp">
+ <dc:Bounds x="148" y="89" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1mz0vdx_di" bpmnElement="SequenceFlow_1mz0vdx">
+ <di:waypoint xsi:type="dc:Point" x="606" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="638" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="638" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="738" y="129" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="608" y="123" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_15mvedq_di" bpmnElement="SequenceFlow_15mvedq">
+ <di:waypoint xsi:type="dc:Point" x="788" y="169" />
+ <di:waypoint xsi:type="dc:Point" x="788" y="218" />
+ <di:waypoint xsi:type="dc:Point" x="0" y="218" />
+ <di:waypoint xsi:type="dc:Point" x="0" y="335" />
+ <di:waypoint xsi:type="dc:Point" x="109" y="335" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="349" y="197" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tezqd4">
+ <dc:Bounds x="506" y="89" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0hu4lhm_di" bpmnElement="Task_0uwlr22">
+ <dc:Bounds x="426" y="295" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1q6ssz7_di" bpmnElement="Task_18tomkl">
+ <dc:Bounds x="738" y="89" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr">
+ <dc:Bounds x="588" y="295" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1jr6zi0_di" bpmnElement="SequenceFlow_1jr6zi0">
+ <di:waypoint xsi:type="dc:Point" x="526" y="335" />
+ <di:waypoint xsi:type="dc:Point" x="554" y="335" />
+ <di:waypoint xsi:type="dc:Point" x="554" y="335" />
+ <di:waypoint xsi:type="dc:Point" x="588" y="335" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="524" y="329" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6">
+ <dc:Bounds x="915" y="522" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_17md60u_di" bpmnElement="SequenceFlow_17md60u">
+ <di:waypoint xsi:type="dc:Point" x="1015" y="562" />
+ <di:waypoint xsi:type="dc:Point" x="1049" y="562" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="987" y="540" width="90" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0a98d9a_di" bpmnElement="ScriptTask_0a98d9a">
+ <dc:Bounds x="-2" y="522" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_10cy2nu_di" bpmnElement="SequenceFlow_10cy2nu">
+ <di:waypoint xsi:type="dc:Point" x="638" y="375" />
+ <di:waypoint xsi:type="dc:Point" x="638" y="435" />
+ <di:waypoint xsi:type="dc:Point" x="-33" y="435" />
+ <di:waypoint xsi:type="dc:Point" x="-33" y="562" />
+ <di:waypoint xsi:type="dc:Point" x="-2" y="562" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="302.5" y="413" width="0" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1toiss1_di" bpmnElement="ScriptTask_1toiss1">
+ <dc:Bounds x="490" y="522" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_10e6vjg_di" bpmnElement="ServiceTask_10e6vjg">
+ <dc:Bounds x="656" y="522" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_05adaey_di" bpmnElement="SequenceFlow_05adaey">
+ <di:waypoint xsi:type="dc:Point" x="590" y="562" />
+ <di:waypoint xsi:type="dc:Point" x="656" y="562" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="623" y="540" width="0" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1afu5al_di" bpmnElement="SequenceFlow_1afu5al">
+ <di:waypoint xsi:type="dc:Point" x="756" y="562" />
+ <di:waypoint xsi:type="dc:Point" x="796" y="562" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="776" y="540" width="0" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_0pr0s2y_di" bpmnElement="CallActivity_0pr0s2y">
+ <dc:Bounds x="178" y="522" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1efgf9m_di" bpmnElement="SequenceFlow_1efgf9m">
+ <di:waypoint xsi:type="dc:Point" x="278" y="562" />
+ <di:waypoint xsi:type="dc:Point" x="336" y="562" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="307" y="540" width="0" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ruppyi_di" bpmnElement="SequenceFlow_0ruppyi">
+ <di:waypoint xsi:type="dc:Point" x="357" y="335" />
+ <di:waypoint xsi:type="dc:Point" x="426" y="335" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="391.5" y="313" width="0" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_13eovp4_di" bpmnElement="Task_0mszkkr">
+ <dc:Bounds x="257" y="295" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0ymnxuf_di" bpmnElement="Task_0p200y6">
+ <dc:Bounds x="336" y="522" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0s3vc50_di" bpmnElement="SequenceFlow_0s3vc50">
+ <di:waypoint xsi:type="dc:Point" x="436" y="562" />
+ <di:waypoint xsi:type="dc:Point" x="490" y="562" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="463" y="540" width="0" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0rp0tdn_di" bpmnElement="SequenceFlow_0rp0tdn">
+ <di:waypoint xsi:type="dc:Point" x="98" y="562" />
+ <di:waypoint xsi:type="dc:Point" x="178" y="562" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="138" y="540" width="0" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateCustom3rdONAPServiceInstance.bpmn b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateCustom3rdONAPServiceInstance.bpmn
new file mode 100644
index 0000000000..a8bd33ca69
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/CreateCustom3rdONAPServiceInstance.bpmn
@@ -0,0 +1,389 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3">
+ <bpmn:process id="CreateCustom3rdONAPServiceInstance" name="CreateCustom3rdONAPServiceInstance" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_00qj6ro" name="Create SI Start Flow">
+ <bpmn:outgoing>SequenceFlow_0s2spoq</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:subProcess id="SubProcess_0ka59nc" name="Sub-process for UnexpectedErrors" triggeredByEvent="true">
+ <bpmn:scriptTask id="ScriptTask_0u3lw39" name="Handle Unexpected Error" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1dsbjjb</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1yay321</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.common.scripts.* ExceptionUtil ex = new ExceptionUtil() ex.processJavaException(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:startEvent id="StartEvent_0v1ffn4">
+ <bpmn:outgoing>SequenceFlow_1dsbjjb</bpmn:outgoing>
+ <bpmn:errorEventDefinition />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_0eznq6x">
+ <bpmn:incoming>SequenceFlow_1yay321</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1dsbjjb" name="" sourceRef="StartEvent_0v1ffn4" targetRef="ScriptTask_0u3lw39" />
+ <bpmn:sequenceFlow id="SequenceFlow_1yay321" name="" sourceRef="ScriptTask_0u3lw39" targetRef="EndEvent_0eznq6x" />
+ </bpmn:subProcess>
+ <bpmn:callActivity id="DoCreateE2EServiceInstance" name="Call DoCreateE2EServiceInstance&#10;" calledElement="DoCreateE2EServiceInstanceV3">
+ <bpmn:extensionElements>
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:out source="rollbackData" target="rollbackData" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="serviceInstanceName" target="serviceInstanceName" />
+ <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+ <camunda:in source="productFamilyId" target="productFamilyId" />
+ <camunda:in source="disableRollback" target="disableRollback" />
+ <camunda:in source="serviceInputParams" target="serviceInputParams" />
+ <camunda:out source="rolledBack" target="rolledBack" />
+ <camunda:out source="serviceInstanceName" target="serviceInstanceName" />
+ <camunda:in source="failIfExists" target="failIfExists" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" />
+ <camunda:in sourceExpression="1610" target="sdncVersion" />
+ <camunda:in source="initialStatus" target="initialStatus" />
+ <camunda:in source="serviceType" target="serviceType" />
+ <camunda:in source="uuiRequest" target="uuiRequest" />
+ <camunda:in source="requestAction" target="operationType" />
+ <camunda:in source="operationId" target="operationId" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_19eilro</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0klbpxx</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:endEvent id="EndEvent_0bpd6c0" name="End">
+ <bpmn:incoming>SequenceFlow_0yayvrf</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_1s09c7d" name="Pre Process Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0s2spoq</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0z4faf9</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CreateCustomE2EServiceInstance()
+csi.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_0ttvn8r" name="Prepare Completion Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_14zu6wr</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0je30si</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi = new CreateCustomE2EServiceInstance()
+csi.prepareCompletionRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_02fyxz0" name="Call CompleteMsoProcess" calledElement="CompleteMsoProcess">
+ <bpmn:extensionElements>
+ <camunda:in source="completionRequest" target="CompleteMsoProcessRequest" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
+ <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+ <camunda:out source="CMSO_ResponseCode" target="CMSO_ResponseCode" />
+ <camunda:out source="CompleteMsoProcessResponse" target="CompleteMsoProcessResponse" />
+ <camunda:out source="CMSO_ErrorResponse" target="CMSO_ErrorResponse" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0je30si</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0yayvrf</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:subProcess id="SubProcess_0vaws86" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_0dug28e">
+ <bpmn:outgoing>SequenceFlow_0e1r62n</bpmn:outgoing>
+ <bpmn:errorEventDefinition />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_03wysuk">
+ <bpmn:incoming>SequenceFlow_1ysapam</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_0u8o9p2" name="Prepare Fallout Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0n9pexp</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_01umodj</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi = new CreateCustomE2EServiceInstance()
+csi.prepareFalloutRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_1ang7q8" name="Call FalloutHandler" calledElement="FalloutHandler">
+ <bpmn:extensionElements>
+ <camunda:in source="falloutRequest" target="FalloutHandlerRequest" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
+ <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+ <camunda:out source="FH_ResponseCode" target="FH_ResponseCode" />
+ <camunda:out source="FalloutHandlerResponse" target="FalloutHandlerResponse" />
+ <camunda:out source="FH_ErrorResponse" target="FH_ErrorResponse" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_01umodj</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ysapam</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="ScriptTask_1rn6nqi" name="Send Error Response">
+ <bpmn:incoming>SequenceFlow_0e1r62n</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0n9pexp</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi = new CreateCustomE2EServiceInstance()
+csi.sendSyncError(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0e1r62n" sourceRef="StartEvent_0dug28e" targetRef="ScriptTask_1rn6nqi" />
+ <bpmn:sequenceFlow id="SequenceFlow_1ysapam" sourceRef="CallActivity_1ang7q8" targetRef="EndEvent_03wysuk" />
+ <bpmn:sequenceFlow id="SequenceFlow_0n9pexp" sourceRef="ScriptTask_1rn6nqi" targetRef="ScriptTask_0u8o9p2" />
+ <bpmn:sequenceFlow id="SequenceFlow_01umodj" sourceRef="ScriptTask_0u8o9p2" targetRef="CallActivity_1ang7q8" />
+ </bpmn:subProcess>
+ <bpmn:scriptTask id="ScriptTask_0xupxj9" name="Send Sync Ack Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_081z8l2</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_19eilro</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi = new CreateCustomE2EServiceInstance()
+csi.sendSyncResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0aqn64l" name="Success?">
+ <bpmn:incoming>SequenceFlow_0klbpxx</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_14zu6wr</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1fueo69</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:endEvent id="EndEvent_07uk5iy">
+ <bpmn:incoming>SequenceFlow_1fueo69</bpmn:incoming>
+ <bpmn:errorEventDefinition errorRef="Error_0nbdy47" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0s2spoq" sourceRef="StartEvent_00qj6ro" targetRef="ScriptTask_1s09c7d" />
+ <bpmn:sequenceFlow id="SequenceFlow_19eilro" sourceRef="ScriptTask_0xupxj9" targetRef="DoCreateE2EServiceInstance" />
+ <bpmn:sequenceFlow id="SequenceFlow_0klbpxx" sourceRef="DoCreateE2EServiceInstance" targetRef="ExclusiveGateway_0aqn64l" />
+ <bpmn:sequenceFlow id="SequenceFlow_0yayvrf" sourceRef="CallActivity_02fyxz0" targetRef="EndEvent_0bpd6c0" />
+ <bpmn:sequenceFlow id="SequenceFlow_0z4faf9" sourceRef="ScriptTask_1s09c7d" targetRef="Task_1tqjch6" />
+ <bpmn:sequenceFlow id="SequenceFlow_14zu6wr" name="yes" sourceRef="ExclusiveGateway_0aqn64l" targetRef="ScriptTask_0ttvn8r">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_0je30si" sourceRef="ScriptTask_0ttvn8r" targetRef="CallActivity_02fyxz0" />
+ <bpmn:sequenceFlow id="SequenceFlow_1fueo69" name="no" sourceRef="ExclusiveGateway_0aqn64l" targetRef="EndEvent_07uk5iy">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") != null}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1euqjsp" sourceRef="Task_1tqjch6" targetRef="Task_19mxcw3" />
+ <bpmn:scriptTask id="Task_1tqjch6" name="Init Service Operation Status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0z4faf9</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1euqjsp</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new CreateCustomE2EServiceInstance()
+csi.prepareInitServiceOperationStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="Task_19mxcw3" name="Update Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1euqjsp</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_081z8l2</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_081z8l2" sourceRef="Task_19mxcw3" targetRef="ScriptTask_0xupxj9" />
+ </bpmn:process>
+ <bpmn:error id="Error_0nbdy47" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateCustom3rdONAPServiceInstance">
+ <bpmndi:BPMNShape id="StartEvent_00qj6ro_di" bpmnElement="StartEvent_00qj6ro">
+ <dc:Bounds x="-6" y="180" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="-24" y="221" width="73" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_0ka59nc_di" bpmnElement="SubProcess_0ka59nc" isExpanded="true">
+ <dc:Bounds x="463" y="632" width="394" height="188" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0rhljy8_di" bpmnElement="DoCreateE2EServiceInstance">
+ <dc:Bounds x="751" y="158" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0bpd6c0_di" bpmnElement="EndEvent_0bpd6c0">
+ <dc:Bounds x="1258" y="286" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1268" y="322" width="22" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1s09c7d_di" bpmnElement="ScriptTask_1s09c7d">
+ <dc:Bounds x="115" y="158" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0ttvn8r_di" bpmnElement="ScriptTask_0ttvn8r">
+ <dc:Bounds x="1038" y="158" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_02fyxz0_di" bpmnElement="CallActivity_02fyxz0">
+ <dc:Bounds x="1226" y="158" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_0vaws86_di" bpmnElement="SubProcess_0vaws86" isExpanded="true">
+ <dc:Bounds x="348" y="370" width="679" height="194" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0xupxj9_di" bpmnElement="ScriptTask_0xupxj9">
+ <dc:Bounds x="610" y="158" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0aqn64l_di" bpmnElement="ExclusiveGateway_0aqn64l" isMarkerVisible="true">
+ <dc:Bounds x="903" y="173" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="903" y="145" width="50" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_07uk5iy_di" bpmnElement="EndEvent_07uk5iy">
+ <dc:Bounds x="910" y="286" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="883" y="322" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0s2spoq_di" bpmnElement="SequenceFlow_0s2spoq">
+ <di:waypoint x="30" y="198" />
+ <di:waypoint x="115" y="198" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="27.5" y="177" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_19eilro_di" bpmnElement="SequenceFlow_19eilro">
+ <di:waypoint x="710" y="198" />
+ <di:waypoint x="751" y="198" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="685.5" y="177" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0klbpxx_di" bpmnElement="SequenceFlow_0klbpxx">
+ <di:waypoint x="851" y="198" />
+ <di:waypoint x="903" y="198" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="832" y="177" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0yayvrf_di" bpmnElement="SequenceFlow_0yayvrf">
+ <di:waypoint x="1276" y="238" />
+ <di:waypoint x="1276" y="286" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1246" y="262" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0z4faf9_di" bpmnElement="SequenceFlow_0z4faf9">
+ <di:waypoint x="215" y="198" />
+ <di:waypoint x="273" y="198" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="199" y="177" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_14zu6wr_di" bpmnElement="SequenceFlow_14zu6wr">
+ <di:waypoint x="953" y="198" />
+ <di:waypoint x="990" y="198" />
+ <di:waypoint x="990" y="198" />
+ <di:waypoint x="1038" y="198" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="987" y="195" width="20" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0je30si_di" bpmnElement="SequenceFlow_0je30si">
+ <di:waypoint x="1138" y="198" />
+ <di:waypoint x="1226" y="198" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1137" y="183" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1fueo69_di" bpmnElement="SequenceFlow_1fueo69">
+ <di:waypoint x="928" y="223" />
+ <di:waypoint x="928" y="250" />
+ <di:waypoint x="928" y="250" />
+ <di:waypoint x="928" y="286" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="901" y="228" width="15" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0u3lw39_di" bpmnElement="ScriptTask_0u3lw39">
+ <dc:Bounds x="611" y="687" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_0v1ffn4_di" bpmnElement="StartEvent_0v1ffn4">
+ <dc:Bounds x="496" y="709" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="469" y="750" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0eznq6x_di" bpmnElement="EndEvent_0eznq6x">
+ <dc:Bounds x="772" y="709" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="745" y="750" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_0dug28e_di" bpmnElement="StartEvent_0dug28e">
+ <dc:Bounds x="363" y="456" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="336" y="497" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_03wysuk_di" bpmnElement="EndEvent_03wysuk">
+ <dc:Bounds x="942" y="456" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="915" y="497" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0u8o9p2_di" bpmnElement="ScriptTask_0u8o9p2">
+ <dc:Bounds x="621" y="434" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_1ang7q8_di" bpmnElement="CallActivity_1ang7q8">
+ <dc:Bounds x="798" y="434" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1rn6nqi_di" bpmnElement="ScriptTask_1rn6nqi">
+ <dc:Bounds x="443" y="434" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1dsbjjb_di" bpmnElement="SequenceFlow_1dsbjjb">
+ <di:waypoint x="532" y="727" />
+ <di:waypoint x="611" y="727" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="529.5" y="727" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1yay321_di" bpmnElement="SequenceFlow_1yay321">
+ <di:waypoint x="711" y="727" />
+ <di:waypoint x="772" y="727" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="701.5" y="727" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0e1r62n_di" bpmnElement="SequenceFlow_0e1r62n">
+ <di:waypoint x="399" y="474" />
+ <di:waypoint x="421" y="474" />
+ <di:waypoint x="421" y="474" />
+ <di:waypoint x="442" y="474" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="391" y="474" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ysapam_di" bpmnElement="SequenceFlow_1ysapam">
+ <di:waypoint x="898" y="474" />
+ <di:waypoint x="942" y="474" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="875" y="459" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0n9pexp_di" bpmnElement="SequenceFlow_0n9pexp">
+ <di:waypoint x="543" y="474" />
+ <di:waypoint x="570" y="474" />
+ <di:waypoint x="570" y="474" />
+ <di:waypoint x="621" y="474" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="540" y="474" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_01umodj_di" bpmnElement="SequenceFlow_01umodj">
+ <di:waypoint x="721" y="474" />
+ <di:waypoint x="798" y="474" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="715.5" y="459" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1euqjsp_di" bpmnElement="SequenceFlow_1euqjsp">
+ <di:waypoint x="373" y="198" />
+ <di:waypoint x="446" y="198" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="364.5" y="177" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1a3vwas_di" bpmnElement="Task_1tqjch6">
+ <dc:Bounds x="273" y="158" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1afiuuq_di" bpmnElement="Task_19mxcw3">
+ <dc:Bounds x="446" y="158" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_081z8l2_di" bpmnElement="SequenceFlow_081z8l2">
+ <di:waypoint x="546" y="198" />
+ <di:waypoint x="610" y="198" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="533" y="177" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/process/DeleteCustom3rdONAPServiceInstance.bpmn b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/DeleteCustom3rdONAPServiceInstance.bpmn
new file mode 100644
index 0000000000..9ca0b06645
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/process/DeleteCustom3rdONAPServiceInstance.bpmn
@@ -0,0 +1,381 @@
+<?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.16.2">
+ <bpmn:process id="DeleteCustom3rdONAPServiceInstance" name="DeleteCustom3rdONAPServiceInstance" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_00m8zen" name="Delete SI Start Flow">
+ <bpmn:outgoing>SequenceFlow_1wxumid</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:subProcess id="SubProcess_0amn8vu" name="Sub-process for UnexpectedErrors" triggeredByEvent="true">
+ <bpmn:scriptTask id="ScriptTask_1c6ogpt" name="Handle Unexpected Error" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0guajy5</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0dbt753</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:startEvent id="StartEvent_121296y">
+ <bpmn:outgoing>SequenceFlow_0guajy5</bpmn:outgoing>
+ <bpmn:errorEventDefinition />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1dw3dwx">
+ <bpmn:incoming>SequenceFlow_0dbt753</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0guajy5" name="" sourceRef="StartEvent_121296y" targetRef="ScriptTask_1c6ogpt" />
+ <bpmn:sequenceFlow id="SequenceFlow_0dbt753" name="" sourceRef="ScriptTask_1c6ogpt" targetRef="EndEvent_1dw3dwx" />
+ </bpmn:subProcess>
+ <bpmn:callActivity id="CallActivity_1vyx9hu" name="Call DoCustomDeleteE2EServiceInstance&#10;" calledElement="DoDeleteE2EServiceInstance">
+ <bpmn:extensionElements>
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="msoRequestId" target="msoRequestId" />
+ <camunda:in source="serviceInstanceId" target="serviceInstanceId" />
+ <camunda:in source="serviceInstanceName" target="serviceInstanceName" />
+ <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
+ <camunda:in source="productFamilyId" target="productFamilyId" />
+ <camunda:in source="disableRollback" target="disableRollback" />
+ <camunda:in source="serviceInputParams" target="serviceInputParams" />
+ <camunda:in source="failIfExists" target="failIfExists" />
+ <camunda:in source="globalSubscriberId" target="globalSubscriberId" />
+ <camunda:in source="serviceType" target="serviceType" />
+ <camunda:in sourceExpression="1610" target="sdncVersion" />
+ <camunda:in source="operationId" target="operationId" />
+ <camunda:in source="operationType" target="operationType" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0zf2qyk</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_07hrbs0</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:endEvent id="EndEvent_0db8bs6" name="End">
+ <bpmn:incoming>SequenceFlow_1ab5l2q</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_0a63hms" name="Pre Process Incoming Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1wxumid</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0yowshs</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new DeleteCustomE2EServiceInstance()
+csi.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_1fzpbop" name="Prepare Completion Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_04urx2e</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ii935p</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi = new DeleteCustomE2EServiceInstance()
+csi.prepareCompletionRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_1wx4ihe" name="Call CompleteMsoProcess" calledElement="CompleteMsoProcess">
+ <bpmn:extensionElements>
+ <camunda:in source="completionRequest" target="CompleteMsoProcessRequest" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
+ <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+ <camunda:out source="CMSO_ResponseCode" target="CMSO_ResponseCode" />
+ <camunda:out source="CompleteMsoProcessResponse" target="CompleteMsoProcessResponse" />
+ <camunda:out source="CMSO_ErrorResponse" target="CMSO_ErrorResponse" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1ii935p</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1ab5l2q</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:subProcess id="SubProcess_1vbcima" name="Sub-process for FalloutHandler " triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_0jybicw">
+ <bpmn:outgoing>SequenceFlow_0for83z</bpmn:outgoing>
+ <bpmn:errorEventDefinition />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1jegbhy">
+ <bpmn:incoming>SequenceFlow_0hrazlh</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="ScriptTask_0so3xj0" name="Prepare Fallout Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1s1cbgf</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1py6yqz</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi = new DeleteCustomE2EServiceInstance()
+csi.prepareFalloutRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_1qhekgt" name="Call FalloutHandler" calledElement="FalloutHandler">
+ <bpmn:extensionElements>
+ <camunda:in source="falloutRequest" target="FalloutHandlerRequest" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
+ <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+ <camunda:out source="FH_ResponseCode" target="FH_ResponseCode" />
+ <camunda:out source="FalloutHandlerResponse" target="FalloutHandlerResponse" />
+ <camunda:out source="FH_ErrorResponse" target="FH_ErrorResponse" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1py6yqz</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0hrazlh</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="ScriptTask_006nty7" name="Send Error Response">
+ <bpmn:incoming>SequenceFlow_0for83z</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1s1cbgf</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi = new DeleteCustomE2EServiceInstance()
+csi.sendSyncError(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0for83z" sourceRef="StartEvent_0jybicw" targetRef="ScriptTask_006nty7" />
+ <bpmn:sequenceFlow id="SequenceFlow_0hrazlh" sourceRef="CallActivity_1qhekgt" targetRef="EndEvent_1jegbhy" />
+ <bpmn:sequenceFlow id="SequenceFlow_1s1cbgf" sourceRef="ScriptTask_006nty7" targetRef="ScriptTask_0so3xj0" />
+ <bpmn:sequenceFlow id="SequenceFlow_1py6yqz" sourceRef="ScriptTask_0so3xj0" targetRef="CallActivity_1qhekgt" />
+ </bpmn:subProcess>
+ <bpmn:scriptTask id="ScriptTask_1mao77y" name="Send Sync Ack Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1dkcu9o</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0zf2qyk</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi = new DeleteCustomE2EServiceInstance()
+csi.sendSyncResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0vu8gx6" name="Success?" default="SequenceFlow_1t6ekab">
+ <bpmn:incoming>SequenceFlow_07hrbs0</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_04urx2e</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1t6ekab</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:endEvent id="EndEvent_1i1g9s6">
+ <bpmn:incoming>SequenceFlow_1t6ekab</bpmn:incoming>
+ <bpmn:errorEventDefinition errorRef="Error_1erlsmy" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1wxumid" sourceRef="StartEvent_00m8zen" targetRef="ScriptTask_0a63hms" />
+ <bpmn:sequenceFlow id="SequenceFlow_0zf2qyk" sourceRef="ScriptTask_1mao77y" targetRef="CallActivity_1vyx9hu" />
+ <bpmn:sequenceFlow id="SequenceFlow_07hrbs0" sourceRef="CallActivity_1vyx9hu" targetRef="ExclusiveGateway_0vu8gx6" />
+ <bpmn:sequenceFlow id="SequenceFlow_1ab5l2q" sourceRef="CallActivity_1wx4ihe" targetRef="EndEvent_0db8bs6" />
+ <bpmn:sequenceFlow id="SequenceFlow_0yowshs" sourceRef="ScriptTask_0a63hms" targetRef="Task_1jksf62" />
+ <bpmn:sequenceFlow id="SequenceFlow_04urx2e" name="yes" sourceRef="ExclusiveGateway_0vu8gx6" targetRef="ScriptTask_1fzpbop">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1ii935p" sourceRef="ScriptTask_1fzpbop" targetRef="CallActivity_1wx4ihe" />
+ <bpmn:sequenceFlow id="SequenceFlow_1t6ekab" name="no" sourceRef="ExclusiveGateway_0vu8gx6" targetRef="EndEvent_1i1g9s6" />
+ <bpmn:sequenceFlow id="SequenceFlow_0c4t26p" sourceRef="Task_1jksf62" targetRef="ServiceTask_0j9q5xe" />
+ <bpmn:scriptTask id="Task_1jksf62" name="prepare init operation status" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0yowshs</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0c4t26p</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi= new DeleteCustomE2EServiceInstance()
+csi.prepareInitServiceOperationStatus(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="ServiceTask_0j9q5xe" name="Update Service Operation Status">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0c4t26p</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1dkcu9o</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1dkcu9o" sourceRef="ServiceTask_0j9q5xe" targetRef="ScriptTask_1mao77y" />
+ </bpmn:process>
+ <bpmn:error id="Error_1erlsmy" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteCustom3rdONAPServiceInstance">
+ <bpmndi:BPMNShape id="StartEvent_00m8zen_di" bpmnElement="StartEvent_00m8zen">
+ <dc:Bounds x="490" y="209" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="471" y="250" width="74" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_0amn8vu_di" bpmnElement="SubProcess_0amn8vu" isExpanded="true">
+ <dc:Bounds x="834" y="660" width="394" height="188" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_1vyx9hu_di" bpmnElement="CallActivity_1vyx9hu">
+ <dc:Bounds x="1121" y="187" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_0db8bs6_di" bpmnElement="EndEvent_0db8bs6">
+ <dc:Bounds x="1646" y="304" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1657" y="340" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0a63hms_di" bpmnElement="ScriptTask_0a63hms">
+ <dc:Bounds x="562" y="187" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1fzpbop_di" bpmnElement="ScriptTask_1fzpbop">
+ <dc:Bounds x="1453" y="187" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_1wx4ihe_di" bpmnElement="CallActivity_1wx4ihe">
+ <dc:Bounds x="1614" y="187" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_1vbcima_di" bpmnElement="SubProcess_1vbcima" isExpanded="true">
+ <dc:Bounds x="736" y="374" width="679" height="194" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1mao77y_di" bpmnElement="ScriptTask_1mao77y">
+ <dc:Bounds x="970" y="187" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0vu8gx6_di" bpmnElement="ExclusiveGateway_0vu8gx6" isMarkerVisible="true">
+ <dc:Bounds x="1318" y="202" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1318" y="174" width="49" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1i1g9s6_di" bpmnElement="EndEvent_1i1g9s6">
+ <dc:Bounds x="1325" y="304" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1298" y="340" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1wxumid_di" bpmnElement="SequenceFlow_1wxumid">
+ <di:waypoint x="526" y="227" />
+ <di:waypoint x="562" y="227" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="499" y="206" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0zf2qyk_di" bpmnElement="SequenceFlow_0zf2qyk">
+ <di:waypoint x="1070" y="227" />
+ <di:waypoint x="1121" y="227" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1050.5" y="206" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_07hrbs0_di" bpmnElement="SequenceFlow_07hrbs0">
+ <di:waypoint x="1221" y="227" />
+ <di:waypoint x="1318" y="227" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1225.5" y="212" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ab5l2q_di" bpmnElement="SequenceFlow_1ab5l2q">
+ <di:waypoint x="1664" y="267" />
+ <di:waypoint x="1664" y="304" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1634" y="279.5" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0yowshs_di" bpmnElement="SequenceFlow_0yowshs">
+ <di:waypoint x="662" y="227" />
+ <di:waypoint x="707" y="227" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="639.5" y="206" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_04urx2e_di" bpmnElement="SequenceFlow_04urx2e">
+ <di:waypoint x="1368" y="227" />
+ <di:waypoint x="1453" y="227" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1370.25" y="203" width="18" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ii935p_di" bpmnElement="SequenceFlow_1ii935p">
+ <di:waypoint x="1553" y="227" />
+ <di:waypoint x="1614" y="227" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1495" y="212" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1t6ekab_di" bpmnElement="SequenceFlow_1t6ekab">
+ <di:waypoint x="1343" y="252" />
+ <di:waypoint x="1343" y="277" />
+ <di:waypoint x="1343" y="277" />
+ <di:waypoint x="1343" y="304" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1352" y="277" width="12" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1c6ogpt_di" bpmnElement="ScriptTask_1c6ogpt">
+ <dc:Bounds x="982" y="715" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_121296y_di" bpmnElement="StartEvent_121296y">
+ <dc:Bounds x="867" y="737" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="795" y="778" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1dw3dwx_di" bpmnElement="EndEvent_1dw3dwx">
+ <dc:Bounds x="1143" y="737" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1071" y="778" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_0jybicw_di" bpmnElement="StartEvent_0jybicw">
+ <dc:Bounds x="752" y="460" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="680" y="501" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1jegbhy_di" bpmnElement="EndEvent_1jegbhy">
+ <dc:Bounds x="1331" y="460" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1259" y="501" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0so3xj0_di" bpmnElement="ScriptTask_0so3xj0">
+ <dc:Bounds x="1010" y="438" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_1qhekgt_di" bpmnElement="CallActivity_1qhekgt">
+ <dc:Bounds x="1187" y="438" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_006nty7_di" bpmnElement="ScriptTask_006nty7">
+ <dc:Bounds x="832" y="438" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0guajy5_di" bpmnElement="SequenceFlow_0guajy5">
+ <di:waypoint x="903" y="755" />
+ <di:waypoint x="982" y="755" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="856" y="755" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0dbt753_di" bpmnElement="SequenceFlow_0dbt753">
+ <di:waypoint x="1082" y="755" />
+ <di:waypoint x="1143" y="755" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1028" y="755" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0for83z_di" bpmnElement="SequenceFlow_0for83z">
+ <di:waypoint x="788" y="478" />
+ <di:waypoint x="810" y="478" />
+ <di:waypoint x="810" y="478" />
+ <di:waypoint x="831" y="478" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="735" y="478" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0hrazlh_di" bpmnElement="SequenceFlow_0hrazlh">
+ <di:waypoint x="1287" y="478" />
+ <di:waypoint x="1331" y="478" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1219" y="463" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1s1cbgf_di" bpmnElement="SequenceFlow_1s1cbgf">
+ <di:waypoint x="932" y="478" />
+ <di:waypoint x="959" y="478" />
+ <di:waypoint x="959" y="478" />
+ <di:waypoint x="1010" y="478" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="884" y="478" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1py6yqz_di" bpmnElement="SequenceFlow_1py6yqz">
+ <di:waypoint x="1110" y="478" />
+ <di:waypoint x="1187" y="478" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1060" y="463" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0c4t26p_di" bpmnElement="SequenceFlow_0c4t26p">
+ <di:waypoint x="807" y="227" />
+ <di:waypoint x="833" y="227" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="820" y="206" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1joo7s7_di" bpmnElement="Task_1jksf62">
+ <dc:Bounds x="707" y="187" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0j9q5xe_di" bpmnElement="ServiceTask_0j9q5xe">
+ <dc:Bounds x="833" y="187" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1dkcu9o_di" bpmnElement="SequenceFlow_1dkcu9o">
+ <di:waypoint x="933" y="227" />
+ <di:waypoint x="970" y="227" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="951.5" y="206" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn b/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn
new file mode 100644
index 0000000000..e44804a822
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn
@@ -0,0 +1,162 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2">
+ <bpmn:process id="ActivateSDNCNetworkResource" name="ActivateSDNCNetworkResource" isExecutable="true">
+ <bpmn:startEvent id="createNS_StartEvent" name="createNS_StartEvent">
+ <bpmn:outgoing>SequenceFlow_1c92ks3</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_1x6k78c" name="create SDNC call end">
+ <bpmn:incoming>SequenceFlow_17md60u</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:callActivity id="CallActivity_1600xlj" name="Call SDNC resource activate&#10;Adapter V1&#10;" calledElement="sdncAdapter">
+ <bpmn:extensionElements>
+ <camunda:in source="CRESDNCRES_activateSDNCRequest" target="sdncAdapterWorkflowRequest" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
+ <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+ <camunda:out source="sdncAdapterResponse" target="CRENWKI_activateSDNCResponse" />
+ <camunda:out source="SDNCA_ResponseCode" target="CRESDNCRES_sdncCreateReturnCode" />
+ <camunda:out source="SDNCA_SuccessIndicator" target="CRESDNCRES_SuccessIndicator" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_18l3crb</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1xk5xed</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_1xk5xed" sourceRef="CallActivity_1600xlj" targetRef="Task_0uwlr22" />
+ <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred" targetRef="ScriptTask_1g5zyi6" />
+ <bpmn:scriptTask id="Task_023hred" name="post SDNC activate call">
+ <bpmn:incoming>SequenceFlow_1vnx1pp</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0ow44q0</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new ActivateSDNCNetworkResource()
+dcsi.postCreateSDNCCall(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp" targetRef="CallActivity_1600xlj" />
+ <bpmn:scriptTask id="Task_13sx2bp" name="Pre Process Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1c92ks3</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_18l3crb</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new ActivateSDNCNetworkResource()
+dcsi.preProcessRequest(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Task_0uwlr22" name="Create progress update parameters After create" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1xk5xed</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1jr6zi0</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new ActivateSDNCNetworkResource()
+dcsi.prepareUpdateAfterActivateSDNCResource(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="ServiceTask_1cm8iwr" name="update progress update">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1jr6zi0</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1vnx1pp</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1jr6zi0" sourceRef="Task_0uwlr22" targetRef="ServiceTask_1cm8iwr" />
+ <bpmn:sequenceFlow id="SequenceFlow_1vnx1pp" sourceRef="ServiceTask_1cm8iwr" targetRef="Task_023hred" />
+ <bpmn:scriptTask id="ScriptTask_1g5zyi6" name="Send Sync Ack Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_17md60u</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def csi = new ActivateSDNCNetworkResource()
+csi.sendSyncResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_17md60u" sourceRef="ScriptTask_1g5zyi6" targetRef="EndEvent_1x6k78c" />
+ <bpmn:sequenceFlow id="SequenceFlow_1c92ks3" sourceRef="createNS_StartEvent" targetRef="Task_13sx2bp" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateSDNCNetworkResource">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent">
+ <dc:Bounds x="-203" y="306" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="-230" y="352" width="89" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c">
+ <dc:Bounds x="930" y="306" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="893" y="348" width="84" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj">
+ <dc:Bounds x="77" y="284" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1xk5xed_di" bpmnElement="SequenceFlow_1xk5xed">
+ <di:waypoint x="177" y="324" />
+ <di:waypoint x="247" y="324" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="210.5" y="314" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0">
+ <di:waypoint x="694" y="324" />
+ <di:waypoint x="765" y="324" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="780.5" y="314" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred">
+ <dc:Bounds x="594" y="284" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb">
+ <di:waypoint x="12" y="324" />
+ <di:waypoint x="77" y="324" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="235.5" y="108" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp">
+ <dc:Bounds x="-88" y="284" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0hu4lhm_di" bpmnElement="Task_0uwlr22">
+ <dc:Bounds x="247" y="284" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr">
+ <dc:Bounds x="417" y="284" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1jr6zi0_di" bpmnElement="SequenceFlow_1jr6zi0">
+ <di:waypoint x="347" y="324" />
+ <di:waypoint x="417" y="324" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="444.5" y="314" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1vnx1pp_di" bpmnElement="SequenceFlow_1vnx1pp">
+ <di:waypoint x="517" y="324" />
+ <di:waypoint x="594" y="324" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="641" y="314" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1g5zyi6_di" bpmnElement="ScriptTask_1g5zyi6">
+ <dc:Bounds x="765" y="284" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_17md60u_di" bpmnElement="SequenceFlow_17md60u">
+ <di:waypoint x="865" y="324" />
+ <di:waypoint x="930" y="324" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="998" y="313" width="0" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1c92ks3_di" bpmnElement="SequenceFlow_1c92ks3">
+ <di:waypoint x="-167" y="324" />
+ <di:waypoint x="-88" y="324" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/DeActivateNetworkResource.bpmn b/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/DeActivateNetworkResource.bpmn
new file mode 100644
index 0000000000..31604fd689
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/resources/subprocess/DeActivateNetworkResource.bpmn
@@ -0,0 +1,258 @@
+<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
+ <bpmn:process id="DeActivateNetworkResource" name="DeActivateNetworkResource" isExecutable="true">
+ <bpmn:startEvent id="deleteNetworkResource_StartEvent" name="deleteNetworkResource_StartEvent">
+ <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="deleteNetworkResource_StartEvent" targetRef="Task_1dlrfiw" />
+ <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="Task_0tezqd4" />
+ <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="prepare SDNC Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_18l3crb</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DeleteSDNCNetworkResource()
+dcsi.prepareSDNCRequest(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:endEvent id="EndEvent_1x6k78c" name="delete SDNC call end">
+ <bpmn:incoming>SequenceFlow_15wux6a</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:callActivity id="CallActivity_1600xlj" name="Call SDNC RSRC &#10; Adapter V1&#10;" calledElement="sdncAdapter">
+ <bpmn:extensionElements>
+ <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
+ <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
+ <camunda:out source="sdncAdapterResponse" target="DELSDNCRES_activateSDNCResponse" />
+ <camunda:out source="SDNCA_ResponseCode" target="DELSDNCRES_sdncDeleteReturnCode" />
+ <camunda:out source="SDNCA_SuccessIndicator" target="DELSDNCRES_SuccessIndicator" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="sdncAdapterWorkflowRequest" target="sdncAdapterWorkflowRequest" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_15mvedq</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1xk5xed</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_1xk5xed" sourceRef="CallActivity_1600xlj" targetRef="Task_0uwlr22" />
+ <bpmn:sequenceFlow id="SequenceFlow_0ow44q0" sourceRef="Task_023hred" targetRef="ScriptTask_1emjxm2" />
+ <bpmn:scriptTask id="Task_023hred" name="post SDNC delete call">
+ <bpmn:incoming>SequenceFlow_1vnx1pp</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0ow44q0</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DeleteSDNCNetworkResource()
+dcsi.postDeleteSDNCCall(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0w2es8j" sourceRef="Task_1dlrfiw" targetRef="Task_13sx2bp" />
+ <bpmn:sequenceFlow id="SequenceFlow_18l3crb" sourceRef="Task_13sx2bp" targetRef="PreprocessIncomingRequest_task" />
+ <bpmn:scriptTask id="Task_1dlrfiw" name="Set the Recipe DesignTimeParam" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0w2es8j</bpmn:outgoing>
+ <bpmn:script><![CDATA[String recipeParamXsdDemo="""{"operationType":"GRE"}"""
+String recipeParamXsd=""
+execution.setVariable("recipeParamXsd", recipeParamXsd)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Task_13sx2bp" name="Pre Process Request" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0w2es8j</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_18l3crb</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DeleteSDNCNetworkResource()
+dcsi.preProcessRequest(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1mz0vdx" sourceRef="Task_0tezqd4" targetRef="Task_18tomkl" />
+ <bpmn:sequenceFlow id="SequenceFlow_15mvedq" sourceRef="Task_18tomkl" targetRef="CallActivity_1600xlj" />
+ <bpmn:scriptTask id="Task_0tezqd4" name="Delete progress update parameters before delete" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1mz0vdx</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DeleteSDNCNetworkResource()
+dcsi.prepareUpdateBeforeDeleteSDNCResource(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="Task_0uwlr22" name="Create progress update parameters After delete" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_1xk5xed</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1jr6zi0</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def dcsi = new DeleteSDNCNetworkResource()
+dcsi.prepareUpdateAfterDeleteSDNCResource(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:serviceTask id="Task_18tomkl" name="update progress update">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1mz0vdx</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_15mvedq</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:serviceTask id="ServiceTask_1cm8iwr" name="update progress update">
+ <bpmn:extensionElements>
+ <camunda:connector>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter>
+ <camunda:inputParameter name="headers">
+ <camunda:map>
+ <camunda:entry key="content-type">application/soap+xml</camunda:entry>
+ <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry>
+ </camunda:map>
+ </camunda:inputParameter>
+ <camunda:inputParameter name="payload">${CVFMI_updateResOperStatusRequest}</camunda:inputParameter>
+ <camunda:inputParameter name="method">POST</camunda:inputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter>
+ <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter>
+ </camunda:inputOutput>
+ <camunda:connectorId>http-connector</camunda:connectorId>
+ </camunda:connector>
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_1jr6zi0</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1vnx1pp</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_1jr6zi0" sourceRef="Task_0uwlr22" targetRef="ServiceTask_1cm8iwr" />
+ <bpmn:sequenceFlow id="SequenceFlow_1vnx1pp" sourceRef="ServiceTask_1cm8iwr" targetRef="Task_023hred" />
+ <bpmn:scriptTask id="ScriptTask_1emjxm2" name="Send Sync Ack Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_0ow44q0</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_15wux6a</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.onap.so.bpmn.infrastructure.scripts.*
+def csi = new DeleteSDNCNetworkResource()
+csi.sendSyncResponse(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_15wux6a" sourceRef="ScriptTask_1emjxm2" targetRef="EndEvent_1x6k78c" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DeleteSDNCNetworkResource">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="deleteNetworkResource_StartEvent">
+ <dc:Bounds x="-111" y="111" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="-136" y="147" width="89" height="28" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln">
+ <di:waypoint xsi:type="dc:Point" x="-75" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="-10" y="129" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="-87.5" y="108" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova">
+ <di:waypoint xsi:type="dc:Point" x="413" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="460" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="500" y="129" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="391.5" y="108" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task">
+ <dc:Bounds x="313" y="89" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c">
+ <dc:Bounds x="967" y="317" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="933" y="359" width="79" height="28" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_1600xlj_di" bpmnElement="CallActivity_1600xlj">
+ <dc:Bounds x="109" y="295" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1xk5xed_di" bpmnElement="SequenceFlow_1xk5xed">
+ <di:waypoint xsi:type="dc:Point" x="209" y="335" />
+ <di:waypoint xsi:type="dc:Point" x="302" y="335" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="210.5" y="314" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ow44q0_di" bpmnElement="SequenceFlow_0ow44q0">
+ <di:waypoint xsi:type="dc:Point" x="735" y="335" />
+ <di:waypoint xsi:type="dc:Point" x="793" y="335" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="719" y="314" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0gyej62_di" bpmnElement="Task_023hred">
+ <dc:Bounds x="635" y="295" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0w2es8j_di" bpmnElement="SequenceFlow_0w2es8j">
+ <di:waypoint xsi:type="dc:Point" x="90" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="148" y="129" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="74" y="108" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_18l3crb_di" bpmnElement="SequenceFlow_18l3crb">
+ <di:waypoint xsi:type="dc:Point" x="248" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="313" y="129" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="235.5" y="108" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_0lc6l7a_di" bpmnElement="Task_1dlrfiw">
+ <dc:Bounds x="-10" y="89" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_14l9mlv_di" bpmnElement="Task_13sx2bp">
+ <dc:Bounds x="148" y="89" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1mz0vdx_di" bpmnElement="SequenceFlow_1mz0vdx">
+ <di:waypoint xsi:type="dc:Point" x="606" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="638" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="638" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="738" y="129" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="608" y="123" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_15mvedq_di" bpmnElement="SequenceFlow_15mvedq">
+ <di:waypoint xsi:type="dc:Point" x="788" y="169" />
+ <di:waypoint xsi:type="dc:Point" x="788" y="218" />
+ <di:waypoint xsi:type="dc:Point" x="0" y="218" />
+ <di:waypoint xsi:type="dc:Point" x="0" y="335" />
+ <di:waypoint xsi:type="dc:Point" x="109" y="335" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="349" y="197" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1kqf4ge_di" bpmnElement="Task_0tezqd4">
+ <dc:Bounds x="506" y="89" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0hu4lhm_di" bpmnElement="Task_0uwlr22">
+ <dc:Bounds x="302" y="295" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1q6ssz7_di" bpmnElement="Task_18tomkl">
+ <dc:Bounds x="738" y="89" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1cm8iwr_di" bpmnElement="ServiceTask_1cm8iwr">
+ <dc:Bounds x="487" y="295" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1jr6zi0_di" bpmnElement="SequenceFlow_1jr6zi0">
+ <di:waypoint xsi:type="dc:Point" x="402" y="335" />
+ <di:waypoint xsi:type="dc:Point" x="487" y="335" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="444.5" y="314" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1vnx1pp_di" bpmnElement="SequenceFlow_1vnx1pp">
+ <di:waypoint xsi:type="dc:Point" x="587" y="335" />
+ <di:waypoint xsi:type="dc:Point" x="635" y="335" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="566" y="314" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1emjxm2_di" bpmnElement="ScriptTask_1emjxm2">
+ <dc:Bounds x="793" y="295" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_15wux6a_di" bpmnElement="SequenceFlow_15wux6a">
+ <di:waypoint xsi:type="dc:Point" x="893" y="335" />
+ <di:waypoint xsi:type="dc:Point" x="967" y="335" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="930" y="313" width="0" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java
new file mode 100644
index 0000000000..e56b45f19d
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/RequestHeaderTest.java
@@ -0,0 +1,46 @@
+/*
+* ============LICENSE_START=======================================================
+ * ONAP : SO
+ * ================================================================================
+ * Copyright (C) 2018 TechMahindra
+ * ================================================================================
+ * 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=========================================================
+*/
+
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.so.bpmn.common.adapter.sdnc.RequestHeader;
+
+public class RequestHeaderTest{
+ RequestHeader rh = new RequestHeader();
+
+ @Test
+ public void testRequestHeader() {
+ rh.setRequestId("requestId");
+ rh.setSvcInstanceId("svcInstanceId");
+ rh.setSvcAction("svcAction");
+ rh.setSvcOperation("svcOperation");
+ rh.setCallbackUrl("callbackUrl");
+ rh.setMsoAction("msoAction");
+ assertEquals(rh.getRequestId(), "requestId");
+ assertEquals(rh.getSvcInstanceId(), "svcInstanceId");
+ assertEquals(rh.getSvcAction(), "svcAction");
+ assertEquals(rh.getSvcOperation(), "svcOperation");
+ assertEquals(rh.getCallbackUrl(), "callbackUrl");
+ assertEquals(rh.getMsoAction(), "msoAction");
+ assert(rh.toString()!=null);
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java
new file mode 100644
index 0000000000..9843a95342
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterCallbackRequestTest.java
@@ -0,0 +1,45 @@
+/*
+* ============LICENSE_START=======================================================
+ * ONAP : SO
+ * ================================================================================
+ * Copyright (C) 2018 TechMahindra
+ * ================================================================================
+ * 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=========================================================
+*/
+
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.onap.so.BaseTest;
+import org.onap.so.bpmn.common.adapter.sdnc.CallbackHeader;
+import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest;
+
+public class SDNCAdapterCallbackRequestTest{
+
+ SDNCAdapterCallbackRequest sdnccall = new SDNCAdapterCallbackRequest();
+ CallbackHeader cbh = new CallbackHeader();
+ String o = "test";
+
+ @Test
+ public void testSDNCAdapterCallbackRequest() {
+ sdnccall.setCallbackHeader(cbh);
+ sdnccall.setRequestData(o);
+ assertEquals(sdnccall.getCallbackHeader(), cbh);
+ assertEquals(sdnccall.getRequestData(), o);
+ assertNotNull(sdnccall.toString());
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java
new file mode 100644
index 0000000000..79bffe40d0
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/SDNCAdapterRequestTest.java
@@ -0,0 +1,41 @@
+/*
+* ============LICENSE_START=======================================================
+ * ONAP : SO
+ * ================================================================================
+ * Copyright (C) 2018 TechMahindra
+ * ================================================================================
+ * 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=========================================================
+*/
+
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.so.bpmn.common.adapter.sdnc.RequestHeader;
+import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterRequest;
+
+public class SDNCAdapterRequestTest {
+
+ SDNCAdapterRequest adapter = new SDNCAdapterRequest();
+ RequestHeader rh = new RequestHeader();
+ Object o = new Object();
+
+ @Test
+ public void testSDNCAdapterRequest() {
+ adapter.setRequestHeader(rh);
+ adapter.setRequestData(o);
+ assertEquals(adapter.getRequestHeader(), rh);
+ assertEquals(adapter.getRequestData(), o);
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java
new file mode 100644
index 0000000000..b5511f67e3
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/BaseIntegrationTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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;
+
+import org.junit.After;
+import org.junit.runner.RunWith;
+import org.onap.so.bpmn.common.BPMNUtil;
+import org.onap.so.bpmn.common.WorkflowTest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import com.github.tomakehurst.wiremock.client.WireMock;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+@ContextConfiguration
+@AutoConfigureWireMock(port = 0)
+public abstract class BaseIntegrationTest extends WorkflowTest {
+ @Autowired
+ BPMNUtil bpmnUtil;
+
+ @Value("${wiremock.server.port}")
+ protected String wiremockPort;
+
+ @After
+ public void baseAfterTest() {
+ WireMock.reset();
+ }
+}
+
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java
new file mode 100644
index 0000000000..eee2810125
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/InfraEmbeddedMariaDbConfig.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.bpmn;
+import ch.vorburger.exec.ManagedProcessException;
+import ch.vorburger.mariadb4j.DBConfigurationBuilder;
+import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
+import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
+import org.springframework.context.annotation.Profile;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
+
+@Configuration
+@EnableTransactionManagement
+@EnableJpaRepositories(
+ entityManagerFactoryRef = "requestEntityManagerFactory",transactionManagerRef = "requestTransactionManager",
+ basePackages = { "org.onap.so.db.request.data.repository"}
+)
+@Profile({"test"})
+public class InfraEmbeddedMariaDbConfig {
+
+ @Primary
+ @Bean(name = "requestEntityManagerFactory")
+ public LocalContainerEntityManagerFactoryBean
+ entityManagerFactory(
+ EntityManagerFactoryBuilder builder,
+ DataSource dataSource
+ ) {
+ return builder
+ .dataSource(dataSource)
+ .packages("org.onap.so.db.request.beans")
+ .persistenceUnit("requestDB")
+ .build();
+ }
+
+ @Bean(name = "requestTransactionManager")
+ public PlatformTransactionManager transactionManager(
+ @Qualifier("requestEntityManagerFactory") EntityManagerFactory
+ entityManagerFactory
+ ) {
+ return new JpaTransactionManager(entityManagerFactory);
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java
new file mode 100644
index 0000000000..f65cadae3c
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/IntegrationTestSuite.java
@@ -0,0 +1,32 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.bpmn;
+
+import com.googlecode.junittoolbox.SuiteClasses;
+import com.googlecode.junittoolbox.WildcardPatternSuite;
+import org.junit.runner.RunWith;
+
+@RunWith(WildcardPatternSuite.class)
+@SuiteClasses({"**/*IT.class"})
+public class IntegrationTestSuite {
+ // the class remains empty,
+ // used only as a holder for the above annotations
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java
new file mode 100644
index 0000000000..5f0722aa3d
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java
@@ -0,0 +1,357 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.core.Response;
+
+import org.camunda.bpm.engine.HistoryService;
+import org.camunda.bpm.engine.ProcessEngineServices;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.history.HistoricProcessInstance;
+import org.camunda.bpm.engine.history.HistoricVariableInstance;
+import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
+import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource;
+import org.onap.so.bpmn.common.workflow.service.WorkflowResource;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * Set of utility methods used for Unit testing
+ *
+ */
+@Component
+public class BPMNUtil {
+
+ private static WorkflowAsyncResource workflowResource;
+
+ @Autowired
+ public void setWorkflowResource(WorkflowAsyncResource workflowResource) {
+ BPMNUtil.workflowResource = workflowResource;
+ }
+
+ public static String getVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) {
+ String pID = getProcessInstanceId(processEngineServices,
+ processDefinitionID);
+ return getVariable( processEngineServices, processDefinitionID, name, pID);
+ }
+
+ public static String getVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name, String processInstanceId) {
+ assertProcessInstanceFinished(processEngineServices, processInstanceId);
+ HistoricVariableInstance responseData = processEngineServices.getHistoryService()
+ .createHistoricVariableInstanceQuery().processInstanceId(processInstanceId)
+ .variableName(name)
+ .singleResult();
+
+ if (responseData != null) {
+ return (responseData.getValue() != null ? responseData.getValue().toString(): null);
+ }
+ return null;
+ }
+
+ /*
+ @SuppressWarnings("unchecked")
+ public static <T extends Object> T getRawVariable(HistoryService historyService, String processDefinitionID, String name) {
+ //String pID = getProcessInstanceId(processEngineServices,
+ // processDefinitionID);
+ assertProcessInstanceFinished(historyService, pID);
+ Object responseData = historyService
+ .createHistoricVariableInstanceQuery().processInstanceId(pID)
+ .variableName(name)
+ .singleResult()
+ .getValue();
+ return (T) responseData;
+ }
+ */
+
+ @SuppressWarnings("unchecked")
+ public static <T> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name) {
+ String pID = getProcessInstanceId(processEngineServices,
+ processDefinitionID);
+ return getRawVariable( processEngineServices, processDefinitionID, name, pID);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <T> T getRawVariable(ProcessEngineServices processEngineServices, String processDefinitionID, String name, String processInstanceId) {
+ assertProcessInstanceFinished(processEngineServices, processInstanceId);
+ Object responseData = processEngineServices.getHistoryService()
+ .createHistoricVariableInstanceQuery().processInstanceId(processInstanceId)
+ .variableName(name)
+ .singleResult()
+ .getValue();
+ return (T) responseData;
+ }
+
+
+ public static void assertAnyProcessInstanceFinished(ProcessEngineServices processEngineServices, String processDefinitionID) {
+ String pID = getProcessInstanceId(processEngineServices,
+ processDefinitionID);
+ assertNotNull(pID);
+ assertTrue(processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count() > 0);
+ }
+
+ public static void assertNoProcessInstance(ProcessEngineServices processEngineServices, String processDefinitionID) {
+ assertNull(getProcessInstanceId(processEngineServices, processDefinitionID));
+ }
+
+ public static void assertProcessInstanceFinished(HistoryService historyService, String pid) {
+ assertEquals(1, historyService.createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count());
+ }
+
+ public static void assertProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {
+ assertEquals(1, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count());
+ }
+
+ public static void assertProcessInstanceNotFinished(ProcessEngineServices processEngineServices, String processDefinitionID) {
+ String pID = getProcessInstanceId(processEngineServices,
+ processDefinitionID);
+ assertEquals(0, processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pID).finished().count());
+ }
+
+ private static String getProcessInstanceId(
+ ProcessEngineServices processEngineServices, String processDefinitionID) {
+ List<HistoricProcessInstance> historyList = processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list();
+ String pID = null;
+ for (HistoricProcessInstance hInstance: historyList) {
+ if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) {
+ pID = hInstance.getId();
+ break;
+ }
+ }
+ return pID;
+ }
+
+ public static void cleanHistory(ProcessEngineServices processEngineServices) {
+ List<HistoricProcessInstance> historyList = processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().list();
+ List<String> pidList = new ArrayList<>();
+ for (HistoricProcessInstance hInstance : historyList) {
+ pidList.add(hInstance.getId());
+ }
+ if (pidList.size() > 0) {
+ processEngineServices.getHistoryService().deleteHistoricProcessInstances(pidList);
+ }
+ }
+
+ private static String getProcessInstanceId(
+ HistoryService historyService, String processDefinitionID) {
+ List<HistoricProcessInstance> historyList = historyService.createHistoricProcessInstanceQuery().list();
+ String pID = null;
+ for (HistoricProcessInstance hInstance: historyList) {
+ if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) {
+ pID = hInstance.getId();
+ break;
+ }
+ }
+ return pID;
+ }
+
+ public static boolean isProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {
+ return processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid).finished().count() == 1 ? true: false;
+ }
+
+
+ private static void buildVariable(String key, String value, Map<String,Object> variableValueType) {
+ Map<String, Object> host = new HashMap<>();
+ host.put("value", value);
+ host.put("type", "String");
+ variableValueType.put(key, host);
+ }
+
+ public static WorkflowResponse executeWorkFlow(ProcessEngineServices processEngineServices, String processKey, Map<String,String> variables) {
+ VariableMapImpl variableMap = new VariableMapImpl();
+
+ Map<String, Object> variableValueType = new HashMap<>();
+ for (String key : variables.keySet()) {
+ buildVariable(key, variables.get(key), variableValueType);
+ }
+ buildVariable("mso-service-request-timeout","600", variableValueType);
+ variableMap.put("variables", variableValueType);
+
+ workflowResource.setProcessEngineServices4junit(processEngineServices);
+ Response response = workflowResource.startProcessInstanceByKey(
+ processKey, variableMap);
+ WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity();
+ return workflowResponse;
+ }
+
+ public static WorkflowResponse executeWorkFlow(RuntimeService runtimeService, String processKey, Map<String,String> variables, WorkflowResource workflowResource) {
+
+ VariableMapImpl variableMap = new VariableMapImpl();
+
+ Map<String, Object> variableValueType = new HashMap<String, Object>();
+ for (String key : variables.keySet()) {
+ buildVariable(key, variables.get(key), variableValueType);
+ }
+ buildVariable("mso-service-request-timeout","600", variableValueType);
+ variableMap.put("variables", variableValueType);
+
+
+ Response response = workflowResource.startProcessInstanceByKey(
+ processKey, variableMap);
+ WorkflowResponse workflowResponse = (WorkflowResponse) response.getEntity();
+ return workflowResponse;
+ }
+
+ //Check the runtime service to see whether the process is completed
+ public static void waitForWorkflowToFinish(ProcessEngineServices processEngineServices, String pid) throws InterruptedException {
+ // Don't wait forever
+ long waitTime = 120000;
+ long endTime = System.currentTimeMillis() + waitTime;
+
+ while (true) {
+ if (processEngineServices.getRuntimeService().createProcessInstanceQuery().processInstanceId(pid).singleResult() == null) {
+ break;
+ }
+
+ if (System.currentTimeMillis() >= endTime) {
+ fail("Process " + pid + " did not finish in " + waitTime + "ms");
+ }
+
+ Thread.sleep(200);
+ }
+ }
+
+
+ //Check the runtime service to see whether the process is completed
+ public static void waitForWorkflowToFinish(RuntimeService runtimeService, String pid) throws InterruptedException {
+ // Don't wait forever
+ long waitTime = 120000;
+ long endTime = System.currentTimeMillis() + waitTime;
+
+ while (true) {
+ if (runtimeService.createProcessInstanceQuery().processInstanceId(pid).singleResult() == null) {
+ break;
+ }
+
+ if (System.currentTimeMillis() >= endTime) {
+ fail("Process " + pid + " did not finish in " + waitTime + "ms");
+ }
+
+ Thread.sleep(200);
+ }
+ }
+
+
+ /**
+ * Executes the Asynchronous workflow in synchronous fashion and returns the WorkflowResponse object
+ * @param processEngineServices
+ * @param processKey
+ * @param variables
+ * @return
+ * @throws InterruptedException
+ */
+ public static WorkflowResponse executeAsyncWorkflow(ProcessEngineServices processEngineServices, String processKey, Map<String,String> variables) throws InterruptedException {
+ ProcessThread pthread = new ProcessThread(processKey, processEngineServices, variables);
+ pthread.start();
+ BPMNUtil.assertProcessInstanceNotFinished(processEngineServices, processKey);
+ String pid = getProcessInstanceId(processEngineServices, processKey);
+ //Caution: If there is a problem with workflow, this may wait for ever
+ while (true) {
+ pid = getProcessInstanceId(processEngineServices, processKey);
+ if (!isProcessInstanceFinished(processEngineServices,pid)) {
+ Thread.sleep(200);
+ } else{
+ break;
+ }
+ }
+ //need to retrieve for second time ?
+ pid = getProcessInstanceId(processEngineServices, processKey);
+ waitForWorkflowToFinish(processEngineServices, pid);
+ return pthread.workflowResponse;
+ }
+
+ /**
+ * Execute workflow using async resource
+ * @param processEngineServices
+ * @param processKey
+ * @param asyncResponse
+ * @param variables
+ * @throws InterruptedException
+ */
+ private static void executeAsyncFlow(ProcessEngineServices processEngineServices, String processKey, Map<String,String> variables) throws InterruptedException {
+ VariableMapImpl variableMap = new VariableMapImpl();
+
+ Map<String, Object> variableValueType = new HashMap<>();
+ for (String key : variables.keySet()) {
+ buildVariable(key, variables.get(key), variableValueType);
+ }
+ buildVariable("mso-service-request-timeout","600", variableValueType);
+ variableMap.put("variables", variableValueType);
+
+ workflowResource.setProcessEngineServices4junit(processEngineServices);
+ workflowResource.startProcessInstanceByKey(processKey, variableMap);
+ }
+
+ /**
+ * Helper class which executes workflow in a thread
+ *
+ */
+ static class ProcessThread extends Thread {
+
+ public WorkflowResponse workflowResponse = null;
+ public String processKey;
+ public boolean started;
+ public ProcessEngineServices processEngineServices;
+ public Map<String,String> variables;
+
+ public ProcessThread(String processKey, ProcessEngineServices processEngineServices, Map<String,String> variables) {
+ this.processKey = processKey;
+ this.processEngineServices = processEngineServices;
+ this.variables = variables;
+ }
+
+ public void run() {
+ started = true;
+ /*doAnswer(new Answer<Void>() {
+ public Void answer(InvocationOnMock invocation) {
+ Response response = (Response) invocation.getArguments()[0];
+ try {
+ workflowResponse = (WorkflowResponse) response.getEntity();
+ } catch (ClassCastException e) {
+ String workflowResponseString = (String)response.getEntity();
+ workflowResponse = new WorkflowResponse();
+ workflowResponse.setResponse(workflowResponseString);
+ workflowResponse.setMessageCode(200);
+ }
+ return null;
+ }
+ }).when(asyncResponse).setResponse(any(Response.class));
+ */
+ try {
+ executeAsyncFlow(processEngineServices, processKey, variables);
+ } catch (InterruptedException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java
new file mode 100644
index 0000000000..470cc2220d
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CompleteMsoProcessIT.java
@@ -0,0 +1,183 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+
+/**
+ * Unit test for CompleteMsoProcess.bpmn.
+ */
+
+public class CompleteMsoProcessIT extends BaseIntegrationTest {
+
+ private void executeFlow(String inputRequestFile) throws InterruptedException {
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("CompleteMsoProcessRequest",inputRequestFile);
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ String processId = invokeSubProcess( "CompleteMsoProcess", variables);
+ waitForWorkflowToFinish(processEngine,processId);
+ logEnd();
+ }
+
+ @Test
+ public void msoCompletionRequestWithNotificationUrl_200() throws Exception {
+ logStart();
+
+ //Execute Flow
+ executeFlow(gMsoCompletionRequestWithNotificationurl());
+
+ //Verify Error
+ String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
+ Assert.assertEquals("200", CMSO_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
+ logEnd();
+ }
+
+ @Test
+ public void msoCompletionRequestWithNoNotificationurl() throws Exception {
+ logStart();
+
+ //Execute Flow
+ executeFlow(gMsoCompletionRequestWithNoNotificationurl());
+
+ //Verify Error
+ String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
+ Assert.assertEquals("200", CMSO_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
+ logEnd();
+ }
+
+ @Test
+ public void msoCompletionRequestWithNotificationurlNoRequestId() throws Exception {
+ logStart();
+
+ //Execute Flow
+ executeFlow(gMsoCompletionRequestWithNotificationurlNoRequestId());
+
+ //Verify Error
+ String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
+ Assert.assertEquals("200", CMSO_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
+ logEnd();
+ }
+
+ @Test
+ public void msoCompletionRequestWithNoNotificationurlNoRequestId() throws Exception {
+ logStart();
+
+ //Execute Flow
+ executeFlow(gMsoCompletionRequestWithNoNotificationurlNoRequestId());
+
+ //Verify Error
+ String CMSO_ResponseCode = BPMNUtil.getVariable(processEngine, "CompleteMsoProcess", "CMSO_ResponseCode");
+ Assert.assertEquals("200", CMSO_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "CompleteMsoProcess", "CMSO_SuccessIndicator"));
+ logEnd();
+ }
+
+ public String gMsoCompletionRequestWithNotificationurl() {
+ String xml = ""
+ + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://ecomp.openecomp.org.com/mso/workflow/schema/v1\">"
+ + " <ns:request-information>"
+ + " <ns:request-id>STUW105_5002</ns:request-id>"
+ + " <ns:request-action>RequestAction</ns:request-action>"
+ + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
+ + " <ns:source>SOURCE</ns:source>"
+ + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
+ + " <ns:order-number>10205000</ns:order-number>"
+ + " <ns:order-version>1</ns:order-version>"
+ + " </ns:request-information>"
+ + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
+ + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+ return xml;
+ }
+
+
+
+ public String gMsoCompletionRequestWithNoNotificationurl() {
+ //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
+ + " <ns:request-information>"
+ + " <ns:request-id>STUW105_5002</ns:request-id>"
+ + " <ns:request-action>RequestAction</ns:request-action>"
+ + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
+ + " <ns:source>SOURCE</ns:source>"
+ + " <ns:notification-url></ns:notification-url>"
+ + " <ns:order-number>10205000</ns:order-number>"
+ + " <ns:order-version>1</ns:order-version>"
+ + " </ns:request-information>"
+ + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
+ + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+ return xml;
+ }
+
+ public String gMsoCompletionRequestWithNoNotificationurlNoRequestId() {
+ //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
+ + " <ns:request-information>"
+ + " <ns:request-id></ns:request-id>"
+ + " <ns:request-action>RequestAction</ns:request-action>"
+ + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
+ + " <ns:source>SOURCE</ns:source>"
+ + " <ns:notification-url></ns:notification-url>"
+ + " <ns:order-number>10205000</ns:order-number>"
+ + " <ns:order-version>1</ns:order-version>"
+ + " </ns:request-information>"
+ + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
+ + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+ return xml;
+ }
+
+ public String gMsoCompletionRequestWithNotificationurlNoRequestId() {
+ //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:MsoCompletionRequest xmlns:ns=\"http://openecomp.org/mso/request/types/v1\" xmlns:sdncadapterworkflow=\"http://openecomp.org/mso/workflow/schema/v1\">"
+ + " <ns:request-information>"
+ + " <ns:request-id></ns:request-id>"
+ + " <ns:request-action>RequestAction</ns:request-action>"
+ + " <ns:request-sub-action>COMPLETE</ns:request-sub-action>"
+ + " <ns:source>SOURCE</ns:source>"
+ + " <ns:notification-url>https://t3nap1a1.snt.bst.bls.com:9004/sdncontroller-sdncontroller-inbound-ws-war/sdncontroller-sdncontroller-inbound-ws.wsdl</ns:notification-url>"
+ + " <ns:order-number>10205000</ns:order-number>"
+ + " <ns:order-version>1</ns:order-version>"
+ + " </ns:request-information>"
+ + " <sdncadapterworkflow:mso-bpel-name>BPELNAME</sdncadapterworkflow:mso-bpel-name>"
+ + "</sdncadapterworkflow:MsoCompletionRequest>";
+
+ return xml;
+ }
+}
+
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java
new file mode 100644
index 0000000000..0ef856bb9d
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupNameIT.java
@@ -0,0 +1,116 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertEquals;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.test.Deployment;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+
+/**
+ * Unit test cases for ConfirmVolumeGroupName.bpmn
+ */
+
+public class ConfirmVolumeGroupNameIT extends BaseIntegrationTest {
+ /**
+ * Sunny day scenario.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void sunnyDay() throws Exception {
+ logStart();
+ MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1");
+ variables.put("ConfirmVolumeGroupName_volumeGroupName", "VOLUME_GROUP_ID_1_NAME");
+ variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ String processId = invokeSubProcess("ConfirmVolumeGroupName", variables);
+ String responseCode = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode",processId);
+
+ assertEquals("200", responseCode);
+
+ logEnd();
+ }
+
+ /**
+ * Rainy day scenario - nonexisting volume group id.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void rainyDayNoVolumeGroupId() throws Exception {
+ logStart();
+
+ // does not exist would return a 404 from AAI
+ MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST", "aai-volume-group-id-info.xml", 404);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21");
+ variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_THAT_DOES_NOT_EXIST");
+ variables.put("ConfirmVolumeGroupName_volumeGroupName", "cee6d136-e378-4678-a024-2cd15f0ee0cg");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ String processId = invokeSubProcess("ConfirmVolumeGroupName", variables);
+ String responseCode = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName", "CVGN_queryVolumeGroupResponseCode",processId);
+
+ assertEquals("404", responseCode);
+
+ logEnd();
+ }
+
+ /**
+ * Rainy day scenario - volume group name does not match the name in AAI
+ *
+ *
+ * @throws Exception
+ */
+ @Test
+ public void rainyDayNameDoesNotMatch() throws Exception {
+ logStart();
+
+ MockGetVolumeGroupById("MDTWNJ21", "VOLUME_GROUP_ID_1", "aai-volume-group-id-info.xml", 200);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("ConfirmVolumeGroupName_volumeGroupId", "VOLUME_GROUP_ID_1");
+ variables.put("ConfirmVolumeGroupName_volumeGroupName", "BAD_VOLUME_GROUP_NAME");
+ variables.put("ConfirmVolumeGroupName_aicCloudRegion", "MDTWNJ21");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ String processId = invokeSubProcess("ConfirmVolumeGroupName", variables);
+ String volumeGroupNameMatches = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupName", "CVGN_volumeGroupNameMatches",processId);
+
+ assertEquals("false", volumeGroupNameMatches);
+
+ logEnd();
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java
new file mode 100644
index 0000000000..af9ab7d3e4
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ConfirmVolumeGroupTenantIT.java
@@ -0,0 +1,88 @@
+/*
+ * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
+ */
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertEquals;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetVolumeGroupById;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+
+/**
+ * Please describe the ConfirmVolumeGroupTenantTest.java class
+ *
+ */
+
+public class ConfirmVolumeGroupTenantIT extends BaseIntegrationTest {
+
+ @Test
+ public void testRemoveLayer3Service_success() throws Exception{
+ MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ String processId = invokeSubProcess("ConfirmVolumeGroupTenant", variables);
+
+ String actualNameMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "groupNamesMatch",processId);
+ String actualIdMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "tenantIdsMatch",processId);
+ String actualResponse = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "volumeHeatStackId",processId);
+
+ assertEquals("Response", "true", actualNameMatch);
+ assertEquals("Response", "true", actualIdMatch);
+ assertEquals("Response", "MoG_CinderVolumes_2/19387dc6-060f-446e-b41f-dcfd29c73845", actualResponse);
+ }
+
+ @Test
+ public void testRemoveLayer3Service_idsNotMatch() throws Exception{
+ MockGetVolumeGroupById("MDTWNJ21", "a8399879-31b3-4973-be26-0a0cbe776b58", "CRTGVNF_queryAAIResponseVolume_idsNotMatch.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ String processId = invokeSubProcess("ConfirmVolumeGroupTenant", variables);
+
+
+ String actualNameMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "groupNamesMatch",processId);
+ String actualIdMatch = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "tenantIdsMatch",processId);
+ String actualResponse = BPMNUtil.getVariable(processEngine, "ConfirmVolumeGroupTenant", "WorkflowException",processId);
+
+ assertEquals("Response", "true", actualNameMatch);
+ assertEquals("Response", "false", actualIdMatch);
+ assertEquals("Response", "WorkflowException[processKey=ConfirmVolumeGroupTenant,errorCode=1,errorMessage=Volume Group a8399879-31b3-4973-be26-0a0cbe776b58 does not belong to your tenant,workStep=*]", actualResponse);
+
+ }
+
+ private void setVariables(Map<String, Object> variables) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("volumeGroupId","a8399879-31b3-4973-be26-0a0cbe776b58");
+ variables.put("tenantId", "7dd5365547234ee8937416c65507d266");
+ variables.put("aicCloudRegion", "MDTWNJ21");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java
new file mode 100644
index 0000000000..fd38ff024d
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java
@@ -0,0 +1,267 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.containing;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.test.Deployment;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit test for CreateAAIVfModule.bpmn.
+ */
+
+public class CreateAAIVfModuleIT extends BaseIntegrationTest {
+
+ MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class);
+
+ @Test
+ public void TestCreateGenericVnfSuccess_200() {
+
+ new MockAAIGenericVnfSearch();
+ MockAAICreateGenericVnf();
+ MockAAIVfModulePUT(true);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfName", "STMTN5MMSC22");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC22-MMSC::module-0-0");
+ variables.put("vfModuleModelName", "MMSC::module-0");
+
+ String processId = invokeSubProcess("CreateAAIVfModule", variables);
+ String response = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode",processId);
+ String responseCode = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode",processId);
+ Assert.assertEquals("201", responseCode);
+ logger.debug(response);
+ }
+
+ @Test
+ public void TestCreateVfModuleSuccess_200() {
+ // create Add-on VF Module for existing Generic VNF
+ new MockAAIGenericVnfSearch();
+ MockAAICreateGenericVnf();
+ MockAAIVfModulePUT(true);
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-1-0");
+ variables.put("vfModuleModelName", "STMTN5MMSC21-MMSC::model-1-0");
+ String processId = invokeSubProcess("CreateAAIVfModule", variables);
+ String response = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode",processId);
+ String responseCode = BPMNUtil.getVariable(processEngine, "CreateAAIVfModule", "CAAIVfMod_createVfModuleResponseCode",processId);
+ Assert.assertEquals("201", responseCode);
+ logger.debug(response);
+ }
+
+ @Test
+ public void TestQueryGenericVnfFailure_5000() {
+ new MockAAIGenericVnfSearch();
+ MockAAICreateGenericVnf();
+ MockAAIVfModulePUT(true);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfName", "STMTN5MMSC23");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC23-MMSC::module-0-0");
+ variables.put("vfModuleModelName", "MMSC::module-0");
+ String processId = invokeSubProcess("CreateAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
+ Assert.assertEquals(500, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("Error occurred attempting to query AAI"));
+ logger.debug(exception.getErrorMessage());
+ }
+
+ @Test
+ public void TestCreateDupGenericVnfFailure_1002() {
+ new MockAAIGenericVnfSearch();
+ MockAAICreateGenericVnf();
+ MockAAIVfModulePUT(true);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfName", "STMTN5MMSC21");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC21-MMSC::module-0-0");
+ variables.put("vfModuleModelName", "MMSC::module-0");
+ String processId = invokeSubProcess("CreateAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("Invalid request for new Generic VNF which already exists"));
+ logger.debug(exception.getErrorMessage());
+ }
+
+ @Test
+ public void TestCreateDupVfModuleFailure_1002() {
+ new MockAAIGenericVnfSearch();
+ MockAAICreateGenericVnf();
+ MockAAIVfModulePUT(true);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfId", "2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC20-MMSC::module-1-0");
+ variables.put("vfModuleModelName", "STMTN5MMSC20-MMSC::model-1-0");
+ String processId = invokeSubProcess("CreateAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("already exists for Generic VNF"));
+ logger.debug(exception.getErrorMessage());
+ }
+
+ @Test
+ public void TestCreateGenericVnfFailure_5000() {
+ new MockAAIGenericVnfSearch();
+ MockAAICreateGenericVnf();
+ MockAAIVfModulePUT(true);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfName", "STMTN5MMSC22");
+ variables.put("serviceId", "99999999-9999-9999-9999-999999999999");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0");
+ variables.put("vfModuleModelName", "PCRF::module-0");
+ String processId = invokeSubProcess("CreateAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
+ Assert.assertEquals(5000, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+ logger.debug(exception.getErrorMessage());
+ }
+
+ @Test
+ public void TestCreateGenericVnfFailure_1002() {
+ new MockAAIGenericVnfSearch();
+ MockAAICreateGenericVnf();
+ MockAAIVfModulePUT(true);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfId", "768073c7-f41f-4822-9323-b75962763d74");
+ variables.put("serviceId", "00000000-0000-0000-0000-000000000000");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC22-PCRF::module-1-0");
+ variables.put("vfModuleModelName", "PCRF::module-0");
+ String processId = invokeSubProcess("CreateAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found"));
+ logger.debug(exception.getErrorMessage());
+ }
+
+ @Test
+ public void TestCreateVfModuleFailure_5000() {
+ new MockAAIGenericVnfSearch();
+ MockAAICreateGenericVnf();
+ MockAAIVfModulePUT(true);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("isVidRequest", "false");
+ variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
+ variables.put("serviceId", "99999999-9999-9999-9999-999999999999");
+ variables.put("personaModelId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
+ variables.put("personaModelVersion", "1.0");
+ variables.put("vfModuleName", "STMTN5MMSC21-PCRF::module-1-0");
+ variables.put("vfModuleModelName", "STMTN5MMSC21-PCRF::model-1-0");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ String processId = invokeSubProcess("CreateAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "CreateAAIVfModule", "WorkflowException",processId);
+ Assert.assertEquals(5000, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+ logger.debug(exception.getErrorMessage());
+ }
+
+ public static void MockAAICreateGenericVnf(){
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
+ .withRequestBody(containing("<service-id>00000000-0000-0000-0000-000000000000</service-id>"))
+ .willReturn(aResponse()
+ .withStatus(201)));
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
+ .withRequestBody(containing("<service-id>99999999-9999-9999-9999-999999999999</service-id>"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ }
+
+ // start of mocks used locally and by other VF Module unit tests
+ public static void MockAAIVfModulePUT(boolean isCreate){
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
+ .withRequestBody(containing("MMSC"))
+ .willReturn(aResponse()
+ .withStatus(isCreate ? 201 : 200)));
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
+ .withRequestBody(containing("PCRF"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ }
+
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java
new file mode 100644
index 0000000000..6af705fd54
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java
@@ -0,0 +1,132 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetVfModuleId;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutVfModuleId;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit tests for CreateAAIVfModuleVolumeGroup.bpmn.
+ */
+
+public class CreateAAIVfModuleVolumeGroupIT extends BaseIntegrationTest {
+
+ MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleVolumeGroupIT.class);
+
+ /**
+ * Test the happy path through the flow.
+ */
+ @Test
+ public void happyPath() throws IOException {
+
+ logStart();
+
+ String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
+ MockGetGenericVnfByIdWithPriority("skask", "lukewarm", 200, "VfModularity/VfModule-lukewarm.xml", 2);
+ MockPutVfModuleIdNoResponse("skask", "PCRF", "lukewarm");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled","true");
+ variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode");
+ logger.debug("Subflow response code: " + responseCode);
+ logger.debug("Subflow response: " + response);
+ Assert.assertEquals(200, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI returns a 404.
+ */
+ @Test
+ public void badGet() throws IOException {
+
+ logStart();
+
+ String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
+ MockGetVfModuleId("skask", ".*", "VfModularity/VfModule-supercool.xml", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled","true");
+ variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponseCode");
+ logger.debug("Subflow response code: " + responseCode);
+ logger.debug("Subflow response: " + response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
+ */
+ @Test
+ public void badPatch() throws IOException {
+
+ logStart();
+
+ String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/CreateAAIVfModuleVolumeGroupRequest.xml");
+ MockGetVfModuleId("skask", "lukewarm", "VfModularity/VfModule-lukewarm.xml", 200);
+ MockPutVfModuleId("skask", "lukewarm", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "999-99-9999");
+ variables.put("isDebugLogEnabled","true");
+ variables.put("CreateAAIVfModuleVolumeGroupRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("CreateAAIVfModuleVolumeGroup", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode");
+ logger.debug("Subflow response code: " + responseCode);
+ logger.debug("Subflow response: " + response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
+}
+
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java
new file mode 100644
index 0000000000..7acaf449e3
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DecomposeServiceIT.java
@@ -0,0 +1,95 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.camunda.bpm.engine.test.Deployment;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+
+/**
+ * Unit Test for the DecomposeService Flow
+ *
+ */
+
+public class DecomposeServiceIT extends BaseIntegrationTest {
+
+
+ public DecomposeServiceIT() throws IOException {
+
+ }
+
+ @Test
+ public void testDecomposeService_success() throws Exception{
+ MockGetServiceResourcesCatalogData("cmw-123-456-789", "1.0", "/getCatalogServiceResourcesDataWithConfig.json");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ invokeSubProcess("DecomposeService", businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+
+ }
+
+ //@Test
+ @Test
+ public void testDecomposeService_success_partial() throws Exception{
+ MockGetServiceResourcesCatalogData("cmw-123-456-789", "1.0", "/getCatalogServiceResourcesDataNoNetwork.json");
+
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ invokeSubProcess("DecomposeService", businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables, String requestId, String siId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", requestId);
+ variables.put("msoRequestId", requestId);
+ variables.put("serviceInstanceId",siId);
+
+ String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
+ "\"modelInvariantUuid\": \"cmw-123-456-789\"," +
+ "\"modelVersionId\": \"ab6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"ServicevSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "}";
+ variables.put("serviceModelInfo", serviceModelInfo);
+
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java
new file mode 100644
index 0000000000..27b39aec64
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java
@@ -0,0 +1,288 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.test.Deployment;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit test for DeleteAAIVfModule.bpmn.
+ */
+
+public class DeleteAAIVfModuleIT extends BaseIntegrationTest {
+ private static final String EOL = "\n";
+
+ MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,DeleteAAIVfModuleIT.class);
+
+ @Test
+ public void TestDeleteGenericVnfSuccess_200() {
+ // delete the Base Module and Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
+ new MockAAIGenericVnfSearch();
+ new MockAAIDeleteGenericVnf();
+ new MockAAIDeleteVfModule();
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest","<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id> <vnf-name>STMTN5MMSC21</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id> <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-request>");
+ String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+ String response = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode",processId);
+ String responseCode = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule", "DAAIVfMod_deleteGenericVnfResponseCode",processId);
+ Assert.assertEquals("200", responseCode);
+ logger.debug(response);
+ }
+
+ @Test
+ public void TestDeleteVfModuleSuccess_200() {
+ // delete Add-on Vf Module for existing Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a75
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+
+ new MockAAIGenericVnfSearch();
+ new MockAAIDeleteGenericVnf();
+ new MockAAIDeleteVfModule();
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest",request);
+ String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+ String response = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode",processId);
+ String responseCode = BPMNUtil.getVariable(processEngine, "DeleteAAIVfModule", "DAAIVfMod_deleteVfModuleResponseCode",processId);
+ Assert.assertEquals("200", responseCode);
+ logger.debug(response);
+ }
+
+ @Test
+ public void TestQueryGenericVnfFailure_5000() {
+ // query Generic Vnf failure (non-404) with A&AI
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c723, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a71
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c723</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC23</vnf-name>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a71</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ new MockAAIGenericVnfSearch();
+ new MockAAIDeleteGenericVnf();
+ new MockAAIDeleteVfModule();
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest",request);
+ String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
+ Assert.assertEquals(5000, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+ logger.debug(exception.getErrorMessage());
+ }
+
+ @Test
+ public void TestQueryGenericVnfFailure_1002() {
+ // attempt to delete Vf Module for Generic Vnf that does not exist (A&AI returns 404)
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c722, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a72
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c722</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC22</vnf-name>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a72</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC22-MMSC::module-1-0</vf-module-name>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ new MockAAIGenericVnfSearch();
+ new MockAAIDeleteGenericVnf();
+ new MockAAIDeleteVfModule();
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest",request);
+ String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("Generic VNF Not Found"));
+ logger.debug(exception.getErrorMessage());
+ }
+
+ @Test
+ public void TestDeleteGenericVnfFailure_5000() {
+ // A&AI failure (non-200) when attempting to delete a Generic Vnf
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c718, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a78
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ new MockAAIGenericVnfSearch();
+ new MockAAIDeleteGenericVnf();
+ new MockAAIDeleteVfModule();
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest",request);
+ String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
+ Assert.assertEquals(5000, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+ logger.debug(exception.getErrorMessage());
+ }
+
+ @Test
+ public void TestDeleteVfModuleFailure_5000() {
+ // A&AI failure (non-200) when attempting to delete a Vf Module
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c719, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a77
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ new MockAAIGenericVnfSearch();
+ new MockAAIDeleteGenericVnf();
+ new MockAAIDeleteVfModule();
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest",request);
+ String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
+ Assert.assertEquals(5000, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("<messageId>SVC3002</messageId>"));
+ logger.debug(exception.getErrorMessage());
+ }
+
+ @Test
+ public void TestDeleteVfModuleFailure_1002_1() {
+ // failure attempting to delete Base Module when not the last Vf Module
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a74
+ String request =
+ "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>DELETE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+ new MockAAIGenericVnfSearch();
+ new MockAAIDeleteGenericVnf();
+ new MockAAIDeleteVfModule();
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest",request);
+ String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("is Base Module, not Last Module"));
+ logger.debug(exception.getErrorMessage());
+ }
+
+ @Test
+ public void TestDeleteVfModuleFailure_1002_2() {
+ // failure attempting to delete a Vf Module that does not exist (A&AI returns 404)
+ // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c720, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a76
+ new MockAAIGenericVnfSearch();
+ new MockAAIDeleteGenericVnf();
+ new MockAAIDeleteVfModule();
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("DeleteAAIVfModuleRequest","<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\"> <request-info> <action>DELETE_VF_MODULE</action> <source>PORTAL</source> </request-info> <vnf-inputs> <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id> <vnf-name>STMTN5MMSC20</vnf-name> <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id> <vf-module-name>STMTN5MMSC20-MMSC::module-2-0</vf-module-name> </vnf-inputs> <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/> </vnf-request>");
+ String processId = invokeSubProcess("DeleteAAIVfModule", variables);
+ WorkflowException exception = BPMNUtil.getRawVariable(processEngine, "DeleteAAIVfModule", "WorkflowException",processId);
+ Assert.assertEquals(1002, exception.getErrorCode());
+ Assert.assertEquals(true, exception.getErrorMessage().contains("does not exist for Generic Vnf Id"));
+ logger.debug(exception.getErrorMessage());
+ }
+}
+
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java
new file mode 100644
index 0000000000..a6d26540dc
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java
@@ -0,0 +1,224 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit test for FalloutHandler.bpmn.
+ */
+
+public class FalloutHandlerIT extends BaseIntegrationTest {
+
+ MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,FalloutHandlerIT.class);
+
+
+ private void setupMocks() {
+ stubFor(post(urlEqualTo("/dbadapters/AttRequestsDbAdapter"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody("<DbTag>Notified</DbTag>")));
+ stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody("<DbTag>Notified</DbTag>")));
+ }
+
+ private String executeFlow(String inputRequestFile) throws InterruptedException {
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("FalloutHandlerRequest",inputRequestFile); variables.put("mso-request-id", UUID.randomUUID().toString());
+ String processId = invokeSubProcess( "FalloutHandler", variables);
+ waitForWorkflowToFinish(processEngine,processId);
+ logEnd();
+ return processId;
+ }
+
+ @Test
+ public void msoFalloutHandlerWithNotificationurl_200() throws Exception{
+ //Setup Mocks
+ setupMocks();
+ //Execute Flow
+ String processId = executeFlow(gMsoFalloutHandlerWithNotificationurl());
+ //Verify Error
+ String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode",processId);
+ Assert.assertEquals("200", FH_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator",processId));
+ }
+
+ public String gMsoFalloutHandlerWithNotificationurl() {
+ //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
+ + " <ns7:request-information>"
+ + " <ns7:request-id>1020_STUW105_5002</ns7:request-id>"
+ + " <ns7:request-action>requestAction</ns7:request-action>"
+ + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+ + " <ns7:source>source</ns7:source>"
+ + " <ns7:notification-url>http://localhost:28090/CCD/StatusNotification</ns7:notification-url>"
+ + " <ns7:order-number>10205000</ns7:order-number>"
+ + " <ns7:order-version>1</ns7:order-version>"
+ + " </ns7:request-information>"
+ + " <sdncadapterworkflow:WorkflowException>"
+ + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+ + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+ + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+ + " </sdncadapterworkflow:WorkflowException>"
+ + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+ return xml;
+
+ }
+
+
+
+
+ @Test
+ public void msoFalloutHandlerWithNoNotificationurl() throws Exception{
+
+ //Setup Mocks
+ setupMocks();
+ //Execute Flow
+ executeFlow(gMsoFalloutHandlerWithNoNotificationurl());
+ //Verify Error
+ String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode");
+ Assert.assertEquals("200", FH_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator"));
+ }
+
+ public String gMsoFalloutHandlerWithNoNotificationurl() {
+ //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
+ + " <ns7:request-information>"
+ + " <ns7:request-id>1020_STUW105_5002</ns7:request-id>"
+ + " <ns7:request-action>requestAction</ns7:request-action>"
+ + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+ + " <ns7:source>source</ns7:source>"
+ + " <ns7:notification-url></ns7:notification-url>"
+ + " <ns7:order-number>10205000</ns7:order-number>"
+ + " <ns7:order-version>1</ns7:order-version>"
+ + " </ns7:request-information>"
+ + " <sdncadapterworkflow:WorkflowException>"
+ + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+ + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+ + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+ + " </sdncadapterworkflow:WorkflowException>"
+ + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+ return xml;
+ }
+
+ @Test
+
+ public void msoFalloutHandlerWithNotificationurlNoRequestId() throws Exception{
+ String method = getClass().getSimpleName() + "." + new Object() {
+ }.getClass().getEnclosingMethod().getName();
+ logger.debug("STARTED TEST: " + method);
+ //Setup Mocks
+ setupMocks();
+ //Execute Flow
+ executeFlow(gMsoFalloutHandlerWithNotificationurlNoRequestId());
+ //Verify Error
+ String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode");
+ Assert.assertEquals("200", FH_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator"));
+ }
+
+ public String gMsoFalloutHandlerWithNotificationurlNoRequestId() {
+ //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
+ + " <ns7:request-information>"
+ + " <ns7:request-id></ns7:request-id>"
+ + " <ns7:request-action>requestAction</ns7:request-action>"
+ + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+ + " <ns7:source>source</ns7:source>"
+ + " <ns7:notification-url>www.test.com</ns7:notification-url>"
+ + " <ns7:order-number>10205000</ns7:order-number>"
+ + " <ns7:order-version>1</ns7:order-version>"
+ + " </ns7:request-information>"
+ + " <sdncadapterworkflow:WorkflowException>"
+ + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+ + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+ + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+ + " </sdncadapterworkflow:WorkflowException>"
+ + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+ return xml;
+ }
+
+ @Test
+
+ public void msoFalloutHandlerWithNoNotificationurlNoRequestId() throws Exception{
+ String method = getClass().getSimpleName() + "." + new Object() {
+ }.getClass().getEnclosingMethod().getName();
+ logger.debug("STARTED TEST: " + method);
+ //Setup Mocks
+ setupMocks();
+ //Execute Flow
+ executeFlow(gMsoFalloutHandlerWithNoNotificationurlNoRequestId());
+ //Verify Error
+ String FH_ResponseCode = BPMNUtil.getVariable(processEngine, "FalloutHandler", "FH_ResponseCode");
+ Assert.assertEquals("200", FH_ResponseCode);
+ Assert.assertTrue((boolean) BPMNUtil.getRawVariable(processEngine, "FalloutHandler", "FH_SuccessIndicator"));
+ }
+
+ public String gMsoFalloutHandlerWithNoNotificationurlNoRequestId() {
+ //Generated the below XML from ActiveVOS moduler ... Using the generate sample XML feature in ActiveVOS
+ String xml = ""
+ + "<sdncadapterworkflow:FalloutHandlerRequest xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns7=\"http://org.onap/so/request/types/v1\">"
+ + " <ns7:request-information>"
+ + " <ns7:request-id></ns7:request-id>"
+ + " <ns7:request-action>requestAction</ns7:request-action>"
+ + " <ns7:request-sub-action>CANCEL</ns7:request-sub-action>"
+ + " <ns7:source>source</ns7:source>"
+ + " <ns7:notification-url></ns7:notification-url>"
+ + " <ns7:order-number>10205000</ns7:order-number>"
+ + " <ns7:order-version>1</ns7:order-version>"
+ + " </ns7:request-information>"
+ + " <sdncadapterworkflow:WorkflowException>"
+ + " <sdncadapterworkflow:ErrorMessage>Some Error Message - Fallout Handler</sdncadapterworkflow:ErrorMessage>"
+ + " <sdncadapterworkflow:ErrorCode>Some Error Code - Fallout Handler</sdncadapterworkflow:ErrorCode>"
+ + " <sdncadapterworkflow:SourceSystemErrorCode>Some Source System Error Code- Fallout Handler</sdncadapterworkflow:SourceSystemErrorCode>"
+ + " </sdncadapterworkflow:WorkflowException>"
+ + "</sdncadapterworkflow:FalloutHandlerRequest>";
+
+ return xml;
+ }
+
+}
+
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java
new file mode 100644
index 0000000000..fa8823a5b4
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenerateVfModuleNameIT.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertNotNull;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.test.Deployment;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+
+/**
+ * Unit test for GenerateVfModuleName.bpmn.
+ */
+
+public class GenerateVfModuleNameIT extends BaseIntegrationTest {
+ private static final String EOL = "\n";
+
+ @Test
+ public void TestGenerateVfModuleNameSuvvess() {
+ //
+ String request =
+ "<vnf-request xmlns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\">" + EOL +
+ " <request-info>" + EOL +
+ " <action>CREATE_VF_MODULE</action>" + EOL +
+ " <source>PORTAL</source>" + EOL +
+ " </request-info>" + EOL +
+ " <vnf-inputs>" + EOL +
+ " <vnf-name>STMTN5MMSC22</vnf-name>" + EOL +
+ " <vf-module-name>STMTN5MMSC22-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <vf-module-model-name>MMSC::module-0</vf-module-model-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
+ " <aic-node-clli>MDTWNJ21</aic-node-clli>" + EOL +
+ " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
+ " </vnf-inputs>" + EOL +
+ " <vnf-params xmlns:tns=\"http://ecomp.att.com/mso/infra/vnf-request/v1\"/>" + EOL +
+ "</vnf-request>" + EOL;
+
+ MockGetGenericVnfById(".*", "GenericFlows/getGenericVnfByNameResponse.xml");
+ RuntimeService runtimeService = processEngine.getRuntimeService();
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("vnfName", "STMTN5MMSC20");
+ variables.put("vfModuleLabel", "ModuleLabel1");
+ variables.put("personaModelId", "extrovert");
+ variables.put("vnfId", "12345678-f41f-4822-9323-b75962763d74");
+
+ runtimeService.startProcessInstanceByKey("GenerateVfModuleName", variables);
+ String response = BPMNUtil.getVariable(processEngine, "GenerateVfModuleName", "vfModuleName");
+
+ assertNotNull(response);
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetServiceIT.java
new file mode 100644
index 0000000000..38d05fe28e
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetServiceIT.java
@@ -0,0 +1,560 @@
+/*
+ * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
+ */
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance_404;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance_500;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceSubscription;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_404;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById_500;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_404;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_500;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+
+
+/**
+ * Unit Test for the GenericGetService Sub Flow
+ */
+
+public class GenericGetServiceIT extends BaseIntegrationTest {
+
+
+ @Test
+ public void testGenericGetService_success_serviceInstance() throws Exception{
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+ String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+ assertEquals("true", successIndicator);
+ assertEquals("true", found);
+ assertEquals("false", obtainUrl);
+ assertEquals("false", byName);
+ assertNotNull(response);
+ assertEquals(null, workflowException);
+ }
+
+
+ @Test
+
+ public void testGenericGetService_success_serviceSubscription() throws Exception{
+
+ MockGetServiceSubscription("1604-MVM-26", "SDN-ETHERNET-INTERNET", "GenericFlows/getServiceSubscription.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSubscription(variables, "", null , "1604-MVM-26", "SDN-ETHERNET-INTERNET");
+
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+ String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+
+ assertEquals("true", successIndicator);
+ assertEquals("true", found);
+ assertEquals("false", obtainUrl);
+ assertEquals("false", byName);
+ assertNotNull(response);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+
+ public void testGenericGetService_success_serviceInstance_byName() throws Exception{
+
+ MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByName.xml");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesInstance(variables, null, "1604-MVM-26", null, null);
+
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+ String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
+
+ assertEquals("true", successIndicator);
+ assertEquals("true", found);
+ assertEquals("true", obtainUrl);
+ assertEquals("true", byName);
+ assertNotNull(response);
+ assertEquals("200", siUrlResponseCode);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+
+ public void testGenericGetService_success_serviceInstance_byId() throws Exception{
+
+ MockNodeQueryServiceInstanceById("MIS%2F1604%2F0026%2FSW_INTERNET", "GenericFlows/getSIUrlById.xml");
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
+
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+ String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId);
+
+ assertEquals("true", successIndicator);
+ assertEquals("true", found);
+ assertEquals("true", obtainUrl);
+ assertEquals("false", byName);
+ assertNotNull(response);
+ assertEquals("200", siUrlResponseCode);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+
+ public void testGenericGetService_success_serviceInstance_404Response() throws Exception{
+
+ MockGetServiceInstance_404("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
+
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+
+ assertEquals("true", successIndicator);
+ assertEquals("false", found);
+ assertEquals("false", obtainUrl);
+ assertEquals("false", byName);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+
+ public void testGenericGetService_success_serviceSubscription404() throws Exception{
+ MockGetServiceSubscription("SDN-ETHERNET-INTERNET", "1604-MVM-26", 404);
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", "1604-MVM-26");
+
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+ String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+
+ assertEquals("true", successIndicator);
+ assertEquals("false", found);
+ assertEquals("false", obtainUrl);
+ assertEquals("false", byName);
+ assertNotNull(response);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+
+ public void testGenericGetService_success_serviceInstanceByName404() throws Exception{
+
+ MockNodeQueryServiceInstanceByName_404("1604-MVM-26");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesInstance(variables, "", "1604-MVM-26", null, null);
+
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
+
+ assertEquals("true", successIndicator);
+ assertEquals("false", found);
+ assertEquals("true", obtainUrl);
+ assertEquals("true", byName);
+ assertEquals("404", siUrlResponseCode);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+
+ public void testGenericGetService_success_serviceInstanceById404() throws Exception{
+
+ MockNodeQueryServiceInstanceById_404("MIS%2F1604%2F0026%2FSW_INTERNET");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
+
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId);
+
+ assertEquals("true", successIndicator);
+ assertEquals("false", found);
+ assertEquals("true", obtainUrl);
+ assertEquals("false", byName);
+ assertEquals("404", siUrlResponseCode);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+
+ public void testGenericGetService_success_serviceInstanceEmptyResponse() throws Exception{
+
+ MockGetServiceInstance("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, "SDN-ETHERNET-INTERNET", "123456789");
+
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+
+ assertEquals("true", successIndicator);
+ assertEquals("false", found);
+ assertEquals("false", obtainUrl);
+ assertEquals("false", byName);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+
+ public void testGenericGetService_success_serviceInstanceByNameEmpty() throws Exception{
+ MockNodeQueryServiceInstanceByName("1604-MVM-26", "");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesInstance(variables, "", "1604-MVM-26", null, null);
+
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
+
+ assertEquals("true", successIndicator);
+ assertEquals("false", found);
+ assertEquals("true", obtainUrl);
+ assertEquals("true", byName);
+ assertEquals("200", siUrlResponseCode);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+
+ public void testGenericGetService_success_serviceInstanceByIdEmpty() throws Exception{
+
+ MockNodeQueryServiceInstanceById("MIS[%]2F1604[%]2F0026[%]2FSW_INTERNET", "");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
+
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId);
+
+ assertEquals("true", successIndicator);
+ assertEquals("false", found);
+ assertEquals("true", obtainUrl);
+ assertEquals("false", byName);
+ assertEquals("200", siUrlResponseCode);
+ assertEquals(null, workflowException);
+ }
+
+
+ @Test
+
+ public void testGenericGetService_error_serviceInstanceInvalidVariables() throws Exception{
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesInstance(variables, null, null, "SDN-ETHERNET-INTERNET", null);
+
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+ String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+
+ String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.,workStep=*]";
+
+ assertEquals("false", successIndicator);
+ assertEquals("false", found);
+ assertEquals("false", obtainUrl);
+ assertEquals("false", byName);
+ assertEquals(expectedWorkflowException, workflowException);
+ }
+
+ @Test
+
+ public void testGenericGetService_success_serviceSubscriptionInvalidVariables() throws Exception{
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSubscription(variables, "", "", "SDN-ETHERNET-INTERNET", null);
+
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+
+ String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Incoming ServiceType or GlobalCustomerId is null. These variables are required to Get a service-subscription.,workStep=*]";
+
+
+ assertEquals("false", successIndicator);
+ assertEquals("false", found);
+ assertEquals("false", obtainUrl);
+ assertEquals("false", byName);
+ assertEquals(expectedWorkflowException, workflowException);
+ }
+
+ @Test
+
+ public void testGenericGetService_error_serviceInstance_getSIBadResponse() throws Exception{
+
+ MockGetServiceInstance_500("SDN-ETHERNET-INTERNET", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", "1604-MVM-26", "SDN-ETHERNET-INTERNET", "123456789");
+
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+ String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+
+ String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]";
+
+ assertEquals("false", successIndicator);
+ assertEquals("false", found);
+ assertEquals("false", obtainUrl);
+ assertEquals("false", byName);
+ assertEquals(expectedWorkflowException, workflowException);
+ }
+
+ @Test
+
+ public void testGenericGetService_error_serviceInstance_getUrlByIdBadResponse() throws Exception{
+
+ MockNodeQueryServiceInstanceById_500("MIS%2F1604%2F0026%2FSW_INTERNET");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesInstance(variables, "MIS%2F1604%2F0026%2FSW_INTERNET", null, null, null);
+
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+ String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_genericQueryResponseCode",processId);
+
+ String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]";
+
+ assertEquals("false", successIndicator);
+ assertEquals("false", found);
+ assertEquals("true", obtainUrl);
+ assertEquals("false", byName);
+ assertEquals("500", siUrlResponseCode);
+ assertEquals(expectedWorkflowException, workflowException);
+ }
+
+ @Test
+
+ public void testGenericGetService_error_serviceInstance_getUrlByNameBadResponse() throws Exception{
+
+ MockNodeQueryServiceInstanceByName_500("1604-MVM-26");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesInstance(variables, null, "1604-MVM-26", null, null);
+
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+ String obtainUrl = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainObjectsUrl",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainServiceInstanceUrlByName",processId);
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
+
+ String expectedWorkflowException = "WorkflowException[processKey=GenericGetService,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]";
+
+ assertEquals("false", successIndicator);
+ assertEquals("false", found);
+ assertEquals("true", obtainUrl);
+ assertEquals("true", byName);
+ assertEquals("500", siUrlResponseCode);
+ assertEquals(expectedWorkflowException, workflowException);
+ }
+
+ @Test
+
+ public void testGenericGetService_success_serviceInstance_byNameServicePresent() throws Exception{
+
+ MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByNameMultiCustomer.xml");
+ MockGetServiceInstance("AbcBank", "ABC-ST", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesInstance(variables, null, "1604-MVM-26", "XyCorporation", null);
+
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String resourceLink = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_resourceLink",processId);
+ String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
+
+ assertEquals("true", successIndicator);
+ assertEquals("true", found);
+ assertNotNull(resourceLink);
+ assertNotNull(response);
+ assertEquals("200", siUrlResponseCode);
+ assertEquals(null, workflowException);
+ }
+
+ @Test
+
+ public void testGenericGetService_success_serviceInstance_byNameServiceNotPresent() throws Exception{
+
+ MockNodeQueryServiceInstanceByName("1604-MVM-26", "GenericFlows/getSIUrlByNameMultiCustomer.xml");
+ MockGetServiceInstance("CorporationNotPresent", "123456789", "MIS%252F1604%252F0026%252FSW_INTERNET", "GenericFlows/getServiceInstance.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesInstance(variables, null, "1604-MVM-26", "CorporationNotPresent", null);
+
+ String processId = invokeSubProcess( "GenericGetService", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_FoundIndicator",processId);
+ String resourceLink = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_resourceLink",processId);
+ String response = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowResponse",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetService", "WorkflowException",processId);
+ String siUrlResponseCode = BPMNUtil.getVariable(processEngine, "GenericGetService", "GENGS_obtainSIUrlResponseCode",processId);
+
+ assertEquals("true", successIndicator);
+ assertEquals("false", found);
+ assertEquals(null, resourceLink);
+ assertEquals(" ", response);
+ assertEquals("200", siUrlResponseCode);
+ assertEquals(null, workflowException);
+ }
+
+ private void setVariablesInstance(Map<String, Object> variables, String siId, String siName, String globalCustId, String serviceType) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("GENGS_serviceInstanceId", siId);
+ variables.put("GENGS_serviceInstanceName", siName);
+ variables.put("GENGS_globalCustomerId",globalCustId);
+ variables.put("GENGS_serviceType", serviceType);
+ variables.put("GENGS_type", "service-instance");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ }
+
+ private void setVariablesSubscription(Map<String, Object> variables, String siId, String siName, String globalCustId, String serviceType) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("GENGS_serviceInstanceId", siId);
+ variables.put("GENGS_serviceInstanceName", siName);
+ variables.put("GENGS_globalCustomerId",globalCustId);
+ variables.put("GENGS_serviceType", serviceType);
+ variables.put("GENGS_type", "service-subscription");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ }
+
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetVnfIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetVnfIT.java
new file mode 100644
index 0000000000..10c0640b17
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/GenericGetVnfIT.java
@@ -0,0 +1,190 @@
+/*
+ * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
+ */
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVceByNameWithDepth;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_500;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByNameWithDepth;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetVceById;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+
+/**
+ * Please describe the GenericGetVnfTest.java class
+ *
+ */
+
+public class GenericGetVnfIT extends BaseIntegrationTest {
+
+ @Test
+
+ public void testGenericGetVnf_success_genericVnf() throws Exception{
+ MockGetGenericVnfByIdWithDepth("testVnfId123", 1, "GenericFlows/getGenericVnfByNameResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", "testVnfName123", "generic-vnf");
+
+ String processId = invokeSubProcess( "GenericGetVnf", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_FoundIndicator",processId);
+ String vnf = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_vnf",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_getVnfByName",processId);
+ String response = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowResponse",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowException",processId);
+
+ assertEquals("true", successIndicator);
+ assertEquals("true", found);
+ assertEquals("false", byName);
+ assertNotNull(response);
+ assertNotNull(vnf);
+ assertEquals(null, workflowException);
+
+ }
+
+ @Test
+
+ public void testGenericGetVnf_success_vce() throws Exception{
+ MockGetVceById("testVnfId123[?]depth=1", "GenericFlows/getVceResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123", "testVnfName123", "vce");
+
+ String processId = invokeSubProcess( "GenericGetVnf", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_FoundIndicator",processId);
+ String vnf = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_vnf",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_getVnfByName",processId);
+ String response = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowResponse",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowException",processId);
+
+ assertEquals("true", successIndicator);
+ assertEquals("true", found);
+ assertEquals("false", byName);
+ assertNotNull(response);
+ assertNotNull(vnf);
+ assertEquals(null, workflowException);
+
+ }
+
+ @Test
+
+ public void testGenericGetVnf_success_genericVnfByName() throws Exception{
+ MockGetGenericVnfByNameWithDepth("testVnfName123", 1, "GenericFlows/getGenericVnfResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables, "", "testVnfName123", "generic-vnf");
+
+ String processId = invokeSubProcess( "GenericGetVnf", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_FoundIndicator",processId);
+ String vnf = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_vnf",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_getVnfByName",processId);
+ String response = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowResponse",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowException",processId);
+
+ assertEquals("true", successIndicator);
+ assertEquals("true", found);
+ assertEquals("true", byName);
+ assertNotNull(response);
+ assertNotNull(vnf);
+ assertEquals(null, workflowException);
+
+ }
+
+ @Test
+
+ public void testGenericGetVnf_success_vceByName() throws Exception{
+ MockGetGenericVceByNameWithDepth("testVnfName123", 1, "GenericFlows/getVceByNameResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables, null, "testVnfName123", "vce");
+
+ String processId = invokeSubProcess( "GenericGetVnf", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_FoundIndicator",processId);
+ String vnf = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_vnf",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_getVnfByName",processId);
+ String response = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowResponse",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowException",processId);
+
+ assertEquals("true", successIndicator);
+ assertEquals("true", found);
+ assertEquals("true", byName);
+ assertNotNull(response);
+ assertNotNull(vnf);
+ assertEquals(null, workflowException);
+
+ }
+
+
+
+ @Test
+ public void testGenericGetVnf_error_genericVnf500() throws Exception{
+
+ MockGetGenericVnfById_500("testVnfId123_500");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables, "testVnfId123_500", "testVnfId123_500", "generic-vnf");
+
+ String processId = invokeSubProcess( "GenericGetVnf", variables);
+
+
+ String successIndicator = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_SuccessIndicator",processId);
+ String found = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_FoundIndicator",processId);
+ String workflowException = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "WorkflowException",processId);
+ String byName = BPMNUtil.getVariable(processEngine, "GenericGetVnf", "GENGV_getVnfByName",processId);
+
+ String expectedWorkflowException = "WorkflowException[processKey=GenericGetVnf,errorCode=500,errorMessage=Received a bad response from AAI,workStep=*]";
+
+ assertEquals("false", successIndicator);
+ assertEquals("false", found);
+ assertEquals("false", byName);
+
+ assertEquals(expectedWorkflowException, workflowException);
+ }
+
+ private void setVariables(Map<String, Object> variables, String vnfId, String vnfName, String type) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("GENGV_vnfId", vnfId);
+ variables.put("GENGV_vnfName",vnfName);
+ variables.put("GENGV_type", type);
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java
new file mode 100644
index 0000000000..744ef9bea5
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java
@@ -0,0 +1,96 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.onap.so.bpmn.mock.StubResponseDatabase.MockPostRequestDB;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.camunda.bpm.engine.TaskService;
+import org.camunda.bpm.engine.task.Task;
+import org.camunda.bpm.engine.task.TaskQuery;
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit test for RainyDayHandler.bpmn.
+ */
+public class ManualHandlingIT extends BaseIntegrationTest {
+ MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,ManualHandlingIT.class);
+
+ @Test
+ public void TestManualHandlingSuccess() {
+ MockPostRequestDB();
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceType", "X");
+ variables.put("vnfType", "Y");
+ variables.put("currentActivity", "BB1");
+ variables.put("workStep", "1");
+ variables.put("failedActivity", "AAI");
+ variables.put("vnfName", "vSAMP12");
+ variables.put("errorCode", "123");
+ variables.put("errorText", "update failed");
+ variables.put("validResponses", "Rollback");
+ variables.put("vnfName", "vSAMP1");
+
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeSubProcess("ManualHandling", businessKey, variables);
+
+ try {
+ Thread.sleep(5);
+ } catch (Exception e) {
+
+ }
+
+ TaskService taskService = processEngine.getTaskService();
+
+ TaskQuery q = taskService.createTaskQuery();
+
+ List<Task> tasks = q.orderByTaskCreateTime().asc().list();
+
+ for (Task task : tasks) {
+ logger.debug("TASK ID: " + task.getId());
+ logger.debug("TASK NAME: " + task.getName());
+
+ try {
+ logger.debug("Completing the task");
+ Map<String,Object> completeVariables = new HashMap<>();
+ completeVariables.put("responseValue", "skip");
+ taskService.complete(task.getId(), completeVariables);
+ } catch(Exception e) {
+ logger.debug("GOT EXCEPTION: " + e.getMessage());
+ }
+ }
+
+ waitForProcessEnd(businessKey, 100000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ }
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java
new file mode 100644
index 0000000000..819962f16c
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteGenericVnf.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.bpmn.common;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+
+public class MockAAIDeleteGenericVnf {
+ public MockAAIDeleteGenericVnf(){
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
+ .willReturn(aResponse()
+ .withStatus(200)));
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java
new file mode 100644
index 0000000000..9cb10a0494
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIDeleteVfModule.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.bpmn.common;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+
+public class MockAAIDeleteVfModule {
+
+ public MockAAIDeleteVfModule()
+ {
+ stubFor(delete(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073"))
+ .willReturn(aResponse().withStatus(200)));
+ stubFor(delete(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075"))
+ .willReturn(aResponse().withStatus(200)));
+ stubFor(delete(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078"))
+ .willReturn(aResponse().withStatus(200)));
+ stubFor(delete(urlMatching(
+ "/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077"))
+ .willReturn(aResponse().withStatus(500).withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*"))
+ .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "text/xml")
+ .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml")));
+
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
+ .willReturn(aResponse().withStatus(200)));
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java
new file mode 100644
index 0000000000..b46d528cc5
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockAAIGenericVnfSearch.java
@@ -0,0 +1,340 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.bpmn.common;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+
+public class MockAAIGenericVnfSearch {
+
+ private static final String EOL = "\n";
+
+ public MockAAIGenericVnfSearch(){
+ String body;
+
+ // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(404)
+ .withHeader("Content-Type", "text/xml")
+ .withBody("Generic VNF Not Found")));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(404)
+ .withHeader("Content-Type", "text/xml")
+ .withBody("Generic VNF Not Found")));
+
+ body =
+ "<generic-vnf xmlns=\"http://com.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>1508691</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>1508692</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>1508691</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>1508692</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>false</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>1508692</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ // The following stubs are for DeleteAAIVfModule
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(500)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("aaiFault.xml")));
+
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(404)
+ .withHeader("Content-Type", "text/xml")
+ .withBody("Generic VNF Not Found")));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000021</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000073</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000020</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000074</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>false</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000075</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000019</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000076</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>false</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000077</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000018</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000078</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ body =
+ "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
+ " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
+ " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
+ " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
+ " <service-id>SDN-MOBILITY</service-id>" + EOL +
+ " <equipment-role>vMMSC</equipment-role>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <in-maint>false</in-maint>" + EOL +
+ " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
+ " <resource-version>0000021</resource-version>" + EOL +
+ " <vf-modules>" + EOL +
+ " <vf-module>" + EOL +
+ " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
+ " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
+ " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
+ " <persona-model-version>1.0</persona-model-version>" + EOL +
+ " <is-base-vf-module>true</is-base-vf-module>" + EOL +
+ " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
+ " <orchestration-status>pending-create</orchestration-status>" + EOL +
+ " <resource-version>0000073</resource-version>" + EOL +
+ " </vf-module>" + EOL +
+ " </vf-modules>" + EOL +
+ " <relationship-list/>" + EOL +
+ " <l-interfaces/>" + EOL +
+ " <lag-interfaces/>" + EOL +
+ "</generic-vnf>" + EOL;
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBody(body)));
+
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java
new file mode 100644
index 0000000000..6a9ff2a4a8
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/MockLoggerDelegate.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.bpmn.common;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+
+public class MockLoggerDelegate implements JavaDelegate {
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ System.out.println("\n\n ..." + MockLoggerDelegate.class.getName() + " invoked by " + "processDefinitionId="
+ + execution.getProcessDefinitionId() + ", activtyId=" + execution.getCurrentActivityId()
+ + ", activtyName='" + execution.getCurrentActivityName() + "'" + ", processInstanceId="
+ + execution.getProcessInstanceId() + ", businessKey=" + execution.getProcessBusinessKey()
+ + ", executionId=" + execution.getId() + " \n\n");
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java
new file mode 100644
index 0000000000..9bcc5593e2
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java
@@ -0,0 +1,761 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid;
+import static org.onap.so.bpmn.mock.StubResponseOof.mockOof;
+import static org.onap.so.bpmn.mock.StubResponseOof.mockOof_500;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.core.domain.AllottedResource;
+import org.onap.so.bpmn.core.domain.CloudFlavor;
+import org.onap.so.bpmn.core.domain.HomingSolution;
+import org.onap.so.bpmn.core.domain.ModelInfo;
+import org.onap.so.bpmn.core.domain.NetworkResource;
+import org.onap.so.bpmn.core.domain.Resource;
+import org.onap.so.bpmn.core.domain.ServiceDecomposition;
+import org.onap.so.bpmn.core.domain.ServiceInstance;
+import org.onap.so.bpmn.core.domain.VnfResource;
+import org.onap.so.bpmn.mock.FileUtil;
+
+
+/**
+ * Test the OOF Homing subflow building block.
+ */
+@Ignore
+public class OofHomingIT extends BaseIntegrationTest {
+
+ ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
+ String subscriber = "";
+ String subscriber2 = "";
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public OofHomingIT() throws IOException {
+ String oofCallback = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackInfraVnf.json");
+ String oofCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf.json");
+ String oofCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf2Net.json");
+
+ String oofCallbackNoSolution = FileUtil.
+ readResourceFile("__files/BuildingBlocks/oofCallbackNoSolutionFound.json");
+ String oofCallbackPolicyException = FileUtil.
+ readResourceFile("__files/BuildingBlocks/oofCallbackPolicyException.json");
+ String oofCallbackServiceException = FileUtil.
+ readResourceFile("__files/BuildingBlocks/oofCallbackServiceException.json");
+
+ callbacks.put("oof", JSON, "oofResponse", oofCallback);
+ callbacks.put("oof2", JSON, "oofResponse", oofCallback2);
+ callbacks.put("oof3", JSON, "oofResponse", oofCallback3);
+ callbacks.put("oofNoSol", JSON, "oofResponse", oofCallbackNoSolution);
+ callbacks.put("oofPolicyEx", JSON, "oofResponse", oofCallbackPolicyException);
+ callbacks.put("oofServiceEx", JSON, "oofResponse", oofCallbackServiceException);
+
+ // Service Model
+ ModelInfo sModel = new ModelInfo();
+ sModel.setModelCustomizationName("testModelCustomizationName");
+ sModel.setModelInstanceName("testModelInstanceName");
+ sModel.setModelInvariantUuid("testModelInvariantId");
+ sModel.setModelName("testModelName");
+ sModel.setModelUuid("testModelUuid");
+ sModel.setModelVersion("testModelVersion");
+ // Service Instance
+ ServiceInstance si = new ServiceInstance();
+ si.setInstanceId("testServiceInstanceId123");
+ // Allotted Resources
+ List<AllottedResource> arList = new ArrayList<AllottedResource>();
+ AllottedResource ar = new AllottedResource();
+ ar.setResourceId("testResourceIdAR");
+ ar.setNfFunction("testARFunctionName");
+ ModelInfo arModel = new ModelInfo();
+ arModel.setModelCustomizationUuid("testModelCustomizationUuidAR");
+ arModel.setModelInvariantUuid("testModelInvariantIdAR");
+ arModel.setModelName("testModelNameAR");
+ arModel.setModelVersion("testModelVersionAR");
+ arModel.setModelUuid("testARModelUuid");
+ arModel.setModelType("testModelTypeAR");
+ ar.setModelInfo(arModel);
+ AllottedResource ar2 = new AllottedResource();
+ ar2.setResourceId("testResourceIdAR2");
+ ar2.setNfFunction("testAR2FunctionName");
+ ModelInfo arModel2 = new ModelInfo();
+ arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2");
+ arModel2.setModelInvariantUuid("testModelInvariantIdAR2");
+ arModel2.setModelName("testModelNameAR2");
+ arModel2.setModelVersion("testModelVersionAR2");
+ arModel2.setModelUuid("testAr2ModelUuid");
+ arModel2.setModelType("testModelTypeAR2");
+ ar2.setModelInfo(arModel2);
+ arList.add(ar);
+ arList.add(ar2);
+ // Vnfs
+ List<VnfResource> vnfList = new ArrayList<VnfResource>();
+ VnfResource vnf = new VnfResource();
+ vnf.setResourceId("testResourceIdVNF");
+ vnf.setNfFunction("testVnfFunctionName");
+ ArrayList<CloudFlavor> flavors = new ArrayList<>();
+ CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx");
+ CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx");
+ flavors.add(flavor1);
+ flavors.add(flavor2);
+ vnf.getHomingSolution().setFlavors(flavors);
+ ModelInfo vnfModel = new ModelInfo();
+ vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
+ vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
+ vnfModel.setModelName("testModelNameVNF");
+ vnfModel.setModelVersion("testModelVersionVNF");
+ vnfModel.setModelUuid("testVnfModelUuid");
+ vnfModel.setModelType("testModelTypeVNF");
+ vnf.setModelInfo(vnfModel);
+ vnfList.add(vnf);
+ System.out.println("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString());
+ serviceDecomposition.setModelInfo(sModel);
+ serviceDecomposition.setAllottedResources(arList);
+ serviceDecomposition.setVnfResources(vnfList);
+ serviceDecomposition.setServiceInstance(si);
+
+ // Subscriber
+ subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+ subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+ }
+
+ @Test
+ public void testHoming_success_2AR1Vnf() throws Exception {
+
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "oof2");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
+ "serviceDecomposition");
+ String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
+
+ Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+ HomingSolution resourceARHoming = resourceAR.getHomingSolution();
+ Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+ HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
+ Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+ HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
+ String resourceARHomingString = resourceARHoming.toString();
+ resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+ String resourceARHoming2String = resourceARHoming2.toString();
+ resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+ String resourceVNFHomingString = resourceVNFHoming.toString();
+ resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+ expectedOofRequest = expectedOofRequest.replaceAll("\\s+", "");
+
+ assertNull(workflowException);
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
+ resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceARHomingString);
+ assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
+ resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
+ null, null), resourceARHoming2String);
+ assertEquals(homingSolutionCloud("cloud","aic", "testCloudRegionId3",
+ true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceVNFHomingString);
+ assertEquals(verifyOofRequest(), expectedOofRequest);
+ }
+
+ @Test
+ public void testHoming_success_2AR1Vnf2Net() throws Exception {
+
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables2(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "oof3");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
+ "serviceDecomposition");
+ String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
+
+ Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+ HomingSolution resourceARHoming = resourceAR.getHomingSolution();
+ Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+ HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
+ Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+ HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
+ Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet");
+ HomingSolution resourceNetHoming = resourceNet.getHomingSolution();
+ Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2");
+ HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution();
+
+ String resourceARHomingString = resourceARHoming.toString();
+ resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+ String resourceARHoming2String = resourceARHoming2.toString();
+ resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+ String resourceVNFHomingString = resourceVNFHoming.toString();
+ resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+ String resourceNetHomingString = resourceNetHoming.toString();
+ resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " ");
+ String resourceNetHoming2String = resourceNetHoming2.toString();
+ resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " ");
+ expectedOofRequest = expectedOofRequest.replaceAll("\\s+", "");
+
+
+ assertNull(workflowException);
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
+ resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceARHomingString);
+ assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
+ resourceARHoming2.getVnf().getResourceId(),
+ "aic", "testCloudRegionId2",
+ null, null), resourceARHoming2String);
+ assertEquals(homingSolutionCloud("cloud","aic",
+ "testCloudRegionId3",
+ true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceVNFHomingString);
+ assertEquals(homingSolutionService("service", "testServiceInstanceIdNet",
+ "testVnfHostNameNet", resourceNetHoming.getVnf().getResourceId(),"aic",
+ "testCloudRegionIdNet",
+ null, null), resourceNetHomingString);
+ assertEquals(homingSolutionCloud("cloud", "aic",
+ "testCloudRegionIdNet2",
+ false, "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""),
+ resourceNetHoming2String);
+ assertEquals(verifyOofRequest(), expectedOofRequest);
+
+ }
+
+ @Test
+ public void testHoming_success_vnfResourceList() throws Exception {
+
+ // Create a Service Decomposition
+ MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4",
+ "/BuildingBlocks/oofCatalogResp.json");
+ String busKey = UUID.randomUUID().toString();
+ Map<String, Object> vars = new HashMap<>();
+ setVariablesForServiceDecomposition(vars, "testRequestId123",
+ "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ invokeSubProcess("DecomposeService", busKey, vars);
+
+ ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
+ System.out.println("In testHoming_success_vnfResourceList, ServiceDecomposition = " + sd);
+ List<VnfResource> vnfResourceList = sd.getVnfResources();
+ vnfResourceList.get(0).setResourceId("test-resource-id-000");
+
+ // Invoke Homing
+
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("homingService", "oof");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", sd);
+ variables.put("subscriberInfo", subscriber2);
+ HashMap customerLocation = new HashMap<String, Object>();
+ customerLocation.put("customerLatitude", "32.89748");
+ customerLocation.put("customerLongitude", "-97.040443");
+ customerLocation.put("customerName", "xyz");
+ variables.put("customerLatitude", "32.89748");
+ variables.put("customerLongitude", "-97.040443");
+ variables.put("customerName", "xyz");
+ variables.put("customerLocation", customerLocation);
+ variables.put("cloudOwner", "amazon");
+ variables.put("cloudRegionId", "TNZED");
+
+ invokeSubProcess("Homing", businessKey, variables);
+ injectWorkflowMessages(callbacks, "oof3");
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
+ "serviceDecomposition");
+ System.out.println("serviceDecompositionExp is: " + serviceDecompositionExp);
+
+ Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000");
+ System.out.println("resourceVnf is: " + resourceVnf);
+ HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution();
+
+ String resourceVnfHomingString = resourceVnfHoming.toString();
+ System.out.println("resourceVnfHomingString is: " + resourceVnfHomingString);
+ resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " ");
+ System.out.println("Now resourceVnfHomingString is: " + resourceVnfHomingString);
+
+ assertNull(workflowException);
+
+ //Verify request
+ String oofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
+ System.out.println("oofRequest is: " + oofRequest);
+ assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf").
+ replaceAll("\n", "").replaceAll("\r", "").
+ replaceAll("\t", ""), oofRequest.replaceAll("\n", "").
+ replaceAll("\r", "").replaceAll("\t", ""));
+
+ //System.out.println("resourceVnfHoming.getVnf().getResourceId() is: " + resourceVnfHoming.getVnf().getResourceId());
+
+ assertEquals(homingSolutionService("service", "service-instance-01234",
+ "MDTNJ01", "test-resource-id-000","att-aic",
+ "mtmnj1a",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," +
+ " \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," +
+ " \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
+ }
+
+ @Test
+ public void testHoming_success_existingLicense() throws Exception {
+
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<String, Object>();
+ setVariablesExistingLicense(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniro");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+ String oofRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+
+ Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+ HomingSolution resourceARHoming = (HomingSolution) resourceAR.getHomingSolution();
+ Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+ HomingSolution resourceARHoming2 = (HomingSolution) resourceAR2.getHomingSolution();
+ Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+ HomingSolution resourceVNFHoming = (HomingSolution) resourceVNF.getHomingSolution();
+ String resourceARHomingString = resourceARHoming.toString();
+ resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+ String resourceARHoming2String = resourceARHoming2.toString();
+ resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+ String resourceVNFHomingString = resourceVNFHoming.toString();
+ resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+ oofRequest = oofRequest.replaceAll("\\s+", "");
+
+ assertNull(workflowException);
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
+ "aic", "dfwtx", "KDTNJ01",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceARHomingString);
+ assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
+ resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
+ null, null), resourceARHoming2String);
+ assertEquals(homingSolutionCloud("cloud", "aic",
+ "testCloudRegionId3",
+ false, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceVNFHomingString);
+ assertEquals(verifyOofRequestExistingLicense(), oofRequest);
+
+ }
+
+ @Test
+ public void testHoming_error_inputVariable() throws Exception {
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables3(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required " +
+ "input variable is missing or null,workStep=*]", workflowException.toString());
+ }
+
+ @Test
+ public void testHoming_error_badResponse() throws Exception {
+ mockOof_500();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=401,errorMessage=Internal Error - BasicAuth value null,workStep=*]", workflowException.toString());
+ }
+
+ @Test
+ public void testHoming_error_oofNoSolution() throws Exception {
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "oofNoSol");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+ Boolean errorMatch = workflowException.toString().contains("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
+ "Response contains error: Unable to find any candidate for demand *** Response:");
+ assert(errorMatch);
+ }
+
+ @Test
+ public void testHoming_error_oofPolicyException() throws Exception {
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "oofPolicyEx");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
+ "Response contains a Request Error Policy Exception: Message content size exceeds the allowable " +
+ "limit]", workflowException.toString());
+ }
+
+ @Test
+ public void testHoming_error_oofServiceException() throws Exception {
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+ injectWorkflowMessages(callbacks, "oofServiceEx");
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
+ "Response contains a Request Error Service Exception: OOF PlacementError: " +
+ "requests.exceptions.HTTPError: 404 Client Error: Not Found for " +
+ "url: http://192.168.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]",
+ workflowException.toString());
+ }
+
+
+ private void setVariables(Map<String, Object> variables) {
+ variables.put("homingService", "oof");
+ HashMap customerLocation = new HashMap<String, Object>();
+ customerLocation.put("customerLatitude", "32.89748");
+ customerLocation.put("customerLongitude", "-97.040443");
+ customerLocation.put("customerName", "xyz");
+ variables.put("customerLatitude", "32.89748");
+ variables.put("customerLongitude", "-97.040443");
+ variables.put("customerName", "xyz");
+ variables.put("customerLocation", customerLocation);
+ variables.put("cloudOwner", "amazon");
+ variables.put("cloudRegionId", "TNZED");
+ variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR");
+ variables.put("vgMuxInfraModelId", "testArModelUuid");
+ // variables.put("mso-request-id", "testRequestId");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId123");
+ variables.put("serviceInstanceName", "testServiceName");
+ variables.put("serviceDecomposition", serviceDecomposition);
+ variables.put("subscriberInfo", subscriber2);
+ }
+
+ private void setVariables2(Map<String, Object> variables) {
+ List<NetworkResource> netList = new ArrayList<NetworkResource>();
+ NetworkResource net = new NetworkResource();
+ net.setResourceId("testResourceIdNet");
+ ModelInfo netModel = new ModelInfo();
+ netModel.setModelCustomizationUuid("testModelCustomizationUuidNet");
+ netModel.setModelInvariantUuid("testModelInvariantIdNet");
+ netModel.setModelName("testModelNameNet");
+ netModel.setModelVersion("testModelVersionNet");
+ net.setModelInfo(netModel);
+ netList.add(net);
+ NetworkResource net2 = new NetworkResource();
+ net2.setResourceId("testResourceIdNet2");
+ ModelInfo netModel2 = new ModelInfo();
+ netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2");
+ netModel2.setModelCustomizationName("testModelCustomizationNameNet2");
+ netModel2.setModelInvariantUuid("testModelInvariantIdNet2");
+ netModel2.setModelName("testModelNameNet2");
+ netModel2.setModelVersion("testModelVersionNet2");
+ net2.setModelInfo(netModel2);
+ netList.add(net2);
+ serviceDecomposition.setNetworkResources(netList);
+
+ variables.put("homingService", "oof");
+ HashMap customerLocation = new HashMap<String, Object>();
+ customerLocation.put("customerLatitude", "32.89748");
+ customerLocation.put("customerLongitude", "-97.040443");
+ customerLocation.put("customerName", "xyz");
+ variables.put("customerLatitude", "32.89748");
+ variables.put("customerLongitude", "-97.040443");
+ variables.put("customerName", "xyz");
+ variables.put("customerLocation", customerLocation);
+ variables.put("cloudOwner", "amazon");
+ variables.put("cloudRegionId", "TNZED");
+ variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR");
+ variables.put("vgMuxInfraModelId", "testArModelUuid");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId123");
+ variables.put("serviceInstanceName", "testServiceName");
+ variables.put("serviceDecomposition", serviceDecomposition);
+ variables.put("subscriberInfo", subscriber2);
+ }
+
+ private void setVariables3(Map<String, Object> variables) {
+ variables.put("homingService", "oof");
+ HashMap customerLocation = new HashMap<String, Object>();
+ customerLocation.put("customerLatitude", "32.89748");
+ customerLocation.put("customerLongitude", "-97.040443");
+ customerLocation.put("customerName", "xyz");
+ variables.put("customerLatitude", "32.89748");
+ variables.put("customerLongitude", "-97.040443");
+ variables.put("customerName", "xyz");
+ variables.put("customerLocation", customerLocation);
+ variables.put("cloudOwner", "amazon");
+ variables.put("cloudRegionId", "TNZED");
+ variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR");
+ variables.put("vgMuxInfraModelId", "testArModelUuid");
+ variables.put("isDebugLogEnabled", "true");
+ // variables.put("mso-request-id", "testRequestId");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId123");
+ variables.put("serviceInstanceName", "testServiceName");
+ variables.put("serviceDecomposition", null);
+ variables.put("subscriberInfo", subscriber2);
+ }
+
+ private void setVariablesExistingLicense(Map<String, Object> variables) {
+ HomingSolution currentHomingSolution = new HomingSolution();
+ serviceDecomposition.getVnfResources().get(0).setCurrentHomingSolution(currentHomingSolution);
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2");
+
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2");
+
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", serviceDecomposition);
+ variables.put("subscriberInfo", subscriber2);
+
+ }
+
+ private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname,
+ String vnfResourceId, String cloudOwner,
+ String cloudRegionId, String enList,
+ String licenseList){
+
+ String solution = "";
+ if(enList == null){
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" +
+ serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" +
+ cloudRegionId + "\", " + "\"vnf\" : { \"resourceId\" : \"" + vnfResourceId +
+ "\", \"resourceType\" : \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" :" +
+ " { }, \"rehome\" : false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { }," +
+ " \"rehome\" : false } }";
+ }else{
+ //language=JSON
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" +
+ serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" +
+ cloudRegionId + "\", \"vnf\" : { \"resourceId\" : \"" + vnfResourceId + "\", \"resourceType\" :" +
+ " \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" : { }, \"rehome\" :" +
+ " false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { \"entitlementPoolList\" :" +
+ " [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
+ }
+ return solution;
+ }
+
+ private String homingSolutionCloud(String type, String cloudOwner,
+ String cloudRegionId, Boolean flavors, String enList,
+ String licenseList){
+ String solution = "";
+ if(enList == null){
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
+ cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
+ "\", \"license\" : { }, \"rehome\" : false } }";
+ } else if (flavors && enList == null){
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
+ cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
+ "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " +
+ "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " +
+ "\"license\" : { }, \"rehome\" : false } }";
+ } else if (flavors) {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
+ cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
+ "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " +
+ "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " +
+ "\"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " +
+ licenseList + " ] }, \"rehome\" : false } }";
+ } else {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
+ cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
+ "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " +
+ licenseList + " ] }, \"rehome\" : false } }";
+ }
+ return solution;
+ }
+
+ private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) {
+ variables.put("homingService", "oof");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", requestId);
+ variables.put("msoRequestId", requestId);
+ variables.put("serviceInstanceId", siId);
+ HashMap customerLocation = new HashMap<String, Object>();
+ customerLocation.put("customerLatitude", "32.89748");
+ customerLocation.put("customerLongitude", "-97.040443");
+ customerLocation.put("customerName", "xyz");
+ variables.put("customerLatitude", "32.89748");
+ variables.put("customerLongitude", "-97.040443");
+ variables.put("customerName", "xyz");
+ variables.put("customerLocation", customerLocation);
+ variables.put("cloudOwner", "amazon");
+ variables.put("cloudRegionId", "TNZED");
+
+
+ String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":" +
+ "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}";
+ variables.put("serviceModelInfo", serviceModelInfo);
+ }
+
+ private String verifyOofRequest() {
+ String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," +
+ "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/oofResponse/testRequestId\"," +
+ "\"sourceId\":\"so\",\"requestType\":\"create\",\"numSolutions\":1,\"optimizers\":[\"placement\"]," +
+ "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":" +
+ "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":" +
+ "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," +
+ "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"testARFunctionName\"" +
+ ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":" +
+ "\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\"," +
+ "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\",\"modelType\":" +
+ "\"\",\"modelVersion\":\"\",\"modelCustomizationName\":\"\"}}," +
+ "{\"resourceModuleName\":\"testAR2FunctionName\",\"serviceResourceId\":\"testResourceIdAR2\"," +
+ "\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\"," +
+ "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\"," +
+ "\"modelType\":\"\",\"modelVersion\":\"\"," +
+ "\"modelCustomizationName\":\"\"}},{\"resourceModuleName\":\"testVnfFunctionName\",\"serviceResourceId\":\"" +
+ "testResourceIdVNF\",\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\"" +
+ ":\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":\"" +
+ "testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\"" +
+ ",\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":" +
+ "{\"serviceInstanceId\":\"testServiceInstanceId123\"," +
+ "\"serviceName\":\"testServiceName\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":" +
+ "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\"," +
+ "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\"" +
+ "\"}}}";
+ return request;
+ }
+
+ private String verifyOofRequestExistingLicense(){
+ String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," +
+ "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\"," +
+ "\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"]," +
+ "\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\"," +
+ "\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":" +
+ "\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":" +
+ "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," +
+ "\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":" +
+ "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\"," +
+ "\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\"," +
+ "\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\"," +
+ "\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":" +
+ "\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":" +
+ "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":" +
+ "\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\"," +
+ "\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\"," +
+ "\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\"," +
+ "\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":" +
+ "[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\"," +
+ "\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":" +
+ "\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\"," +
+ "\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\"," +
+ "\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}," +
+ "\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\"," +
+ "\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\"," +
+ "\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":" +
+ "\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
+ return request;
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
new file mode 100644
index 0000000000..33e444310f
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
@@ -0,0 +1,771 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.core.domain.AllottedResource;
+import org.onap.so.bpmn.core.domain.CloudFlavor;
+import org.onap.so.bpmn.core.domain.HomingSolution;
+import org.onap.so.bpmn.core.domain.ModelInfo;
+import org.onap.so.bpmn.core.domain.NetworkResource;
+import org.onap.so.bpmn.core.domain.Resource;
+import org.onap.so.bpmn.core.domain.ServiceDecomposition;
+import org.onap.so.bpmn.core.domain.ServiceInstance;
+import org.onap.so.bpmn.core.domain.VnfResource;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.logger.MsoLogger;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid;
+import static org.onap.so.bpmn.mock.StubResponseOof.mockOof;
+import static org.onap.so.bpmn.mock.StubResponseOof.mockOof_500;
+
+
+/**
+ * Test the OOF Homing subflow building block.
+ */
+@Ignore
+public class OofHomingTestIT extends BaseIntegrationTest {
+
+ MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class);
+
+ ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
+ String subscriber = "";
+ String subscriber2 = "";
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public OofHomingTestIT() throws IOException {
+ String oofCallback = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackInfraVnf");
+ String oofCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf");
+ String oofCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf2Net");
+
+ String oofCallbackNoSolution = FileUtil.
+ readResourceFile("__files/BuildingBlocks/oofCallbackNoSolutionFound");
+ String oofCallbackPolicyException = FileUtil.
+ readResourceFile("__files/BuildingBlocks/oofCallbackPolicyException");
+ String oofCallbackServiceException = FileUtil.
+ readResourceFile("__files/BuildingBlocks/oofCallbackServiceException");
+
+ callbacks.put("oof", JSON, "oofResponse", oofCallback);
+ callbacks.put("oof2", JSON, "oofResponse", oofCallback2);
+ callbacks.put("oof3", JSON, "oofResponse", oofCallback3);
+ callbacks.put("oofNoSol", JSON, "oofResponse", oofCallbackNoSolution);
+ callbacks.put("oofPolicyEx", JSON, "oofResponse", oofCallbackPolicyException);
+ callbacks.put("oofServiceEx", JSON, "oofResponse", oofCallbackServiceException);
+
+ // Service Model
+ ModelInfo sModel = new ModelInfo();
+ sModel.setModelCustomizationName("testModelCustomizationName");
+ sModel.setModelInstanceName("testModelInstanceName");
+ sModel.setModelInvariantUuid("testModelInvariantId");
+ sModel.setModelName("testModelName");
+ sModel.setModelUuid("testModelUuid");
+ sModel.setModelVersion("testModelVersion");
+ // Service Instance
+ ServiceInstance si = new ServiceInstance();
+ si.setInstanceId("testServiceInstanceId123");
+ // Allotted Resources
+ List<AllottedResource> arList = new ArrayList<AllottedResource>();
+ AllottedResource ar = new AllottedResource();
+ ar.setResourceId("testResourceIdAR");
+ ar.setResourceInstanceName("testARInstanceName");
+ ModelInfo arModel = new ModelInfo();
+ arModel.setModelCustomizationUuid("testModelCustomizationUuidAR");
+ arModel.setModelInvariantUuid("testModelInvariantIdAR");
+ arModel.setModelName("testModelNameAR");
+ arModel.setModelVersion("testModelVersionAR");
+ arModel.setModelUuid("testARModelUuid");
+ arModel.setModelType("testModelTypeAR");
+ ar.setModelInfo(arModel);
+ AllottedResource ar2 = new AllottedResource();
+ ar2.setResourceId("testResourceIdAR2");
+ ar2.setResourceInstanceName("testAR2InstanceName");
+ ModelInfo arModel2 = new ModelInfo();
+ arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2");
+ arModel2.setModelInvariantUuid("testModelInvariantIdAR2");
+ arModel2.setModelName("testModelNameAR2");
+ arModel2.setModelVersion("testModelVersionAR2");
+ arModel2.setModelUuid("testAr2ModelUuid");
+ arModel2.setModelType("testModelTypeAR2");
+ ar2.setModelInfo(arModel2);
+ arList.add(ar);
+ arList.add(ar2);
+ // Vnfs
+ List<VnfResource> vnfList = new ArrayList<VnfResource>();
+ VnfResource vnf = new VnfResource();
+ vnf.setResourceId("testResourceIdVNF");
+ vnf.setResourceInstanceName("testVnfInstanceName");
+ ArrayList<CloudFlavor> flavors = new ArrayList<>();
+ CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx");
+ CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx");
+ flavors.add(flavor1);
+ flavors.add(flavor2);
+ vnf.getHomingSolution().setFlavors(flavors);
+ ModelInfo vnfModel = new ModelInfo();
+ vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
+ vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
+ vnfModel.setModelName("testModelNameVNF");
+ vnfModel.setModelVersion("testModelVersionVNF");
+ vnfModel.setModelUuid("testVnfModelUuid");
+ vnfModel.setModelType("testModelTypeVNF");
+ vnf.setModelInfo(vnfModel);
+ vnfList.add(vnf);
+ logger.debug("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString());
+ serviceDecomposition.setModelInfo(sModel);
+ serviceDecomposition.setAllottedResources(arList);
+ serviceDecomposition.setVnfResources(vnfList);
+ serviceDecomposition.setServiceInstance(si);
+
+ // Subscriber
+ subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+ subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+ }
+
+ @Test
+
+ public void testHoming_success_2AR1Vnf() throws Exception {
+
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "oof2");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
+ "serviceDecomposition");
+ String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
+
+ Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+ HomingSolution resourceARHoming = resourceAR.getHomingSolution();
+ Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+ HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
+ Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+ HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
+ String resourceARHomingString = resourceARHoming.toString();
+ resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+ String resourceARHoming2String = resourceARHoming2.toString();
+ resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+ String resourceVNFHomingString = resourceVNFHoming.toString();
+ resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+ expectedOofRequest = expectedOofRequest.replaceAll("\\s+", "");
+
+ assertNull(workflowException);
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
+ resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceARHomingString);
+ assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
+ resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
+ null, null), resourceARHoming2String);
+ assertEquals(homingSolutionCloud("cloud","aic", "testCloudRegionId3",
+ true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceVNFHomingString);
+ assertEquals(verifyOofRequest(), expectedOofRequest);
+ }
+
+ @Test
+
+ public void testHoming_success_2AR1Vnf2Net() throws Exception {
+
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables2(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "oof3");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
+ "serviceDecomposition");
+ String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
+
+ Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+ HomingSolution resourceARHoming = resourceAR.getHomingSolution();
+ Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+ HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
+ Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+ HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
+ Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet");
+ HomingSolution resourceNetHoming = resourceNet.getHomingSolution();
+ Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2");
+ HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution();
+
+ String resourceARHomingString = resourceARHoming.toString();
+ resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+ String resourceARHoming2String = resourceARHoming2.toString();
+ resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+ String resourceVNFHomingString = resourceVNFHoming.toString();
+ resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+ String resourceNetHomingString = resourceNetHoming.toString();
+ resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " ");
+ String resourceNetHoming2String = resourceNetHoming2.toString();
+ resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " ");
+ expectedOofRequest = expectedOofRequest.replaceAll("\\s+", "");
+
+
+ assertNull(workflowException);
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
+ resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceARHomingString);
+ assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
+ resourceARHoming2.getVnf().getResourceId(),
+ "aic", "testCloudRegionId2",
+ null, null), resourceARHoming2String);
+ assertEquals(homingSolutionCloud("cloud","aic",
+ "testCloudRegionId3",
+ true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceVNFHomingString);
+ assertEquals(homingSolutionService("service", "testServiceInstanceIdNet",
+ "testVnfHostNameNet", resourceNetHoming.getVnf().getResourceId(),"aic",
+ "testCloudRegionIdNet",
+ null, null), resourceNetHomingString);
+ assertEquals(homingSolutionCloud("cloud", "aic",
+ "testCloudRegionIdNet2",
+ false, "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""),
+ resourceNetHoming2String);
+ assertEquals(verifyOofRequest(), expectedOofRequest);
+
+ }
+
+ @Test
+
+
+ public void testHoming_success_vnfResourceList() throws Exception {
+
+ // Create a Service Decomposition
+ MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4",
+ "/BuildingBlocks/oofCatalogResp.json");
+ String busKey = UUID.randomUUID().toString();
+ Map<String, Object> vars = new HashMap<>();
+ setVariablesForServiceDecomposition(vars, "testRequestId123",
+ "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ invokeSubProcess("DecomposeService", busKey, vars);
+
+ ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey,
+ "serviceDecomposition");
+ logger.debug("In testHoming_success_vnfResourceList, ServiceDecomposition = " + sd);
+ List<VnfResource> vnfResourceList = sd.getVnfResources();
+//logger.debug(" vnfResourceList = " + vnfResourceList);
+ vnfResourceList.get(0).setResourceId("test-resource-id-000");
+
+ // Invoke Homing
+
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("homingService", "oof");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", sd);
+ variables.put("subscriberInfo", subscriber2);
+ HashMap customerLocation = new HashMap<String, Object>();
+ customerLocation.put("customerLatitude", "32.89748");
+ customerLocation.put("customerLongitude", "-97.040443");
+ customerLocation.put("customerName", "xyz");
+ variables.put("customerLatitude", "32.89748");
+ variables.put("customerLongitude", "-97.040443");
+ variables.put("customerName", "xyz");
+ variables.put("customerLocation", customerLocation);
+ variables.put("cloudOwner", "amazon");
+ variables.put("cloudRegionId", "TNZED");
+
+ invokeSubProcess("Homing", businessKey, variables);
+ injectWorkflowMessages(callbacks, "oof3");
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
+ "serviceDecomposition");
+ logger.debug("serviceDecompositionExp is: " + serviceDecompositionExp);
+
+ Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000");
+ logger.debug("resourceVnf is: " + resourceVnf);
+ HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution();
+
+ String resourceVnfHomingString = resourceVnfHoming.toString();
+ logger.debug("resourceVnfHomingString is: " + resourceVnfHomingString);
+ resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " ");
+ logger.debug("Now resourceVnfHomingString is: " + resourceVnfHomingString);
+
+ assertNull(workflowException);
+
+ //Verify request
+ String oofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
+ logger.debug("oofRequest is: " + oofRequest);
+ assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf").
+ replaceAll("\n", "").replaceAll("\r", "").
+ replaceAll("\t", ""), oofRequest.replaceAll("\n", "").
+ replaceAll("\r", "").replaceAll("\t", ""));
+
+ //logger.debug("resourceVnfHoming.getVnf().getResourceId() is: " + resourceVnfHoming.getVnf().getResourceId());
+
+ assertEquals(homingSolutionService("service", "service-instance-01234",
+ "MDTNJ01", "test-resource-id-000","att-aic",
+ "mtmnj1a",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," +
+ " \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," +
+ " \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
+ }
+
+ @Test
+ public void testHoming_success_existingLicense() throws Exception {
+
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<String, Object>();
+ setVariablesExistingLicense(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniro");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+ String oofRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+
+ Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+ HomingSolution resourceARHoming = (HomingSolution) resourceAR.getHomingSolution();
+ Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+ HomingSolution resourceARHoming2 = (HomingSolution) resourceAR2.getHomingSolution();
+ Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+ HomingSolution resourceVNFHoming = (HomingSolution) resourceVNF.getHomingSolution();
+ String resourceARHomingString = resourceARHoming.toString();
+ resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+ String resourceARHoming2String = resourceARHoming2.toString();
+ resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+ String resourceVNFHomingString = resourceVNFHoming.toString();
+ resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+ oofRequest = oofRequest.replaceAll("\\s+", "");
+
+ assertNull(workflowException);
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
+ "aic", "dfwtx", "KDTNJ01",
+ "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceARHomingString);
+ assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
+ resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
+ null, null), resourceARHoming2String);
+ assertEquals(homingSolutionCloud("cloud", "aic",
+ "testCloudRegionId3",
+ false, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
+ resourceVNFHomingString);
+ assertEquals(verifyOofRequestExistingLicense(), oofRequest);
+
+ }
+
+ @Test
+
+ public void testHoming_error_inputVariable() throws Exception {
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables3(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required " +
+ "input variable is missing or null]", workflowException.toString());
+ }
+
+ @Test
+
+ public void testHoming_error_badResponse() throws Exception {
+ mockOof_500();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a " +
+ "Bad Sync Response from Sniro/OOF.]", workflowException.toString());
+ }
+
+ @Test
+
+ public void testHoming_error_oofNoSolution() throws Exception {
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "oofNoSol");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found " +
+ "for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString());
+ }
+
+ @Test
+
+ public void testHoming_error_oofPolicyException() throws Exception {
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "oofPolicyEx");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
+ "Response contains a Request Error Policy Exception: Message content size exceeds the allowable " +
+ "limit]", workflowException.toString());
+ }
+
+ @Test
+
+ public void testHoming_error_oofServiceException() throws Exception {
+ mockOof();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "oofServiceEx");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
+ "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
+ "Response contains a Request Error Service Exception: OOF PlacementError: " +
+ "requests.exceptions.HTTPError: 404 Client Error: Not Found for " +
+ "url: http://192.168.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]",
+ workflowException.toString());
+ }
+
+
+ private void setVariables(Map<String, Object> variables) {
+ variables.put("homingService", "oof");
+ HashMap customerLocation = new HashMap<String, Object>();
+ customerLocation.put("customerLatitude", "32.89748");
+ customerLocation.put("customerLongitude", "-97.040443");
+ customerLocation.put("customerName", "xyz");
+ variables.put("customerLatitude", "32.89748");
+ variables.put("customerLongitude", "-97.040443");
+ variables.put("customerName", "xyz");
+ variables.put("customerLocation", customerLocation);
+ variables.put("cloudOwner", "amazon");
+ variables.put("cloudRegionId", "TNZED");
+ variables.put("isDebugLogEnabled", "true");
+ // variables.put("mso-request-id", "testRequestId");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", serviceDecomposition);
+ variables.put("subscriberInfo", subscriber2);
+ }
+
+ private void setVariables2(Map<String, Object> variables) {
+ List<NetworkResource> netList = new ArrayList<NetworkResource>();
+ NetworkResource net = new NetworkResource();
+ net.setResourceId("testResourceIdNet");
+ ModelInfo netModel = new ModelInfo();
+ netModel.setModelCustomizationUuid("testModelCustomizationUuidNet");
+ netModel.setModelInvariantUuid("testModelInvariantIdNet");
+ netModel.setModelName("testModelNameNet");
+ netModel.setModelVersion("testModelVersionNet");
+ net.setModelInfo(netModel);
+ netList.add(net);
+ NetworkResource net2 = new NetworkResource();
+ net2.setResourceId("testResourceIdNet2");
+ ModelInfo netModel2 = new ModelInfo();
+ netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2");
+ netModel2.setModelCustomizationName("testModelCustomizationNameNet2");
+ netModel2.setModelInvariantUuid("testModelInvariantIdNet2");
+ netModel2.setModelName("testModelNameNet2");
+ netModel2.setModelVersion("testModelVersionNet2");
+ net2.setModelInfo(netModel2);
+ netList.add(net2);
+ serviceDecomposition.setNetworkResources(netList);
+
+ variables.put("homingService", "oof");
+ HashMap customerLocation = new HashMap<String, Object>();
+ customerLocation.put("customerLatitude", "32.89748");
+ customerLocation.put("customerLongitude", "-97.040443");
+ customerLocation.put("customerName", "xyz");
+ variables.put("customerLatitude", "32.89748");
+ variables.put("customerLongitude", "-97.040443");
+ variables.put("customerName", "xyz");
+ variables.put("customerLocation", customerLocation);
+ variables.put("cloudOwner", "amazon");
+ variables.put("cloudRegionId", "TNZED");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", serviceDecomposition);
+ variables.put("subscriberInfo", subscriber2);
+ }
+
+ private void setVariables3(Map<String, Object> variables) {
+ variables.put("homingService", "oof");
+ HashMap customerLocation = new HashMap<String, Object>();
+ customerLocation.put("customerLatitude", "32.89748");
+ customerLocation.put("customerLongitude", "-97.040443");
+ customerLocation.put("customerName", "xyz");
+ variables.put("customerLatitude", "32.89748");
+ variables.put("customerLongitude", "-97.040443");
+ variables.put("customerName", "xyz");
+ variables.put("customerLocation", customerLocation);
+ variables.put("cloudOwner", "amazon");
+ variables.put("cloudRegionId", "TNZED");
+ variables.put("isDebugLogEnabled", "true");
+ // variables.put("mso-request-id", "testRequestId");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", null);
+ variables.put("subscriberInfo", subscriber2);
+ }
+
+ private void setVariablesExistingLicense(Map<String, Object> variables) {
+ HomingSolution currentHomingSolution = new HomingSolution();
+ serviceDecomposition.getVnfResources().get(0).setCurrentHomingSolution(currentHomingSolution);
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2");
+
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2");
+
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", serviceDecomposition);
+ variables.put("subscriberInfo", subscriber2);
+
+ }
+
+ private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname,
+ String vnfResourceId, String cloudOwner,
+ String cloudRegionId, String enList,
+ String licenseList){
+
+ String solution = "";
+ if(enList == null){
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" +
+ serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" +
+ cloudRegionId + "\", " + "\"vnf\" : { \"resourceId\" : \"" + vnfResourceId +
+ "\", \"resourceType\" : \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" :" +
+ " { }, \"rehome\" : false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { }," +
+ " \"rehome\" : false } }";
+ }else{
+ //language=JSON
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" +
+ serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" +
+ cloudRegionId + "\", \"vnf\" : { \"resourceId\" : \"" + vnfResourceId + "\", \"resourceType\" :" +
+ " \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" : { }, \"rehome\" :" +
+ " false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { \"entitlementPoolList\" :" +
+ " [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
+ }
+ return solution;
+ }
+
+ private String homingSolutionCloud(String type, String cloudOwner,
+ String cloudRegionId, Boolean flavors, String enList,
+ String licenseList){
+ String solution = "";
+ if(enList == null){
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
+ cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
+ "\", \"license\" : { }, \"rehome\" : false } }";
+ } else if (flavors && enList == null){
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
+ cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
+ "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " +
+ "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " +
+ "\"license\" : { }, \"rehome\" : false } }";
+ } else if (flavors) {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
+ cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
+ "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " +
+ "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " +
+ "\"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " +
+ licenseList + " ] }, \"rehome\" : false } }";
+ } else {
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
+ cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
+ "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " +
+ licenseList + " ] }, \"rehome\" : false } }";
+ }
+ return solution;
+ }
+
+ private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) {
+ variables.put("homingService", "oof");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", requestId);
+ variables.put("msoRequestId", requestId);
+ variables.put("serviceInstanceId", siId);
+ HashMap customerLocation = new HashMap<String, Object>();
+ customerLocation.put("customerLatitude", "32.89748");
+ customerLocation.put("customerLongitude", "-97.040443");
+ customerLocation.put("customerName", "xyz");
+ variables.put("customerLatitude", "32.89748");
+ variables.put("customerLongitude", "-97.040443");
+ variables.put("customerName", "xyz");
+ variables.put("customerLocation", customerLocation);
+ variables.put("cloudOwner", "amazon");
+ variables.put("cloudRegionId", "TNZED");
+
+
+ String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":" +
+ "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}";
+ variables.put("serviceModelInfo", serviceModelInfo);
+ }
+
+ private String verifyOofRequest() {
+ String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," +
+ "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/oofResponse/testRequestId\"," +
+ "\"sourceId\":\"so\",\"requestType\":\"create\",\"numSolutions\":1,\"optimizers\":[\"placement\"]," +
+ "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":" +
+ "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":" +
+ "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," +
+ "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"ALLOTTED_RESOURCE\"" +
+ ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":" +
+ "\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR\"," +
+ "\"modelVersionId\":\"testARModelUuid\",\"modelName\":\"testModelNameAR\",\"modelType\":" +
+ "\"testModelTypeAR\",\"modelVersion\":\"testModelVersionAR\",\"modelCustomizationName\":\"\"}}," +
+ "{\"resourceModuleName\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\"," +
+ "\"tenantId\":\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR2\"," +
+ "\"modelVersionId\":\"testAr2ModelUuid\",\"modelName\":\"testModelNameAR2\"," +
+ "\"modelType\":\"testModelTypeAR2\",\"modelVersion\":\"testModelVersionAR2\"," +
+ "\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":" +
+ "{\"serviceInstanceId\":\"testServiceInstanceId123\"," +
+ "\"serviceName\":\"null\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":" +
+ "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\"," +
+ "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\"" +
+ "\"}},\"licenseInfo\":{\"licenseDemands\":[{\"resourceModuleName\":\"VNF\",\"serviceResourceId\":" +
+ "\"testResourceIdVNF\",\"resourceInstanceType\":\"VNF\",\"resourceModelInfo\":{\"modelInvariantId\":" +
+ "\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":" +
+ "\"testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\"," +
+ "\"modelCustomizationName\":\"\"}}]}}";
+ return request;
+ }
+
+ private String verifyOofRequestExistingLicense(){
+ String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," +
+ "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\"," +
+ "\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"]," +
+ "\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\"," +
+ "\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":" +
+ "\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":" +
+ "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," +
+ "\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":" +
+ "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\"," +
+ "\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\"," +
+ "\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\"," +
+ "\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":" +
+ "\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":" +
+ "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":" +
+ "\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\"," +
+ "\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\"," +
+ "\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\"," +
+ "\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":" +
+ "[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\"," +
+ "\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":" +
+ "\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\"," +
+ "\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\"," +
+ "\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}," +
+ "\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\"," +
+ "\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\"," +
+ "\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":" +
+ "\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
+ return request;
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java
new file mode 100644
index 0000000000..b8ae341361
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java
@@ -0,0 +1,208 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockAAIVfModuleBadPatch;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.camunda.bpm.engine.test.Deployment;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit tests for PrepareUpdateAAIVfModule.bpmn.
+ */
+
+public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest {
+
+ MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,PrepareUpdateAAIVfModuleIT.class);
+
+ /**
+ * Test the happy path through the flow.
+ */
+ @Test
+
+ public void happyPath() throws IOException {
+
+ logStart();
+
+ String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
+
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200);
+ MockPatchVfModuleId("skask", "supercool");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+ invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode");
+ logger.debug("Subflow response code: " + responseCode);
+ logger.debug("Subflow response: " + response);
+ Assert.assertEquals(200, responseCode.intValue());
+ String heatStackId = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_heatStackId");
+ logger.debug("Ouput heat-stack-id:" + heatStackId);
+ Assert.assertEquals("slowburn", heatStackId);
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI returns a 404.
+ */
+ @Test
+
+ public void badGet() throws IOException {
+
+ logStart();
+
+ String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
+ MockGetGenericVnfById_404("skask[?]depth=1");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+ invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponseCode");
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ logger.debug("Subflow response code: " + responseCode);
+ logger.debug("Subflow response: " + response);
+ Assert.assertEquals(404, responseCode.intValue());
+ Assert.assertNotNull(workflowException);
+ logger.debug("Subflow WorkflowException error message: " + workflowException.getErrorMessage());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the validation of the VF Module fails.
+ */
+ @Test
+
+ public void failValidation1() throws IOException {
+
+ logStart();
+
+ String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "lukewarm");
+
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+ invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ Assert.assertNotNull(workflowException);
+ logger.debug("Subflow WorkflowException error message: " + workflowException.getErrorMessage());
+ Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: Orchestration"));
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the validation of the VF Module fails.
+ */
+ @Test
+
+ public void failValidation2() throws IOException {
+
+ logStart();
+
+ String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml").replaceFirst("supercool", "notsocool");
+
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+ invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ Assert.assertNotNull(workflowException);
+ logger.debug("Subflow WorkflowException error message: " + workflowException.getErrorMessage());
+ Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: VF Module"));
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI is successful, but the subsequent PUT returns 404.
+ */
+ @Test
+
+ public void badPatch() throws IOException {
+
+ logStart();
+
+ String prepareUpdateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/PrepareUpdateAAIVfModuleRequest.xml");
+
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("PrepareUpdateAAIVfModuleRequest", prepareUpdateAAIVfModuleRequest);
+ invokeSubProcess("PrepareUpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode");
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ logger.debug("Subflow response code: " + responseCode);
+ logger.debug("Subflow response: " + response);
+ Assert.assertEquals(404, responseCode.intValue());
+ Assert.assertNotNull(workflowException);
+ logger.debug("Subflow WorkflowException error message: " + workflowException.getErrorMessage());
+
+ logEnd();
+ }
+}
+
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java
new file mode 100644
index 0000000000..7b85edf49a
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/RainyDayHandlerIT.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.onap.so.bpmn.mock.StubResponsePolicy.MockPolicyAbort;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+
+/**
+ * Unit test for RainyDayHandler.bpmn.
+ */
+
+public class RainyDayHandlerIT extends BaseIntegrationTest {
+
+ @Test
+
+ public void TestRainyDayHandlingSuccess() {
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled","true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceType", "X");
+ variables.put("vnfType", "Y");
+ variables.put("currentActivity", "BB1");
+ variables.put("workStep", "1");
+ variables.put("failedActivity", "");
+ variables.put("errorCode", "123");
+ variables.put("errorText", "update failed");
+ variables.put("vnfName", "vSAMP1");
+
+ MockPolicyAbort();
+
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeSubProcess("RainyDayHandler", businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+
+ }
+
+
+
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java
new file mode 100644
index 0000000000..7f3e884601
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ReceiveWorkflowMessageTest.java
@@ -0,0 +1,145 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.camunda.bpm.engine.test.Deployment;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.bpmn.common.WorkflowTest;
+import org.onap.so.bpmn.common.WorkflowTest.CallbackSet;
+import org.onap.so.bpmn.core.WorkflowException;
+
+/**
+ * Unit tests for SDNCAdapterRestV1.
+ */
+@Ignore
+public class ReceiveWorkflowMessageTest extends WorkflowTest {
+
+ private static final String EOL = "\n";
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public ReceiveWorkflowMessageTest() throws IOException {
+ callbacks.put("sdnc-event-success", JSON, "SDNCAEvent",
+ "{" + EOL +
+ " \"SDNCEvent\": {" + EOL +
+ " \"eventType\": \"evenType\"," + EOL +
+ " \"eventCorrelatorType\": \"HOST-NAME\"," + EOL +
+ " \"eventCorrelator\": \"((CORRELATOR))\"," + EOL +
+ " \"params\": {" + EOL +
+ " \"success-indicator\":\"Y\"" + EOL +
+ " }" +EOL +
+ " }" + EOL +
+ "}" + EOL);
+
+ callbacks.put("sdnc-event-fail", JSON, "SDNCAEvent",
+ "{" + EOL +
+ " \"SDNCEvent\": {" + EOL +
+ " \"eventType\": \"evenType\"," + EOL +
+ " \"eventCorrelatorType\": \"HOST-NAME\"," + EOL +
+ " \"eventCorrelator\": \"((CORRELATOR))\"," + EOL +
+ " \"params\": {" + EOL +
+ " \"success-indicator\":\"N\"," + EOL +
+ " \"error-message\":\"SOMETHING BAD HAPPENED\"" + EOL +
+ " }" +EOL +
+ " }" + EOL +
+ "}" + EOL);
+ }
+
+ /**
+ * Test the happy path.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/ReceiveWorkflowMessage.bpmn"
+ })
+ public void happyPath() throws Exception {
+
+ logStart();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("RCVWFMSG_timeout", "PT1M");
+ variables.put("RCVWFMSG_messageType", "SDNCAEvent");
+ variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31");
+
+ invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables);
+ injectWorkflowMessages(callbacks, "sdnc-event-success");
+ waitForProcessEnd(businessKey, 10000);
+
+ String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
+ System.out.println("Response:\n" + response);
+ assertTrue(response.contains("\"SDNCEvent\""));
+ assertTrue((boolean)getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ /**
+ * Test the timeout scenario.
+ */
+ @Test
+ @Deployment(resources = {
+ "subprocess/ReceiveWorkflowMessage.bpmn"
+ })
+ public void timeout() throws Exception {
+
+ logStart();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", "dffbae0e-5588-4bd6-9749-b0f0adb52312");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("RCVWFMSG_timeout", "PT5S");
+ variables.put("RCVWFMSG_messageType", "SDNCAEvent");
+ variables.put("RCVWFMSG_correlator", "USOSTCDALTX0101UJZZ31");
+
+ invokeSubProcess("ReceiveWorkflowMessage", businessKey, variables);
+
+ // No injection
+
+ waitForProcessEnd(businessKey, 10000);
+
+ // There is no response from SDNC, so the flow doesn't set WorkflowResponse.
+ String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
+ assertNull(response);
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ assertNotNull(wfe);
+ System.out.println(wfe.toString());
+ assertEquals("Receive Workflow Message Timeout Error", wfe.getErrorMessage());
+ assertFalse((boolean)getVariableFromHistory(businessKey, "RCVWFMSG_SuccessIndicator"));
+
+ logEnd();
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java
new file mode 100644
index 0000000000..dc5c36f5a7
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterCallbackRule.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import javax.xml.ws.Endpoint;
+
+import org.camunda.bpm.engine.ProcessEngineServices;
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+import org.onap.so.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl;
+
+/**
+ * A JUnit rule that starts the SDNC Adapter Callback Service before
+ * every test, and tears it down after every test. Example:
+ * <pre>
+ * @Rule
+ * public final SDNCAdapterCallbackRule sdncAdapterCallbackRule =
+ * new SDNCAdapterCallbackRule(processEngineRule);
+ * </pre>
+ */
+public class SDNCAdapterCallbackRule implements TestRule {
+ public static final String DEFAULT_ENDPOINT_URL =
+ "http://localhost:28080/mso/SDNCAdapterCallbackService";
+
+ private final ProcessEngineServices processEngineServices;
+ private final String endpointUrl;
+
+ public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices) {
+ this(processEngineServices, DEFAULT_ENDPOINT_URL);
+ }
+
+ public SDNCAdapterCallbackRule(ProcessEngineServices processEngineServices,
+ String endpointUrl) {
+ this.processEngineServices = processEngineServices;
+ this.endpointUrl = endpointUrl;
+ }
+
+ @Override
+ public Statement apply(final Statement baseStmt, Description description) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ Endpoint endpoint = null;
+
+ try {
+ SDNCAdapterCallbackServiceImpl sdncCallbackService = new SDNCAdapterCallbackServiceImpl();
+ sdncCallbackService.setProcessEngineServices4junit(processEngineServices);
+
+ System.setProperty("com.sun.xml.ws.transport.http.HttpAdapter.dump", "true");
+ System.setProperty("com.sun.xml.internal.ws.transport.http.HttpAdapter.dump", "true");
+
+ System.out.println("Publishing Endpoint - " + endpointUrl);
+ endpoint = Endpoint.publish(endpointUrl, sdncCallbackService);
+
+ baseStmt.evaluate();
+ } finally {
+ if (endpoint != null) {
+ System.out.println("Stopping Endpoint - " + endpointUrl);
+ endpoint.stop();
+ }
+ }
+ }
+ };
+ }
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java
new file mode 100644
index 0000000000..baf41d120b
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java
@@ -0,0 +1,120 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit tests for SDNCAdapterRestV2.bpmn.
+ *
+ * This version of SDNCAdapterRest allows for interim notifications to be sent for
+ * any non-final response received from SDNC.
+ */
+
+public class SDNCAdapterRestV2IT extends BaseIntegrationTest {
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,SDNCAdapterRestV2IT.class);
+
+
+ /**
+ * Constructor. Insert callbacks.
+ *
+ * @throws IOException
+ */
+ public SDNCAdapterRestV2IT() throws IOException {
+ String sdncCallbackFinal = FileUtil.readResourceFile("__files/SDNCAdapterRestCallbackFinal.json");
+ String sdncCallbackNonFinal = FileUtil.readResourceFile("__files/SDNCAdapterRestCallbackNonFinal.json");
+ callbacks.put("nonfinal", sdncCallbackNonFinal);
+ callbacks.put("final", sdncCallbackFinal);
+ }
+
+ /**
+ * Test the success path through the subflow.
+ */
+ @Test
+ @Ignore
+ public void success() throws IOException {
+ logStart();
+ mocks();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("mso-request-id", "a4383a52-b9de-4bc4-bedf-02f3f9466535");
+ variables.put("mso-service-instance-id", "fd8bcdbb-b799-43ce-a7ff-ed8f2965a3b5");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("SDNCREST_Request",
+ FileUtil.readResourceFile("__files/SDNCAdapterRestV2Request.json"));
+ variables.put("SDNCREST_InterimNotification1",
+ FileUtil.readResourceFile("__files/SDNCInterimNotification1.json"));
+
+ invokeSubProcess("SDNCAdapterRestV2", businessKey, variables);
+
+ injectSDNCRestCallbacks(callbacks, "nonfinal");
+
+ // First non-final response will have done a notification
+ Object interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
+ Assert.assertNotNull(interimNotification);
+
+ injectSDNCRestCallbacks(callbacks, "nonfinal");
+
+ // Second non-final response will not have done a notification
+ interimNotification = getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
+ Assert.assertNull(interimNotification);
+
+ injectSDNCRestCallbacks(callbacks, "final");
+
+ interimNotification = this.getVariableFromHistory(businessKey, "SDNCREST_interimNotification");
+ Assert.assertNull(interimNotification);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+
+ logEnd();
+ }
+
+ /**
+ * Defines WireMock stubs needed by these tests.
+ */
+ private void mocks() {
+ stubFor(post(urlEqualTo("/SDNCAdapter/v1/sdnc"))
+ .willReturn(aResponse()
+ .withStatus(202)
+ .withHeader("Content-Type", "application/json")));
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java
new file mode 100644
index 0000000000..9239889f28
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SPIPropertiesTest.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.onap.so.client.RestPropertiesLoader;
+import org.onap.so.client.aai.AAIProperties;
+import org.onap.so.client.dmaap.DmaapProperties;
+import org.onap.so.client.dmaap.DmaapPropertiesLoader;
+import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
+
+public class SPIPropertiesTest {
+
+ @BeforeClass
+ public static void beforeClass() {
+ System.setProperty("mso.config.path", "src/test/resources");
+ }
+
+ @Test
+ public void notEqual() {
+ DmaapProperties one = DmaapPropertiesLoader.getInstance().getNewImpl();
+ DmaapProperties two = DmaapPropertiesLoader.getInstance().getNewImpl();
+ assertNotEquals(one, two);
+ }
+ @Test
+ public void equal() {
+ DmaapProperties one = DmaapPropertiesLoader.getInstance().getImpl();
+ DmaapProperties two = DmaapPropertiesLoader.getInstance().getImpl();
+ assertEquals(one, two);
+ }
+ @Test
+ public void restNotEqual() {
+ AAIProperties one = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class);
+ AAIProperties two = RestPropertiesLoader.getInstance().getNewImpl(AAIProperties.class);
+ assertNotEquals(one, two);
+ }
+ @Test
+ public void restEqual() {
+ AAIProperties one = RestPropertiesLoader.getInstance().getImpl(AAIProperties.class);
+ AAIProperties two = RestPropertiesLoader.getInstance().getImpl(AAIProperties.class);
+ assertEquals(one, two);
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java
new file mode 100644
index 0000000000..f780b694aa
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java
@@ -0,0 +1,549 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid;
+import static org.onap.so.bpmn.mock.StubResponseSNIRO.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.camunda.bpm.engine.test.Deployment;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.core.domain.*;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.logger.MsoLogger;
+
+
+/**
+ * Test the SNIRO Homing subflow building block.
+ */
+@Ignore
+public class SniroHomingV1IT extends BaseIntegrationTest {
+
+ MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,SniroHomingV1IT.class);
+
+
+ ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
+ String subscriber = "";
+ String subscriber2 = "";
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public SniroHomingV1IT() throws IOException {
+ String sniroCallback = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf");
+ String sniroCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf2Net");
+ String sniroCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackInfraVnf");
+ String sniroCallbackNoSolution = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackNoSolutionFound");
+ String sniroCallbackPolicyException = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackPolicyException");
+ String sniroCallbackServiceException = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackServiceException");
+ callbacks.put("sniro", JSON, "SNIROResponse", sniroCallback);
+ callbacks.put("sniro2", JSON, "SNIROResponse", sniroCallback2);
+ callbacks.put("sniro3", JSON, "SNIROResponse", sniroCallback3);
+ callbacks.put("sniroNoSol", JSON, "SNIROResponse", sniroCallbackNoSolution);
+ callbacks.put("sniroPolicyEx", JSON, "SNIROResponse", sniroCallbackPolicyException);
+ callbacks.put("sniroServiceEx", JSON, "SNIROResponse", sniroCallbackServiceException);
+
+ // Service Model
+ ModelInfo sModel = new ModelInfo();
+ sModel.setModelCustomizationUuid("testModelCustomizationUuid");
+ sModel.setModelInstanceName("testModelInstanceName");
+ sModel.setModelInvariantUuid("testModelInvariantId");
+ sModel.setModelName("testModelName");
+ sModel.setModelUuid("testModelUuid");
+ sModel.setModelVersion("testModelVersion");
+ // Service Instance
+ ServiceInstance si = new ServiceInstance();
+ si.setInstanceId("testServiceInstanceId123");
+ // Allotted Resources
+ List<AllottedResource> arList = new ArrayList<AllottedResource>();
+ AllottedResource ar = new AllottedResource();
+ ar.setResourceId("testResourceIdAR");
+ ar.setResourceInstanceName("testARInstanceName");
+ ModelInfo arModel = new ModelInfo();
+ arModel.setModelCustomizationUuid("testModelCustomizationUuidAR");
+ arModel.setModelInvariantUuid("testModelInvariantIdAR");
+ arModel.setModelName("testModelNameAR");
+ arModel.setModelVersion("testModelVersionAR");
+ arModel.setModelUuid("testARModelUuid");
+ arModel.setModelType("testModelTypeAR");
+ ar.setModelInfo(arModel);
+ AllottedResource ar2 = new AllottedResource();
+ ar2.setResourceId("testResourceIdAR2");
+ ar2.setResourceInstanceName("testAR2InstanceName");
+ ModelInfo arModel2 = new ModelInfo();
+ arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2");
+ arModel2.setModelInvariantUuid("testModelInvariantIdAR2");
+ arModel2.setModelName("testModelNameAR2");
+ arModel2.setModelVersion("testModelVersionAR2");
+ arModel2.setModelUuid("testAr2ModelUuid");
+ arModel2.setModelType("testModelTypeAR2");
+ ar2.setModelInfo(arModel2);
+ arList.add(ar);
+ arList.add(ar2);
+ // Vnfs
+ List<VnfResource> vnfList = new ArrayList<VnfResource>();
+ VnfResource vnf = new VnfResource();
+ vnf.setResourceId("testResourceIdVNF");
+ vnf.setResourceInstanceName("testVnfInstanceName");
+ ModelInfo vnfModel = new ModelInfo();
+ vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
+ vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
+ vnfModel.setModelName("testModelNameVNF");
+ vnfModel.setModelVersion("testModelVersionVNF");
+ vnfModel.setModelUuid("testVnfModelUuid");
+ vnfModel.setModelType("testModelTypeVNF");
+ vnf.setModelInfo(vnfModel);
+ vnfList.add(vnf);
+ logger.debug("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString());
+ serviceDecomposition.setModelInfo(sModel);
+ serviceDecomposition.setAllottedResources(arList);
+ serviceDecomposition.setVnfResources(vnfList);
+ serviceDecomposition.setServiceInstance(si);
+
+ // Subscriber
+ subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+ subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
+ }
+
+ @Test
+ // 1802 merge
+
+ public void testHoming_success_2AR1Vnf() throws Exception {
+
+ mockSNIRO();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniro");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+ String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+
+ Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+ HomingSolution resourceARHoming = resourceAR.getHomingSolution();
+ Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+ HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
+ Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+ HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
+ String resourceARHomingString = resourceARHoming.toString();
+ resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+ String resourceARHoming2String = resourceARHoming2.toString();
+ resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+ String resourceVNFHomingString = resourceVNFHoming.toString();
+ resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+ expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", "");
+
+ assertNull(workflowException);
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString);
+ assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String);
+ assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString);
+ assertEquals(verifySniroRequest(), expectedSniroRequest);
+
+ }
+
+ @Test
+ // 1802 merge
+
+ public void testHoming_success_2AR1Vnf2Net() throws Exception {
+
+ mockSNIRO();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables2(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniro2");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+ String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+
+ Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+ HomingSolution resourceARHoming = resourceAR.getHomingSolution();
+ Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+ HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
+ Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+ HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
+ Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet");
+ HomingSolution resourceNetHoming = resourceNet.getHomingSolution();
+ Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2");
+ HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution();
+
+ String resourceARHomingString = resourceARHoming.toString();
+ resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+ String resourceARHoming2String = resourceARHoming2.toString();
+ resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+ String resourceVNFHomingString = resourceVNFHoming.toString();
+ resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+ String resourceNetHomingString = resourceNetHoming.toString();
+ resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " ");
+ String resourceNetHoming2String = resourceNetHoming2.toString();
+ resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " ");
+ expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", "");
+
+ assertNull(workflowException);
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString);
+ assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String);
+ assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString);
+ assertEquals(homingSolutionService("service", "testServiceInstanceIdNet", "testVnfHostNameNet", "aic", "testCloudRegionIdNet", "testAicClliNet", "3.0", null, null), resourceNetHomingString);
+ assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionIdNet2", "testAicClliNet2", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"", "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""), resourceNetHoming2String);
+ assertEquals(verifySniroRequest(), expectedSniroRequest);
+ }
+
+ @Test
+ // 1802 merge
+
+ public void testHoming_success_vnfResourceList() throws Exception {
+
+ // Create a Service Decomposition
+ MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4", "/BuildingBlocks/catalogResp.json");
+ String busKey = UUID.randomUUID().toString();
+ Map<String, Object> vars = new HashMap<>();
+ setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
+ invokeSubProcess("DecomposeService", busKey, vars);
+
+ ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
+ List<VnfResource> vnfResourceList = sd.getVnfResources();
+ vnfResourceList.get(0).setResourceId("test-resource-id-000");
+
+ // Invoke Homing
+
+ mockSNIRO();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("homingService", "sniro");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", sd);
+ variables.put("subscriberInfo", subscriber2);
+
+ invokeSubProcess("Homing", businessKey, variables);
+ injectWorkflowMessages(callbacks, "sniro3");
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+
+ Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000");
+ HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution();
+
+ String resourceVnfHomingString = resourceVnfHoming.toString();
+ resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " ");
+
+ assertNull(workflowException);
+
+ //Verify request
+ String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+ assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/sniroRequest_infravnf").replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""), sniroRequest.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""));
+
+ assertEquals(homingSolutionService("service", "service-instance-01234", "MDTNJ01", "att-aic", "mtmnj1a", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
+ }
+
+ @Test
+
+ public void testHoming_success_existingLicense() throws Exception {
+
+ mockSNIRO();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<String, Object>();
+ setVariablesExistingLicense(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniro");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
+ String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
+
+ Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
+ HomingSolution resourceARHoming = resourceAR.getHomingSolution();
+ Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
+ HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
+ Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
+ HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
+ String resourceARHomingString = resourceARHoming.toString();
+ resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
+ String resourceARHoming2String = resourceARHoming2.toString();
+ resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
+ String resourceVNFHomingString = resourceVNFHoming.toString();
+ resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
+ sniroRequest = sniroRequest.replaceAll("\\s+", "");
+
+ assertNull(workflowException);
+ assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString);
+ assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String);
+ assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString);
+ assertEquals(verifySniroRequest_existingLicense(), sniroRequest);
+
+ }
+
+
+ @Test
+
+ public void testHoming_error_inputVariable() throws Exception {
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables3(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required input variable is missing or null]", workflowException.toString());
+ }
+
+ @Test
+
+ public void testHoming_error_badResponse() throws Exception {
+ mockSNIRO_500();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a Bad Sync Response from Sniro/OOF.]", workflowException.toString());
+ }
+
+ @Test
+ // 1802 merge
+
+ public void testHoming_error_sniroNoSolution() throws Exception {
+ mockSNIRO();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniroNoSol");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString());
+ }
+
+ @Test
+
+ public void testHoming_error_sniroPolicyException() throws Exception {
+ mockSNIRO();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniroPolicyEx");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Policy Exception: Message content size exceeds the allowable limit]", workflowException.toString());
+ }
+
+ @Test
+
+ public void testHoming_error_sniroServiceException() throws Exception {
+ mockSNIRO();
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariables(variables);
+
+ invokeSubProcess("Homing", businessKey, variables);
+
+ injectWorkflowMessages(callbacks, "sniroServiceEx");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ //Get Variables
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+
+ assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Service Exception: SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]", workflowException.toString());
+ }
+
+
+
+ private void setVariables(Map<String, Object> variables) {
+ variables.put("homingService", "sniro");
+ variables.put("isDebugLogEnabled", "true");
+ // variables.put("mso-request-id", "testRequestId");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", serviceDecomposition);
+ variables.put("subscriberInfo", subscriber2);
+
+ }
+
+ private void setVariables2(Map<String, Object> variables) {
+ List<NetworkResource> netList = new ArrayList<NetworkResource>();
+ NetworkResource net = new NetworkResource();
+ net.setResourceId("testResourceIdNet");
+ ModelInfo netModel = new ModelInfo();
+ netModel.setModelCustomizationUuid("testModelCustomizationUuidNet");
+ netModel.setModelInvariantUuid("testModelInvariantIdNet");
+ netModel.setModelName("testModelNameNet");
+ netModel.setModelVersion("testModelVersionNet");
+ net.setModelInfo(netModel);
+ netList.add(net);
+ NetworkResource net2 = new NetworkResource();
+ net2.setResourceId("testResourceIdNet2");
+ ModelInfo netModel2 = new ModelInfo();
+ netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2");
+ netModel2.setModelInvariantUuid("testModelInvariantIdNet2");
+ netModel2.setModelName("testModelNameNet2");
+ netModel2.setModelVersion("testModelVersionNet2");
+ net2.setModelInfo(netModel2);
+ netList.add(net2);
+ serviceDecomposition.setNetworkResources(netList);
+
+ variables.put("homingService", "sniro");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", serviceDecomposition);
+ variables.put("subscriberInfo", subscriber2);
+ }
+
+ private void setVariables3(Map<String, Object> variables) {
+ variables.put("homingService", "sniro");
+ variables.put("isDebugLogEnabled", "true");
+ // variables.put("mso-request-id", "testRequestId");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", null);
+ variables.put("subscriberInfo", subscriber2);
+
+ }
+
+ private void setVariablesExistingLicense(Map<String, Object> variables) {
+ HomingSolution currentHomingSolution = new HomingSolution();
+ serviceDecomposition.getVnfResources().get(0).setCurrentHomingSolution(currentHomingSolution);
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2");
+
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1");
+ serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2");
+
+ variables.put("isDebugLogEnabled", "true");
+ // variables.put("mso-request-id", "testRequestId");
+ variables.put("msoRequestId", "testRequestId");
+ variables.put("serviceInstanceId", "testServiceInstanceId");
+ variables.put("serviceDecomposition", serviceDecomposition);
+ variables.put("subscriberInfo", subscriber2);
+
+ }
+
+ private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname, String cloudOwner, String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList){
+ String solution = "";
+ if(enList == null){
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { }, \"rehome\" : false } }";
+ }else{
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
+ }
+ return solution;
+ }
+
+ private String homingSolutionCloud(String type, String serviceInstanceId, String vnfHostname, String cloudOwner, String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList){
+ String solution = "";
+ if(enList == null){
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { }, \"rehome\" : false } }";
+ }else{
+ solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
+ }
+ return solution;
+ }
+
+ private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) {
+ variables.put("homingService", "sniro");
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("mso-request-id", requestId);
+ variables.put("msoRequestId", requestId);
+ variables.put("serviceInstanceId",siId);
+
+ String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
+ "\"modelInvariantUuid\": \"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\"," +
+ "\"modelUuid\": \"2f7f309d-c842-4644-a2e4-34167be5eeb4\"," +
+ "\"modelName\": \"ADIOD vRouter vCE 011017 Service\"," +
+ "\"modelVersion\": \"5.0\"," +
+ "}";
+ variables.put("serviceModelInfo", serviceModelInfo);
+ }
+
+ private String verifySniroRequest(){
+ String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"initial\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
+ return request;
+ }
+
+ private String verifySniroRequest_existingLicense(){
+ String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"},\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\",\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\",\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
+ return request;
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java
new file mode 100644
index 0000000000..e1a265b274
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java
@@ -0,0 +1,174 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockAAIVfModuleBadPatch;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchGenericVnf;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf_Bad;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.camunda.bpm.engine.test.Deployment;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit tests for UpdateAAIGenericVnf bpmn.
+ */
+
+public class UpdateAAIGenericVnfIT extends BaseIntegrationTest {
+
+ MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class);
+
+
+ /**
+ * Test the happy path through the flow.
+ */
+ @Test
+
+ public void happyPath() throws IOException {
+ logStart();
+
+ String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutGenericVnf("/skask", 200);
+ MockPatchGenericVnf("skask");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
+ invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode");
+ logger.debug("Subflow response code: " + responseCode);
+ logger.debug("Subflow response: " + response);
+ Assert.assertEquals(200, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the happy path through the flow.
+ */
+ @Test
+
+ public void personaMismatch() throws IOException {
+
+ logStart();
+
+ String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
+ updateAAIGenericVnfRequest = updateAAIGenericVnfRequest.replaceFirst("introvert", "extrovert");
+
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
+ invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ logger.debug("Workflow Exception: " + workflowException);
+ Assert.assertNotNull(workflowException);
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI returns a 404.
+ */
+ @Test
+
+ public void badGet() throws IOException {
+
+ logStart();
+
+ String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
+
+ MockGetGenericVnfById_404("skask[?]depth=1");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
+ invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponseCode");
+ logger.debug("Subflow response code: " + responseCode);
+ logger.debug("Subflow response: " + response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
+ */
+ @Test
+
+ public void badPatch() throws IOException {
+
+ logStart();
+
+ String updateAAIGenericVnfRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIGenericVnfRequest.xml");
+
+ MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutGenericVnf_Bad("skask", 404);
+ MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("UpdateAAIGenericVnfRequest", updateAAIGenericVnfRequest);
+ invokeSubProcess("UpdateAAIGenericVnf", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode");
+ logger.debug("Subflow response code: " + responseCode);
+ logger.debug("Subflow response: " + response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
+}
+
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java
new file mode 100644
index 0000000000..3ff2657193
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java
@@ -0,0 +1,142 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockAAIVfModuleBadPatch;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfById_404;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.camunda.bpm.engine.test.Deployment;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit tests for UpdateAAIVfModuleTest.bpmn.
+ */
+
+public class UpdateAAIVfModuleIT extends BaseIntegrationTest {
+
+ MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class);
+
+
+ /**
+ * Test the happy path through the flow.
+ */
+ @Test
+
+ public void happyPath() throws IOException {
+ logStart();
+
+ String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
+ MockGetGenericVnfByIdWithPriority("/skask/vf-modules/vf-module/supercool", 200, "VfModularity/VfModule-supercool.xml");
+ MockPutGenericVnf("/skask/vf-modules/vf-module/supercool", "PCRF", 200);
+ MockPatchVfModuleId("skask", "supercool");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode");
+ logger.debug("Subflow response code: " + responseCode);
+ logger.debug("Subflow response: " + response);
+ Assert.assertEquals(200, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI returns a 404.
+ */
+ @Test
+
+ public void badGet() throws IOException {
+
+ logStart();
+
+ String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
+ MockGetGenericVnfById("/skask/vf-modules/vf-module/.*", "VfModularity/VfModule-supercool.xml", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponseCode");
+ logger.debug("Subflow response code: " + responseCode);
+ logger.debug("Subflow response: " + response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
+
+ /**
+ * Test the case where the GET to AAI is successful, but he subsequent PUT returns 404.
+ */
+ @Test
+
+ public void badPatch() throws IOException {
+
+ logStart();
+
+ String updateAAIVfModuleRequest = FileUtil.readResourceFile("__files/VfModularity/UpdateAAIVfModuleRequest.xml");
+ MockGetGenericVnfById_404("/skask/vf-modules/vf-module/supercool");
+ MockGetGenericVnfById("/skask/vf-modules/vf-module/supercool", "VfModularity/VfModule-supercool.xml", 200);
+ MockAAIVfModuleBadPatch("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool", 404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("isDebugLogEnabled","true");
+ variables.put("UpdateAAIVfModuleRequest", updateAAIVfModuleRequest);
+ invokeSubProcess("UpdateAAIVfModule", businessKey, variables);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse");
+ Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode");
+ logger.debug("Subflow response code: " + responseCode);
+ logger.debug("Subflow response: " + response);
+ Assert.assertEquals(404, responseCode.intValue());
+
+ logEnd();
+ }
+}
+
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java
new file mode 100644
index 0000000000..fc15e92bca
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java
@@ -0,0 +1,386 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete;
+import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFPost;
+import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFPut;
+import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFRollbackDelete;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.camunda.bpm.engine.test.Deployment;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Unit tests for VnfAdapterRestV1.
+ */
+
+public class VnfAdapterRestV1IT extends BaseIntegrationTest {
+
+ MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,VnfAdapterRestV1IT.class);
+
+
+ private static final String EOL = "\n";
+
+ private final CallbackSet callbacks = new CallbackSet();
+
+ private final String CREATE_VF_MODULE_REQUEST =
+ "<createVfModuleRequest>" + EOL +
+ " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <tenantId>tenantId</tenantId>" + EOL +
+ " <vnfId>vnfId</vnfId>" + EOL +
+ " <vfModuleName>vfModuleName</vfModuleName>" + EOL +
+ " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
+ " <vnfType>vnfType</vnfType>" + EOL +
+ " <vnfVersion>vnfVersion</vnfVersion>" + EOL +
+ " <vfModuleType>vfModuleType</vfModuleType>" + EOL +
+ " <volumeGroupId>volumeGroupId</volumeGroupId>" + EOL +
+ " <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL +
+ " <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL +
+ " <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL +
+ " <skipAAI>true</skipAAI>" + EOL +
+ " <backout>false</backout>" + EOL +
+ " <failIfExists>true</failIfExists>" + EOL +
+ " <vfModuleParams>" + EOL +
+ " <entry>" + EOL +
+ " <key>key1</key>" + EOL +
+ " <value>value1</value>" + EOL +
+ " </entry>" + EOL +
+ " <entry>" + EOL +
+ " <key>key2</key>" + EOL +
+ " <value>value2</value>" + EOL +
+ " </entry>" + EOL +
+ " </vfModuleParams>" + EOL +
+ " <msoRequest>" + EOL +
+ " <requestId>requestId</requestId>" + EOL +
+ " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
+ " </msoRequest>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
+ "</createVfModuleRequest>" + EOL;
+
+ private final String UPDATE_VF_MODULE_REQUEST =
+ "<updateVfModuleRequest>" + EOL +
+ " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <tenantId>tenantId</tenantId>" + EOL +
+ " <vnfId>vnfId</vnfId>" + EOL +
+ " <vfModuleName>vfModuleName</vfModuleName>" + EOL +
+ " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
+ " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
+ " <vnfType>vnfType</vnfType>" + EOL +
+ " <vnfVersion>vnfVersion</vnfVersion>" + EOL +
+ " <vfModuleType>vfModuleType</vfModuleType>" + EOL +
+ " <volumeGroupId>volumeGroupId</volumeGroupId>" + EOL +
+ " <volumeGroupStackId>volumeGroupStackId</volumeGroupStackId>" + EOL +
+ " <baseVfModuleId>baseVfModuleId</baseVfModuleId>" + EOL +
+ " <baseVfModuleStackId>baseVfModuleStackId</baseVfModuleStackId>" + EOL +
+ " <skipAAI>true</skipAAI>" + EOL +
+ " <backout>false</backout>" + EOL +
+ " <failIfExists>true</failIfExists>" + EOL +
+ " <vfModuleParams>" + EOL +
+ " <entry>" + EOL +
+ " <key>key1</key>" + EOL +
+ " <value>value1</value>" + EOL +
+ " </entry>" + EOL +
+ " <entry>" + EOL +
+ " <key>key2</key>" + EOL +
+ " <value>value2</value>" + EOL +
+ " </entry>" + EOL +
+ " </vfModuleParams>" + EOL +
+ " <msoRequest>" + EOL +
+ " <requestId>requestId</requestId>" + EOL +
+ " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
+ " </msoRequest>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
+ "</updateVfModuleRequest>" + EOL;
+
+ private final String DELETE_VF_MODULE_REQUEST =
+ "<deleteVfModuleRequest>" + EOL +
+ " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <tenantId>tenantId</tenantId>" + EOL +
+ " <vnfId>vnfId</vnfId>" + EOL +
+ " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
+ " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
+ " <skipAAI>true</skipAAI>" + EOL +
+ " <msoRequest>" + EOL +
+ " <requestId>requestId</requestId>" + EOL +
+ " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
+ " </msoRequest>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
+ "</deleteVfModuleRequest>" + EOL;
+
+ private final String ROLLBACK_VF_MODULE_REQUEST =
+ "<rollbackVfModuleRequest>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ " <notificationUrl>http://localhost:28080/mso/WorkflowMessage</notificationUrl>" + EOL +
+ " <skipAAI>true</skipAAI>" + EOL +
+ " <vfModuleRollback>" + EOL +
+ " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <tenantId>tenantId</tenantId>" + EOL +
+ " <vnfId>vnfId</vnfId>" + EOL +
+ " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
+ " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
+ " <msoRequest>" + EOL +
+ " <requestId>requestId</requestId>" + EOL +
+ " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
+ " </msoRequest>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ " <vfModuleCreated>true</vfModuleCreated>" + EOL +
+ " </vfModuleRollback>" + EOL +
+ "</rollbackVfModuleRequest>" + EOL;
+
+ public VnfAdapterRestV1IT() throws IOException {
+ callbacks.put("createVfModule",
+ "<createVfModuleResponse>" + EOL +
+ " <vnfId>vnfId</vnfId>" + EOL +
+ " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
+ " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
+ " <vfModuleCreated>true</vfModuleCreated>" + EOL +
+ " <vfModuleOutputs>" + EOL +
+ " <entry>" + EOL +
+ " <key>key1</key>" + EOL +
+ " <value>value1</value>" + EOL +
+ " </entry>" + EOL +
+ " <entry>" + EOL +
+ " <key>key2</key>" + EOL +
+ " <value>value2</value>" + EOL +
+ " </entry>" + EOL +
+ " </vfModuleOutputs>" + EOL +
+ " <rollback>" + EOL +
+ " <vnfId>vnfId</vnfId>" + EOL +
+ " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
+ " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
+ " <vfModuleCreated>true</vfModuleCreated>" + EOL +
+ " <tenantId>tenantId</tenantId>" + EOL +
+ " <cloudSiteId>cloudSiteId</cloudSiteId>" + EOL +
+ " <msoRequest>" + EOL +
+ " <requestId>requestId</requestId>" + EOL +
+ " <serviceInstanceId>serviceInstanceId</serviceInstanceId>" + EOL +
+ " </msoRequest>" + EOL +
+ " <messageId>messageId</messageId>" + EOL +
+ " </rollback>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</createVfModuleResponse>" + EOL);
+
+ callbacks.put("updateVfModule",
+ "<updateVfModuleResponse>" + EOL +
+ " <vnfId>vnfId</vnfId>" + EOL +
+ " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
+ " <vfModuleStackId>vfModuleStackId</vfModuleStackId>" + EOL +
+ " <vfModuleOutputs>" + EOL +
+ " <entry>" + EOL +
+ " <key>key1</key>" + EOL +
+ " <value>value1</value>" + EOL +
+ " </entry>" + EOL +
+ " <entry>" + EOL +
+ " <key>key2</key>" + EOL +
+ " <value>value2</value>" + EOL +
+ " </entry>" + EOL +
+ " </vfModuleOutputs>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</updateVfModuleResponse>" + EOL);
+
+ callbacks.put("deleteVfModule",
+ "<deleteVfModuleResponse>" + EOL +
+ " <vnfId>vnfId</vnfId>" + EOL +
+ " <vfModuleId>vfModuleId</vfModuleId>" + EOL +
+ " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</deleteVfModuleResponse>" + EOL);
+
+ callbacks.put("rollbackVfModule",
+ "<rollbackVfModuleResponse>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ " <vfModuleRolledback>true</vfModuleRolledback>" + EOL +
+ "</rollbackVfModuleResponse>" + EOL);
+
+ callbacks.put("vfModuleException",
+ "<vfModuleException>" + EOL +
+ " <message>message</message>" + EOL +
+ " <category>category</category>" + EOL +
+ " <rolledBack>false</rolledBack>" + EOL +
+ " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
+ "</vfModuleException>" + EOL);
+ }
+
+ @Test
+
+ public void testCreateVfModuleSuccess() throws Exception {
+ logStart();
+
+ mockVNFPost("", 202, "vnfId");
+
+ String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+ String messageId = requestId + "-" + System.currentTimeMillis();
+ String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", requestId);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfAdapterRestV1Request", request);
+
+ invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+ injectVNFRestCallbacks(callbacks, "createVfModule");
+ waitForProcessEnd(businessKey, 10000);
+
+ String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+ logger.debug("Response:\n" + response);
+ assertTrue(response!=null && response.contains("<createVfModuleResponse>"));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ @Test
+
+ public void testUpdateVfModuleSuccess() throws Exception {
+ logStart();
+
+ mockVNFPut("/vfModuleId", 202);
+
+ String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+ String messageId = requestId + "-" + System.currentTimeMillis();
+ String request = UPDATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", requestId);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfAdapterRestV1Request", request);
+
+ invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+ injectVNFRestCallbacks(callbacks, "updateVfModule");
+ waitForProcessEnd(businessKey, 10000);
+
+ String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+ logger.debug("Response:\n" + response);
+ assertTrue(response.contains("<updateVfModuleResponse>"));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ @Test
+
+ public void testDeleteVfModuleSuccess() throws Exception {
+ logStart();
+
+ mockVNFDelete("vnfId", "/vfModuleId", 202);
+
+ String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+ String messageId = requestId + "-" + System.currentTimeMillis();
+ String request = DELETE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", requestId);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfAdapterRestV1Request", request);
+
+ invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+ injectVNFRestCallbacks(callbacks, "deleteVfModule");
+ waitForProcessEnd(businessKey, 10000);
+
+ String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+ logger.debug("Response:\n" + response);
+ assertTrue(response.contains("<deleteVfModuleResponse>"));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ @Test
+
+ public void testRollbackVfModuleSuccess() throws Exception {
+ logStart();
+
+ mockVNFRollbackDelete("/vfModuleId", 202);
+
+ String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+ String messageId = requestId + "-" + System.currentTimeMillis();
+ String request = ROLLBACK_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", requestId);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfAdapterRestV1Request", request);
+
+ invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+ injectVNFRestCallbacks(callbacks, "rollbackVfModule");
+ waitForProcessEnd(businessKey, 10000);
+
+ String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response");
+ logger.debug("Response:\n" + response);
+ assertTrue(response.contains("<rollbackVfModuleResponse>"));
+ assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
+
+ @Test
+
+ public void testCreateVfModuleException() throws Exception {
+ logStart();
+
+ mockVNFPost("", 202, "vnfId");
+
+ String requestId = "dffbae0e-5588-4bd6-9749-b0f0adb52312";
+ String messageId = requestId + "-" + System.currentTimeMillis();
+ String request = CREATE_VF_MODULE_REQUEST.replace("{{MESSAGE-ID}}", messageId);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("mso-request-id", requestId);
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("vnfAdapterRestV1Request", request);
+
+ invokeSubProcess("vnfAdapterRestV1", businessKey, variables);
+ injectVNFRestCallbacks(callbacks, "vfModuleException");
+ waitForProcessEnd(businessKey, 10000);
+
+ WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
+ assertNotNull(wfe);
+ logger.debug(wfe.toString());
+
+ String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse");
+ logger.debug("Response:\n" + response);
+ assertTrue(response.contains("<vfModuleException>"));
+ assertFalse((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator"));
+
+ logEnd();
+ }
+}
+
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java
new file mode 100644
index 0000000000..a746bbb48e
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowAsyncResourceTest.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.camunda.bpm.engine.test.Deployment;
+import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
+import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource;
+
+@Ignore
+public class WorkflowAsyncResourceTest extends WorkflowTest {
+
+ @Test
+ @Deployment(resources = { "testAsyncResource.bpmn" })
+ public void asyncRequestSuccess() throws InterruptedException {
+ //it can be any request which asynchronously processed by the workflow
+ String request = "<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns5=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type> <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id> <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>";
+
+ Map<String,String> variables = new HashMap<>();
+ variables.put("testAsyncRequestMsg", request);
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ variables.put("mso-service-request-timeout", "5");
+
+ WorkflowResponse workflowResponse = BPMNUtil.executeAsyncWorkflow(processEngineRule, "testAsyncProcess", variables);
+ assertEquals("Received the request, the process is getting executed, request message<aetgt:CreateTenantRequest xmlns:aetgt=\"http://org.onap/so/workflow/schema/v1\" xmlns:sdncadapterworkflow=\"http://org.onap/so/workflow/schema/v1\" xmlns:ns5=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-information xmlns:msoservtypes=\"http://org.onap/so/request/types/v1\"> <msoservtypes:service-type>SDN-ETHERNET-INTERNET</msoservtypes:service-type> <msoservtypes:service-instance-id>HI/VLXM/950604//SW_INTERNET</msoservtypes:service-instance-id> <msoservtypes:subscriber-name>SubName01</msoservtypes:subscriber-name> </msoservtypes:service-information> </aetgt:CreateTenantRequest>", workflowResponse.getResponse());
+ assertEquals(200, workflowResponse.getMessageCode());
+ }
+
+ private void executeWorkflow(String request, String requestId, String processKey) throws InterruptedException {
+ WorkflowAsyncResource workflowResource = new WorkflowAsyncResource();
+ VariableMapImpl variableMap = new VariableMapImpl();
+
+ Map<String, Object> variableValueType = new HashMap<>();
+
+ Map<String, Object> requestMsg = new HashMap<>();
+ requestMsg.put("value", request);
+ requestMsg.put("type", "String");
+
+ Map<String, Object> msorequestId = new HashMap<>();
+ msorequestId.put("type", "String");
+ msorequestId.put("value",requestId);
+
+ Map<String, Object> timeout = new HashMap<>();
+ timeout.put("type", "String");
+ timeout.put("value","5");
+
+ variableValueType.put("testAsyncRequestMsg", requestMsg);
+ variableValueType.put("mso-request-id", msorequestId);
+ variableValueType.put("mso-service-request-timeout", timeout);
+
+ variableMap.put("variables", variableValueType);
+
+ workflowResource.setProcessEngineServices4junit(processEngineRule);
+ workflowResource.startProcessInstanceByKey( processKey, variableMap);
+ }
+
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java
new file mode 100644
index 0000000000..0efecac254
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowContextHolderTest.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+
+
+import java.util.UUID;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
+import org.onap.so.bpmn.common.workflow.context.WorkflowContext;
+import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
+
+
+public class WorkflowContextHolderTest {
+
+
+ @Test
+ public void testProcessCallback() throws Exception {
+ String requestId = UUID.randomUUID().toString();
+ String message = "TEST MESSATGE";
+ String responseMessage = "Successfully processed request";
+ int testCode = 200;
+
+
+ WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
+
+ WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
+ callbackResponse.setMessage(message);
+ callbackResponse.setResponse(responseMessage);
+ callbackResponse.setStatusCode(testCode);
+
+ contextHolder.processCallback("testAsyncProcess","process-instance-id",requestId,callbackResponse);
+
+ //same object returned
+ WorkflowContext contextFound = contextHolder.getWorkflowContext(requestId);
+ if(contextFound == null)
+ throw new Exception("Expected to find Context Object");
+
+ WorkflowResponse testResponse = contextFound.getWorkflowResponse();
+ Assert.assertEquals(200,testResponse.getMessageCode());
+ Assert.assertEquals(message, testResponse.getMessage());
+ Assert.assertEquals(responseMessage, testResponse.getResponse());
+
+
+
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
new file mode 100644
index 0000000000..8ebc80c4c2
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
@@ -0,0 +1,2215 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+import static org.onap.so.bpmn.core.json.JsonUtils.getJsonValue;
+import static org.onap.so.bpmn.core.json.JsonUtils.updJsonValue;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.camunda.bpm.engine.HistoryService;
+import org.camunda.bpm.engine.ProcessEngine;
+import org.camunda.bpm.engine.ProcessEngineException;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.history.HistoricProcessInstance;
+import org.camunda.bpm.engine.history.HistoricVariableInstance;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.test.ProcessEngineRule;
+import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
+import org.custommonkey.xmlunit.DetailedDiff;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.json.JSONArray;
+import org.json.JSONObject;
+import org.junit.Rule;
+import org.onap.so.bpmn.common.adapter.sdnc.CallbackHeader;
+import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterCallbackRequest;
+import org.onap.so.bpmn.common.adapter.sdnc.SDNCAdapterResponse;
+import org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.DeleteVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.MsoExceptionCategory;
+import org.onap.so.bpmn.common.adapter.vnf.MsoRequest;
+import org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.VnfRollback;
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
+import org.onap.so.bpmn.common.workflow.service.SDNCAdapterCallbackServiceImpl;
+import org.onap.so.bpmn.common.workflow.service.VnfAdapterNotifyServiceImpl;
+import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource;
+import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource;
+import org.onap.so.bpmn.common.workflow.service.WorkflowResource;
+import org.onap.so.bpmn.core.domain.Resource;
+import org.onap.so.bpmn.core.domain.ServiceDecomposition;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+
+/**
+ * A base class for Workflow tests.
+ * <p>
+ * WireMock response transformers may be specified by declaring public
+ * static fields with the @WorkflowTestTransformer annotation. For example:
+ * <pre>
+ * @WorkflowTestTransformer
+ * public static final ResponseTransformer sdncAdapterMockTransformer =
+ * new SDNCAdapterMockTransformer();
+ * </pre>
+ */
+
+public abstract class WorkflowTest {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowTest.class);
+
+ //TODO this is not used anymore, can maybe be removed
+ @Rule
+ public ProcessEngineRule processEngineRule;
+
+ @Autowired
+ protected WorkflowResource workflowResourceSync;
+
+ @Autowired
+ protected ProcessEngine processEngine;
+
+ @Autowired
+ protected RuntimeService runtimeService;
+
+ @Autowired
+ protected HistoryService historyService;
+
+ @Autowired
+ private WorkflowAsyncResource workflowResource;
+
+ @Autowired
+ private WorkflowMessageResource workflowMessageResource;
+
+ @Autowired
+ SDNCAdapterCallbackServiceImpl callbackService;
+ /**
+ * Content-Type for XML.
+ */
+ protected static final String XML = "application/xml";
+
+ /**
+ * Content-Type for JSON.
+ */
+ protected static final String JSON = "application/json; charset=UTF-8";
+
+
+ /**
+ * Constructor.
+ */
+ public WorkflowTest() throws RuntimeException {
+ }
+
+ /**
+ * The current request ID. Normally set when an "invoke" method is called.
+ */
+ protected volatile String msoRequestId = null;
+
+ /**
+ * The current service instance ID. Normally set when an "invoke" method
+ * is called.
+ */
+ protected volatile String msoServiceInstanceId = null;
+
+ /**
+ * Logs a test start method.
+ */
+ protected void logStart() {
+ msoLogger.debug("STARTED TEST");
+ }
+
+ /**
+ * Logs a test end method.
+ */
+ protected void logEnd() {
+ msoLogger.debug("ENDED TEST");
+ }
+
+ /**
+ * Invokes a subprocess.
+ * @param processKey the process key
+ * @param businessKey a unique key that will identify the process instance
+ * @param injectedVariables variables to inject into the process
+ */
+ protected void invokeSubProcess(String processKey, String businessKey, Map<String, Object> injectedVariables) {
+ RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+ List<String> arguments = runtimeMxBean.getInputArguments();
+ msoLogger.debug("JVM args = " + arguments);
+
+ msoRequestId = (String) injectedVariables.get("mso-request-id");
+ String requestId = (String) injectedVariables.get("msoRequestId");
+
+ if (msoRequestId == null && requestId == null) {
+ String msg = "mso-request-id variable was not provided";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ // Note: some scenarios don't have a service-instance-id, may be null
+ msoServiceInstanceId = (String) injectedVariables.get("mso-service-instance-id");
+
+
+ runtimeService.startProcessInstanceByKey(processKey, businessKey, injectedVariables);
+ }
+
+ protected String invokeSubProcess(String processKey, Map<String, Object> injectedVariables) {
+ RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+ List<String> arguments = runtimeMxBean.getInputArguments();
+ msoLogger.debug("JVM args = " + arguments);
+
+ msoRequestId = (String) injectedVariables.get("mso-request-id");
+ String requestId = (String) injectedVariables.get("msoRequestId");
+
+ if (msoRequestId == null && requestId == null) {
+ String msg = "mso-request-id variable was not provided";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ // Note: some scenarios don't have a service-instance-id, may be null
+ msoServiceInstanceId = (String) injectedVariables.get("mso-service-instance-id");
+
+
+ ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processKey, msoRequestId, injectedVariables);
+ return processInstance.getId();
+ }
+
+ /**
+ * Invokes an asynchronous process.
+ * Errors are handled with junit assertions and will cause the test to fail.
+ * @param processKey the process key
+ * @param schemaVersion the API schema version, e.g. "v1"
+ * @param businessKey a unique key that will identify the process instance
+ * @param request the request
+ * @return a TestAsyncResponse object associated with the test
+ * @throws InterruptedException
+ */
+ protected TestAsyncResponse invokeAsyncProcess(String processKey,
+ String schemaVersion, String businessKey, String request) throws InterruptedException {
+ return invokeAsyncProcess(processKey, schemaVersion, businessKey, request, null);
+ }
+
+ /**
+ * Invokes an asynchronous process.
+ * Errors are handled with junit assertions and will cause the test to fail.
+ * @param processKey the process key
+ * @param schemaVersion the API schema version, e.g. "v1"
+ * @param businessKey a unique key that will identify the process instance
+ * @param request the request
+ * @param injectedVariables optional variables to inject into the process
+ * @return a TestAsyncResponse object associated with the test
+ * @throws InterruptedException
+ */
+ protected TestAsyncResponse invokeAsyncProcess(String processKey,
+ String schemaVersion, String businessKey, String request,
+ Map<String, Object> injectedVariables) {
+
+ RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+ List<String> arguments = runtimeMxBean.getInputArguments();
+ msoLogger.debug("JVM args = " + arguments);
+
+ Map<String, Object> variables = createVariables(schemaVersion, businessKey,
+ request, injectedVariables, false);
+ VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
+
+ msoLogger.debug("Sending " + request + " to " + processKey + " process");
+
+ TestAsyncResponse asyncResponse = new TestAsyncResponse();
+
+ asyncResponse.setResponse(workflowResource.startProcessInstanceByKey( processKey, variableMapImpl));
+
+ return asyncResponse;
+ }
+
+ /**
+ * Invokes an asynchronous process.
+ * Errors are handled with junit assertions and will cause the test to fail.
+ * @param processKey the process key
+ * @param schemaVersion the API schema version, e.g. "v1"
+ * @param businessKey a unique key that will identify the process instance
+ * @param request the request
+ * @param injectedVariables optional variables to inject into the process
+ * @param serviceInstantiationModel indicates whether this method is being
+ * invoked for a flow that is designed using the service instantiation model
+ * @return a TestAsyncResponse object associated with the test
+ * @throws InterruptedException
+ */
+ protected Response invokeAsyncProcess(String processKey,
+ String schemaVersion, String businessKey, String request,
+ Map<String, Object> injectedVariables, boolean serviceInstantiationModel) {
+
+ RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean();
+ List<String> arguments = runtimeMxBean.getInputArguments();
+ msoLogger.debug("JVM args = " + arguments);
+
+ Map<String, Object> variables = createVariables(schemaVersion, businessKey,
+ request, injectedVariables, serviceInstantiationModel);
+ VariableMapImpl variableMapImpl = createVariableMapImpl(variables);
+
+ msoLogger.debug("Sending " + request + " to " + processKey + " process");
+
+ return workflowResource.startProcessInstanceByKey( processKey, variableMapImpl);
+
+ }
+
+ /**
+ * Private helper method that creates a variable map for a request.
+ * Errors are handled with junit assertions and will cause the test to fail.
+ * @param schemaVersion the API schema version, e.g. "v1"
+ * @param businessKey a unique key that will identify the process instance
+ * @param request the request
+ * @param injectedVariables optional variables to inject into the process
+ * @param serviceInstantiationModel indicates whether this method is being
+ * invoked for a flow that is designed using the service instantiation model
+ * @return a variable map
+ */
+ private Map<String, Object> createVariables(String schemaVersion,
+ String businessKey, String request, Map<String, Object> injectedVariables,
+ boolean serviceInstantiationModel) {
+
+ Map<String, Object> variables = new HashMap<>();
+
+ // These variables may be overridded by injected variables.
+ variables.put("mso-service-request-timeout", "180");
+ variables.put("isDebugLogEnabled", "true");
+
+ // These variables may not be overridded by injected variables.
+ String[] notAllowed = new String[] {
+ "mso-schema-version",
+ "mso-business-key",
+ "bpmnRequest",
+ "mso-request-id",
+ "mso-service-instance-id"
+ };
+
+ if (injectedVariables != null) {
+ for (String key : injectedVariables.keySet()) {
+ for (String var : notAllowed) {
+ if (var.equals(key)) {
+ String msg = "Cannot specify " + var + " in injected variables";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+ }
+
+ variables.put(key, injectedVariables.get(key));
+ }
+ }
+
+ variables.put("mso-schema-version", schemaVersion);
+ variables.put("mso-business-key", businessKey);
+ variables.put("bpmnRequest", request);
+
+ if (serviceInstantiationModel) {
+
+ /*
+ * The request ID and the service instance ID are generated for flows
+ * that follow the service instantiation model unless "requestId" and
+ * "serviceInstanceId" are injected variables.
+ */
+
+ try {
+ msoRequestId = (String) injectedVariables.get("requestId");
+ variables.put("mso-request-id", msoRequestId);
+ msoServiceInstanceId = (String) injectedVariables.get("serviceInstanceId");
+ variables.put("mso-service-instance-id", msoServiceInstanceId);
+ }
+ catch(Exception e) {
+ }
+ if (msoRequestId == null || msoRequestId.trim().equals("")) {
+ msoLogger.debug("No requestId element in injectedVariables");
+ variables.put("mso-request-id", UUID.randomUUID().toString());
+ }
+ if (msoServiceInstanceId == null || msoServiceInstanceId.trim().equals("")) {
+ msoLogger.debug("No seviceInstanceId element in injectedVariables");
+ variables.put("mso-service-instance-id", UUID.randomUUID().toString());
+ }
+
+ } else {
+ msoRequestId = getXMLTextElement(request, "request-id");
+
+ if (msoRequestId == null) {
+ //check in injected variables
+ try {
+ msoRequestId = (String) injectedVariables.get("requestId");
+ }
+ catch(Exception e) {
+ }
+ if (msoRequestId == null || msoRequestId.trim().equals("")) {
+ String msg = "No request-id element in " + request;
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+ }
+
+ variables.put("mso-request-id", msoRequestId);
+
+ // Note: some request types don't have a service-instance-id
+ msoServiceInstanceId = getXMLTextElement(request, "service-instance-id");
+
+ if (msoServiceInstanceId != null) {
+ variables.put("mso-service-instance-id", msoServiceInstanceId);
+ }
+ }
+
+ return variables;
+ }
+
+ /**
+ * Private helper method that creates a camunda VariableMapImpl from a simple
+ * variable map.
+ * @param variables the simple variable map
+ * @return a VariableMap
+ */
+ private VariableMapImpl createVariableMapImpl(Map<String, Object> variables) {
+ Map<String, Object> wrappedVariables = new HashMap<>();
+
+ for (String key : variables.keySet()) {
+ Object value = variables.get(key);
+ wrappedVariables.put(key, wrapVariableValue(value));
+ }
+
+ VariableMapImpl variableMapImpl = new VariableMapImpl();
+ variableMapImpl.put("variables", wrappedVariables);
+ return variableMapImpl;
+ }
+
+ /**
+ * Private helper method that wraps a variable value for inclusion in a
+ * camunda VariableMapImpl.
+ * @param value the variable value
+ * @return the wrapped variable
+ */
+ private Map<String, Object> wrapVariableValue(Object value) {
+ HashMap<String, Object> valueMap = new HashMap<>();
+ valueMap.put("value", value);
+ return valueMap;
+ }
+
+ /**
+ * Receives a response from an asynchronous process.
+ * Errors are handled with junit assertions and will cause the test to fail.
+ * @param businessKey the process business key
+ * @param asyncResponse the TestAsyncResponse object associated with the test
+ * @param timeout the timeout in milliseconds
+ * @return the WorkflowResponse
+ */
+ protected WorkflowResponse receiveResponse(String businessKey,
+ TestAsyncResponse asyncResponse, long timeout) {
+ msoLogger.debug("Waiting " + timeout + "ms for process with business key " + businessKey
+ + " to send a response");
+
+ long now = System.currentTimeMillis() + timeout;
+ long endTime = now + timeout;
+
+ while (now <= endTime) {
+ Response response = asyncResponse.getResponse();
+
+ if (response != null) {
+ msoLogger.debug("Received a response from process with business key " + businessKey);
+
+ Object entity = response.getEntity();
+
+ if (!(entity instanceof WorkflowResponse)) {
+ String msg = "Response entity is " +
+ (entity == null ? "null" : entity.getClass().getName()) +
+ ", expected WorkflowResponse";
+ msoLogger.debug(msg);
+ fail(msg);
+ return null; // unreachable
+ }
+
+ return (WorkflowResponse) entity;
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ String msg = "Interrupted waiting for a response from process with business key " +
+ businessKey;
+ msoLogger.debug(msg);
+ fail(msg);
+ return null; // unreachable
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ String msg = "No response received from process with business key " + businessKey +
+ " within " + timeout + "ms";
+ msoLogger.debug(msg);
+ fail("Process with business key " + businessKey + " did not end within 10000ms");
+ return null; // unreachable
+ }
+
+ /**
+ * Runs a program to inject SDNC callback data into the test environment.
+ * A program is essentially just a list of keys that identify callback data
+ * to be injected, in sequence. An example program:
+ * <pre>
+ * reserve, assign, delete:ERR
+ * </pre>
+ * Errors are handled with junit assertions and will cause the test to fail.
+ * @param callbacks an object containing callback data for the program
+ * @param program the program to execute
+ */
+ protected void injectSDNCRestCallbacks(CallbackSet callbacks, String program) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String content = null;
+ String contentType = null;
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No callback defined for '" + action + "' SDNC request";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ contentType = callbackData.getContentType();
+ } else if ("ERR".equals(modifier)) {
+ content = "{\"SDNCServiceError\":{\"sdncRequestId\":\"((REQUEST-ID))\",\"responseCode\":\"500\",\"responseMessage\":\"SIMULATED ERROR FROM SDNC ADAPTER\",\"ackFinalIndicator\":\"Y\"}}";
+ contentType = JSON;
+ } else {
+ String msg = "Invalid SDNC program modifier: '" + modifier + "'";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ if (contentType == null) {
+ // Default for backward compatibility with existing tests.
+ contentType = JSON;
+ }
+
+ if (!injectSDNCRestCallback(contentType, content, 10000)) {
+ fail("Failed to inject SDNC '" + action + "' callback");
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of SDNC '" + action + "' callback");
+ }
+ }
+ }
+
+ /**
+ * Runs a program to inject SDNC events into the test environment.
+ * A program is essentially just a list of keys that identify event data
+ * to be injected, in sequence. An example program:
+ * <pre>
+ * event1, event2
+ * </pre>
+ * NOTE: Each callback must have a message type associated with it, e.g.
+ * "SDNCAEvent".
+ * Errors are handled with junit assertions and will cause the test to fail.
+ * @param callbacks an object containing event data for the program
+ * @param program the program to execute
+ */
+ protected void injectSDNCEvents(CallbackSet callbacks, String program) {
+ injectWorkflowMessages(callbacks, program);
+ }
+
+ /**
+ * Runs a program to inject SDNC callback data into the test environment.
+ * A program is essentially just a list of keys that identify callback data
+ * to be injected, in sequence. An example program:
+ * <pre>
+ * reserve, assign, delete:ERR
+ * </pre>
+ * Errors are handled with junit assertions and will cause the test to fail.
+ * @param callbacks an object containing callback data for the program
+ * @param program the program to execute
+ */
+ protected void injectSDNCCallbacks(CallbackSet callbacks, String program) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String content = null;
+ int respCode = 200;
+ String respMsg = "OK";
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No callback defined for '" + action + "' SDNC request";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ respCode = 200;
+ respMsg = "OK";
+ } else if ("CREATED".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No callback defined for '" + action + "' SDNC request";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ respCode = 201;
+ respMsg = "Created";
+ } else if ("ERR".equals(modifier)) {
+ content = "<svc-request-id>((REQUEST-ID))</svc-request-id><response-code>500</response-code><response-message>SIMULATED ERROR FROM SDNC ADAPTER</response-message>";
+ respCode = 500;
+ respMsg = "SERVER ERROR";
+ } else {
+ String msg = "Invalid SDNC program modifier: '" + modifier + "'";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ if (!injectSDNCCallback(respCode, respMsg, content, 10000)) {
+ fail("Failed to inject SDNC '" + action + "' callback");
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of SDNC '" + action + "' callback");
+ }
+ }
+ }
+
+ /**
+ * Runs a program to inject VNF adapter REST callback data into the test environment.
+ * A program is essentially just a list of keys that identify callback data
+ * to be injected, in sequence. An example program:
+ * <pre>
+ * create, rollback
+ * </pre>
+ * Errors are handled with junit assertions and will cause the test to fail.
+ * @param callbacks an object containing callback data for the program
+ * @param program the program to execute
+ */
+ protected void injectVNFRestCallbacks(CallbackSet callbacks, String program) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String content = null;
+ String contentType = null;
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No callback defined for '" + action + "' VNF REST request";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ contentType = callbackData.getContentType();
+ } else if ("ERR".equals(modifier)) {
+ content = "SIMULATED ERROR FROM VNF ADAPTER";
+ contentType = "text/plain";
+ } else {
+ String msg = "Invalid VNF REST program modifier: '" + modifier + "'";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ if (contentType == null) {
+ // Default for backward compatibility with existing tests.
+ contentType = XML;
+ }
+
+ if (!injectVnfAdapterRestCallback(contentType, content, 10000)) {
+ fail("Failed to inject VNF REST '" + action + "' callback");
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of VNF REST '" + action + "' callback");
+ }
+ }
+ }
+
+ /**
+ * Runs a program to inject VNF callback data into the test environment.
+ * A program is essentially just a list of keys that identify callback data
+ * to be injected, in sequence. An example program:
+ * <pre>
+ * createVnf, deleteVnf
+ * </pre>
+ * Errors are handled with junit assertions and will cause the test to fail.
+ * @param callbacks an object containing callback data for the program
+ * @param program the program to execute
+ */
+ protected void injectVNFCallbacks(CallbackSet callbacks, String program) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String content = null;
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No callback defined for '" + action + "' VNF request";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ } else if ("ERR".equals(modifier)) {
+ String msg = "Currently unsupported VNF program modifier: '" + modifier + "'";
+ msoLogger.debug(msg);
+ fail(msg);
+ } else {
+ String msg = "Invalid VNF program modifier: '" + modifier + "'";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ boolean injected = false;
+
+ if (content.contains("createVnfNotification")) {
+ injected = injectCreateVNFCallback(content, 10000);
+ } else if (content.contains("deleteVnfNotification")) {
+ injected = injectDeleteVNFCallback(content, 10000);
+ } else if (content.contains("updateVnfNotification")) {
+ injected = injectUpdateVNFCallback(content, 10000);
+ }
+
+ if (!injected) {
+ String msg = "Failed to inject VNF '" + action + "' callback";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of VNF '" + action + "' callback");
+ }
+ }
+ }
+
+ /**
+ * Waits for the number of running processes with the specified process
+ * definition key to equal a particular count.
+ * @param processKey the process definition key
+ * @param count the desired count
+ * @param timeout the timeout in milliseconds
+ */
+ protected void waitForRunningProcessCount(String processKey, int count, long timeout) {
+ msoLogger.debug("Waiting " + timeout + "ms for there to be " + count + " "
+ + processKey + " instances");
+
+ long now = System.currentTimeMillis() + timeout;
+ long endTime = now + timeout;
+ int last = -1;
+
+ while (now <= endTime) {
+ int actual = runtimeService
+ .createProcessInstanceQuery()
+ .processDefinitionKey(processKey)
+ .list().size();
+
+ if (actual != last) {
+ msoLogger.debug("There are now " + actual + " "
+ + processKey + " instances");
+ last = actual;
+ }
+
+ if (actual == count) {
+ return;
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ String msg = "Interrupted waiting for there to be " + count + " "
+ + processKey + " instances";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ String msg = "Timed out waiting for there to be " + count + " "
+ + processKey + " instances";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ /**
+ * Waits for the specified process variable to be set.
+ * @param processKey the process definition key
+ * @param variable the variable name
+ * @param timeout the timeout in milliseconds
+ * @return the variable value, or null if it cannot be obtained
+ * in the specified time
+ */
+ protected Object getProcessVariable(String processKey, String variable,
+ long timeout) {
+
+ msoLogger.debug("Waiting " + timeout + "ms for "
+ + processKey + "." + variable + " to be set");
+
+ long now = System.currentTimeMillis() + timeout;
+ long endTime = now + timeout;
+
+ ProcessInstance processInstance = null;
+ Object value = null;
+
+ while (value == null) {
+ if (now > endTime) {
+ if (processInstance == null) {
+ msoLogger.debug("Timed out waiting for "
+ + processKey + " to start");
+ } else {
+ msoLogger.debug("Timed out waiting for "
+ + processKey + "[" + processInstance.getId()
+ + "]." + variable + " to be set");
+ }
+
+ return null;
+ }
+
+ if (processInstance == null) {
+ processInstance = runtimeService
+ .createProcessInstanceQuery()
+ .processDefinitionKey(processKey)
+ .singleResult();
+ }
+
+ if (processInstance != null) {
+ value = runtimeService
+ .getVariable(processInstance.getId(), variable);
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ msoLogger.debug("Interrupted waiting for "
+ + processKey + "." + variable + " to be set");
+ return null;
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ msoLogger.debug(processKey + "["
+ + processInstance.getId() + "]." + variable + "="
+ + value);
+
+ return value;
+ }
+
+ /**
+ * Injects a single SDNC adapter callback request. The specified callback data
+ * may contain the placeholder string ((REQUEST-ID)) which is replaced with
+ * the actual SDNC request ID. Note: this is not the requestId in the original
+ * MSO request.
+ * @param contentType the HTTP content type for the callback
+ * @param content the content of the callback
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ */
+ protected boolean injectSDNCRestCallback(String contentType, String content, long timeout) {
+ String sdncRequestId = (String) getProcessVariable("SDNCAdapterRestV1",
+ "SDNCAResponse_CORRELATOR", timeout);
+
+ if (sdncRequestId == null) {
+ return false;
+ }
+
+ content = content.replace("((REQUEST-ID))", sdncRequestId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{REQUEST-ID}}", sdncRequestId);
+
+ msoLogger.debug("Injecting SDNC adapter callback");
+
+ Response response = workflowMessageResource.deliver(contentType, "SDNCAResponse", sdncRequestId, content);
+ msoLogger.debug("Workflow response to SDNC adapter callback: " + response);
+ return true;
+ }
+
+ /**
+ * Injects a single SDNC adapter callback request. The specified callback data
+ * may contain the placeholder string ((REQUEST-ID)) which is replaced with
+ * the actual SDNC request ID. Note: this is not the requestId in the original
+ * MSO request.
+ * @param content the content of the callback
+ * @param respCode the response code (normally 200)
+ * @param respMsg the response message (normally "OK")
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ */
+ protected boolean injectSDNCCallback(int respCode, String respMsg,
+ String content, long timeout) {
+
+ String sdncRequestId = (String) getProcessVariable("sdncAdapter",
+ "SDNCA_requestId", timeout);
+
+ if (sdncRequestId == null) {
+ return false;
+ }
+
+ content = content.replace("((REQUEST-ID))", sdncRequestId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{REQUEST-ID}}", sdncRequestId);
+
+ // TODO this needs to be fixed. It is causing double tags and content
+ // Need to parse content before setting below since content includes not just RequestData or modify callback files to only contain RequestData contents.
+
+ msoLogger.debug("Injecting SDNC adapter callback");
+ CallbackHeader callbackHeader = new CallbackHeader();
+ callbackHeader.setRequestId(sdncRequestId);
+ callbackHeader.setResponseCode(String.valueOf(respCode));
+ callbackHeader.setResponseMessage(respMsg);
+ SDNCAdapterCallbackRequest sdncAdapterCallbackRequest = new SDNCAdapterCallbackRequest();
+ sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader);
+ sdncAdapterCallbackRequest.setRequestData(content);
+ SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest);
+ msoLogger.debug("Workflow response to SDNC adapter callback: " + sdncAdapterResponse);
+
+ return true;
+ }
+
+ /**
+ * Injects a single VNF adapter callback request. The specified callback data
+ * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
+ * the actual message ID. Note: this is not the requestId in the original
+ * MSO request.
+ * @param contentType the HTTP content type for the callback
+ * @param content the content of the callback
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ */
+ protected boolean injectVnfAdapterRestCallback(String contentType, String content, long timeout) {
+ String messageId = (String) getProcessVariable("vnfAdapterRestV1",
+ "VNFAResponse_CORRELATOR", timeout);
+
+ if (messageId == null) {
+ return false;
+ }
+
+ content = content.replace("((MESSAGE-ID))", messageId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{MESSAGE-ID}}", messageId);
+
+ msoLogger.debug("Injecting VNF adapter callback");
+
+ Response response = workflowMessageResource.deliver(contentType, "VNFAResponse", messageId, content);
+ msoLogger.debug("Workflow response to VNF adapter callback: " + response);
+ return true;
+ }
+
+ /**
+ * Injects a Create VNF adapter callback request. The specified callback data
+ * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
+ * the actual message ID. It may also contain the placeholder string
+ * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
+ * @param content the content of the callback
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ * @throws JAXBException if the content does not adhere to the schema
+ */
+ protected boolean injectCreateVNFCallback(String content, long timeout) {
+
+ String messageId = (String) getProcessVariable("vnfAdapterCreateV1",
+ "VNFC_messageId", timeout);
+
+ if (messageId == null) {
+ return false;
+ }
+
+ content = content.replace("((MESSAGE-ID))", messageId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{MESSAGE-ID}}", messageId);
+
+ if(content.contains("((REQUEST-ID))")){
+ content = content.replace("((REQUEST-ID))", msoRequestId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{REQUEST-ID}}", msoRequestId);
+ }
+
+ msoLogger.debug("Injecting VNF adapter callback");
+
+ // Is it possible to unmarshal this with JAXB? I couldn't.
+
+ CreateVnfNotification createVnfNotification = new CreateVnfNotification();
+ XPathTool xpathTool = new VnfNotifyXPathTool();
+ xpathTool.setXML(content);
+
+ try {
+ String completed = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:completed/text()");
+ createVnfNotification.setCompleted("true".equals(completed));
+
+ String vnfId = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:vnfId/text()");
+ createVnfNotification.setVnfId(vnfId);
+
+ NodeList entries = (NodeList) xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:outputs/tns:entry",
+ XPathConstants.NODESET);
+
+ CreateVnfNotificationOutputs outputs = new CreateVnfNotificationOutputs();
+
+ for (int i = 0; i < entries.getLength(); i++) {
+ Node node = entries.item(i);
+
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element entry = (Element) node;
+ String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent();
+ String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent();
+ outputs.add(key, value);
+ }
+ }
+
+ createVnfNotification.setOutputs(outputs);
+
+ VnfRollback rollback = new VnfRollback();
+
+ String cloudSiteId = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:rollback/tns:cloudSiteId/text()");
+ rollback.setCloudSiteId(cloudSiteId);
+
+ String requestId = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
+ String serviceInstanceId = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()");
+
+ if (requestId != null || serviceInstanceId != null) {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId(requestId);
+ msoRequest.setServiceInstanceId(serviceInstanceId);
+ rollback.setMsoRequest(msoRequest);
+ }
+
+ String tenantCreated = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:rollback/tns:tenantCreated/text()");
+ rollback.setTenantCreated("true".equals(tenantCreated));
+
+ String tenantId = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:rollback/tns:tenantId/text()");
+ rollback.setTenantId(tenantId);
+
+ String vnfCreated = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:rollback/tns:vnfCreated/text()");
+ rollback.setVnfCreated("true".equals(vnfCreated));
+
+ String rollbackVnfId = xpathTool.evaluate(
+ "/tns:createVnfNotification/tns:rollback/tns:vnfId/text()");
+ rollback.setVnfId(rollbackVnfId);
+
+ createVnfNotification.setRollback(rollback);
+
+ } catch (Exception e) {
+ msoLogger.debug("Failed to unmarshal VNF callback content:");
+ msoLogger.debug(content);
+ return false;
+ }
+
+ VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
+
+
+ notifyService.createVnfNotification(
+ messageId,
+ createVnfNotification.isCompleted(),
+ createVnfNotification.getException(),
+ createVnfNotification.getErrorMessage(),
+ createVnfNotification.getVnfId(),
+ createVnfNotification.getOutputs(),
+ createVnfNotification.getRollback());
+
+ return true;
+ }
+
+ /**
+ * Injects a Delete VNF adapter callback request. The specified callback data
+ * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
+ * the actual message ID. It may also contain the placeholder string
+ * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
+ * @param content the content of the callback
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ * @throws JAXBException if the content does not adhere to the schema
+ */
+ protected boolean injectDeleteVNFCallback(String content, long timeout) {
+
+ String messageId = (String) getProcessVariable("vnfAdapterDeleteV1",
+ "VNFDEL_uuid", timeout);
+
+ if (messageId == null) {
+ return false;
+ }
+
+ content = content.replace("((MESSAGE-ID))", messageId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{MESSAGE-ID}}", messageId);
+
+ msoLogger.debug("Injecting VNF adapter delete callback");
+
+ // Is it possible to unmarshal this with JAXB? I couldn't.
+
+ DeleteVnfNotification deleteVnfNotification = new DeleteVnfNotification();
+ XPathTool xpathTool = new VnfNotifyXPathTool();
+ xpathTool.setXML(content);
+
+ try {
+ String completed = xpathTool.evaluate(
+ "/tns:deleteVnfNotification/tns:completed/text()");
+ deleteVnfNotification.setCompleted("true".equals(completed));
+ // if notification failure, set the exception and error message
+ if (deleteVnfNotification.isCompleted() == false) {
+ deleteVnfNotification.setException(MsoExceptionCategory.INTERNAL);
+ deleteVnfNotification.setErrorMessage(xpathTool.evaluate(
+ "/tns:deleteVnfNotification/tns:errorMessage/text()")) ;
+ }
+
+ } catch (Exception e) {
+ msoLogger.debug("Failed to unmarshal VNF Delete callback content:");
+ msoLogger.debug(content);
+ return false;
+ }
+
+ VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
+
+
+ notifyService.deleteVnfNotification(
+ messageId,
+ deleteVnfNotification.isCompleted(),
+ deleteVnfNotification.getException(),
+ deleteVnfNotification.getErrorMessage());
+
+ return true;
+ }
+
+ /**
+ * Injects a Update VNF adapter callback request. The specified callback data
+ * may contain the placeholder string ((MESSAGE-ID)) which is replaced with
+ * the actual message ID. It may also contain the placeholder string
+ * ((REQUEST-ID)) which is replaced request ID of the original MSO request.
+ * @param content the content of the callback
+ * @param timeout the timeout in milliseconds
+ * @return true if the callback could be injected, false otherwise
+ * @throws JAXBException if the content does not adhere to the schema
+ */
+ protected boolean injectUpdateVNFCallback(String content, long timeout) {
+
+ String messageId = (String) getProcessVariable("vnfAdapterUpdate",
+ "VNFU_messageId", timeout);
+
+ if (messageId == null) {
+ return false;
+ }
+
+ content = content.replace("((MESSAGE-ID))", messageId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{MESSAGE-ID}}", messageId);
+
+ content = content.replace("((REQUEST-ID))", msoRequestId);
+ // Deprecated usage. All test code should switch to the (( ... )) syntax.
+ content = content.replace("{{REQUEST-ID}}", msoRequestId);
+
+ msoLogger.debug("Injecting VNF adapter callback");
+
+ // Is it possible to unmarshal this with JAXB? I couldn't.
+
+ UpdateVnfNotification updateVnfNotification = new UpdateVnfNotification();
+ XPathTool xpathTool = new VnfNotifyXPathTool();
+ xpathTool.setXML(content);
+
+ try {
+ String completed = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:completed/text()");
+ updateVnfNotification.setCompleted("true".equals(completed));
+
+ NodeList entries = (NodeList) xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:outputs/tns:entry",
+ XPathConstants.NODESET);
+
+ UpdateVnfNotificationOutputs outputs = new UpdateVnfNotificationOutputs();
+
+ for (int i = 0; i < entries.getLength(); i++) {
+ Node node = entries.item(i);
+
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element entry = (Element) node;
+ String key = entry.getElementsByTagNameNS("*", "key").item(0).getTextContent();
+ String value = entry.getElementsByTagNameNS("*", "value").item(0).getTextContent();
+ outputs.add(key, value);
+ }
+ }
+
+ updateVnfNotification.setOutputs(outputs);
+
+ VnfRollback rollback = new VnfRollback();
+
+ String cloudSiteId = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:rollback/tns:cloudSiteId/text()");
+ rollback.setCloudSiteId(cloudSiteId);
+
+ String requestId = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:requestId/text()");
+ String serviceInstanceId = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:rollback/tns:msoRequest/tns:serviceInstanceId/text()");
+
+ if (requestId != null || serviceInstanceId != null) {
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId(requestId);
+ msoRequest.setServiceInstanceId(serviceInstanceId);
+ rollback.setMsoRequest(msoRequest);
+ }
+
+ String tenantCreated = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:rollback/tns:tenantCreated/text()");
+ rollback.setTenantCreated("true".equals(tenantCreated));
+
+ String tenantId = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:rollback/tns:tenantId/text()");
+ rollback.setTenantId(tenantId);
+
+ String vnfCreated = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:rollback/tns:vnfCreated/text()");
+ rollback.setVnfCreated("true".equals(vnfCreated));
+
+ String rollbackVnfId = xpathTool.evaluate(
+ "/tns:updateVnfNotification/tns:rollback/tns:vnfId/text()");
+ rollback.setVnfId(rollbackVnfId);
+
+ updateVnfNotification.setRollback(rollback);
+
+ } catch (Exception e) {
+ msoLogger.debug("Failed to unmarshal VNF callback content:");
+ msoLogger.debug(content);
+ return false;
+ }
+
+ VnfAdapterNotifyServiceImpl notifyService = new VnfAdapterNotifyServiceImpl();
+
+
+ notifyService.updateVnfNotification(
+ messageId,
+ updateVnfNotification.isCompleted(),
+ updateVnfNotification.getException(),
+ updateVnfNotification.getErrorMessage(),
+ updateVnfNotification.getOutputs(),
+ updateVnfNotification.getRollback());
+
+ return true;
+ }
+
+ /**
+ * Runs a program to inject workflow messages into the test environment.
+ * A program is essentially just a list of keys that identify event data
+ * to be injected, in sequence. An example program:
+ * <pre>
+ * event1, event2
+ * </pre>
+ * Errors are handled with junit assertions and will cause the test to fail.
+ * NOTE: Each callback must have a workflow message type associated with it.
+ * @param callbacks an object containing event data for the program
+ * @param program the program to execute
+ */
+ protected void injectWorkflowMessages(CallbackSet callbacks, String program) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String messageType = null;
+ String content = null;
+ String contentType = null;
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No '" + action + "' workflow message callback is defined";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ messageType = callbackData.getMessageType();
+
+ if (messageType == null || messageType.trim().equals("")) {
+ String msg = "No workflow message type is defined in the '" + action + "' callback";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ contentType = callbackData.getContentType();
+ } else {
+ String msg = "Invalid workflow message program modifier: '" + modifier + "'";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ if (!injectWorkflowMessage(contentType, messageType, content, 10000)) {
+ fail("Failed to inject '" + action + "' workflow message");
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of '" + action + "' workflow message");
+ }
+ }
+ }
+
+ /**
+ * Injects a workflow message. The specified callback data may contain the
+ * placeholder string ((CORRELATOR)) which is replaced with the actual
+ * correlator value.
+ * @param contentType the HTTP contentType for the message (possibly null)
+ * @param messageType the message type
+ * @param content the message content (possibly null)
+ * @param timeout the timeout in milliseconds
+ * @return true if the message could be injected, false otherwise
+ */
+ protected boolean injectWorkflowMessage(String contentType, String messageType, String content, long timeout) {
+ String correlator = (String) getProcessVariable("ReceiveWorkflowMessage",
+ messageType + "_CORRELATOR", timeout);
+
+ if (correlator == null) {
+ return false;
+ }
+
+ if (content != null) {
+ content = content.replace("((CORRELATOR))", correlator);
+ }
+
+ msoLogger.debug("Injecting " + messageType + " message");
+
+ Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
+ msoLogger.debug("Workflow response to " + messageType + " message: " + response);
+ return true;
+ }
+
+ /**
+ * Runs a program to inject sniro workflow messages into the test environment.
+ * A program is essentially just a list of keys that identify event data
+ * to be injected, in sequence. For more details, see
+ * injectSNIROCallbacks(String contentType, String messageType, String content, long timeout)
+ *
+ * Errors are handled with junit assertions and will cause the test to fail.
+ * NOTE: Each callback must have a workflow message type associated with it.
+ *
+ * @param callbacks an object containing event data for the program
+ * @param program the program to execute
+ */
+ protected void injectSNIROCallbacks(CallbackSet callbacks, String program) {
+
+ String[] cmds = program.replaceAll("\\s+", "").split(",");
+
+ for (String cmd : cmds) {
+ String action = cmd;
+ String modifier = "STD";
+
+ if (cmd.contains(":")) {
+ String[] parts = cmd.split(":");
+ action = parts[0];
+ modifier = parts[1];
+ }
+
+ String messageType = null;
+ String content = null;
+ String contentType = null;
+
+ if ("STD".equals(modifier)) {
+ CallbackData callbackData = callbacks.get(action);
+
+ if (callbackData == null) {
+ String msg = "No '" + action + "' workflow message callback is defined";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ messageType = callbackData.getMessageType();
+
+ if (messageType == null || messageType.trim().equals("")) {
+ String msg = "No workflow message type is defined in the '" + action + "' callback";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ content = callbackData.getContent();
+ contentType = callbackData.getContentType();
+ } else {
+ String msg = "Invalid workflow message program modifier: '" + modifier + "'";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ if (!injectSNIROCallbacks(contentType, messageType, content, 10000)) {
+ fail("Failed to inject '" + action + "' workflow message");
+ }
+
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ fail("Interrupted after injection of '" + action + "' workflow message");
+ }
+ }
+ }
+
+ /**
+ * Injects a sniro workflow message. The specified callback response may
+ * contain the placeholder strings ((CORRELATOR)) and ((SERVICE_RESOURCE_ID))
+ * The ((CORRELATOR)) is replaced with the actual correlator value from the
+ * request. The ((SERVICE_RESOURCE_ID)) is replaced with the actual serviceResourceId
+ * value from the sniro request. Currently this only works with sniro request
+ * that contain only 1 resource.
+ *
+ * @param contentType the HTTP contentType for the message (possibly null)
+ * @param messageType the message type
+ * @param content the message content (possibly null)
+ * @param timeout the timeout in milliseconds
+ * @return true if the message could be injected, false otherwise
+ */
+ protected boolean injectSNIROCallbacks(String contentType, String messageType, String content, long timeout) {
+ String correlator = (String) getProcessVariable("ReceiveWorkflowMessage",
+ messageType + "_CORRELATOR", timeout);
+
+ if (correlator == null) {
+ return false;
+ }
+ if (content != null) {
+ content = content.replace("((CORRELATOR))", correlator);
+ if(messageType.equalsIgnoreCase("SNIROResponse")){
+ ServiceDecomposition decomp = (ServiceDecomposition) getProcessVariable("Homing", "serviceDecomposition", timeout);
+ List<Resource> resourceList = decomp.getServiceResources();
+ if(resourceList.size() == 1){
+ String resourceId = "";
+ for(Resource resource:resourceList){
+ resourceId = resource.getResourceId();
+ }
+ String homingList = getJsonValue(content, "solutionInfo.placement");
+ JSONArray placementArr = null;
+ try {
+ placementArr = new JSONArray(homingList);
+ }
+ catch (Exception e) {
+ return false;
+ }
+ if(placementArr.length() == 1){
+ content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
+ }
+ String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
+ JSONArray licenseArr = null;
+ try {
+ licenseArr = new JSONArray(licenseInfoList);
+ }
+ catch (Exception e) {
+ return false;
+ }
+ if(licenseArr.length() == 1){
+ content = content.replace("((SERVICE_RESOURCE_ID))", resourceId);
+ }
+ }
+ else {
+ try {
+ String homingList = getJsonValue(content, "solutionInfo.placementInfo");
+ String licenseInfoList = getJsonValue(content, "solutionInfo.licenseInfo");
+ JSONArray placementArr = new JSONArray(homingList);
+ JSONArray licenseArr = new JSONArray(licenseInfoList);
+ for (Resource resource: resourceList) {
+ String resourceModuleName = resource.getModelInfo().getModelInstanceName();
+ String resourceId = resource.getResourceId();
+
+ for (int i=0; i<placementArr.length(); i++) {
+ JSONObject placementObj = placementArr.getJSONObject(i);
+ String placementModuleName = placementObj.getString("resourceModuleName");
+ if (placementModuleName.equalsIgnoreCase(resourceModuleName)) {
+ String placementString = placementObj.toString();
+ placementString = placementString.replace("((SERVICE_RESOURCE_ID))", resourceId);
+ JSONObject newPlacementObj = new JSONObject(placementString);
+ placementArr.put(i, newPlacementObj);
+ }
+ }
+
+ for (int i=0; i<licenseArr.length(); i++) {
+ JSONObject licenseObj = licenseArr.getJSONObject(i);
+ String licenseModuleName = licenseObj.getString("resourceModuleName");
+ if (licenseModuleName.equalsIgnoreCase(resourceModuleName)) {
+ String licenseString = licenseObj.toString();
+ licenseString = licenseString.replace("((SERVICE_RESOURCE_ID))", resourceId);
+ JSONObject newLicenseObj = new JSONObject(licenseString);
+ licenseArr.put(i, newLicenseObj);
+ }
+ }
+ }
+ String newPlacementInfos = placementArr.toString();
+ String newLicenseInfos = licenseArr.toString();
+ content = updJsonValue(content, "solutionInfo.placementInfo", newPlacementInfos);
+ content = updJsonValue(content, "solutionInfo.licenseInfo", newLicenseInfos);
+ }
+ catch(Exception e) {
+ return false;
+ }
+
+ }
+ }
+ }
+ msoLogger.debug("Injecting " + messageType + " message");
+
+ Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content);
+ msoLogger.debug("Workflow response to " + messageType + " message: " + response);
+ return true;
+ }
+
+
+ /**
+ * Wait for the process to end.
+ * @param businessKey the process business key
+ * @param timeout the amount of time to wait, in milliseconds
+ */
+ protected void waitForProcessEnd(String businessKey, long timeout) {
+ msoLogger.debug("Waiting " + timeout + "ms for process with business key " +
+ businessKey + " to end");
+
+ long now = System.currentTimeMillis() + timeout;
+ long endTime = now + timeout;
+
+ while (now <= endTime) {
+ if (isProcessEnded(businessKey)) {
+ msoLogger.debug("Process with business key " + businessKey + " has ended");
+ return;
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ String msg = "Interrupted waiting for process with business key " +
+ businessKey + " to end";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ String msg = "Process with business key " + businessKey +
+ " did not end within " + timeout + "ms";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ /**
+ * Wait for the process to end. Must be used when multiple process instances exist with
+ * this same business key such as when its passed to subflows or shared across multiple
+ * processes.
+ *
+ * @param businessKey the process business key
+ * @param processName the process definition name
+ * @param timeout the amount of time to wait, in milliseconds
+ * @author cb645j
+ */
+ protected void waitForProcessEnd(String businessKey, String processName, long timeout) {
+ msoLogger.debug("Waiting " + timeout + "ms for process with business key " +
+ businessKey + " to end");
+
+ long now = System.currentTimeMillis() + timeout;
+ long endTime = now + timeout;
+
+ while (now <= endTime) {
+ if (isProcessEnded(businessKey, processName)) {
+ msoLogger.debug("Process with business key " + businessKey + " has ended");
+ return;
+ }
+
+ try {
+ Thread.sleep(200);
+ } catch (InterruptedException e) {
+ String msg = "Interrupted waiting for process with business key " +
+ businessKey + " to end";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ now = System.currentTimeMillis();
+ }
+
+ String msg = "Process with business key " + businessKey +
+ " did not end within " + timeout + "ms";
+ msoLogger.debug(msg);
+ fail(msg);
+ }
+
+ /**
+ * Verifies that the specified historic process variable has the specified value.
+ * If the variable does not have the specified value, the test is failed.
+ *
+ * @param businessKey the process business key
+ * @param variable the variable name
+ * @param value the expected variable value
+ */
+ protected void checkVariable(String businessKey, String variable, Object value) {
+ if (!isProcessEnded(businessKey)) {
+ fail("Cannot get historic variable " + variable + " because process with business key " +
+ businessKey + " has not ended");
+ }
+
+ Object variableValue = getVariableFromHistory(businessKey, variable);
+ assertEquals(value, variableValue);
+ }
+
+ /**
+ * Checks to see if the specified process is ended.
+ * @param businessKey the process business Key
+ * @return true if the process is ended
+ */
+ protected boolean isProcessEnded(String businessKey) {
+ HistoricProcessInstance processInstance = historyService
+ .createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult();
+ return processInstance != null && processInstance.getEndTime() != null;
+ }
+
+ /**
+ * Checks to see if the specified process is ended.
+<<<<<<< HEAD:bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
+ * @param processInstanceId the process Instance Id
+ * @return true if the process is ended
+ */
+ protected boolean isProcessEndedByProcessInstanceId(String processInstanceId) {
+ HistoricProcessInstance processInstance = historyService
+ .createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
+ return processInstance != null && processInstance.getEndTime() != null;
+ }
+
+ /**
+ * Checks to see if the specified process is ended.
+=======
+>>>>>>> origin/release/1806.51:bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/WorkflowTest.java
+ * @author cb645j
+ */
+ //TODO combine into 1
+ private boolean isProcessEnded(String businessKey, String processName) {
+ HistoricProcessInstance processInstance = historyService
+ .createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).processDefinitionName(processName).singleResult();
+ return processInstance != null && processInstance.getEndTime() != null;
+ }
+
+ /**
+ * Gets a variable value from a historical process instance. The business key must be unique.
+ *
+ * @param businessKey the process business key
+ * @param variableName the variable name
+ * @return the variable value or null if the variable does not exist
+ */
+ protected Object getVariableFromHistory(String businessKey, String variableName) {
+ try {
+ HistoricProcessInstance processInstance = historyService
+ .createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).singleResult();
+
+ if (processInstance == null) {
+ return null;
+ }
+
+ HistoricVariableInstance v = historyService
+ .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
+ .variableName(variableName).singleResult();
+ return v == null ? null : v.getValue();
+ } catch (Exception e) {
+ msoLogger.debug("Error retrieving variable " + variableName +
+ " from historical process with business key " + businessKey + ": " + e);
+ return null;
+ }
+ }
+
+ /**
+ * Gets a variable value from a process instance based on businessKey and process name.
+ * Must be used when multiple instances exist with the same business key such as when
+ * business key is passed to subflows or shared across multiple processes. This method
+ * can obtain variables from mainflows and from subflows.
+ *
+ * @param businessKey the process business key
+ * @param processName the process definition name
+ * @param variableName the variable name
+ * @return the variable value or null if the variable does not exist
+ * @author cb645j
+ */
+ protected Object getVariableFromHistory(String businessKey, String processName, String variableName){
+ try{
+ HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).processDefinitionName(processName)
+ .singleResult();
+
+ if(processInstance == null){
+ return null;
+ }
+ HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).variableName(variableName).singleResult();
+
+ return variable == null ? null : variable.getValue();
+ }catch(ProcessEngineException e){
+ msoLogger.debug("Multiple proccess instances exist with process name " + processName + " and business key " + businessKey + ". Must pass instance index as a parameter.");
+ return null;
+ }catch(Exception e){
+ msoLogger.debug("Error retrieving variable " + variableName + " from historical process for process " + processName + " with business key " + businessKey + ": " + e);
+ return null;
+ }
+ }
+
+ /**
+ * Gets the value of a process variable from x instance of y process. Must be used when
+ * multiple instances exist with the same business key AND process name. This method
+ * shall be used primarily for obtaining subflow variables when the business key is
+ * passed to the subflow AND the subflow is called multiple times in a given flow.
+ *
+ * @param businessKey the process business key
+ * @param processName the name of the subflow that contains the variable
+ * @param variableName the variable name
+ * @param processInstanceIndex the instance in which the subprocess was called
+ * @return the variable value or null if the variable does not exist
+ * @author cb645j
+ */
+ protected Object getVariableFromHistory(String businessKey, int subflowInstanceIndex, String processName, String variableName){
+ try{
+ List<HistoricProcessInstance> processInstanceList = historyService.createHistoricProcessInstanceQuery().processInstanceBusinessKey(businessKey).processDefinitionName(processName)
+ .list();
+
+ if(processInstanceList == null){
+ return null;
+ }
+ processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
+
+ HistoricProcessInstance processInstance = processInstanceList.get(subflowInstanceIndex);
+ HistoricVariableInstance variable = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
+ .variableName(variableName).singleResult();
+
+ return variable == null ? null : variable.getValue();
+ }catch(Exception e) {
+ msoLogger.debug("Error retrieving variable " + variableName + " from historical process for process " + processName + " with business key " + businessKey + ": " + e);
+ return null;
+ }
+ }
+
+
+ /**
+ * Gets the value of a subflow variable from the specified subflow's
+ * historical process instance.
+ *
+ * DEPRECATED - Use method getVariableFromHistory(businessKey, processName, variableName) instead
+ *
+ * @param subflowName - the name of the subflow that contains the variable
+ * @param variableName the variable name
+ *
+ * @return the variable value, or null if the variable could not be obtained
+ *
+ */
+ @Deprecated
+ protected Object getVariableFromSubflowHistory(String subflowName, String variableName) {
+ try {
+ List<HistoricProcessInstance> processInstanceList = historyService
+ .createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list();
+
+ if (processInstanceList == null) {
+ return null;
+ }
+
+ processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
+
+ HistoricProcessInstance processInstance = processInstanceList.get(0);
+
+ HistoricVariableInstance v = historyService
+ .createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
+ .variableName(variableName).singleResult();
+ return v == null ? null : v.getValue();
+ } catch (Exception e) {
+ msoLogger.debug("Error retrieving variable " + variableName +
+ " from sub flow: " + subflowName + ", Exception is: " + e);
+ return null;
+ }
+ }
+
+ /**
+ * Gets the value of a subflow variable from the subflow's
+ * historical process x instance.
+ *
+ * DEPRECATED: Use method getVariableFromHistory(businessKey, processInstanceIndex, processName, variableName) instead
+ *
+ * @param subflowName - the name of the subflow that contains the variable
+ * @param variableName the variable name
+ * @param subflowInstanceIndex - the instance of the subflow (use when same subflow is called more than once from mainflow)
+ *
+ * @return the variable value, or null if the variable could not be obtained
+ */
+ @Deprecated
+ protected Object getVariableFromSubflowHistory(int subflowInstanceIndex, String subflowName, String variableName) {
+ try {
+ List<HistoricProcessInstance> processInstanceList = historyService.createHistoricProcessInstanceQuery().processDefinitionName(subflowName).list();
+
+ if (processInstanceList == null) {
+ return null;
+ }
+
+ processInstanceList.sort((m1, m2) -> m1.getStartTime().compareTo(m2.getStartTime()));
+
+ HistoricProcessInstance processInstance = processInstanceList.get(subflowInstanceIndex);
+
+ HistoricVariableInstance v = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId())
+ .variableName(variableName).singleResult();
+ return v == null ? null : v.getValue();
+ } catch (Exception e) {
+ msoLogger.debug("Error retrieving variable " + variableName +
+ " from " + subflowInstanceIndex + " instance index of sub flow: " + subflowName + ", Exception is: " + e);
+ return null;
+ }
+ }
+
+ /**
+ * Extracts text from an XML element. This method is not namespace aware
+ * (namespaces are ignored). The first matching element is selected.
+ * @param xml the XML document or fragment
+ * @param tag the desired element, e.g. "<name>"
+ * @return the element text, or null if the element was not found
+ */
+ protected String getXMLTextElement(String xml, String tag) {
+ xml = removeXMLNamespaces(xml);
+
+ if (!tag.startsWith("<")) {
+ tag = "<" + tag + ">";
+ }
+
+ int start = xml.indexOf(tag);
+
+ if (start == -1) {
+ return null;
+ }
+
+ int end = xml.indexOf('<', start + tag.length());
+
+ if (end == -1) {
+ return null;
+ }
+
+ return xml.substring(start + tag.length(), end);
+ }
+
+ /**
+ * Removes namespace definitions and prefixes from XML, if any.
+ */
+ private String removeXMLNamespaces(String xml) {
+ // remove xmlns declaration
+ xml = xml.replaceAll("xmlns.*?(\"|\').*?(\"|\')", "");
+
+ // remove opening tag prefix
+ xml = xml.replaceAll("(<)(\\w+:)(.*?>)", "$1$3");
+
+ // remove closing tags prefix
+ xml = xml.replaceAll("(</)(\\w+:)(.*?>)", "$1$3");
+
+ // remove extra spaces left when xmlns declarations are removed
+ xml = xml.replaceAll("\\s+>", ">");
+
+ return xml;
+ }
+
+ /**
+ * Asserts that two XML documents are semantically equivalent. Differences
+ * in whitespace or in namespace usage do not affect the comparison.
+ * @param expected the expected XML
+ * @param actual the XML to test
+ * @throws SAXException
+ * @throws IOException
+ */
+ public static void assertXMLEquals(String expected, String actual)
+ throws SAXException, IOException {
+ XMLUnit.setIgnoreWhitespace(true);
+ XMLUnit.setIgnoreAttributeOrder(true);
+ DetailedDiff diff = new DetailedDiff(XMLUnit.compareXML(expected, actual));
+ List<?> allDifferences = diff.getAllDifferences();
+ assertEquals("Differences found: " + diff.toString(), 0, allDifferences.size());
+ }
+
+ /**
+ * A test implementation of AsynchronousResponse.
+ */
+ public class TestAsyncResponse {
+ Response response = null;
+
+ /**
+ * {@inheritDoc}
+ */
+ public synchronized void setResponse(Response response) {
+ this.response = response;
+ }
+
+ /**
+ * Gets the response.
+ * @return the response, or null if none has been produced yet
+ */
+ public synchronized Response getResponse() {
+ return response;
+ }
+ }
+
+ /**
+ * An object that contains callback data for a "program".
+ */
+ public class CallbackSet {
+ private final Map<String, CallbackData> map = new HashMap<>();
+
+ /**
+ * Add untyped callback data to the set.
+ * @param action the action with which the data is associated
+ * @param content the callback data
+ */
+ public void put(String action, String content) {
+ map.put(action, new CallbackData(null, null, content));
+ }
+
+ /**
+ * Add callback data to the set.
+ * @param action the action with which the data is associated
+ * @param messageType the callback message type
+ * @param content the callback data
+ */
+ public void put(String action, String messageType, String content) {
+ map.put(action, new CallbackData(null, messageType, content));
+ }
+
+ /**
+ * Add callback data to the set.
+ * @param action the action with which the data is associated
+ * @param contentType the callback HTTP content type
+ * @param messageType the callback message type
+ * @param content the callback data
+ */
+ public void put(String action, String contentType, String messageType, String content) {
+ map.put(action, new CallbackData(contentType, messageType, content));
+ }
+
+ /**
+ * Retrieve callback data from the set.
+ * @param action the action with which the data is associated
+ * @return the callback data, or null if there is none for the specified operation
+ */
+ public CallbackData get(String action) {
+ return map.get(action);
+ }
+ }
+
+ /**
+ * Represents a callback data item.
+ */
+ public class CallbackData {
+ private final String contentType;
+ private final String messageType;
+ private final String content;
+
+ /**
+ * Constructor
+ * @param contentType the HTTP content type (optional)
+ * @param messageType the callback message type (optional)
+ * @param content the content
+ */
+ public CallbackData(String contentType, String messageType, String content) {
+ this.contentType = contentType;
+ this.messageType = messageType;
+ this.content = content;
+ }
+
+ /**
+ * Gets the callback HTTP content type, possibly null.
+ */
+ public String getContentType() {
+ return contentType;
+ }
+
+ /**
+ * Gets the callback message type, possibly null.
+ */
+ public String getMessageType() {
+ return messageType;
+ }
+
+ /**
+ * Gets the callback content.
+ */
+ public String getContent() {
+ return content;
+ }
+ }
+
+ /**
+ * A tool for evaluating XPath expressions.
+ */
+ protected class XPathTool {
+ private final DocumentBuilderFactory factory;
+ private final SimpleNamespaceContext context = new SimpleNamespaceContext();
+ private final XPath xpath = XPathFactory.newInstance().newXPath();
+ private String xml = null;
+ private Document doc = null;
+
+ /**
+ * Constructor.
+ */
+ public XPathTool() {
+ factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ xpath.setNamespaceContext(context);
+ }
+
+ /**
+ * Adds a namespace.
+ * @param prefix the namespace prefix
+ * @param uri the namespace uri
+ */
+ public synchronized void addNamespace(String prefix, String uri) {
+ context.add(prefix, uri);
+ }
+
+ /**
+ * Sets the XML content to be operated on.
+ * @param xml the XML content
+ */
+ public synchronized void setXML(String xml) {
+ this.xml = xml;
+ this.doc = null;
+ }
+
+ /**
+ * Returns the document object.
+ * @return the document object, or null if XML has not been set
+ * @throws SAXException
+ * @throws IOException
+ * @throws ParserConfigurationException
+ */
+ public synchronized Document getDocument()
+ throws ParserConfigurationException, IOException, SAXException {
+ if (xml == null) {
+ return null;
+ }
+
+ buildDocument();
+ return doc;
+ }
+
+ /**
+ * Evaluates the specified XPath expression and returns a string result.
+ * This method throws exceptions on error.
+ * @param expression the expression
+ * @return the result object
+ * @throws ParserConfigurationException
+ * @throws IOException
+ * @throws SAXException
+ * @throws XPathExpressionException on error
+ */
+ public synchronized String evaluate(String expression)
+ throws ParserConfigurationException, SAXException,
+ IOException, XPathExpressionException {
+ return (String) evaluate(expression, XPathConstants.STRING);
+ }
+
+ /**
+ * Evaluates the specified XPath expression.
+ * This method throws exceptions on error.
+ * @param expression the expression
+ * @param returnType the return type
+ * @return the result object
+ * @throws ParserConfigurationException
+ * @throws IOException
+ * @throws SAXException
+ * @throws XPathExpressionException on error
+ */
+ public synchronized Object evaluate(String expression, QName returnType)
+ throws ParserConfigurationException, SAXException,
+ IOException, XPathExpressionException {
+
+ buildDocument();
+ XPathExpression expr = xpath.compile(expression);
+ return expr.evaluate(doc, returnType);
+ }
+
+ /**
+ * Private helper method that builds the document object.
+ * Assumes the calling method is synchronized.
+ * @throws ParserConfigurationException
+ * @throws IOException
+ * @throws SAXException
+ */
+ private void buildDocument() throws ParserConfigurationException,
+ IOException, SAXException {
+ if (doc == null) {
+ if (xml == null) {
+ throw new IOException("XML input is null");
+ }
+
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ InputSource source = new InputSource(new StringReader(xml));
+ doc = builder.parse(source);
+ }
+ }
+ }
+
+ /**
+ * A NamespaceContext class based on a Map.
+ */
+ private class SimpleNamespaceContext implements NamespaceContext {
+ private Map<String, String> prefixMap = new HashMap<>();
+ private Map<String, String> uriMap = new HashMap<>();
+
+ public synchronized void add(String prefix, String uri) {
+ prefixMap.put(prefix, uri);
+ uriMap.put(uri, prefix);
+ }
+
+ @Override
+ public synchronized String getNamespaceURI(String prefix) {
+ return prefixMap.get(prefix);
+ }
+
+ @Override
+ public Iterator<String> getPrefixes(String uri) {
+ List<String> list = new ArrayList<>();
+ String prefix = uriMap.get(uri);
+ if (prefix != null) {
+ list.add(prefix);
+ }
+ return list.iterator();
+ }
+
+ @Override
+ public String getPrefix(String uri) {
+ return uriMap.get(uri);
+ }
+ }
+
+ /**
+ * A VnfNotify XPathTool.
+ */
+ protected class VnfNotifyXPathTool extends XPathTool {
+ public VnfNotifyXPathTool() {
+ addNamespace("tns", "http://org.onap.so/vnfNotify");
+ }
+ }
+
+ /**
+ * Helper class to make it easier to create this type.
+ */
+ private static class CreateVnfNotificationOutputs
+ extends CreateVnfNotification.Outputs {
+ public void add(String key, String value) {
+ Entry entry = new Entry();
+ entry.setKey(key);
+ entry.setValue(value);
+ getEntry().add(entry);
+ }
+ }
+
+ /**
+ * Helper class to make it easier to create this type.
+ */
+ private static class UpdateVnfNotificationOutputs
+ extends UpdateVnfNotification.Outputs {
+ public void add(String key, String value) {
+ Entry entry = new Entry();
+ entry.setKey(key);
+ entry.setValue(value);
+ getEntry().add(entry);
+ }
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java
new file mode 100644
index 0000000000..dbad35a6a4
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTestTransformer.java
@@ -0,0 +1,41 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.common;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Allows a subclass of WorkflowTest to specify one or more WireMock
+ * response transformers. A transformer must be declared as a public
+ * static field in the subclass. For example:
+ * <pre>
+ * @WorkflowTestTransformer
+ * public static final ResponseTransformer sdncAdapterMockTransformer =
+ * new SDNCAdapterMockTransformer();
+ * </pre>
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.FIELD)
+public @interface WorkflowTestTransformer {
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java
new file mode 100644
index 0000000000..5b5e17c5fc
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/FlakyTests.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 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.bpmn.infrastructure;
+
+public interface FlakyTests {
+ /* category marker */
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
new file mode 100644
index 0000000000..7cb649d66e
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionTestImpl.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+
+public class AaiConnectionTestImpl implements AaiConnection {
+
+ public static final String ID_WITH_ENTRY_AND_IP = "idWithEntryAndIp";
+ public static final String ID_WITH_IP_V6 = "idWithIpV6";
+ public static final String ID_WITHOUT_ENTRY = "IdWithoutEntry";
+ public static final String ID_WITH_ENTRY_NO_IP = "idWithEntryNoIp";
+ public static final String DEFAULT_IP = "1.2.3.4";
+ public static final String DEFAULT_IP_V6 = "2001:db8::ff00:42:8329";
+
+ private Map<String, Pnf> created = new HashMap<>();
+
+ @Override
+ public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
+ if (Objects.equals(correlationId, ID_WITH_ENTRY_AND_IP)) {
+ Pnf pnf = new Pnf();
+ pnf.setIpaddressV4Oam(DEFAULT_IP);
+ return Optional.of(pnf);
+ } else if (Objects.equals(correlationId, ID_WITH_IP_V6)) {
+ Pnf pnf = new Pnf();
+ pnf.setIpaddressV6Oam(DEFAULT_IP_V6);
+ return Optional.of(pnf);
+ } else if (Objects.equals(correlationId, ID_WITH_ENTRY_NO_IP)) {
+ return Optional.of(new Pnf());
+ } else {
+ return Optional.empty();
+ }
+ }
+
+ @Override
+ public void createEntry(String correlationId, Pnf entry) throws IOException {
+ created.put(correlationId, entry);
+ }
+
+ public Map<String, Pnf> getCreated() {
+ return created;
+ }
+
+ public void reset() {
+ created.clear();
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
new file mode 100644
index 0000000000..7df6757817
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AaiConnectionThrowingException.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import java.io.IOException;
+import java.util.Optional;
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiConnection;
+
+public class AaiConnectionThrowingException implements AaiConnection {
+
+ @Override
+ public Optional<Pnf> getEntryFor(String correlationId) throws IOException {
+ throw new IOException();
+ }
+
+ @Override
+ public void createEntry(String correlationId, Pnf entry) throws IOException {
+ throw new IOException();
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
new file mode 100644
index 0000000000..f5d212f61c
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CancelDmaapSubscriptionTest.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {CancelDmaapSubscription.class, DmaapClientTestImpl.class})
+public class CancelDmaapSubscriptionTest {
+
+ @Autowired
+ public CancelDmaapSubscription delegate;
+
+ @Autowired
+ private DmaapClientTestImpl dmaapClientTest;
+
+ @Test
+ public void shouldCancelSubscription() throws Exception {
+ // given
+ DelegateExecution delegateExecution = mock(DelegateExecution.class);
+ when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId");
+ when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
+ dmaapClientTest.registerForUpdate("testCorrelationId", () -> {});
+ // when
+ delegate.execute(delegateExecution);
+ // then
+ assertThat(dmaapClientTest.haveRegisteredConsumer()).isFalse();
+ }
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
new file mode 100644
index 0000000000..301e5d9f6d
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
@@ -0,0 +1,132 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_IP_V6;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_IP;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.junit.Test;
+import org.junit.experimental.runners.Enclosed;
+import org.junit.runner.RunWith;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(Enclosed.class)
+public class CheckAaiForCorrelationIdDelegateTest {
+
+ @RunWith(SpringRunner.class)
+ @SpringBootTest(classes = {CheckAaiForCorrelationIdDelegate.class, AaiConnectionTestImpl.class})
+ public static class ConnectionOkTests {
+
+ @Autowired
+ private CheckAaiForCorrelationIdDelegate delegate;
+
+ @Test
+ public void shouldThrowExceptionWhenCorrelationIdIsNotSet() throws Exception {
+ // given
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable(CORRELATION_ID)).thenReturn(null);
+ when(execution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue");
+ // when, then
+ assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class);
+ verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class));
+ }
+
+ @Test
+ public void shouldSetCorrectVariablesWhenAaiDoesNotContainInfoAboutPnf() throws Exception {
+ // given
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITHOUT_ENTRY);
+ // when
+ delegate.execute(execution);
+ // then
+ verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, false);
+ }
+
+ @Test
+ public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf() throws Exception {
+ shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(ID_WITH_ENTRY_AND_IP);
+ }
+
+ @Test
+ public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithIpV6() throws Exception {
+ shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(ID_WITH_IP_V6);
+ }
+
+ private void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnf(String id) throws Exception {
+ // given
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable(CORRELATION_ID)).thenReturn(id);
+ // when
+ delegate.execute(execution);
+ // then
+ verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, true);
+ verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, true);
+ }
+
+ @Test
+ public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithoutIp() throws Exception {
+ // given
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY_NO_IP);
+ // when
+ delegate.execute(execution);
+ // then
+ verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, true);
+ verify(execution).setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, false);
+ }
+ }
+
+
+ @RunWith(SpringRunner.class)
+ @SpringBootTest(classes = {CheckAaiForCorrelationIdDelegate.class, AaiConnectionThrowingException.class})
+ public static class NoConnectionTests {
+
+ @Autowired
+ private CheckAaiForCorrelationIdDelegate delegate;
+
+ @Test
+ public void shouldThrowExceptionWhenIoExceptionOnConnectionToAai() throws Exception {
+ // given
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable(CORRELATION_ID)).thenReturn(ID_WITH_ENTRY_NO_IP);
+ when(execution.getVariable("testProcessKey")).thenReturn("testProcessKey");
+ // when, then
+ assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class);
+ verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class));
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java
new file mode 100644
index 0000000000..465dc085fc
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CreateAaiEntryWithPnfIdDelegateTest.java
@@ -0,0 +1,50 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.junit.Test;
+import org.onap.aai.domain.yang.Pnf;
+
+public class CreateAaiEntryWithPnfIdDelegateTest {
+
+ @Test
+ public void shouldSetPnfIdAndPnfName() throws Exception {
+ // given
+ CreateAaiEntryWithPnfIdDelegate delegate = new CreateAaiEntryWithPnfIdDelegate();
+ AaiConnectionTestImpl aaiConnection = new AaiConnectionTestImpl();
+ delegate.setAaiConnection(aaiConnection);
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable(eq(CORRELATION_ID))).thenReturn("testCorrelationId");
+ // when
+ delegate.execute(execution);
+ // then
+ Pnf createdEntry = aaiConnection.getCreated().get("testCorrelationId");
+ assertThat(createdEntry.getPnfId()).isEqualTo("testCorrelationId");
+ assertThat(createdEntry.getPnfName()).isEqualTo("testCorrelationId");
+ assertThat(createdEntry.isInMaint()).isTrue();
+ }
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
new file mode 100644
index 0000000000..9c8f19f102
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
+import java.util.Objects;
+
+public class DmaapClientTestImpl implements DmaapClient {
+
+ private String correlationId;
+ private Runnable informConsumer;
+
+ @Override
+ public void registerForUpdate(String correlationId, Runnable informConsumer) {
+ this.correlationId = correlationId;
+ this.informConsumer = informConsumer;
+ }
+
+ @Override
+ public Runnable unregister(String correlationId) {
+ if (Objects.equals(this.correlationId, correlationId)) {
+ this.correlationId = null;
+ Runnable informConsumer = this.informConsumer;
+ this.informConsumer = null;
+ return informConsumer;
+ }
+ return null;
+ }
+
+ public String getCorrelationId() {
+ return correlationId;
+ }
+
+ public Runnable getInformConsumer() {
+ return informConsumer;
+ }
+
+ public boolean haveRegisteredConsumer() {
+ return correlationId != null;
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
new file mode 100644
index 0000000000..168cd69436
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClientTest.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.inOrder;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.Mockito.when;
+
+import org.camunda.bpm.engine.ProcessEngineServices;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.runtime.MessageCorrelationBuilder;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InOrder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = {InformDmaapClient.class, DmaapClientTestImpl.class})
+public class InformDmaapClientTest {
+
+ @Autowired
+ private InformDmaapClient informDmaapClient;
+
+ @Autowired
+ private DmaapClientTestImpl dmaapClientTest;
+
+ private DelegateExecution delegateExecution;
+
+ private MessageCorrelationBuilder messageCorrelationBuilder;
+
+ @Test
+ public void shouldSendListenerToDmaapClient() throws Exception {
+ // given
+ mockDelegateExecution();
+ // when
+ informDmaapClient.execute(delegateExecution);
+ // then
+ assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId");
+ assertThat(dmaapClientTest.getInformConsumer()).isNotNull();
+ verifyZeroInteractions(messageCorrelationBuilder);
+ }
+
+ @Test
+ public void shouldSendListenerToDmaapClientAndSendMessageToCamunda() throws Exception {
+ // given
+ mockDelegateExecution();
+ // when
+ informDmaapClient.execute(delegateExecution);
+ dmaapClientTest.getInformConsumer().run();
+ // then
+ assertThat(dmaapClientTest.getCorrelationId()).isEqualTo("testCorrelationId");
+ InOrder inOrder = inOrder(messageCorrelationBuilder);
+ inOrder.verify(messageCorrelationBuilder).processInstanceBusinessKey("testBusinessKey");
+ inOrder.verify(messageCorrelationBuilder).correlateWithResult();
+ }
+
+ private void mockDelegateExecution() {
+ delegateExecution = mock(DelegateExecution.class);
+ when(delegateExecution.getVariable(eq(ExecutionVariableNames.CORRELATION_ID))).thenReturn("testCorrelationId");
+ when(delegateExecution.getProcessBusinessKey()).thenReturn("testBusinessKey");
+ ProcessEngineServices processEngineServices = mock(ProcessEngineServices.class);
+ when(delegateExecution.getProcessEngineServices()).thenReturn(processEngineServices);
+ RuntimeService runtimeService = mock(RuntimeService.class);
+ when(processEngineServices.getRuntimeService()).thenReturn(runtimeService);
+ messageCorrelationBuilder = mock(MessageCorrelationBuilder.class);
+ when(runtimeService.createMessageCorrelation(any())).thenReturn(messageCorrelationBuilder);
+ when(messageCorrelationBuilder.processInstanceBusinessKey(any())).thenReturn(messageCorrelationBuilder);
+ }
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
new file mode 100644
index 0000000000..aab289fd90
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate;
+
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.TIMEOUT_FOR_NOTIFICATION;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.junit.Before;
+import org.junit.Test;
+
+public class PnfCheckInputsTest {
+
+ private PnfCheckInputs delegate;
+
+ @Before
+ public void setUp() throws Exception {
+ delegate = new PnfCheckInputs();
+ }
+
+ private DelegateExecution mockDelegateExecution() {
+ DelegateExecution delegateExecution = mock(DelegateExecution.class);
+ when(delegateExecution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue");
+ return delegateExecution;
+ }
+
+ @Test
+ public void shouldThrowException_whenPnfIdNotSet() throws Exception {
+ // given
+ DelegateExecution delegateExecution = mockDelegateExecution();
+ // when, then
+ assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class);
+ }
+
+ private DelegateExecution mockDelegateExecutionWithCorrelationId() {
+ DelegateExecution delegateExecution = mockDelegateExecution();
+ when(delegateExecution.getVariable(CORRELATION_ID)).thenReturn("testCorrelationId");
+ return delegateExecution;
+ }
+
+ @Test
+ public void shouldThrowException_whenTimeoutIsNotSetAndDefaultIsNotDefined() throws Exception {
+ // given
+ DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId();
+ // when, then
+ assertThatThrownBy(() -> delegate.execute(delegateExecution)).isInstanceOf(BpmnError.class);
+ }
+
+ @Test
+ public void shouldSetDefaultTimeout_whenTimeoutIsNotSet() throws Exception {
+ // given
+ String defaultTimeout = "T1D";
+ delegate.setDefaultTimeout(defaultTimeout);
+ DelegateExecution delegateExecution = mockDelegateExecutionWithCorrelationId();
+ // when
+ delegate.execute(delegateExecution);
+ // then
+ verify(delegateExecution).setVariable(eq(TIMEOUT_FOR_NOTIFICATION), eq(defaultTimeout));
+ }
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java
new file mode 100644
index 0000000000..7c4c8201ea
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/bpmn/CreateAndActivatePnfResourceTest.java
@@ -0,0 +1,150 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.delegate.bpmn;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.camunda.bpm.engine.test.assertions.ProcessEngineAssertions.assertThat;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.history.HistoricVariableInstance;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.camunda.bpm.engine.test.Deployment;
+import org.camunda.bpm.engine.test.ProcessEngineRule;
+import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareTests;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@ContextConfiguration(locations = "/applicationContext_forPnfTesting.xml")
+@Ignore
+public class CreateAndActivatePnfResourceTest {
+
+ private static final String TIMEOUT_10_S = "PT10S";
+ @Autowired
+ private RuntimeService runtimeService;
+
+ @Autowired
+ @Rule
+ public ProcessEngineRule processEngineRule;
+
+ @Autowired
+ private AaiConnectionTestImpl aaiConnection;
+
+ @Test
+ @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"})
+ public void shouldSaveCurrentIpToVariableIfItAlreadyExistsInAai() throws Exception {
+ // given
+ aaiConnection.reset();
+ BpmnAwareTests.init(processEngineRule.getProcessEngine());
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
+ variables.put(CORRELATION_ID, ID_WITH_ENTRY_AND_IP);
+ // when
+ ProcessInstance instance = runtimeService
+ .startProcessInstanceByKey("CreateAndActivatePnfResource", variables);
+ // then
+ assertThat(instance).isEnded().hasPassedInOrder(
+ "CreateAndActivatePnf_StartEvent",
+ "CheckAiiForCorrelationId",
+ "DoesAaiContainInfoAboutPnf",
+ "DoesAaiContainInfoAboutIp",
+ "AaiEntryAlreadyUpToDate"
+ );
+ }
+
+ @Test
+ @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"})
+ public void shouldWaitForMessageFromDmaapAndUpdateAaiEntryWhenIpIsMissingInAaiEntry() throws Exception {
+ // given
+ aaiConnection.reset();
+ BpmnAwareTests.init(processEngineRule.getProcessEngine());
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
+ variables.put(CORRELATION_ID, ID_WITH_ENTRY_NO_IP);
+ // when
+ ProcessInstance instance = runtimeService
+ .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
+ assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
+ runtimeService.createMessageCorrelation("WorkflowMessage")
+ .processInstanceBusinessKey("businessKey")
+ .correlateWithResult();
+ // then
+ assertThat(instance).isEnded().hasPassedInOrder(
+ "CreateAndActivatePnf_StartEvent",
+ "CheckAiiForCorrelationId",
+ "DoesAaiContainInfoAboutPnf",
+ "DoesAaiContainInfoAboutIp",
+ "AaiEntryExists",
+ "InformDmaapClient",
+ "WaitForDmaapPnfReadyNotification",
+ "AaiEntryUpdated"
+ );
+ }
+
+ @Test
+ @Deployment(resources = {"process/CreateAndActivatePnfResource.bpmn"})
+ public void shouldCreateAaiEntryWaitForMessageFromDmaapAndUpdateAaiEntryWhenNoAaiEntry() throws Exception {
+ // given
+ aaiConnection.reset();
+ BpmnAwareTests.init(processEngineRule.getProcessEngine());
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("timeoutForPnfEntryNotification", TIMEOUT_10_S);
+ variables.put(CORRELATION_ID, ID_WITHOUT_ENTRY);
+ // when
+ ProcessInstance instance = runtimeService
+ .startProcessInstanceByKey("CreateAndActivatePnfResource", "businessKey", variables);
+ assertThat(instance).isWaitingAt("WaitForDmaapPnfReadyNotification").isWaitingFor("WorkflowMessage");
+ runtimeService.createMessageCorrelation("WorkflowMessage")
+ .processInstanceBusinessKey("businessKey")
+ .correlateWithResult();
+ // then
+ assertThat(instance).isEnded().hasPassedInOrder(
+ "CreateAndActivatePnf_StartEvent",
+ "CheckAiiForCorrelationId",
+ "DoesAaiContainInfoAboutPnf",
+ "CreateAndActivatePnf_CreateAaiEntry",
+ "AaiEntryExists",
+ "InformDmaapClient",
+ "WaitForDmaapPnfReadyNotification",
+ "AaiEntryUpdated"
+ );
+ assertThat(aaiConnection.getCreated()).containsOnlyKeys(ID_WITHOUT_ENTRY);
+ }
+
+ private List<HistoricVariableInstance> getVariables(ProcessInstance instance) {
+ return processEngineRule.getHistoryService().createHistoricVariableInstanceQuery()
+ .processInstanceId(instance.getProcessInstanceId()).taskIdIn().list();
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
new file mode 100644
index 0000000000..08ac9b6948
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
@@ -0,0 +1,197 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.pnf.dmaap;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Field;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ScheduledExecutorService;
+
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.message.BasicHttpResponse;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.onap.so.bpmn.infrastructure.pnf.dmaap.PnfEventReadyDmaapClient.DmaapTopicListenerThread;
+import org.springframework.core.env.Environment;
+@RunWith(MockitoJUnitRunner.class)
+public class PnfEventReadyDmaapClientTest {
+
+ private static final String CORRELATION_ID = "corrTestId";
+ private static final String CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId";
+ private static final String JSON_EXAMPLE_WITH_CORRELATION_ID = "[\n"
+ + " {\n"
+ + " \"pnfRegistrationFields\" : {\n"
+ + " \"correlationId\" : \"%s\",\n"
+ + " \"value\" : \"value1\"\n"
+ + " }\n"
+ + " },\n"
+ + " {\n"
+ + " \"pnfRegistrationFields\" : {\n"
+ + " \"correlationId\" : \"corr\",\n"
+ + " \"value\" : \"value2\"\n"
+ + " }\n"
+ + " }\n"
+ + "]";
+ private static final String JSON_EXAMPLE_WITH_NO_CORRELATION_ID =
+ "{\"pnfRegistrationFields\":{\"field\":\"value\"}}";
+
+ private static final String HOST = "hostTest";
+ private static final int PORT = 1234;
+ private static final String PROTOCOL = "http";
+ private static final String URI_PATH_PREFIX = "eventsForTesting";
+ private static final String EVENT_TOPIC_TEST = "eventTopicTest";
+ private static final String CONSUMER_ID = "consumerTestId";
+ private static final String CONSUMER_GROUP = "consumerGroupTest";
+ @Mock
+ private Environment env;
+ @InjectMocks
+ private PnfEventReadyDmaapClient testedObject = new PnfEventReadyDmaapClient();
+;
+ private DmaapTopicListenerThread testedObjectInnerClassThread;
+ private HttpClient httpClientMock;
+ private Runnable threadMockToNotifyCamundaFlow;
+ private ScheduledExecutorService executorMock;
+
+ @Before
+ public void init() throws NoSuchFieldException, IllegalAccessException {
+ when(env.getProperty(eq("pnf.dmaap.port"), eq(Integer.class))).thenReturn(PORT);
+ when(env.getProperty(eq("pnf.dmaap.host"))).thenReturn(HOST);
+ testedObject.setDmaapProtocol(PROTOCOL);
+ testedObject.setDmaapUriPathPrefix(URI_PATH_PREFIX);
+ testedObject.setDmaapTopicName(EVENT_TOPIC_TEST);
+ testedObject.setConsumerId(CONSUMER_ID);
+ testedObject.setConsumerGroup(CONSUMER_GROUP);
+ testedObject.setDmaapClientDelayInSeconds(1);
+ testedObject.init();
+ testedObjectInnerClassThread = testedObject.new DmaapTopicListenerThread();
+ httpClientMock = mock(HttpClient.class);
+ threadMockToNotifyCamundaFlow = mock(Runnable.class);
+ executorMock = mock(ScheduledExecutorService.class);
+ setPrivateField();
+ }
+
+ /**
+ * Test run method, where the are following conditions:
+ * <p> - DmaapThreadListener is running, flag is set to true
+ * <p> - map is filled with one entry with the key that we get from response
+ * <p> run method should invoke thread from map to notify camunda process, remove element from the map (map is
+ * empty) and shutdown the executor because of empty map
+ */
+ @Test
+ public void correlationIdIsFoundInHttpResponse_notifyAboutPnfReady()
+ throws IOException {
+ when(httpClientMock.execute(any(HttpGet.class))).
+ thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID)));
+ testedObjectInnerClassThread.run();
+ ArgumentCaptor<HttpGet> captor1 = ArgumentCaptor.forClass(HttpGet.class);
+ verify(httpClientMock).execute(captor1.capture());
+ assertThat(captor1.getValue().getURI()).hasHost(HOST).hasPort(PORT).hasScheme(PROTOCOL)
+ .hasPath(
+ "/" + URI_PATH_PREFIX + "/" + EVENT_TOPIC_TEST + "/" + CONSUMER_GROUP + "/" + CONSUMER_ID + "");
+ verify(threadMockToNotifyCamundaFlow).run();
+ verify(executorMock).shutdownNow();
+ }
+
+ /**
+ * Test run method, where the are following conditions:
+ * <p> - DmaapThreadListener is running, flag is set to true
+ * <p> - map is filled with one entry with the correlationId that does not match to correlationId
+ * taken from http response. run method should not do anything with the map not run any thread to notify camunda
+ * process
+ */
+ @Test
+ public void correlationIdIsFoundInHttpResponse_NotFoundInMap()
+ throws IOException {
+ when(httpClientMock.execute(any(HttpGet.class))).
+ thenReturn(createResponse(
+ String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID_NOT_FOUND_IN_MAP)));
+ testedObjectInnerClassThread.run();
+ verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
+ }
+
+ /**
+ * Test run method, where the are following conditions:
+ * <p> - DmaapThreadListener is running, flag is set to true
+ * <p> - map is filled with one entry with the correlationId but no correlation id is taken from HttpResponse
+ * run method should not do anything with the map and not run any thread to notify camunda process
+ */
+ @Test
+ public void correlationIdIsNotFoundInHttpResponse() throws IOException {
+ when(httpClientMock.execute(any(HttpGet.class))).
+ thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_CORRELATION_ID));
+ testedObjectInnerClassThread.run();
+ verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock);
+ }
+
+ private void setPrivateField() throws NoSuchFieldException, IllegalAccessException {
+ Field httpClientField = testedObject.getClass().getDeclaredField("httpClient");
+ httpClientField.setAccessible(true);
+ httpClientField.set(testedObject, httpClientMock);
+ httpClientField.setAccessible(false);
+
+ Field executorField = testedObject.getClass().getDeclaredField("executor");
+ executorField.setAccessible(true);
+ executorField.set(testedObject, executorMock);
+ executorField.setAccessible(false);
+
+ Field pnfCorrelationToThreadMapField = testedObject.getClass()
+ .getDeclaredField("pnfCorrelationIdToThreadMap");
+ pnfCorrelationToThreadMapField.setAccessible(true);
+ Map<String, Runnable> pnfCorrelationToThreadMap = new ConcurrentHashMap<>();
+ pnfCorrelationToThreadMap.put(CORRELATION_ID, threadMockToNotifyCamundaFlow);
+ pnfCorrelationToThreadMapField.set(testedObject, pnfCorrelationToThreadMap);
+
+ Field threadRunFlag = testedObject.getClass().getDeclaredField("dmaapThreadListenerIsRunning");
+ threadRunFlag.setAccessible(true);
+ threadRunFlag.set(testedObject, true);
+ threadRunFlag.setAccessible(false);
+ }
+
+ private HttpResponse createResponse(String json) throws UnsupportedEncodingException {
+ HttpEntity entity = new StringEntity(json);
+ ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1);
+ HttpResponse response = new BasicHttpResponse(protocolVersion, 1, "");
+ response.setEntity(entity);
+ response.setStatusCode(200);
+ return response;
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java
new file mode 100644
index 0000000000..8c31a021ae
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/AbstractTestBase.java
@@ -0,0 +1,47 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+import org.onap.so.BaseIntegrationTest;
+import org.onap.so.bpmn.infrastructure.FlakyTests;
+
+import groovy.lang.Category;
+
+
+@Category(FlakyTests.class)
+public class AbstractTestBase extends BaseIntegrationTest {
+
+
+ public static final String CUST = "SDN-ETHERNET-INTERNET";
+ public static final String SVC = "123456789";
+ public static final String INST = "MIS%252F1604%252F0026%252FSW_INTERNET";
+ public static final String PARENT_INST = "MIS%252F1604%252F0027%252FSW_INTERNET";
+ public static final String ARID = "arId-1";
+ public static final String ARVERS = "1490627351232";
+
+ public static final String DEC_INST = "MIS%2F1604%2F0026%2FSW_INTERNET";
+ public static final String DEC_PARENT_INST = "MIS%2F1604%2F0027%2FSW_INTERNET";
+
+ public static final String VAR_SUCCESS_IND = "SuccessIndicator";
+ public static final String VAR_WFEX = "SavedWorkflowException1";
+ public static final String VAR_RESP_CODE = "CMSO_ResponseCode";
+ public static final String VAR_COMP_REQ = "CompleteMsoProcessRequest";
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java
new file mode 100644
index 0000000000..610930665c
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/CreateVcpeResCustServiceIT.java
@@ -0,0 +1,381 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetCustomer;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithDepth;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetGenericVnfByIdWithPriority;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkPolicyfqdn;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance_500;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceByName_404;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchGenericVnf;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutGenericVnf;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutNetwork;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutServiceInstance;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutVfModuleIdNoResponse;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.MockPostRequestDB;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
+import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
+import static org.onap.so.bpmn.mock.StubResponseVNFAdapter.mockVNFPost;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BPMNUtil;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.onap.so.bpmn.mock.StubResponseOof;
+
+
+public class CreateVcpeResCustServiceIT extends AbstractTestBase {
+
+ private static final String PROCNAME = "CreateVcpeResCustService";
+ private static final String Prefix = "CVRCS_";
+
+ private final CallbackSet callbacks = new CallbackSet();
+ private final String request;
+
+ @Before
+ public void init(){
+ BPMNUtil.cleanHistory(processEngine);
+ }
+
+ public CreateVcpeResCustServiceIT() throws IOException {
+
+ callbacks.put("oof", JSON, "oofResponse", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/oofCallbackInfraVnf.json"));
+ callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+ callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("queryTXC", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryTXCCallback.xml"));
+ callbacks.put("queryBRG", FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/SDNCTopologyQueryBRGCallback.xml"));
+ callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+
+ callbacks.put("query", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallback.xml"));
+ callbacks.put("queryVnf", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVnf.xml"));
+ callbacks.put("queryModuleNoVnf", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVfModuleNoVnf.xml"));
+ callbacks.put("queryModule", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyQueryCallbackVfModule.xml"));
+ callbacks.put("vnfCreate", FileUtil.readResourceFile("__files/VfModularity/VNFAdapterRestCreateCallback.xml"));
+
+ request = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestNoSIName.json");
+ }
+
+ @Test
+ public void testCreateVcpeResCustService_Success() throws Exception {
+ System.out.println("starting: testCreateVcpeResCustService_Success\n");
+ MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2","VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+ StubResponseOof.mockOof();
+ // TODO: the SI should NOT have to be URL-encoded yet again!
+ MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+
+ MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockGetGenericVnfByIdWithDepth(".*", 1, "VCPE/CreateVcpeResCustService/GenericVnf.xml");
+
+ MockPutGenericVnf(".*");
+ MockPatchGenericVnf(".*");
+
+ MockGetGenericVnfByIdWithPriority(".*", ".*", 200, "VfModularity/VfModule-new.xml", 5);
+ // MockGetGenericVnfByIdWithDepth("skask", 1, "VfModularity/GenericVnf.xml");
+ MockPutVfModuleIdNoResponse(".*", "PCRF", ".*");
+ MockPutNetwork(".*", "VfModularity/AddNetworkPolicy_AAIResponse_Success.xml", 200);
+
+ MockGetNetworkPolicyfqdn(".*","CreateNetworkV2/createNetwork_queryNetworkPolicy_AAIResponse_Success.xml",200);
+ MockNodeQueryServiceInstanceByName_404(".*");
+
+ mockVNFPost("", 202, ".*");
+
+ stubFor(post(urlMatching("/services/rest/v1/vnfs" + ".*" + "/vf-modules" )).willReturn(aResponse().withStatus(202)));
+ stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+ stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
+ stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
+ stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
+ MockPostRequestDB();
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+ mockSDNCAdapter(200);
+
+ Map<String, Object> variables = setupVariables();
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+
+ injectWorkflowMessages(callbacks, "oof");
+ // for SI
+ injectSDNCCallbacks(callbacks, "assign");
+ // for TXC
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "create");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "queryTXC");
+
+ // For VNF
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "queryModule");
+ injectSDNCCallbacks(callbacks, "activate");
+ //VF Module
+ injectSDNCCallbacks(callbacks, "queryModule");
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "queryModule");
+ injectSDNCCallbacks(callbacks, "queryModule");
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "queryModuleNoVnf");
+ injectVNFRestCallbacks(callbacks, "vnfCreate");
+ injectSDNCCallbacks(callbacks, "activate");
+
+ // for BRG
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "create");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "queryBRG");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
+ assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+ assertEquals(null, workflowException);
+ assertTrue(completionReq.indexOf("request-id>testRequestId<") >= 0);
+ assertTrue(completionReq.indexOf("action>CREATE<") >= 0);
+ assertTrue(completionReq.indexOf("source>VID<") >= 0);
+
+ assertEquals("1", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"VnfsCreatedCount"));
+ }
+
+ @Test
+ public void testCreateVcpeResCustService_NoParts() throws Exception {
+ System.out.println("starting: testCreateVcpeResCustService_NoParts\n" );
+ MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
+ MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesNoData.json");
+ MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+
+ // TODO: the SI should NOT have to be URL-encoded yet again!
+ MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+
+ MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+
+ // TODO: should these really be PARENT_INST, or should they be INST?
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ StubResponseOof.mockOof();
+ stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+ stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
+ stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
+ stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
+ MockPostRequestDB();
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = setupVariables();
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+
+ injectWorkflowMessages(callbacks, "oof");
+ // for SI
+ injectSDNCCallbacks(callbacks, "assign");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
+ assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+ assertEquals(null, workflowException);
+ assertTrue(completionReq.indexOf("request-id>testRequestId<") >= 0);
+ assertTrue(completionReq.indexOf("action>CREATE<") >= 0);
+ assertTrue(completionReq.indexOf("source>VID<") >= 0);
+
+ assertEquals("0", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"VnfsCreatedCount"));
+ }
+
+ @Test
+ public void testCreateVcpeResCustService_Fault_NoRollback() throws Exception {
+ System.out.println("starting: testCreateVcpeResCustService_Fault_NoRollback\n");
+ MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+
+ // TODO: the SI should NOT have to be URL-encoded yet again!
+ MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+
+ MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance_500(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+
+ mockSDNCAdapter(404);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ StubResponseOof.mockOof();
+ stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+ stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
+ stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
+ stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
+ MockPostRequestDB();
+
+ Map<String, Object> variables = setupVariables();
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+
+ injectWorkflowMessages(callbacks, "oof");
+
+ waitForProcessEnd(businessKey, 100000);
+
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+ assertNotNull(workflowException);
+
+ BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateAllottedResourceBRGRollback");
+ BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateVnfAndModulesRollback");
+ BPMNUtil.assertNoProcessInstance(processEngine, "DoCreateAllottedResourceTXCRollback");
+ }
+
+ @Test
+ public void testCreateVcpeResCustService_Fault_Rollback() throws Exception {
+ System.out.println("starting: testCreateVcpeResCustService_Fault_Rollback\n");
+ MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "2", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetServiceResourcesCatalogData("uuid-miu-svc-011-abcdef", "VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json");
+ MockGetCustomer(CUST, "VCPE/CreateVcpeResCustService/getCustomer.xml");
+
+ // TODO: the SI should NOT have to be URL-encoded yet again!
+ MockPutServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, INST.replace("%", "%25"), "GenericFlows/getServiceInstance.xml");
+
+ MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
+ MockGetAllottedResource(CUST, SVC, PARENT_INST, ARID, "VCPE/CreateVcpeResCustService/arGetById.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, PARENT_INST, ARID, ARVERS);
+
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ StubResponseOof.mockOof();
+ stubFor(get(urlMatching(".*/business/owning-entities?.*")).willReturn(aResponse().withStatus(404)));
+ stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/.*")).willReturn(aResponse().withStatus(200)));
+ stubFor(put(urlMatching(".*/business/owning-entities/owning-entity/038d99af-0427-42c2-9d15-971b99b9b489/relationship-list/relationship")).willReturn(aResponse().withStatus(200)));
+ stubFor(put(urlMatching(".*/query?.*")).willReturn(aResponse().withStatus(200)));
+ MockPostRequestDB();
+ String req = FileUtil.readResourceFile("__files/VCPE/CreateVcpeResCustService/requestRollback.json");
+
+ Map<String, Object> variables = setupVariables();
+
+ String businessKey = UUID.randomUUID().toString();
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, req, variables);
+
+ injectWorkflowMessages(callbacks, "oof");
+ // for SI
+ injectSDNCCallbacks(callbacks, "assign");
+
+ // for TXC
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "create");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+ assertEquals(null, completionReq);
+ assertNotNull(workflowException);
+
+ BPMNUtil.assertAnyProcessInstanceFinished(processEngine, "DoCreateServiceInstanceRollback");
+ }
+
+ // *****************
+ // Utility Section
+ // *****************
+
+ // Success Scenario
+ private Map<String, Object> setupVariables() {
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("requestId", "testRequestId");
+ variables.put("request-id", "testRequestId");
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("allottedResourceId", ARID);
+ variables.put("URN_mso_workflow_aai_distribution_delay", "PT5S");
+ return variables;
+
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java
new file mode 100644
index 0000000000..ca81d99832
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DeleteVcpeResCustServiceIT.java
@@ -0,0 +1,291 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+import com.github.tomakehurst.wiremock.stubbing.Scenario;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BPMNUtil;
+import org.onap.so.bpmn.mock.FileUtil;
+
+import java.io.IOException;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.delete;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteServiceInstance;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockQueryAllottedResourceById;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
+import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
+
+public class DeleteVcpeResCustServiceIT extends AbstractTestBase {
+
+ private static final String PROCNAME = "DeleteVcpeResCustService";
+ private static final String Prefix = "DVRCS_";
+ private static final String AR_BRG_ID = "ar-brgB";
+ private static final String AR_TXC_ID = "ar-txcA";
+
+ private final CallbackSet callbacks = new CallbackSet();
+ private final String request;
+
+ public DeleteVcpeResCustServiceIT() throws IOException {
+ callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+
+ request = FileUtil.readResourceFile("__files/VCPE/DeleteVcpeResCustService/request.json");
+ }
+
+ @Before
+ public void init(){
+ BPMNUtil.cleanHistory(processEngine);
+ }
+
+ @Test
+ public void testDeleteVcpeResCustService_Success() throws Exception {
+ logStart();
+ MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+
+ // TODO: use INST instead of DEC_INST
+ /*
+ * Seems to be a bug as they
+ * fail to URL-encode the SI id before performing the query so we'll
+ * add a stub for that case, too.
+ */
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+
+ /*
+ * cannot use MockGetServiceInstance(), because we need to return
+ * different responses as we traverse through the flow
+ */
+
+ // initially, the SI includes the ARs
+ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST))
+ .inScenario("SI retrieval")
+ .whenScenarioStateIs(Scenario.STARTED)
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VCPE/DeleteVcpeResCustService/getSI.xml"))
+ .willSetStateTo("ARs Deleted"));
+
+ // once the ARs have been deleted, the SI should be empty
+ stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + CUST + "/service-subscriptions/service-subscription/" + SVC + "/service-instances/service-instance/" + INST))
+ .inScenario("SI retrieval")
+ .whenScenarioStateIs("ARs Deleted")
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml")));
+
+ // for BRG
+ MockQueryAllottedResourceById(AR_BRG_ID, "VCPE/DeleteVcpeResCustService/getBRGArUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, AR_BRG_ID, "VCPE/DeleteVcpeResCustService/arGetBRGById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, AR_BRG_ID);
+ MockDeleteAllottedResource(CUST, SVC, INST, AR_BRG_ID, ARVERS);
+
+ // for TXC
+ MockQueryAllottedResourceById(AR_TXC_ID, "VCPE/DeleteVcpeResCustService/getTXCArUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, AR_TXC_ID, "VCPE/DeleteVcpeResCustService/arGetTXCById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, AR_TXC_ID);
+ MockDeleteAllottedResource(CUST, SVC, INST, AR_TXC_ID, ARVERS);
+
+ //MockGetGenericVnfById("vnfX.*", "GenericFlows/getGenericVnfByNameResponse.xml");
+ stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
+ .willReturn(aResponse()
+ .withStatus(200)
+ .withHeader("Content-Type", "text/xml")
+ .withBodyFile("GenericFlows/getGenericVnfByNameResponse.xml")));
+
+
+ stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*"))
+ .willReturn(aResponse()
+ .withStatus(204)
+ .withHeader("Content-Type", "text/xml")));
+
+ MockDeleteServiceInstance(CUST,SVC,INST,SVC);
+
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = setupVariables(businessKey);
+
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+
+ // for BRG
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ // for VNF1
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ // for VNF2
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ // for TXC
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ // for SI
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+
+ waitForProcessEnd(businessKey, 70000);
+ assertTrue(isProcessEnded(businessKey));
+
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
+ assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+ assertNull(workflowException);
+ assertTrue(completionReq.contains("<request-id>"+businessKey+"<"));
+ assertTrue(completionReq.contains("<action>DELETE<"));
+ assertTrue(completionReq.contains("<source>VID<"));
+
+ assertEquals("2", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"vnfsDeletedCount"));
+
+ BPMNUtil.assertAnyProcessInstanceFinished(processEngine, "DoDeleteVnfAndModules");
+ logEnd();
+ }
+
+ @Test
+ public void testDeleteVcpeResCustService_NoBRG_NoTXC_NoVNF() throws Exception {
+ logStart();
+ MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+
+ // TODO: use INST instead of DEC_INST
+ /*
+ * Seems to be a bug as they
+ * fail to URL-encode the SI id before performing the query so we'll
+ * add a stub for that case, too.
+ */
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
+
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = setupVariables(businessKey);
+
+
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+
+ // for SI
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+
+ waitForProcessEnd(businessKey, 70000);
+
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
+ assertEquals("200", BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+ assertNull( workflowException);
+ assertTrue(completionReq.contains("<request-id>"+businessKey+"<"));
+ assertTrue(completionReq.contains("<action>DELETE<"));
+ assertTrue(completionReq.contains("<source>VID<"));
+
+ assertEquals("0", BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+"vnfsDeletedCount"));
+
+ BPMNUtil.assertNoProcessInstance(processEngine, "DoDeleteVnfAndModules");
+ logEnd();
+ }
+
+ @Test
+ public void testDeleteVcpeResCustService_Fault() throws Exception {
+ logStart();
+ MockNodeQueryServiceInstanceById(INST, "GenericFlows/getSIUrlById.xml");
+
+ // TODO: use INST instead of DEC_INST
+ /*
+ * Seems to be a bug as they
+ * fail to URL-encode the SI id before performing the query so we'll
+ * add a stub for that case, too.
+ */
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "VCPE/DeleteVcpeResCustService/getSIAfterDelArs.xml");
+
+ // generate failure
+ mockSDNCAdapter(404);
+
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = setupVariables(businessKey);
+
+ invokeAsyncProcess(PROCNAME, "v1", businessKey, request, variables);
+
+ waitForProcessEnd(businessKey, 70000);
+
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+
+ String completionReq = BPMNUtil.getVariable(processEngine, PROCNAME, Prefix+VAR_COMP_REQ);
+ System.out.println("completionReq:\n" + completionReq);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, PROCNAME+VAR_SUCCESS_IND));
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, VAR_RESP_CODE));
+ assertNotNull(workflowException);
+ logEnd();
+ }
+
+ private Map<String, Object> setupVariables(String requestId) throws UnsupportedEncodingException {
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("requestId", requestId);
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("sdncVersion", "1802");
+ variables.put("serviceInstanceName", "some-junk-name");
+ return variables;
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java
new file mode 100644
index 0000000000..2b1b5a3bd0
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGIT.java
@@ -0,0 +1,266 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+import static org.junit.Assert.*;
+import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
+import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.Test;
+import org.onap.so.bpmn.common.BPMNUtil;
+import org.onap.so.bpmn.mock.FileUtil;
+
+
+public class DoCreateAllottedResourceBRGIT extends AbstractTestBase {
+
+ private static final String PROCNAME = "DoCreateAllottedResourceBRG";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateAllottedResourceBRGIT() {
+ callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+ callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRG/SDNCTopologyQueryCallback.xml"));
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRG_Success() throws InterruptedException {
+ logStart();
+
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to
+ * have a bug in that they don't URL-encode the SI id before using
+ * it in the query
+ */
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables,"testRequestId123");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "create");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "query");
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ assertNull(workflowException);
+
+ assertEquals("namefromrequest", BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRG_NoSI() throws Exception{
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to
+ * have a bug in that they don't URL-encode the SI id before using
+ * it in the query
+ */
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables,"testRequestId124");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ assertNotNull(workflowException);
+
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRG_ActiveAr() throws Exception{
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to
+ * have a bug in that they don't URL-encode the SI id before using
+ * it in the query
+ */
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceBRG/getSIandAR.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRG/getArBrg2.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables,"testRequestId125");
+
+ variables.put("failExists", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+
+
+ injectSDNCCallbacks(callbacks, "query");
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ assertNull( workflowException);
+
+ assertEquals("namefromrequest", BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRG_NoParentSI() throws Exception{
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to
+ * have a bug in that they don't URL-encode the SI id before using
+ * it in the query
+ */
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables,"testRequestId126");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ assertNotNull(workflowException);
+
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRG_SubProcessError() throws Exception{
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to
+ * have a bug in that they don't URL-encode the SI id before using
+ * it in the query
+ */
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(404);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables,"testRequestId127");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ assertNotNull(workflowException);
+
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
+ logEnd();
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failExists", "true");
+ variables.put("disableRollback", "true");
+ variables.put("msoRequestId", requestId);
+ variables.put("mso-request-id", "requestId");
+ variables.put("sourceNetworkId", "snId");
+ variables.put("sourceNetworkRole", "snRole");
+ variables.put("allottedResourceRole", "txc");
+ variables.put("allottedResourceType", "BRG");
+ variables.put("allottedResourceId", ARID);
+ variables.put("vni", "BRG");
+ variables.put("vgmuxBearerIP", "bearerip");
+ variables.put("brgWanMacAddress", "wanmac");
+
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+
+ variables.put("serviceChainServiceInstanceId", "scsiId");
+
+ String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," +
+ "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"vSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
+ "}";
+ variables.put("allottedResourceModelInfo", arModelInfo);
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java
new file mode 100644
index 0000000000..5b78b485a9
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceBRGRollbackIT.java
@@ -0,0 +1,323 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+import org.junit.Test;
+import org.onap.so.bpmn.common.BPMNUtil;
+import org.onap.so.bpmn.core.RollbackData;
+import org.onap.so.bpmn.mock.FileUtil;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
+import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
+
+public class DoCreateAllottedResourceBRGRollbackIT extends AbstractTestBase {
+
+ private static final String PROCNAME = "DoCreateAllottedResourceBRGRollback";
+ private static final String RbType = "DCARBRG_";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateAllottedResourceBRGRollbackIT() throws IOException {
+ callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRGRollback_Success() throws Exception {
+ logStart();
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, businessKey);
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRGRollback_skipRollback() throws Exception {
+ logStart();
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ rollbackData.put(RbType, "rollbackAAI", "false");
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRGRollback_DoNotRollBack() throws Exception {
+ logStart();
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ // this will cause "rollbackSDNC" to be set to false
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRGRollback_NoDeactivate() throws Exception {
+ logStart();
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ rollbackData.put(RbType, "rollbackSDNCactivate", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRGRollback_NoDelete() throws Exception {
+ logStart();
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ rollbackData.put(RbType, "rollbackSDNCcreate", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRGRollback_NoUnassign() throws Exception {
+ logStart();
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+ /*
+ * Note: if assign == false then the flow/script will set
+ * "skipRollback" to false, which will cause ALL of the SDNC steps
+ * to be skipped, not just the unassign step.
+ */
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRGRollback_SubProcessError() throws Exception {
+ logStart();
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ mockSDNCAdapter(404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, businessKey);
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+ assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceBRGRollback_JavaException() throws Exception {
+ logStart();
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceBRGRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, businessKey);
+
+ variables.put("rollbackData", "string instead of rollback data");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+ assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+ logEnd();
+ }
+
+ private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failNotFound", "true");
+ variables.put("msoRequestId", requestId);
+ variables.put("mso-request-id", "requestId");
+ variables.put("allottedResourceId", ARID);
+
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+
+ RollbackData rollbackData = new RollbackData();
+
+ rollbackData.put(RbType, "serviceInstanceId", DEC_INST);
+ rollbackData.put(RbType, "serviceSubscriptionType", SVC);
+ rollbackData.put(RbType, "disablerollback", "false");
+ rollbackData.put(RbType, "rollbackAAI", "true");
+ rollbackData.put(RbType, "rollbackSDNCassign", "true");
+ rollbackData.put(RbType, "rollbackSDNCactivate", "true");
+ rollbackData.put(RbType, "rollbackSDNCcreate", "true");
+ rollbackData.put(RbType, "aaiARPath", "http://localhost:"+wiremockPort+"/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID);
+
+ rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncActivateRollbackReq.xml"));
+ rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncCreateRollbackReq.xml"));
+ rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceBRGRollback/sdncAssignRollbackReq.xml"));
+
+ variables.put("rollbackData",rollbackData);
+
+ return rollbackData;
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java
new file mode 100644
index 0000000000..473661c860
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCIT.java
@@ -0,0 +1,276 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetServiceInstance;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockNodeQueryServiceInstanceById;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPutAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
+import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.camunda.bpm.engine.test.Deployment;
+import org.junit.Assert;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BPMNUtil;
+import org.onap.so.bpmn.mock.FileUtil;
+
+public class DoCreateAllottedResourceTXCIT extends AbstractTestBase {
+
+ private static final String PROCNAME = "DoCreateAllottedResourceTXC";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateAllottedResourceTXCIT() throws IOException {
+ callbacks.put("assign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyAssignCallback.xml"));
+ callbacks.put("create", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyCreateCallback.xml"));
+ callbacks.put("activate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyActivateCallback.xml"));
+ callbacks.put("query", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXC/SDNCTopologyQueryCallback.xml"));
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXC_Success() throws Exception{
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to
+ * have a bug in that they don't URL-encode the SI id before using
+ * it in the query
+ */
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "assign");
+ injectSDNCCallbacks(callbacks, "create");
+ injectSDNCCallbacks(callbacks, "activate");
+ injectSDNCCallbacks(callbacks, "query");
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ assertEquals(null, workflowException);
+
+ assertEquals("namefromrequest", BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
+ assertEquals("my-vni", BPMNUtil.getVariable(processEngine, PROCNAME, "vni",processId));
+ assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxBearerIP",processId));
+ assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxLanIP",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXC_NoSI() throws Exception{
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to
+ * have a bug in that they don't URL-encode the SI id before using
+ * it in the query
+ */
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getNotFound.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ assertNotNull(workflowException);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXC_ActiveAr() throws Exception{
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to
+ * have a bug in that they don't URL-encode the SI id before using
+ * it in the query
+ */
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "VCPE/DoCreateAllottedResourceTXC/getSIandAR.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXC/getArTxc2.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ variables.put("failExists", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "query");
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ assertEquals(null, workflowException);
+
+ assertEquals("namefromrequest", BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
+ assertEquals("my-vni", BPMNUtil.getVariable(processEngine, PROCNAME, "vni",processId));
+ assertEquals("my-bearer-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxBearerIP",processId));
+ assertEquals("my-lan-ip", BPMNUtil.getVariable(processEngine, PROCNAME, "vgmuxLanIP",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXC_NoParentSI() throws Exception{
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to
+ * have a bug in that they don't URL-encode the SI id before using
+ * it in the query
+ */
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getNotFound.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ assertNotNull(workflowException);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXC_SubProcessError() throws Exception{
+ logStart();
+ // TODO: use INST instead of DEC_INST
+ /*
+ * should be INST instead of DEC_INST, but AAI utilities appear to
+ * have a bug in that they don't URL-encode the SI id before using
+ * it in the query
+ */
+ MockNodeQueryServiceInstanceById(DEC_INST, "GenericFlows/getSIUrlById.xml");
+ MockNodeQueryServiceInstanceById(DEC_PARENT_INST, "GenericFlows/getParentSIUrlById.xml");
+
+ MockGetServiceInstance(CUST, SVC, INST, "GenericFlows/getServiceInstance.xml");
+ MockGetServiceInstance(CUST, SVC, PARENT_INST, "GenericFlows/getParentServiceInstance.xml");
+ MockPutAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ MockPatchAllottedResource(CUST, SVC, PARENT_INST, ARID);
+ mockSDNCAdapter(404);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, "testRequestId123");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ assertNotNull(workflowException);
+
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "allotedResourceName",processId));
+ logEnd();
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables, String requestId) {
+ // TODO: need all of these?
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failExists", "true");
+ variables.put("disableRollback", "true");
+ variables.put("msoRequestId", requestId);
+ variables.put("mso-request-id", "requestId");
+ variables.put("sourceNetworkId", "snId");
+ variables.put("sourceNetworkRole", "snRole");
+ variables.put("allottedResourceRole", "brg");
+ variables.put("allottedResourceType", "TXC");
+ variables.put("allottedResourceId", ARID);
+ variables.put("brgWanMacAddress", "wanmac");
+
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+
+ variables.put("serviceChainServiceInstanceId", "scsiId");
+
+ String arModelInfo = "{ "+ "\"modelType\": \"allotted-resource\"," +
+ "\"modelInvariantUuid\": \"ff5256d2-5a33-55df-13ab-12abad84e7ff\"," +
+ "\"modelUuid\": \"fe6478e5-ea33-3346-ac12-ab121484a3fe\"," +
+ "\"modelName\": \"vSAMP12\"," +
+ "\"modelVersion\": \"1.0\"," +
+ "\"modelCustomizationUuid\": \"MODEL-ID-1234\"," +
+ "}";
+ variables.put("allottedResourceModelInfo", arModelInfo);
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java
new file mode 100644
index 0000000000..3720f1d840
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoCreateAllottedResourceTXCRollbackIT.java
@@ -0,0 +1,323 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+import org.junit.Test;
+import org.onap.so.bpmn.common.BPMNUtil;
+import org.onap.so.bpmn.core.RollbackData;
+import org.onap.so.bpmn.mock.FileUtil;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.onap.so.bpmn.common.BPMNUtil.waitForWorkflowToFinish;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockDeleteAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseAAI.MockPatchAllottedResource;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
+import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
+
+public class DoCreateAllottedResourceTXCRollbackIT extends AbstractTestBase {
+
+ private static final String PROCNAME = "DoCreateAllottedResourceTXCRollback";
+ private static final String RbType = "DCARTXC_";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoCreateAllottedResourceTXCRollbackIT() throws IOException {
+ callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXCRollback_Success() throws Exception {
+ logStart();
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, businessKey);
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXCRollback_skipRollback() throws Exception {
+ logStart();
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ rollbackData.put(RbType, "rollbackAAI", "false");
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals(null, BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXCRollback_DoNotRollBack() throws Exception {
+ logStart();
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ // this will cause "rollbackSDNC" to be set to false
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXCRollback_NoDeactivate() throws Exception {
+ logStart();
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ rollbackData.put(RbType, "rollbackSDNCactivate", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXCRollback_NoDelete() throws Exception {
+ logStart();
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ rollbackData.put(RbType, "rollbackSDNCcreate", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXCRollback_NoUnassign() throws Exception {
+ logStart();
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ RollbackData rollbackData = setVariablesSuccess(variables, businessKey);
+
+ rollbackData.put(RbType, "rollbackSDNCassign", "false");
+
+ /*
+ * Note: if assign == false then the flow/script will set
+ * "skipRollback" to false, which will cause ALL of the SDNC steps
+ * to be skipped, not just the unassign step.
+ */
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("true", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+ assertNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXCRollback_SubProcessError() throws Exception {
+ logStart();
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ mockSDNCAdapter(404);
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, businessKey);
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+ assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+ logEnd();
+ }
+
+ @Test
+ public void testDoCreateAllottedResourceTXCRollback_JavaException() throws Exception {
+ logStart();
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables, businessKey);
+
+ variables.put("rollbackData", "string instead of rollback data");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ waitForWorkflowToFinish(processEngine,processId);
+
+ assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX,processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertEquals(null, workflowException);
+ assertEquals("false", BPMNUtil.getVariable(processEngine, PROCNAME, "rolledBack",processId));
+ assertNotNull(BPMNUtil.getVariable(processEngine, PROCNAME, "rollbackError",processId));
+ logEnd();
+ }
+
+ private RollbackData setVariablesSuccess(Map<String, Object> variables, String requestId) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failNotFound", "true");
+ variables.put("msoRequestId", requestId);
+ variables.put("mso-request-id", "requestId");
+ variables.put("allottedResourceId", ARID);
+
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+
+ RollbackData rollbackData = new RollbackData();
+
+ rollbackData.put(RbType, "serviceInstanceId", DEC_INST);
+ rollbackData.put(RbType, "serviceSubscriptionType", SVC);
+ rollbackData.put(RbType, "disablerollback", "false");
+ rollbackData.put(RbType, "rollbackAAI", "true");
+ rollbackData.put(RbType, "rollbackSDNCassign", "true");
+ rollbackData.put(RbType, "rollbackSDNCactivate", "true");
+ rollbackData.put(RbType, "rollbackSDNCcreate", "true");
+ rollbackData.put(RbType, "aaiARPath", "http://localhost:"+wiremockPort+"/aai/v9/business/customers/customer/"+CUST+"/service-subscriptions/service-subscription/"+SVC+"/service-instances/service-instance/"+INST+"/allotted-resources/allotted-resource/"+ARID);
+
+ rollbackData.put(RbType, "sdncActivateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncActivateRollbackReq.xml"));
+ rollbackData.put(RbType, "sdncCreateRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncCreateRollbackReq.xml"));
+ rollbackData.put(RbType, "sdncAssignRollbackReq", FileUtil.readResourceFile("__files/VCPE/DoCreateAllottedResourceTXCRollback/sdncAssignRollbackReq.xml"));
+
+ variables.put("rollbackData",rollbackData);
+
+ return rollbackData;
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java
new file mode 100644
index 0000000000..4edaf7d21f
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceBRGIT.java
@@ -0,0 +1,145 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BPMNUtil;
+import org.onap.so.bpmn.mock.FileUtil;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import static org.junit.Assert.*;
+import static org.onap.so.bpmn.mock.StubResponseAAI.*;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
+import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
+
+
+public class DoDeleteAllottedResourceBRGIT extends AbstractTestBase {
+
+ private static final String PROCNAME = "DoDeleteAllottedResourceBRG";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoDeleteAllottedResourceBRGIT() {
+ callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+ }
+
+ @Test
+ public void testDoDeleteAllottedResourceBRG_Success() {
+ logStart();
+ MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables);
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertNull(workflowException);
+ logEnd();
+ }
+
+ @Test
+ public void testDoDeleteAllottedResourceBRG_ARNotInSDNC() {
+ logStart();
+ MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ String businessKey = UUID.randomUUID().toString();
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables);
+
+ variables.put("failNotFound", "false");
+
+ invokeSubProcess(PROCNAME, businessKey, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivateNF");
+
+ waitForProcessEnd(businessKey, 10000);
+
+ Assert.assertTrue(isProcessEnded(businessKey));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, VAR_WFEX);
+ System.out.println("workflowException:\n" + workflowException);
+ assertNull(workflowException);
+ logEnd();
+ }
+
+
+ @Test
+ public void testDoDeleteAllottedResourceBRG_SubProcessError() throws Exception {
+ logStart();
+ MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceBRG/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ mockSDNCAdapter(500);
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables);
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+
+ BPMNUtil.waitForWorkflowToFinish(processEngine,processId);
+
+ Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException",processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertNotNull(workflowException);
+ logEnd();
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failNotFound", "true");
+ variables.put("msoRequestId", "testRequestId1");
+ variables.put("mso-request-id", "requestId");
+ variables.put("allottedResourceId", ARID);
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java
new file mode 100644
index 0000000000..520beaf07b
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/vcpe/DoDeleteAllottedResourceTXCIT.java
@@ -0,0 +1,140 @@
+/*
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.vcpe;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BPMNUtil;
+import org.onap.so.bpmn.mock.FileUtil;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.onap.so.bpmn.mock.StubResponseAAI.*;
+import static org.onap.so.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
+import static org.onap.so.bpmn.mock.StubResponseSDNCAdapter.mockSDNCAdapter;
+
+
+public class DoDeleteAllottedResourceTXCIT extends AbstractTestBase {
+
+ private static final String PROCNAME = "DoDeleteAllottedResourceTXC";
+ private final CallbackSet callbacks = new CallbackSet();
+
+ public DoDeleteAllottedResourceTXCIT() {
+ callbacks.put("deactivate", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallback.xml"));
+ callbacks.put("deactivateNF", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeactivateCallbackNotFound.xml"));
+ callbacks.put("delete", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyDeleteCallback.xml"));
+ callbacks.put("unassign", FileUtil.readResourceFile("__files/VfModularity/SDNCTopologyUnassignCallback.xml"));
+ }
+
+ @Test
+ public void testDoDeleteAllottedResourceTXC_Success() throws Exception {
+ logStart();
+ MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables);
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivate");
+ injectSDNCCallbacks(callbacks, "delete");
+ injectSDNCCallbacks(callbacks, "unassign");
+
+ BPMNUtil.waitForWorkflowToFinish(processEngine,processId);
+
+ Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException",processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertNull(workflowException);
+ logEnd();
+ }
+
+ @Test
+ public void testDoDeleteAllottedResourceTXC_ARNotInSDNC() throws Exception {
+ logStart();
+ MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockSDNCAdapter(200);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables);
+
+ variables.put("failNotFound", "false");
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ injectSDNCCallbacks(callbacks, "deactivateNF");
+
+ BPMNUtil.waitForWorkflowToFinish(processEngine,processId);
+
+ Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
+ logEnd();
+ }
+
+
+ @Test
+ public void testDoDeleteAllottedResourceTXC_SubProcessError() throws Exception {
+ logStart();
+ MockQueryAllottedResourceById(ARID, "GenericFlows/getARUrlById.xml");
+ MockGetAllottedResource(CUST, SVC, INST, ARID, "VCPE/DoDeleteAllottedResourceTXC/arGetById.xml");
+ MockPatchAllottedResource(CUST, SVC, INST, ARID);
+ MockDeleteAllottedResource(CUST, SVC, INST, ARID, ARVERS);
+ mockUpdateRequestDB(200, "Database/DBUpdateResponse.xml");
+
+ mockSDNCAdapter(500);
+
+ Map<String, Object> variables = new HashMap<>();
+ setVariablesSuccess(variables);
+
+ String processId = invokeSubProcess(PROCNAME, variables);
+
+ BPMNUtil.waitForWorkflowToFinish(processEngine,processId);
+
+ Assert.assertTrue(isProcessEndedByProcessInstanceId(processId));
+ String workflowException = BPMNUtil.getVariable(processEngine, PROCNAME, "WorkflowException",processId);
+ System.out.println("workflowException:\n" + workflowException);
+ assertNotNull(workflowException);
+ logEnd();
+ }
+
+ private void setVariablesSuccess(Map<String, Object> variables) {
+ variables.put("isDebugLogEnabled", "true");
+ variables.put("failNotFound", "true");
+ variables.put("msoRequestId", "testRequestId1");
+ variables.put("mso-request-id", "requestId");
+ variables.put("allottedResourceId", ARID);
+
+ variables.put("serviceInstanceId", DEC_INST);
+ variables.put("parentServiceInstanceId", DEC_PARENT_INST);
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/GenericVnf.xml b/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/GenericVnf.xml
new file mode 100644
index 0000000000..aaac6c1ec7
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/GenericVnf.xml
@@ -0,0 +1,16 @@
+<generic-vnf xmlns="http://org.openecomp.aai.inventory/v7">
+ <vnf-id>VCPE-123456</vnf-id>
+ <vnf-name>VCPE</vnf-name>
+ <vnf-type>VCPE</vnf-type>
+ <service-id>SDN-MOBILITY</service-id>
+ <equipment-role>vPCRF</equipment-role>
+ <orchestration-status>pending-create</orchestration-status>
+ <in-maint>false</in-maint>
+ <is-closed-loop-disabled>false</is-closed-loop-disabled>
+ <model-invariant-id>introvert</model-invariant-id>
+ <model-version-id>2.0</model-version-id>
+ <resource-version>0000020</resource-version>
+ <relationship-list/>
+ <l-interfaces/>
+ <lag-interfaces/>
+</generic-vnf>
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/oofCallbackInfraVnf.json b/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/oofCallbackInfraVnf.json
new file mode 100644
index 0000000000..15e601bae8
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/oofCallbackInfraVnf.json
@@ -0,0 +1,50 @@
+{
+ "transactionId": "xxx-xxx-xxxx",
+ "requestId": "yyy-yyy-yyyy",
+ "requestStatus": "completed",
+ "statusMessage": "success",
+ "solutions": {
+ "placementSolutions": [
+ [
+ {
+ "resourceModuleName": "vGMuxInfra",
+ "serviceResourceId": "some_resource_id",
+ "solution": {
+ "identifierType": "serviceInstanceId",
+ "identifiers": ["gjhd-098-fhd-987"]
+ },
+ "assignmentInfo": [
+ { "key": "cloudOwner", "value": "amazon" },
+ { "key": "vnfHostName", "value": "ahr344gh" },
+ { "key": "isRehome", "value": "False" },
+ { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" }
+ ]
+ },
+ {
+ "resourceModuleName": "vG",
+ "serviceResourceId": "some_resource_id",
+ "solution": {
+ "identifierType": "cloudRegionId",
+ "cloudOwner": "amazon",
+ "identifiers": ["gjhd-098-fhd-987"]
+ },
+ "assignmentInfo": [
+ { "key": "cloudOwner", "value": "amazon" },
+ { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" },
+ { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}}
+ ]
+ }
+ ]
+ ],
+ "licenseSolutions": [
+ {
+ "resourceModuleName": "vGMuxInfra",
+ "serviceResourceId": "some_resource_id",
+ "entitlementPoolUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"],
+ "licenseKeyGroupUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"],
+ "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"],
+ "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"]
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestRollback.json b/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestRollback.json
new file mode 100644
index 0000000000..a7b5c1be95
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestRollback.json
@@ -0,0 +1,60 @@
+{
+ "requestDetails":
+ {
+ "modelInfo":
+ {
+ "modelType":"service",
+ "modelInvariantUuid":"uuid-miu-svc-011-abcdef",
+ "modelVersionId":"ASDC_TOSCA_UUID",
+ "modelName":"SIModelName1",
+ "modelVersion":"2"
+ },
+ "subscriberInfo":
+ {
+ "globalSubscriberId":"SDN-ETHERNET-INTERNET",
+ "subscriberName":"Kaneohe"
+ },
+ "requestInfo":
+ {
+ "source":"VID",
+ "suppressRollback":"false",
+ "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "instanceName":"serviceInstanceName"
+ },
+ "cloudConfiguration":
+ {
+ "lcpCloudRegionId":"mdt1_123",
+ "tenantId":"8b1df54faa3b49078e3416e21370a3ba"
+ },
+ "owningEntity": {
+ "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
+ "owningEntityName": "PACKET CORE"
+ },
+ "requestParameters":
+ {
+ "subscriptionServiceType":"123456789",
+ "aLaCarte":"false",
+ "userParams": [
+ {
+ "name": "BRG_WAN_MAC_Address"
+ },
+ {
+ "name": "Customer_Location",
+ "value":
+ {
+ "customerLatitude" : "32.89748",
+ "customerLongitude" : "-97.040443"
+ }
+ },
+ {
+ "name": "Homing_Model_Ids",
+ "value":
+ {
+ "resourceModuleName" : "test"
+ }
+ }
+ ]
+ }
+
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml b/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml
new file mode 100644
index 0000000000..8a5ade6fb6
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/resources/application-test.yaml
@@ -0,0 +1,208 @@
+aai:
+ auth: 26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764
+ endpoint: http://localhost:${wiremock.server.port}
+appc:
+ client:
+ key: iaEMAfjsVsZnraBP
+ response:
+ timeout: '120000'
+ secret: wcivUjsjXzmGFBfxMmyJu9dz
+ poolMembers: localhost:3904
+ service: ueb
+ topic:
+ read:
+ name: APPC-TEST-AMDOCS2
+ timeout: '120000'
+ write: APPC-TEST-AMDOCS1-DEV3
+ sdnc:
+ read: SDNC-LCM-READ
+ write: SDNC-LCM-WRITE
+mso:
+ adapters:
+ completemsoprocess:
+ endpoint: http://localhost:${wiremock.server.port}/CompleteMsoProcess
+ db:
+ auth: 757A94191D685FD2092AC1490730A4FC
+ endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter
+ spring:
+ endpoint: http://localhost:${wiremock.server.port}
+ network:
+ endpoint: http://localhost:${wiremock.server.port}/networks/NetworkAdapter
+ rest:
+ endpoint: http://localhost:${wiremock.server.port}/networks/rest/v1/networks
+ openecomp:
+ db:
+ endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter
+ po:
+ auth: 757A94191D685FD2092AC1490730A4FC
+ password: 3141634BF7E070AA289CF2892C986C0B
+ sdnc:
+ endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter
+ rest:
+ endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter/v1/sdnc
+ timeout: PT60S
+ tenant:
+ endpoint: http://localhost:${wiremock.server.port}/tenantAdapterMock
+ vnf:
+ endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapter
+ rest:
+ endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/vnfs
+ volume-groups:
+ rest:
+ endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/volume-groups
+ vnf-async:
+ endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapterAsync
+ workflow:
+ message:
+ endpoint: http://localhost:${wiremock.server.port}/workflows/messages/message
+
+ async:
+ core-pool-size: 50
+ max-pool-size: 50
+ queue-capacity: 500
+
+ bpmn:
+ optimisticlockingexception:
+ retrycount: '3'
+ callbackRetryAttempts: '5'
+ catalog:
+ db:
+ endpoint: http://localhost:${wiremock.server.port}/
+ spring:
+ endpoint: http://localhost:${wiremock.server.port}
+ correlation:
+ timeout: 60
+ db:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ default:
+ adapter:
+ namespace: http://org.onap.so
+ healthcheck:
+ log:
+ debug: 'false'
+ infra:
+ customer:
+ id: testCustIdInfra
+ logPath: logs
+ msoKey: 07a7159d3bf51a0e53be7a8f89699be7
+ po:
+ timeout: PT60S
+ request:
+ db:
+ endpoint: http://localhost:${wiremock.server.port}/
+ rollback: 'true'
+ sdnc:
+ password: 3141634BF7E070AA289CF2892C986C0B
+ site-name: localDevEnv
+ workflow:
+ default:
+ aai:
+ cloud-region:
+ version: '9'
+ generic-vnf:
+ version: '9'
+ v8:
+ customer:
+ uri: /aai/v8/business/customers/customer
+ generic-query:
+ uri: /aai/v8/search/generic-query
+ l3-network:
+ uri: /aai/v8/network/l3-networks/l3-network
+ network-policy:
+ uri: /aai/v8/network/network-policies/network-policy
+ nodes-query:
+ uri: /aai/v8/search/nodes-query
+ route-table-reference:
+ uri: /aai/v8/network/route-table-references/route-table-reference
+ tenant:
+ uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant
+ vce:
+ uri: /aai/v8/network/vces/vce
+ vpn-binding:
+ uri: /aai/v8/network/vpn-bindings/vpn-binding
+ v9:
+ cloud-region:
+ uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic
+ generic-vnf:
+ uri: /aai/v9/network/generic-vnfs/generic-vnf
+ global:
+ default:
+ aai:
+ namespace: http://org.openecomp.aai.inventory/
+ version: '8'
+ message:
+ endpoint: http://localhost:${wiremock.server.port}/mso/WorkflowMesssage
+ notification:
+ name: GenericNotificationService
+ sdncadapter:
+ callback: http://localhost:${wiremock.server.port}/mso/SDNCAdapterCallbackService
+ vnfadapter:
+ create:
+ callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify
+ delete:
+ callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify
+ query:
+ callback: http://localhost:${wiremock.server.port}/mso/services/VNFAdapterQuerCallbackV1
+ rollback:
+ callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify
+ global:
+ dmaap:
+ username: dmaapUsername
+ password: dmaapPassword
+ host: http://localhost:28090
+ publisher:
+ topic: com.att.mso.asyncStatusUpdate
+ service-plugin:
+ third-sp-endpoint:
+ oof-calc-endpoint:
+policy:
+ auth: Basic dGVzdHBkcDphbHBoYTEyMw==
+ client:
+ auth: Basic bTAzNzQzOnBvbGljeVIwY2sk
+ endpoint: https://localhost:8081/pdp/api/
+ environment: TEST
+sniro:
+ conductor:
+ enabled: true
+ host: http://localhost:${wiremock.server.port}
+ uri: /v1/release-orders
+ headers.auth: Basic dGVzdDp0ZXN0cHdk
+ manager:
+ timeout: PT30M
+ host: http://localhost:${wiremock.server.port}
+ uri.v1: /sniro/api/v2/placement
+ uri.v2: /sniro/api/placement/v2
+ headers.auth: Basic dGVzdDp0ZXN0cHdk
+ headers.patchVersion: 1
+ headers.minorVersion: 1
+ headers.latestVersion: 2
+spring:
+ datasource:
+ url: jdbc:mariadb://localhost:3307/camundabpmn
+ username: root
+ password: password
+ driver-class-name: org.mariadb.jdbc.Driver
+ initialize: true
+ jpa:
+ generate-ddl: false
+ show-sql: false
+ hibernate:
+ ddl-auto: none
+ naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
+ enable-lazy-load-no-trans: true
+ database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+ security:
+ usercredentials:
+ -
+ username: test
+ password: '$2a$12$Zi3AuYcZoZO/gBQyUtST2.F5N6HqcTtaNci2Et.ufsQhski56srIu'
+ role: BPEL-Client
+mariaDB4j:
+ dataDir:
+ port: 3307
+ databaseName: camundabpmn
+camunda:
+ bpm:
+ metrics:
+ enabled: false
+ db-reporter-activate: false \ No newline at end of file