summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy120
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/appc/payload/PayloadClientTest.java81
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java104
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/util/CryptoHandlerTest.java42
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net5
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf5
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CloudFlavor.java55
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java12
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResultTest.java83
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy69
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy10
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy16
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/PnfReadyEventHandler.java28
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java12
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java3
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.java96
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.java23
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java13
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/dmaap.properties7
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/processengine.properties20
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml14
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java11
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java68
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/dmaapTest.properties7
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/test/resources/springConfig_PnfEventReadyConsumer.xml19
29 files changed, 699 insertions, 242 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy
index 5e7ed982a6..f0f239b50f 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy
@@ -20,11 +20,12 @@
package org.openecomp.mso.bpmn.common.scripts
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.common.scripts.AaiUtil
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
+import org.openecomp.mso.bpmn.core.domain.CloudFlavor
import org.openecomp.mso.bpmn.core.domain.InventoryType
import org.openecomp.mso.bpmn.core.domain.Resource
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
@@ -199,54 +200,87 @@ class OofHoming extends AbstractServiceTaskProcessor {
List<Resource> resourceList = decomposition.getServiceResources()
JSONArray arr = new JSONArray(placements)
for (int i = 0; i < arr.length(); i++) {
- JSONObject placement = arr.getJSONObject(i)
- utils.log("DEBUG", "****** JSONObject is: " + placement + " *****", "true")
- String jsonServiceResourceId = placement.getString("serviceResourceId")
- for (Resource resource : resourceList) {
- String serviceResourceId = resource.getResourceId()
- if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) {
- JSONObject solution = placement.getJSONObject("solution")
- String solutionType = solution.getString("identifierType")
- String inventoryType = ""
- if (solutionType.equalsIgnoreCase("serviceInstanceId")) {
- inventoryType = "service"
- } else {
- inventoryType = "cloud"
+ JSONArray arrSol = arr.getJSONArray(i)
+ for (int j = 0; j < arrSol.length(); j++) {
+ JSONObject placement = arrSol.getJSONObject(j)
+ utils.log("DEBUG", "****** JSONObject is: " + placement + " *****", "true")
+ String jsonServiceResourceId = placement.getString("serviceResourceId")
+ for (Resource resource : resourceList) {
+ String serviceResourceId = resource.getResourceId()
+ if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) {
+ JSONObject solution = placement.getJSONObject("solution")
+ String solutionType = solution.getString("identifierType")
+ String inventoryType = ""
+ if (solutionType.equalsIgnoreCase("serviceInstanceId")) {
+ inventoryType = "service"
+ } else {
+ inventoryType = "cloud"
+ }
+ resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType))
- }
- resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType))
+ // TODO Deal with Placement Solutions & Assignment Info here
+ JSONArray assignmentArr = placement.getJSONArray("assignmentInfo")
+ Integer arrayIndex = 0
+ Integer flavorsIndex = null
+ Boolean foundFlavors = false
+ String flavors = null
+ Map<String, String> flavorsMap = null
+ ArrayList<CloudFlavor> flavorsArrayList = new ArrayList<CloudFlavor>()
+ assignmentArr.each { element ->
+ JSONObject jsonObject = new JSONObject(element.toString())
+ if (jsonUtil.getJsonRawValue(jsonObject.toString(), "key") == "flavors") {
+ flavors = jsonUtil.getJsonRawValue(jsonObject.toString(), "value")
+ foundFlavors = true
+ flavorsIndex = arrayIndex
+ } else {
+ arrayIndex += 1
+ }
+ }
+ if (foundFlavors) {
+ assignmentArr.remove(flavorsIndex)
+ flavorsMap = jsonUtil.jsonStringToMap(execution, flavors.toString())
+ flavorsMap.each { label, flavor ->
+ CloudFlavor cloudFlavor = new CloudFlavor(label, flavor)
+ flavorsArrayList.add(cloudFlavor)
+ }
+ }
+ Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "key", "value")
+ String cloudOwner = assignmentMap.get("cloudOwner")
+ String cloudRegionId = assignmentMap.get("cloudRegionId")
+ resource.getHomingSolution().setCloudOwner(cloudOwner)
+ resource.getHomingSolution().setCloudRegionId(cloudRegionId)
+ if (flavorsArrayList != null && flavorsArrayList.size != 0) {
+ resource.getHomingSolution().setFlavors(flavorsArrayList)
+ execution.setVariable(cloudRegionId + "_flavorList", flavorsArrayList)
+ }
- // TODO Deal with Placement Solutions & Assignment Info here
- JSONArray assignmentArr = placement.getJSONArray("assignmentInfo")
- Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "key", "value")
- resource.getHomingSolution().setCloudOwner(assignmentMap.get("cloudOwner"))
- resource.getHomingSolution().setCloudRegionId(assignmentMap.get("cloudRegionId"))
- if (inventoryType.equalsIgnoreCase("service")) {
- resource.getHomingSolution().setRehome(assignmentMap.get("isRehome").toBoolean())
- VnfResource vnf = new VnfResource()
- vnf.setVnfHostname(assignmentMap.get("vnfHostName"))
- resource.getHomingSolution().setVnf(vnf)
- resource.getHomingSolution().setServiceInstanceId(solution.getJSONArray("identifiers")[0].toString())
+ if (inventoryType.equalsIgnoreCase("service")) {
+ resource.getHomingSolution().setRehome(assignmentMap.get("isRehome").toBoolean())
+ VnfResource vnf = new VnfResource()
+ vnf.setVnfHostname(assignmentMap.get("vnfHostName"))
+ resource.getHomingSolution().setVnf(vnf)
+ resource.getHomingSolution().setServiceInstanceId(solution.getJSONArray("identifiers")[0].toString())
+ }
}
}
}
- }
- if (JsonUtils.jsonElementExist(response, "solutions.licenseSolutions")) {
- String licenseSolutions = jsonUtil.getJsonValue(response, "solutions.licenseSolutions")
- JSONArray licenseArr = new JSONArray(licenseSolutions)
- for (int l = 0; l < licenseArr.length(); l++) {
- JSONObject license = licenseArr.getJSONObject(l)
- String jsonServiceResourceId = license.getString("serviceResourceId")
- for (Resource resource : resourceList) {
- String serviceResourceId = resource.getResourceId()
- if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) {
- String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolUUID")
- List<String> entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList)
- resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList)
+ if (JsonUtils.jsonElementExist(response, "solutions.licenseSolutions")) {
+ String licenseSolutions = jsonUtil.getJsonValue(response, "solutions.licenseSolutions")
+ JSONArray licenseArr = new JSONArray(licenseSolutions)
+ for (int l = 0; l < licenseArr.length(); l++) {
+ JSONObject license = licenseArr.getJSONObject(l)
+ String jsonServiceResourceId = license.getString("serviceResourceId")
+ for (Resource resource : resourceList) {
+ String serviceResourceId = resource.getResourceId()
+ if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) {
+ String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolUUID")
+ List<String> entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList)
+ resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList)
- String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupUUID")
- List<String> licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList)
- resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList)
+ String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupUUID")
+ List<String> licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList)
+ resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList)
+ }
}
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy
index fc7c62baa7..4b2b0e20ac 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy
@@ -311,7 +311,7 @@ class OofUtils {
sb.append(",\n" +
" \"existingCandidates\": [\n")
def existingCandidateJson = ""
- existingCandidates.each {
+ existingCandidates.each { existingCandidate ->
type = existingCandidate.get('identifierType')
if (type == 'vimId') {
def cloudOwner = existingCandidate.get('cloudOwner')
@@ -342,7 +342,7 @@ class OofUtils {
sb.append(",\n" +
" \"excludedCandidates\": [\n")
def excludedCandidateJson = ""
- excludedCandidates.each {
+ excludedCandidates.each { excludedCandidate ->
type = excludedCandidate.get('identifierType')
if (type == 'vimId') {
def cloudOwner = excludedCandidate.get('cloudOwner')
@@ -373,7 +373,7 @@ class OofUtils {
sb.append(",\n" +
" \"requiredCandidates\": [\n")
def requiredCandidatesJson = ""
- requiredCandidates.each {
+ requiredCandidates.each { requiredCandidate ->
type = requiredCandidate.get('identifierType')
if (type == 'vimId') {
def cloudOwner = requiredCandidate.get('cloudOwner')
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/appc/payload/PayloadClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/appc/payload/PayloadClientTest.java
new file mode 100644
index 0000000000..95af260ac6
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/appc/payload/PayloadClientTest.java
@@ -0,0 +1,81 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.openecomp.mso.bpmn.appc.payload;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Optional;
+
+import org.json.JSONObject;
+import org.junit.Test;
+
+public class PayloadClientTest {
+
+ @Test
+ public void upgradeFormatTest() throws Exception {
+ String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"existing-software-version\":\"existingVersion\",\"new-software-version\":\"newVersion\"}}";
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("existing-software-version", "existingVersion");
+ jsonObject.put("new-software-version", "newVersion");
+ Optional<String> payload = Optional.of(jsonObject.toString());
+ Optional<String> payloadClient = PayloadClient.upgradeFormat(payload, "vnfName1");
+ assertEquals(payloadResult, payloadClient.get());
+ }
+
+ @Test
+ public void resumeTrafficFormatTest() throws Exception {
+ String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}";
+ Optional<String> payloadClient = PayloadClient.resumeTrafficFormat("vnfName1");
+ assertEquals(payloadResult, payloadClient.get());
+ }
+
+ @Test
+ public void quiesceTrafficFormatTest() throws Exception {
+ String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"operations_timeout\":\"operationTimeout\"}}";
+ JSONObject jsonObject = new JSONObject();
+ jsonObject.put("operations-timeout", "operationTimeout");
+ Optional<String> payload = Optional.of(jsonObject.toString());
+ Optional<String> payloadClient = PayloadClient.quiesceTrafficFormat(payload, "vnfName1");
+ assertEquals(payloadResult, payloadClient.get());
+ }
+
+ @Test
+ public void startStopFormatTest() throws Exception {
+ String payloadResult = "{\" AICIdentity \":\"aicIdentity1\"}";
+ Optional<String> payloadClient = PayloadClient.startStopFormat("aicIdentity1");
+ assertEquals(payloadResult, payloadClient.get());
+ }
+
+ @Test
+ public void healthCheckFormatTest() throws Exception {
+ String payloadResult = "{\"request-parameters\":{\"vnf-name\":\"vnfName1\"},\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}";
+ Optional<String> payloadClient = PayloadClient.healthCheckFormat("vnfName1", "vnfHostIpAddress1");
+ assertEquals(payloadResult, payloadClient.get());
+ }
+
+ @Test
+ public void snapshotFormatTest() throws Exception {
+ String payloadResult = "{\"vm-id\":\"vmId1\",\"identity-url\":\"identityUrl1\"}";
+ Optional<String> payloadClient = PayloadClient.snapshotFormat("vmId1", "identityUrl1");
+ assertEquals(payloadResult, payloadClient.get());
+ }
+
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java
index 45645be7cd..d7239fe0c1 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java
@@ -28,6 +28,7 @@ import org.junit.Ignore;
import org.junit.Test;
import org.openecomp.mso.bpmn.core.WorkflowException;
import org.openecomp.mso.bpmn.core.domain.AllottedResource;
+import org.openecomp.mso.bpmn.core.domain.CloudFlavor;
import org.openecomp.mso.bpmn.core.domain.HomingSolution;
import org.openecomp.mso.bpmn.core.domain.ModelInfo;
import org.openecomp.mso.bpmn.core.domain.NetworkResource;
@@ -123,6 +124,12 @@ public class OofHomingTest extends WorkflowTest {
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");
@@ -190,7 +197,7 @@ public class OofHomingTest extends WorkflowTest {
resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
null, null), resourceARHoming2String);
assertEquals(homingSolutionCloud("cloud","aic", "testCloudRegionId3",
- "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ 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);
@@ -255,7 +262,7 @@ public class OofHomingTest extends WorkflowTest {
null, null), resourceARHoming2String);
assertEquals(homingSolutionCloud("cloud","aic",
"testCloudRegionId3",
- "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ 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",
@@ -264,7 +271,7 @@ public class OofHomingTest extends WorkflowTest {
null, null), resourceNetHomingString);
assertEquals(homingSolutionCloud("cloud", "aic",
"testCloudRegionIdNet2",
- "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"",
+ 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);
@@ -405,7 +412,7 @@ public class OofHomingTest extends WorkflowTest {
null, null), resourceARHoming2String);
assertEquals(homingSolutionCloud("cloud", "aic",
"testCloudRegionId3",
- "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
+ 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);
@@ -625,43 +632,6 @@ public class OofHomingTest extends WorkflowTest {
}
- /*private String homingSolutionService(String resourceModuleName, String serviceInstanceId, String vnfHostname, String cloudOwner,
- String cloudRegionId, String licenseList) {
- String solution = "";
- if (licenseList == null || licenseList == "") {
- solution = "{\n" +
- " \"resourceModuleName\": \"" + resourceModuleName + "\",\n" +
- " \"serviceResourceId\": \"some_resource_id\",\n" +
- " \"solution\": {\n" +
- " \"identifierType\": \"serviceInstanceId\",\n" +
- " \"identifiers\": [\"" + serviceInstanceId + "\"]\n" +
- " }\n" +
- " \"assignmentInfo\": [\n" +
- " { \"key\": \"cloudOwner\", \"value\": \"" + cloudOwner + "\" },\n" +
- " { \"key\": \"vnfHostName\", \"value\": \"" + vnfHostname + "\" },\n" +
- " { \"key\": \"isRehome\", \"value\": \"False\" },\n" +
- " { \"key\": \"cloudRegionId\", \"value\": \"" + cloudRegionId + "\" }\n" +
- " ]\n" +
- " }";
- } else {
- solution = "{\n" +
- " \"resourceModuleName\": \"" + resourceModuleName + "\",\n" +
- " \"serviceResourceId\": \"some_resource_id\",\n" +
- " \"solution\": {\n" +
- " \"identifierType\": \"service_instance_id\",\n" +
- " \"identifiers\": [\"" + serviceInstanceId + "\"]\n" +
- " }\n" +
- " \"assignmentInfo\": [\n" +
- " { \"key\": \"cloudOwner\", \"value\": \"" + cloudOwner + "\" },\n" +
- " { \"key\": \"vnfHostName\", \"value\": \"" + vnfHostname + "\" },\n" +
- " { \"key\": \"isRehome\", \"value\": \"False\" },\n" +
- " { \"key\": \"cloudRegionId\", \"value\": \"" + cloudRegionId + "\" }\n" +
- " ], " +
- " \"licenseSolutions\" : [ {\"licenseKeyGroupUUID\": [" + licenseList + "]} ] " +
- "}";
- }
- return solution;
- }*/
private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname,
String vnfResourceId, String cloudOwner,
String cloudRegionId, String enList,
@@ -687,50 +657,28 @@ public class OofHomingTest extends WorkflowTest {
return solution;
}
- /*private String homingSolutionCloud(String resourceModuleName, String cloudOwner,
- String cloudRegionId, String licenseList) {
- String solution = "";
- if (licenseList == null || licenseList == "") {
- solution = "{\n" +
- " \"resourceModuleName\": \"" + resourceModuleName + "\",\n" +
- " \"serviceResourceId\": \"some_resource_id\",\n" +
- " \"solution\": {\n" +
- " \"identifierType\": \"cloudRegionId\",\n" +
- " \"cloudOwner\": \"" + cloudOwner + "\",\n" +
- " \"identifiers\": [\"" + cloudRegionId + "\"]\n" +
- " }\n" +
- " \"assignmentInfo\": [\n" +
- " { \"key\": \"cloudOwner\", \"value\": \"" + cloudOwner + "\" },\n" +
- " { \"key\": \"cloudRegionId\", \"value\": \"" + cloudRegionId + "\" }\n" +
- " ]\n" +
- "}";
- } else {
- solution = "{\n" +
- " \"resourceModuleName\": \"" + resourceModuleName + "\",\n" +
- " \"serviceResourceId\": \"some_resource_id\",\n" +
- " \"solution\": {\n" +
- " \"identifierType\": \"cloudRegionId\",\n" +
- " \"cloudOwner\": \"" + cloudOwner + "\",\n" +
- " \"identifiers\": [\"" + cloudRegionId + "\"]\n" +
- " }\n" +
- " \"assignmentInfo\": [\n" +
- " { \"key\": \"cloudOwner\", \"value\": \"" + cloudOwner + "\" },\n" +
- " { \"key\": \"cloudRegionId\", \"value\": \"" + cloudRegionId + "\" }\n" +
- " ]," +
- " \"licenseSolutions\" : [ {\"licenseKeyGroupUUID\": [" + licenseList + "]} ] } " +
- "}";
- }
- return solution;
- }*/
private String homingSolutionCloud(String type, String cloudOwner,
- String cloudRegionId, String enList,
+ 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{
+ } 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\" : [ " +
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/util/CryptoHandlerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/util/CryptoHandlerTest.java
new file mode 100644
index 0000000000..724d3edf4d
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/util/CryptoHandlerTest.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.openecomp.mso.bpmn.common.util;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class CryptoHandlerTest {
+
+ @Test
+ public void test() throws Exception {
+ String plainPswd = "mso0206";
+ String encryptPwd = "C1FC4A39E16419DD41DFC1212843F440";
+ CryptoHandler cryptoHandler = new CryptoHandler();
+ String aaiPassword = cryptoHandler.getMsoAaiPassword();
+ assertEquals(plainPswd, aaiPassword);
+ String encryptPassword = cryptoHandler.encryptMsoPassword(plainPswd);
+ assertEquals(encryptPwd, encryptPassword);
+ String decryptPassword = cryptoHandler.decryptMsoPassword(encryptPwd);
+ assertEquals(plainPswd, decryptPassword);
+ }
+
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf
index 3559708728..808723828a 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf
@@ -31,6 +31,7 @@
}
],
"placementSolutions": [
+ [
{
"resourceModuleName": "ALLOTTED_RESOURCE",
"serviceInstanceId": "testSIID1",
@@ -101,9 +102,12 @@
{
"key": "cloudRegionId",
"value": "testCloudRegionId3"
- }
+ },
+ { "key":"flavors",
+ "value":{"flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}}
]
}
]
+ ]
}
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net
index 30fa09afd9..8766df8dba 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net
@@ -43,6 +43,7 @@
},
],
"placementSolutions": [
+ [
{
"resourceModuleName": "ALLOTTED_RESOURCE",
"serviceResourceId": "testResourceIdAR",
@@ -108,9 +109,11 @@
},
"assignmentInfo": [
{ "key": "cloudOwner", "value": "aic" },
- { "key": "cloudRegionId", "value": "testCloudRegionId3" }
+ { "key": "cloudRegionId", "value": "testCloudRegionId3" },
+ { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}}
]
}
]
+ ]
}
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf
index b4e748c6e7..8e6f2d46be 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf
@@ -5,6 +5,7 @@
"statusMessage": "success",
"solutions": {
"placementSolutions": [
+ [
{
"resourceModuleName": "vGMuxInfra",
"serviceResourceId": "some_resource_id",
@@ -29,9 +30,11 @@
},
"assignmentInfo": [
{ "key": "cloudOwner", "value": "amazon" },
- { "key": "cloudRegionId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" }
+ { "key": "cloudRegionId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" },
+ { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}}
]
}
+ ]
],
"licenseSolutions": [
{
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CloudFlavor.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CloudFlavor.java
new file mode 100644
index 0000000000..100d70e1b2
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CloudFlavor.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2018 Intel Corp. Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.core.domain;
+
+import java.io.Serializable;
+
+/**
+ * Stores Cloud Flavor information and is an attribute
+ * of a <class>HomingSolution</class>
+ *
+ */
+public class CloudFlavor extends JsonWrapper implements Serializable {
+ private String flavorLabel;
+ private String flavor;
+
+ public CloudFlavor (String flavorLabel, String flavor){
+ this.flavorLabel = flavorLabel;
+ this.flavor = flavor;
+ }
+
+ public String getFlavorLabel() {
+ return flavorLabel;
+ }
+
+ public void setFlavorLabel(String flavorLabel) {
+ this.flavorLabel = flavorLabel;
+ }
+
+ public String getFlavor() {
+ return flavor;
+ }
+
+ public void setFlavor(String flavor) {
+ this.flavor = flavor;
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java
index 611c8dfff9..f0193bc1c3 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java
@@ -45,6 +45,7 @@ public class HomingSolution extends JsonWrapper implements Serializable {
private String aicVersion;
private String tenant;
private VnfResource vnf;
+ private List<CloudFlavor> flavors;
private License license = new License();
@@ -126,6 +127,17 @@ public class HomingSolution extends JsonWrapper implements Serializable {
this.vnf = vnf;
}
+ /**
+ * @return a map<string, string> key is label name, value is any flavor
+ */
+ public List<CloudFlavor> getFlavors() {
+ return flavors;
+ }
+
+ public void setFlavors(List<CloudFlavor> flavors) {
+ this.flavors = flavors;
+ }
+
public License getLicense() {
return license;
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
index 79b9239015..1869b930f0 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
@@ -931,7 +931,7 @@ public class JsonUtils {
for (int i = 0; i < arr.length(); i++){
JSONObject jo = arr.getJSONObject(i);
String key = jo.getString(keyNode);
- String value =jo.getString(valueNode);
+ String value = jo.getString(valueNode);
map.put(key, value);
}
msoLogger.debug("Outgoing Map is: " + map);
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResultTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResultTest.java
new file mode 100644
index 0000000000..90cb7362cf
--- /dev/null
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResultTest.java
@@ -0,0 +1,83 @@
+/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright (C) 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.openecomp.mso.bpmn.core.domain;
+
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class CompareModelsResultTest {
+
+ private CompareModelsResult modelsResult;
+ private List<ResourceModelInfo> addedResourceList;
+ private List<ResourceModelInfo> deletedResourceList;
+ private ResourceModelInfo resourceModelInfo1;
+ private ResourceModelInfo resourceModelInfo2;
+ private List<String> requestInputs;
+
+ @Before
+ public void before() {
+ resourceModelInfo1 = new ResourceModelInfo();
+ resourceModelInfo1.setResourceCustomizationUuid("f1d563e8-e714-4393-8f99-cc480144a05e");
+ resourceModelInfo1.setResourceInvariantUuid("e1d563e8-e714-4393-8f99-cc480144a05f");
+ resourceModelInfo1.setResourceName("resourceName1");
+ resourceModelInfo1.setResourceUuid("f1d563e8-e714-4393-8f99-cc480144a05g");
+ resourceModelInfo2 = new ResourceModelInfo();
+ resourceModelInfo2.setResourceCustomizationUuid("a1d563e8-e714-4393-8f99-cc480144a05d");
+ resourceModelInfo2.setResourceInvariantUuid("b1d563e8-e714-4393-8f99-cc480144a05e");
+ resourceModelInfo2.setResourceName("resourceName2");
+ resourceModelInfo2.setResourceUuid("c1d563e8-e714-4393-8f99-cc480144a05f");
+ }
+
+ @Test
+ public void testSetAddedResourceList() {
+ addedResourceList = new ArrayList<ResourceModelInfo>();
+ addedResourceList.add(resourceModelInfo1);
+ addedResourceList.add(resourceModelInfo2);
+ modelsResult = new CompareModelsResult();
+ modelsResult.setAddedResourceList(addedResourceList);
+ assertEquals(addedResourceList, modelsResult.getAddedResourceList());
+ }
+
+ @Test
+ public void testSetDeletedResourceList() {
+ deletedResourceList = new ArrayList<ResourceModelInfo>();
+ deletedResourceList.add(resourceModelInfo1);
+ deletedResourceList.add(resourceModelInfo2);
+ modelsResult = new CompareModelsResult();
+ modelsResult.setDeletedResourceList(deletedResourceList);
+ assertEquals(deletedResourceList, modelsResult.getDeletedResourceList());
+ }
+
+ @Test
+ public void testSetRequestInputs() {
+ requestInputs = new ArrayList<String>();
+ requestInputs.add("requestInput1");
+ requestInputs.add("requestInput2");
+ modelsResult = new CompareModelsResult();
+ modelsResult.setRequestInputs(requestInputs);
+ assertEquals(requestInputs, modelsResult.getRequestInputs());
+ }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy
index c70c971bc7..3652d56303 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy
@@ -101,32 +101,49 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
if (isBlank(serviceInstanceId)) {
msg = "Input serviceInstanceId' is null"
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- }
-
- /*
- * Extracting User Parameters from incoming Request and converting into a Map
- */
- def jsonSlurper = new JsonSlurper()
- def jsonOutput = new JsonOutput()
-
- Map reqMap = jsonSlurper.parseText(siRequest)
-
- //InputParams
- def userParams = reqMap.requestDetails?.requestParameters?.userParams
-
- Map<String, String> inputMap = [:]
- if (userParams) {
- userParams.each {
- userParam -> inputMap.put(userParam.name, userParam.value.toString())
- }
}
- execution.setVariable("operationType", "CompareModel")
- utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled)
- execution.setVariable("serviceInputParams", inputMap)
-
- } catch (BpmnError e) {
- throw e;
+ //subscriberInfo
+ String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId' is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ }
+
+ //subscriptionServiceType
+ String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "serviceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType is null"
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("serviceType", subscriptionServiceType)
+ }
+
+ //modelInvariantIdTarget
+ String modelInvariantIdTarget = jsonUtil.getJsonValue(siRequest, "modelInvariantIdTarget")
+ if (isBlank(modelInvariantIdTarget)) {
+ msg = "Input modelInvariantIdTarget' is null"
+ utils.log("INFO", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("modelInvariantIdTarget", modelInvariantIdTarget)
+ }
+
+ //modelVersionIdTarget
+ String modelVersionIdTarget = jsonUtil.getJsonValue(siRequest, "modelVersionIdTarget")
+ if (isBlank(modelVersionIdTarget)) {
+ msg = "Input modelVersionIdTarget is null"
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("modelVersionIdTarget", modelVersionIdTarget)
+ }
+
+ execution.setVariable("operationType", "CompareModel")
+
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
utils.log("INFO", msg, isDebugEnabled)
@@ -143,13 +160,13 @@ public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcess
CompareModelsResult compareModelsResult = execution.getVariable("compareModelsResult")
// RESTResponse (for API Handler(APIH) Reply Task)
- String syncResponse = compareModelsResult.toString()
+ String syncResponse = compareModelsResult.toJsonStringNoRootName()
utils.log("INFO", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled)
sendWorkflowResponse(execution, 202, syncResponse)
} catch (Exception ex) {
String msg = "Exception in sendSyncResponse: " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
utils.log("INFO"," ***** Exit sendSyncResopnse *****", isDebugEnabled)
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
index a49a0664e8..77b0657514 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
@@ -149,7 +149,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
"modelUuid":"${modelUuid}",
"modelVersion":""
}"""
- execution.setVariable("serviceModelInfo", serviceModelInfo)
+
execution.setVariable("serviceModelInfo_Target", serviceModelInfo)
utils.log("DEBUG", " ***** Completed prepareDecomposeService_Target of update generic e2e service ***** ", isDebugEnabled)
@@ -187,7 +187,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
"modelUuid":"${modelUuid}",
"modelVersion":""
}"""
- execution.setVariable("serviceModelInfo", serviceModelInfo)
+
execution.setVariable("serviceModelInfo_Original", serviceModelInfo)
utils.log("DEBUG", " ***** Completed prepareDecomposeService_Original of update generic e2e service ***** ", isDebugEnabled)
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
index 30db8c53eb..0172402185 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
@@ -34,6 +34,7 @@ import org.openecomp.mso.bpmn.common.scripts.AaiUtil
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
+import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder
import org.openecomp.mso.bpmn.core.RollbackData
import org.openecomp.mso.bpmn.core.WorkflowException
import org.openecomp.mso.rest.APIResponse;
@@ -84,13 +85,12 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce
JsonUtils jsonUtil = new JsonUtils()
public void preProcessRequest (DelegateExecution execution) {
- execution.setVariable("isDebugLogEnabled","true")
def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
utils.log("INFO","Entered " + method, isDebugEnabled)
String msg = ""
- utils.log("INFO"," ***** Enter CompareModelofE2EServiceInstance preProcessRequest *****", isDebugEnabled)
+ utils.log("INFO"," ***** Enter DoCompareModelofE2EServiceInstance preProcessRequest *****", isDebugEnabled)
execution.setVariable("prefix", Prefix)
//Inputs
@@ -121,14 +121,14 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
- String modelInvariantUuid = execution.getVariable('modelInvariantIdTarget')
+ String modelInvariantUuid = execution.getVariable("modelInvariantIdTarget")
if (isBlank(modelInvariantUuid)){
msg = "Input modelInvariantUuid is null"
utils.log("INFO", msg, isDebugEnabled)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
}
- String modelUuid = execution.getVariable('modelVersionIdTarget')
+ String modelUuid = execution.getVariable("modelVersionIdTarget")
if (isBlank(modelUuid)){
msg = "Input modelUuid is null"
utils.log("INFO", msg, isDebugEnabled)
@@ -238,7 +238,7 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce
requestInputs.addAll(resourceParameters.keySet())
}
- for(Resource rc : deletedResourceList) {
+ for(Resource rc : delResourceList) {
mi = rc.getModelInfo()
String resourceCustomizationUuid = mi.getModelCustomizationUuid()
ResourceModelInfo rmodel = new ResourceModelInfo()
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
index b9319466d9..95747d5a0b 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
@@ -18,7 +18,9 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.bpmn.infrastructure.scripts;
+package org.openecomp.mso.bpmn.infrastructure.scripts
+
+import org.openecomp.mso.bpmn.core.domain.CloudFlavor
import java.util.Map
import java.util.Currency.CurrencyNameGetter
@@ -174,6 +176,12 @@ public class DoCreateVfModule extends VfModuleBase {
execution.setVariable("DCVFM_serviceInstanceId", serviceInstanceId)
rollbackData.put("VFMODULE", "serviceInstanceId", serviceInstanceId)
logDebug("serviceInstanceId: " + serviceInstanceId, isDebugLogEnabled)
+ //flavorList
+ ArrayList<CloudFlavor> flavorList = execution.getVariable(cloudSiteId + "_flavorList")
+ if (flavorList != null) {
+ execution.setVariable("DCVFM_flavorList", flavorList)
+ logDebug("flavorList is: " + flavorList, isDebugLogEnabled)
+ }
//source - HARDCODED
def source = "VID"
execution.setVariable("DCVFM_source", source)
@@ -927,6 +935,8 @@ public class DoCreateVfModule extends VfModuleBase {
def serviceId = execution.getVariable("DCVFM_serviceId")
//serviceInstanceId
def serviceInstanceId = execution.getVariable("DCVFM_serviceInstanceId")
+ //flavorList
+ ArrayList<CloudFlavor> flavorList = execution.getVariable("DCVFM_flavorList")
//backoutOnFailure
def backoutOnFailure = execution.getVariable("DCVFM_backoutOnFailure")
//volumeGroupId
@@ -962,6 +972,10 @@ public class DoCreateVfModule extends VfModuleBase {
}
Map<String, String> vnfParamsMap = execution.getVariable("DCVFM_vnfParamsMap")
+ // Add flavorLabel List to vnfParamsMap
+ flavorList.each { cloudFlavor ->
+ vnfParamsMap.put("label_" + cloudFlavor.getFlavorLabel(), cloudFlavor.getFlavor())
+ }
String vfModuleParams = ""
//Get SDNC Response Data for VF Module Topology
String vfModuleSdncGetResponse = execution.getVariable('DCVFM_getSDNCAdapterResponse')
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/PnfReadyEventHandler.java b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/PnfReadyEventHandler.java
deleted file mode 100644
index f89b6a7a58..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/PnfReadyEventHandler.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.openecomp.mso.bpmn.infrastructure.scripts;
-
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil;
-import org.openecomp.mso.client.dmaap.DmaapConsumer;
-import org.openecomp.mso.client.sdno.dmaap.PnfReadyEventConsumer;
-
-public class PnfReadyEventHandler {
-
- private ExceptionUtil exceptionUtil;
-
- private static final String TOPIC_NAME = "VES event";
-
- public PnfReadyEventHandler() {
- exceptionUtil = new ExceptionUtil();
- }
-
- public void getPnfReadyEventFromDmaap (DelegateExecution execution) throws Exception {
- Object correlationIdVar = execution.getVariable("correlationId");
- if (!(correlationIdVar instanceof String)) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, "correlationId variable is not String type");
- }
- String correlationId = (String) correlationIdVar;
- DmaapConsumer dmaapConsumer = new PnfReadyEventConsumer(correlationId);
- dmaapConsumer.consume();
- // TODO inform camunda process that event has been received
- }
-}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
index f4483f5923..417bb4668e 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
@@ -28,6 +28,7 @@ import java.io.IOException;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil;
import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiConnection;
import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.AaiResponse;
import org.openecomp.mso.bpmn.infrastructure.pnf.implementation.CheckAaiForCorrelationIdImplementation;
@@ -58,21 +59,16 @@ public class CheckAaiForCorrelationIdDelegate implements JavaDelegate {
public void execute(DelegateExecution execution) throws Exception {
String correlationId = (String) execution.getVariable(CORRELATION_ID);
if (correlationId == null) {
- //todo: fix Execution -> DelegateExecution in ALL groovy scripts
-// new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, CORRELATION_ID + " is not set");
- throw new BpmnError("MSOWorkflowException");
+ new ExceptionUtil().buildAndThrowWorkflowException(execution, 500, CORRELATION_ID + " is not set");
}
try {
AaiResponse aaiResponse = implementation.check(correlationId, aaiConnection);
execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_PNF, aaiResponse.getContainsInfoAboutPnf());
- aaiResponse.getContainsInfoAboutIp().ifPresent(
- isIp -> execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, isIp)
- );
+ execution.setVariableLocal(AAI_CONTAINS_INFO_ABOUT_IP, aaiResponse.getContainsInfoAboutIp());
} catch (IOException e) {
- //todo: log this
- throw new BpmnError("MSOWorkflowException");
+ new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, e.getMessage());
}
}
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java
index 6b49908a0f..0d64f2c8b7 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java
@@ -23,6 +23,9 @@ package org.openecomp.mso.bpmn.infrastructure.pnf.delegate;
@SuppressWarnings("ALL")
public class ExecutionVariableNames {
+ private ExecutionVariableNames() {
+ }
+
public final static String CORRELATION_ID = "correlationId";
public final static String AAI_CONTAINS_INFO_ABOUT_PNF = "aaiContainsInfoAboutPnf";
public final static String AAI_CONTAINS_INFO_ABOUT_IP = "aaiContainsInfoAboutIp";
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.java
new file mode 100644
index 0000000000..e6019f73f0
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.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.openecomp.mso.bpmn.infrastructure.pnf.dmaap;
+
+import java.io.IOException;
+import java.net.URI;
+import javax.ws.rs.core.UriBuilder;
+import org.apache.http.HttpResponse;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.HttpClientBuilder;
+
+public class PnfEventReadyConsumer {
+
+ private static final String JSON_PATH_CORRELATION_ID = "$.pnfRegistrationFields.correlationId";
+ private HttpClient httpClient;
+
+ private String dmaapHost;
+ private int dmaapPort;
+ private String dmaapProtocol;
+ private String dmaapUriPathPrefix;
+ private String dmaapTopicName;
+ private String consumerId;
+ private String consumerGroup;
+
+ public PnfEventReadyConsumer() {
+ httpClient = HttpClientBuilder.create().build();
+ }
+
+ public void notifyWhenPnfReady(String correlationId)
+ throws IOException {
+ HttpGet getRequest = new HttpGet(buildURI(consumerGroup, consumerId));
+ HttpResponse response = httpClient.execute(getRequest);
+ checkIfResponseIsAccepted(response, correlationId);
+ }
+
+ private boolean checkIfResponseIsAccepted(HttpResponse response, String correlationId) {
+ // TODO parse response if contains proper correlationId
+ return false;
+ }
+
+ private URI buildURI(String consumerGroup, String consumerId) {
+ return UriBuilder.fromUri(dmaapUriPathPrefix)
+ .scheme(dmaapProtocol)
+ .host(dmaapHost)
+ .port(dmaapPort).path(dmaapTopicName)
+ .path(consumerGroup).path(consumerId).build();
+ }
+
+ public void setDmaapHost(String dmaapHost) {
+ this.dmaapHost = dmaapHost;
+ }
+
+ public void setDmaapPort(int dmaapPort) {
+ this.dmaapPort = dmaapPort;
+ }
+
+ public void setDmaapProtocol(String dmaapProtocol) {
+ this.dmaapProtocol = dmaapProtocol;
+ }
+
+ public void setDmaapUriPathPrefix(String dmaapUriPathPrefix) {
+ this.dmaapUriPathPrefix = dmaapUriPathPrefix;
+ }
+
+ public void setDmaapTopicName(String dmaapTopicName) {
+ this.dmaapTopicName = dmaapTopicName;
+ }
+
+ public void setConsumerId(String consumerId) {
+ this.consumerId = consumerId;
+ }
+
+ public void setConsumerGroup(String consumerGroup) {
+ this.consumerGroup = consumerGroup;
+ }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.java
index bbb7adc143..5fb7a43e00 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.java
@@ -24,28 +24,25 @@ import java.util.Optional;
import javax.annotation.Nullable;
import javax.validation.constraints.NotNull;
-public class AaiResponse {
+public enum AaiResponse {
+ NO_ENTRY(false, false),
+ ENTRY_NO_IP(true, false),
+ ENTRY_WITH_IP(true, true);
- private Boolean containsInfoAboutPnf;
- private Boolean containsInfoAboutIp;
- private String ipAddress;
+ private boolean containsInfoAboutPnf;
+ private boolean containsInfoAboutIp;
- public AaiResponse(@NotNull Boolean containsInfoAboutPnf, @Nullable Boolean containsInfoAboutIp,
- @Nullable String ipAddress) {
+ AaiResponse(boolean containsInfoAboutPnf, boolean containsInfoAboutIp) {
this.containsInfoAboutPnf = containsInfoAboutPnf;
this.containsInfoAboutIp = containsInfoAboutIp;
- this.ipAddress = ipAddress;
}
- public Boolean getContainsInfoAboutPnf() {
+ public boolean getContainsInfoAboutPnf() {
return containsInfoAboutPnf;
}
- public Optional<Boolean> getContainsInfoAboutIp() {
- return Optional.ofNullable(containsInfoAboutIp);
+ public boolean getContainsInfoAboutIp() {
+ return containsInfoAboutIp;
}
- public Optional<String> getIpAddress() {
- return Optional.ofNullable(ipAddress);
- }
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java
index 353a3bd5d3..b982a693da 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java
+++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java
@@ -29,15 +29,14 @@ public class CheckAaiForCorrelationIdImplementation {
public AaiResponse check(String correlationId, AaiConnection aaiConnection) throws IOException {
Optional<Pnf> pnf = aaiConnection.getEntryFor(correlationId);
if (!pnf.isPresent()) {
- return new AaiResponse(false, null, null);
+ return AaiResponse.NO_ENTRY;
}
- Optional<String> ip = extractIp(pnf.get());
- return ip.map(
- s -> new AaiResponse(true, true, s)
- ).orElseGet(
- () -> new AaiResponse(true, false, null)
- );
+ if(extractIp(pnf.get()).isPresent()) {
+ return AaiResponse.ENTRY_WITH_IP;
+ } else {
+ return AaiResponse.ENTRY_NO_IP;
+ }
}
private Optional<String> extractIp(Pnf pnf) {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/dmaap.properties b/bpmn/MSOInfrastructureBPMN/src/main/resources/dmaap.properties
new file mode 100644
index 0000000000..3c4dca49cf
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/dmaap.properties
@@ -0,0 +1,7 @@
+dmaapHost=HOSTNAME
+dmaapPort=3905
+dmaapProtocol=http
+dmaapUriPathPrefix = events
+eventReadyTopicName=pnfEventReady
+consumerId=consumerId
+consumerGroup=group
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/processengine.properties b/bpmn/MSOInfrastructureBPMN/src/main/resources/processengine.properties
deleted file mode 100644
index d071fdabf8..0000000000
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/processengine.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-###
-# ============LICENSE_START=======================================================
-# ECOMP MSO
-# ================================================================================
-# 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=========================================================
-###
-processEngineName=infrastructure
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml
index 46cea5da63..f46cd065ed 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml
@@ -14,4 +14,18 @@
<property name="aaiConnection" ref="aaiConnection"/>
</bean>
+ <bean id="pnfEventReadyConsumer" class="org.openecomp.mso.bpmn.infrastructure.pnf.dmaap.PnfEventReadyConsumer">
+ <property name="dmaapHost" value="${dmaapHost}" />
+ <property name="dmaapPort" value="${dmaapPort}"/>
+ <property name="dmaapProtocol" value="${dmaapProtocol}"/>
+ <property name="dmaapUriPathPrefix" value="${dmaapUriPathPrefix}"/>
+ <property name="dmaapTopicName" value="${eventReadyTopicName}"/>
+ <property name= "consumerGroup" value="${consumerGroup}"/>
+ <property name="consumerId" value="${consumerId}"/>
+ </bean>
+
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="locations" value="classpath:dmaap.properties"/>
+ </bean>
+
</beans>
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
index d98a395838..75a7450434 100644
--- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
@@ -21,10 +21,11 @@
package org.openecomp.mso.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.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.DEFAULT_IP;
import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITHOUT_ENTRY;
import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_AND_IP;
import static org.openecomp.mso.bpmn.infrastructure.pnf.delegate.AaiConnectionTestImpl.ID_WITH_ENTRY_NO_IP;
@@ -38,6 +39,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
import org.junit.runner.RunWith;
+import org.openecomp.mso.bpmn.core.WorkflowException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@@ -60,8 +62,7 @@ public class CheckAaiForCorrelationIdDelegateTest {
when(execution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue");
// when, then
assertThatThrownBy(() -> delegate.execute(execution)).isInstanceOf(BpmnError.class);
- // todo: uncomment line below after fixing Execution -> DelecateExecution in groovy scripts
-// verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class));
+ verify(execution).setVariable(eq("WorkflowException"), any(WorkflowException.class));
}
@Test
@@ -118,12 +119,14 @@ public class CheckAaiForCorrelationIdDelegateTest {
private CheckAaiForCorrelationIdDelegate delegate;
@Test
- public void shouldThrowExceptionWhenSSADFDSADSFDS() throws Exception {
+ 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/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java
new file mode 100644
index 0000000000..2f6a00db66
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java
@@ -0,0 +1,68 @@
+/*-
+ * ============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.openecomp.mso.bpmn.infrastructure.pnf.dmaap;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import java.lang.reflect.Field;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpGet;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@ContextConfiguration({"classpath:springConfig_PnfEventReadyConsumer.xml"})
+public class PnfEventReadyConsumerTest {
+
+ @Autowired
+ private PnfEventReadyConsumer pnfEventReadyConsumer;
+
+ private HttpClient httpClientMock;
+
+ @Before
+ public void init() throws NoSuchFieldException, IllegalAccessException {
+ httpClientMock = mock(HttpClient.class);
+ setPrivateField();
+ }
+
+ @Test
+ public void restClientInvokesWithProperURI() throws Exception {
+ ArgumentCaptor<HttpGet> captor1 = ArgumentCaptor.forClass(HttpGet.class);
+ pnfEventReadyConsumer.notifyWhenPnfReady("correlationId");
+ verify(httpClientMock).execute(captor1.capture());
+ assertThat(captor1.getValue().getURI()).hasHost("hostTest").hasPort(1234).hasScheme("http")
+ .hasPath("/eventsForTesting/eventTopicTest/consumerGroupTest/consumerTestId");
+ }
+
+ private void setPrivateField() throws NoSuchFieldException, IllegalAccessException {
+ Field field = pnfEventReadyConsumer.getClass().getDeclaredField("httpClient");
+ field.setAccessible(true);
+ field.set(pnfEventReadyConsumer, httpClientMock);
+ }
+
+}
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/dmaapTest.properties b/bpmn/MSOInfrastructureBPMN/src/test/resources/dmaapTest.properties
new file mode 100644
index 0000000000..a8df15c5df
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/dmaapTest.properties
@@ -0,0 +1,7 @@
+dmaapHost=hostTest
+dmaapPort=1234
+dmaapProtocol=http
+dmaapUriPathPrefix = eventsForTesting
+eventReadyTopicName=eventTopicTest
+consumerId=consumerTestId
+consumerGroup=consumerGroupTest \ No newline at end of file
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/springConfig_PnfEventReadyConsumer.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/springConfig_PnfEventReadyConsumer.xml
new file mode 100644
index 0000000000..5abee9dfd9
--- /dev/null
+++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/springConfig_PnfEventReadyConsumer.xml
@@ -0,0 +1,19 @@
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans.xsd">
+ <bean id="pnfEventReadyConsumer" class="org.openecomp.mso.bpmn.infrastructure.pnf.dmaap.PnfEventReadyConsumer">
+ <property name="dmaapHost" value="${dmaapHost}" />
+ <property name="dmaapPort" value="${dmaapPort}"/>
+ <property name="dmaapProtocol" value="${dmaapProtocol}"/>
+ <property name="dmaapUriPathPrefix" value="${dmaapUriPathPrefix}"/>
+ <property name="dmaapTopicName" value="${eventReadyTopicName}"/>
+ <property name= "consumerGroup" value="${consumerGroup}"/>
+ <property name="consumerId" value="${consumerId}"/>
+ </bean>
+
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="locations" value="classpath:dmaapTest.properties"/>
+ </bean>
+
+</beans>