aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java40
-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
-rw-r--r--cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/BlueprintsResourceTest.java15
-rw-r--r--cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/DeploymentsResourceTest.java148
-rw-r--r--cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/NodeInstancesResourceTest.java98
-rw-r--r--common/src/main/java/org/openecomp/mso/client/sdno/dmaap/PnfReadyEventConsumer.java93
-rw-r--r--common/src/test/java/org/openecomp/mso/client/dmaap/PnfReadyEventConsumerTest.java85
-rw-r--r--docs/SO_R1_Interface.rst170
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java2
-rw-r--r--mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java2
39 files changed, 989 insertions, 606 deletions
diff --git a/.gitignore b/.gitignore
index 958c3e2f76..2173a1915d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@ target
**/debug-logs/
*.log
*.tmp
+.DS_Store
packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/main-schemas/MySQL-Catalog-schema.sql
packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/main-schemas/MySQL-Requests-schema.sql
/bin/
diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
index 2fec3f8b43..f8cba6afcb 100644
--- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
@@ -668,15 +668,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
LOGGER.debug("requestTypeString = " + requestTypeString + ", nestedStackId = " + nestedStackId + ", nestedBaseStackId = " + nestedBaseStackId);
- // TODO(sshank): Figure out the body format to be sent from Groovy.
- String hpaEnviromnentString = "";
- // Something similar to the following:
- /*
- if requestTypeString.substring(?) != "" {
- hpaEnviromnentString = requestTypeString.substring(?)
- }
- */
-
// Will capture execution time for metrics
long startTime = System.currentTimeMillis();
@@ -1052,6 +1043,18 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
LOGGER.debug("no environment parameter found for this Type " + vfModuleType);
}
+ // Replace flavors in environment with those returned by OOF
+ Map<String, Object> returnMap = updateFlavorsFromOof(heatEnvironmentString, inputs);
+ heatEnvironmentString = returnMap.get("heatEnvironmentString").toString();
+ LOGGER.debug("After OOF Update Heat Env String is: " + heatEnvironmentString);
+ if (returnMap.get("inputs") instanceof Map) {
+ inputs = (Map<String, String>) returnMap.get("inputs");
+ LOGGER.debug("After OOF Update inputs are: " + inputs.toString());
+ } else {
+ LOGGER.debug("inputs is not an instance of a Map: " + returnMap.get("inputs"));
+ throw new VnfException("Updating inputs using OOF info failed.", MsoExceptionCategory.INTERNAL);
+ }
+
// 1510 - Add the files: for nested templates *if* there are any
LOGGER.debug("In MsoVnfAdapterImpl, createVfModule about to call db.getNestedTemplates avec templateId="
+ heatTemplate.getArtifactUuid());
@@ -1170,12 +1173,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
//LOGGER.debug("About to create MHEE with " + sb);
mhee = new MsoHeatEnvironmentEntry(sb);
- // sshank: hpaEnviromnentString is obtained from requestTypeString above.
- if (hpaEnviromnentString != null && hpaEnviromnentString.contains("parameters:")) {
- StringBuilder hpasb = new StringBuilder(hpaEnviromnentString);
- mhee.setHPAParameters(hpasb);
- }
-
StringBuilder sb2 = new StringBuilder("\nHeat Template Parameters:\n");
for (HeatTemplateParam parm : heatTemplate.getParameters()) {
sb2.append("\t" + parm.getParamName() + ", required=" + parm.isRequired());
@@ -2163,4 +2160,17 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
return CatalogDatabase.getInstance();
}
+ private Map<String, Object> updateFlavorsFromOof(String heatEnvironmentString, Map<String, String> inputs) {
+ Map<String, Object> returnMap = new HashMap<>();
+ for (Map.Entry<String, String> input : inputs.entrySet()){
+ if (heatEnvironmentString.contains("label_" + input.getKey())){
+ heatEnvironmentString = heatEnvironmentString.replace("label_" + input.getKey(),
+ input.getValue());
+ inputs.remove("label_" + input.getKey());
+ }
+ }
+ returnMap.put("heatEnvironmentString", heatEnvironmentString);
+ returnMap.put("inputs", inputs);
+ return returnMap;
+ }
}
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>
diff --git a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/BlueprintsResourceTest.java b/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/BlueprintsResourceTest.java
index ec7435fca5..5e443a5c69 100644
--- a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/BlueprintsResourceTest.java
+++ b/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/BlueprintsResourceTest.java
@@ -128,5 +128,20 @@ public class BlueprintsResourceTest {
assertEquals("123", b.getId());
}
+ @Test
+ public void cloudifyClientBlueprintGetMetadataById() {
+ wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/blueprints/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{\"id\": \"123\"}")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ BlueprintsResource br = c.blueprints();
+ GetBlueprint gb = br.getMetadataById("123");
+ Blueprint b = gb.execute();
+ assertEquals("123", b.getId());
+ }
+
}
diff --git a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/DeploymentsResourceTest.java b/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/DeploymentsResourceTest.java
new file mode 100644
index 0000000000..f4741b9b08
--- /dev/null
+++ b/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/DeploymentsResourceTest.java
@@ -0,0 +1,148 @@
+/*-
+ * ============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.cloudify.v3.client;
+
+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.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.http.HttpStatus;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.openecomp.mso.cloudify.v3.client.DeploymentsResource.CreateDeployment;
+import org.openecomp.mso.cloudify.v3.client.DeploymentsResource.DeleteDeployment;
+import org.openecomp.mso.cloudify.v3.client.DeploymentsResource.GetDeployment;
+import org.openecomp.mso.cloudify.v3.client.DeploymentsResource.GetDeploymentOutputs;
+import org.openecomp.mso.cloudify.v3.client.DeploymentsResource.ListDeployments;
+import org.openecomp.mso.cloudify.v3.model.CreateDeploymentParams;
+import org.openecomp.mso.cloudify.v3.model.Deployment;
+import org.openecomp.mso.cloudify.v3.model.Deployments;
+import org.openecomp.mso.cloudify.v3.model.DeploymentOutputs;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+
+public class DeploymentsResourceTest {
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public void cloudifyDeploymentsCreate() {
+ wireMockRule.stubFor(put(urlPathEqualTo("/api/v3/deployments/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{ \"id\": \"123\" }")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ DeploymentsResource br = c.deployments();
+
+ CreateDeploymentParams cdp = new CreateDeploymentParams();
+ cdp.setBlueprintId("123");
+ Map<String, Object> inputs = new HashMap<String, Object>();
+ cdp.setInputs(inputs);
+ CreateDeployment cd = br.create("123", cdp);
+ Deployment d = cd.execute();
+ assertEquals("123", d.getId());
+ }
+
+ @Test
+ public void cloudifyDeploymentsList() {
+ wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/deployments")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{ \"items\": {\"id\": \"123\" } } ")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ DeploymentsResource br = c.deployments();
+ ListDeployments ld = br.list();
+ Deployments d = ld.execute();
+ assertEquals("123", d.getItems().get(0).getId());
+ }
+
+ @Test
+ public void cloudifyDeploymentsGet() {
+ wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/deployments/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{ \"id\": \"123\" }")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ DeploymentsResource br = c.deployments();
+ GetDeployment gd = br.byId("123");
+ Deployment d = gd.execute();
+ assertEquals("123", d.getId());
+ }
+
+ @Test
+ public void cloudifyDeploymentsGetOutputs() {
+ wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/deployments/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{ \"deployment_id\": \"123\" }")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ DeploymentsResource br = c.deployments();
+ GetDeploymentOutputs gdo = br.outputsById("123");
+ DeploymentOutputs d = gdo.execute();
+ assertEquals("123", d.getDeploymentId());
+
+ Map<String, Object> map = new HashMap<String, Object>();
+ map.put("test", "answer");
+ assertEquals("answer", d.getMapValue(map, "test", String.class));
+
+ Integer i = d.getMapValue(map, "nil", Integer.class);
+ assertNull( i );
+
+ i = d.getMapValue(map, "test", Integer.class);
+ assertNull( i );
+ }
+
+ @Test
+ public void cloudifyDeploymentsDelete() {
+ wireMockRule.stubFor(delete(urlPathEqualTo("/api/v3/deployments/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{ \"id\": \"123\" }")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ DeploymentsResource br = c.deployments();
+ DeleteDeployment cd = br.deleteByName("name");
+ Deployment d = cd.execute();
+ assertEquals("123", d.getId());
+ }
+
+}
diff --git a/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/NodeInstancesResourceTest.java b/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/NodeInstancesResourceTest.java
new file mode 100644
index 0000000000..66616e9c8a
--- /dev/null
+++ b/cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/NodeInstancesResourceTest.java
@@ -0,0 +1,98 @@
+/*-
+ * ============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.cloudify.v3.client;
+
+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.patch;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
+import static org.junit.Assert.assertEquals;
+
+import org.apache.http.HttpStatus;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.openecomp.mso.cloudify.connector.http.HttpClientException;
+import org.openecomp.mso.cloudify.v3.client.NodeInstancesResource.GetNodeInstance;
+import org.openecomp.mso.cloudify.v3.client.NodeInstancesResource.ListNodeInstances;
+import org.openecomp.mso.cloudify.v3.client.NodeInstancesResource.UpdateNodeInstance;
+import org.openecomp.mso.cloudify.v3.model.NodeInstance;
+import org.openecomp.mso.cloudify.v3.model.NodeInstances;
+import org.openecomp.mso.cloudify.v3.model.UpdateNodeInstanceParams;
+
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+
+public class NodeInstancesResourceTest {
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public void nodeInstanceGet() {
+ wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/node-instances/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{ \"node_instance\": { \"id\": \"123\" } }")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ NodeInstancesResource nir = c.nodeInstances();
+ GetNodeInstance gni = nir.byId("123");
+ NodeInstance ni = gni.execute();
+ assertEquals("123", ni.getId());
+ }
+
+ @Test
+ public void nodeInstanceList() {
+ wireMockRule.stubFor(get(urlPathEqualTo("/api/v3/node-instances")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+// .withBody(" { \"items\": [ { \"node_instance\": { \"id\": \"123\" } } ] } ")
+ .withBody(" { \"items\": [ { \"id\": \"123\" } ] } ")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ NodeInstancesResource nir = c.nodeInstances();
+ ListNodeInstances lni = nir.list();
+ NodeInstances ni = lni.execute();
+ assertEquals("123", ni.getItems().get(0).getId());
+ }
+
+ @Test
+ public void nodeInstanceUpdate() {
+ wireMockRule.stubFor(patch(urlPathEqualTo("/api/v3/node-instances/")).willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .withBody("{ \"node_instance\": { \"id\": \"123\" } }")
+ .withStatus(HttpStatus.SC_OK)));
+
+ int port = wireMockRule.port();
+
+ Cloudify c = new Cloudify("http://localhost:"+port, "tenant");
+ NodeInstancesResource nir = c.nodeInstances();
+ UpdateNodeInstanceParams params = new UpdateNodeInstanceParams();
+
+ UpdateNodeInstance uni = nir.update("123", params);
+ thrown.expect(HttpClientException.class); /// ???????
+ NodeInstance ni = uni.execute();
+ }
+}
diff --git a/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/PnfReadyEventConsumer.java b/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/PnfReadyEventConsumer.java
deleted file mode 100644
index 08e35f62f8..0000000000
--- a/common/src/main/java/org/openecomp/mso/client/sdno/dmaap/PnfReadyEventConsumer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-
- * ============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.client.sdno.dmaap;
-
-import java.io.IOException;
-import java.util.Optional;
-import javax.ws.rs.NotSupportedException;
-import org.openecomp.mso.client.dmaap.DmaapConsumer;
-import org.openecomp.mso.jsonpath.JsonPathUtil;
-
-public class PnfReadyEventConsumer extends DmaapConsumer {
-
- private static final String JSON_PATH_CORRELATION_ID = "$.pnfRegistrationFields.correlationId";
-
- private boolean continuePolling = true;
- private String correlationId;
-
- public PnfReadyEventConsumer(String correlationId) throws IOException {
- this.correlationId = correlationId;
- }
-
- @Override
- public boolean continuePolling() {
- return continuePolling;
- }
-
- @Override
- public void processMessage(String message) {
- }
-
- @Override
- public boolean isAccepted(String message) {
- Optional<String> correlationIdOpt = JsonPathUtil.getInstance().locateResult(message, JSON_PATH_CORRELATION_ID);
- if (correlationIdOpt.isPresent()) {
- continuePolling = false;
- return correlationIdOpt.get().equals(correlationId);
- }
- return false;
- }
-
- @Override
- public boolean isFailure(String message) {
- throw new NotSupportedException();
- }
-
- @Override
- public void stopProcessingMessages() {
- continuePolling = false;
- }
-
- @Override
- public String getRequestId() {
- throw new NotSupportedException();
- }
-
- @Override
- public String getUserName() {
- throw new NotSupportedException();
- }
-
- @Override
- public String getPassword() {
- throw new NotSupportedException();
- }
-
- @Override
- public String getTopic() {
- throw new NotSupportedException();
- }
-
- @Override
- public Optional<String> getHost() {
- throw new NotSupportedException();
- }
-}
diff --git a/common/src/test/java/org/openecomp/mso/client/dmaap/PnfReadyEventConsumerTest.java b/common/src/test/java/org/openecomp/mso/client/dmaap/PnfReadyEventConsumerTest.java
deleted file mode 100644
index 1561f75140..0000000000
--- a/common/src/test/java/org/openecomp/mso/client/dmaap/PnfReadyEventConsumerTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*-
- * ============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.openecomp.mso.client.dmaap;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Optional;
-import org.junit.Test;
-import org.openecomp.mso.client.sdno.dmaap.PnfReadyEventConsumer;
-
-public class PnfReadyEventConsumerTest {
-
- private static final String CORRELATION_ID = "correlation_id_test";
-
- private static final String JSON_WITH_CORRELATION_ID = " {\"pnfRegistrationFields\": {\n"
- + " \"correlationId\": \"correlation_id_test\"\n"
- + " }}";
-
- @Test
- public void eventIsFoundForGivenCorrelationId2() throws Exception {
- PnfReadyEventConsumerForTesting testedObjectSpy = spy(new PnfReadyEventConsumerForTesting(CORRELATION_ID));
- Consumer consumerMock = mock(Consumer.class);
- when(testedObjectSpy.getConsumer()).thenReturn(consumerMock);
- when(consumerMock.fetch()).thenReturn(Arrays.asList(JSON_WITH_CORRELATION_ID));
- testedObjectSpy.consume();
- assertThat(testedObjectSpy.continuePolling()).isFalse();
- }
-
- // TODO this is temporary class, when methods are defined, it will be deleted
- private class PnfReadyEventConsumerForTesting extends PnfReadyEventConsumer {
-
- public PnfReadyEventConsumerForTesting(String correlationId) throws IOException {
- super(correlationId);
- }
-
- @Override
- public String getUserName(){
- return "userNameTest";
- }
- @Override
- public String getPassword(){
- return "passTest";
- }
- @Override
- public String getTopic(){
- return "topicTest";
- }
- @Override
- public Optional<String> getHost(){
- return Optional.of("http://localhost");
- }
- @Override
- public boolean isFailure(String message) {
- return false;
- }
- @Override
- public String getRequestId() {
- return "requestTest";
- }
- }
-
-}
diff --git a/docs/SO_R1_Interface.rst b/docs/SO_R1_Interface.rst
index 10b894c457..61bdcc81b0 100644
--- a/docs/SO_R1_Interface.rst
+++ b/docs/SO_R1_Interface.rst
@@ -411,7 +411,7 @@ relatedInstance List
|instanceName |String |Name of the instance |
+-------------------------+------------------+-------------------------------------------------+
-Delete Volume Group
+Delete VF Module
++++++++++++++++++++++++
+--------------------+--------------------------------------------------------------------------------------------------------------+
@@ -480,174 +480,6 @@ RequestInfo Object
|Source |String |source of the request |
+-------------------------+------------------+-------------------------------------------------+
-Create Network
-+++++++++++++++
-
-+--------------------+------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+==================================================================+
-|URI |{serverRoot}/serviceInstances/v2/{serviceInstanceId}/networks |
-+--------------------+------------------------------------------------------------------+
-|Operation Type |POST |
-+--------------------+------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+------------------------------------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+---------------------+-------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=====================+=========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|relatedInstanceList |List |Content of relatedInstanceList. |
-+---------------------+-------------------------+-------------------------------------------------+
-|requestParameters |requestParameters Object |Content of requestParameters object. |
-+---------------------+-------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-
-CloudConfiguration Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|tenantId |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|InstanceName |String |The instance Name |
-+-------------------------+------------------+-------------------------------------------------+
-|ProductFamilyId |String |The product family Id. |
-+-------------------------+------------------+-------------------------------------------------+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-|SuppressRollback |Boolean |SuppressRollback |
-+-------------------------+------------------+-------------------------------------------------+
-
-relatedInstance List
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|relatedInstance |Object |relatedInstance Object |
-+-------------------------+------------------+-------------------------------------------------+
-
-relatedInstance List
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|instanceId |String |instanceId |
-+-------------------------+------------------+-------------------------------------------------+
-|modelInfo |Object |Content of modelInfo object. |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestParameters Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|UserParams |Array |The product family Id. |
-+-------------------------+------------------+-------------------------------------------------+
-
-UserParams Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|name |String |Tag name of attribute |
-+-------------------------+------------------+-------------------------------------------------+
-|value |String |Value of the tag |
-+-------------------------+------------------+-------------------------------------------------+
-
-Delete Network
-+++++++++++++++
-
-+--------------------+--------------------------------------------------------------------------------------+
-|Interface Definition|Description |
-+====================+======================================================================================+
-|URI |{serverRoot}/serviceInstances/v2/{serviceInstanceId}/networks/{networkInstanceId} |
-+--------------------+--------------------------------------------------------------------------------------+
-|Operation Type |DELETE |
-+--------------------+--------------------------------------------------------------------------------------+
-|Content-Type |application/json |
-+--------------------+--------------------------------------------------------------------------------------+
-
-Request Body:
-
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-|Attribute |Qualifier|Cardinality|Content |Description |
-+================+=========+===========+==========================+===========================================+
-|requestDetails |M |1 |requestDetails Object |Content of requestDetails object. |
-+----------------+---------+-----------+--------------------------+-------------------------------------------+
-
-RequestDetails Object
-
-+---------------------+-------------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=====================+=========================+=================================================+
-|modelInfo |modelInfo Object |Content of modelInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|cloudConfiguration |cloudConfiguration Object|Content of cloudConfiguration object. |
-+---------------------+-------------------------+-------------------------------------------------+
-|requestInfo |requestInfo Object |Content of requestInfo object. |
-+---------------------+-------------------------+-------------------------------------------------+
-
-ModelInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|ModelType |String |Type of model |
-+-------------------------+------------------+-------------------------------------------------+
-|ModelName |String |Name of the Model |
-+-------------------------+------------------+-------------------------------------------------+
-
-CloudConfiguration Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|lcpCloudRegionId |String |CloudRegion Id (in A&AI) |
-+-------------------------+------------------+-------------------------------------------------+
-|tenantId |String |Name of the Subscriber |
-+-------------------------+------------------+-------------------------------------------------+
-
-RequestInfo Object
-
-+-------------------------+------------------+-------------------------------------------------+
-|Attribute |Content |Description |
-+=========================+==================+=================================================+
-|Source |String |source of the request |
-+-------------------------+------------------+-------------------------------------------------+
-
Create VNF
+++++++++++++++
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
index 5f74cb9ddd..08fe0f856b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
@@ -182,7 +182,7 @@ public class E2EServiceInstances {
* GET Requests for Comparing model of service instance with target version
*/
- @GET
+ @POST
@Path("/{version:[vV][3-5]}/{serviceId}/modeldifferences")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java
index d199671621..3fad9a4d02 100644
--- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java
+++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java
@@ -133,7 +133,7 @@ public class ServiceMacroHolder implements Serializable {
}
if (this.vnfResourceCustomizations != null && this.vnfResourceCustomizations.size() > 0) {
int i=0;
- sb.append("VnfResources: ");
+ sb.append("vnfResourceCustomization: ");
for (VnfResourceCustomization vrc : this.vnfResourceCustomizations) {
sb.append(", vnfResourceCustomization[").append(i++).append("]:").append(vrc.toString());
}