Merge "Add workflow for deleting sdnc resource"
authorChuanyu Chen <chenchuanyu@huawei.com>
Wed, 11 Apr 2018 08:05:55 +0000 (08:05 +0000)
committerGerrit Code Review <gerrit@onap.org>
Wed, 11 Apr 2018 08:05:55 +0000 (08:05 +0000)
39 files changed:
.gitignore
adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vnf/MsoVnfAdapterImpl.java
bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy
bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/appc/payload/PayloadClientTest.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java
bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/util/CryptoHandlerTest.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf
bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net
bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/CloudFlavor.java [new file with mode: 0644]
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java
bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/json/JsonUtils.java
bpmn/MSOCoreBPMN/src/test/java/org/openecomp/mso/bpmn/core/domain/CompareModelsResultTest.java [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/PnfReadyEventHandler.java [deleted file]
bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/ExecutionVariableNames.java
bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumer.java [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/AaiResponse.java
bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/pnf/implementation/CheckAaiForCorrelationIdImplementation.java
bpmn/MSOInfrastructureBPMN/src/main/resources/dmaap.properties [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/main/resources/processengine.properties [deleted file]
bpmn/MSOInfrastructureBPMN/src/main/webapp/WEB-INF/applicationContext.xml
bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegateTest.java
bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/dmaapTest.properties [new file with mode: 0644]
bpmn/MSOInfrastructureBPMN/src/test/resources/springConfig_PnfEventReadyConsumer.xml [new file with mode: 0644]
cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/BlueprintsResourceTest.java
cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/DeploymentsResourceTest.java [new file with mode: 0644]
cloudify-client/src/test/java/org/openecomp/mso/cloudify/v3/client/NodeInstancesResourceTest.java [new file with mode: 0644]
common/src/main/java/org/openecomp/mso/client/sdno/dmaap/PnfReadyEventConsumer.java [deleted file]
common/src/test/java/org/openecomp/mso/client/dmaap/PnfReadyEventConsumerTest.java [deleted file]
docs/SO_R1_Interface.rst
mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java
mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/ServiceMacroHolder.java

index 958c3e2..2173a19 100644 (file)
@@ -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/
index 2fec3f8..f8cba6a 100644 (file)
@@ -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;
+    }
 }
index 5e7ed98..f0f239b 100644 (file)
 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)
+                            }
                         }
                     }
                 }
index fc7c62b..4b2b0e2 100644 (file)
@@ -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 (file)
index 0000000..95af260
--- /dev/null
@@ -0,0 +1,81 @@
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. \r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.bpmn.appc.payload;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+\r
+import java.util.Optional;\r
+\r
+import org.json.JSONObject;\r
+import org.junit.Test;\r
+\r
+public class PayloadClientTest {\r
+\r
+       @Test\r
+       public void upgradeFormatTest()  throws Exception {\r
+               String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"existing-software-version\":\"existingVersion\",\"new-software-version\":\"newVersion\"}}";\r
+               JSONObject jsonObject = new JSONObject();\r
+               jsonObject.put("existing-software-version", "existingVersion");\r
+               jsonObject.put("new-software-version", "newVersion");\r
+               Optional<String> payload = Optional.of(jsonObject.toString());\r
+               Optional<String> payloadClient = PayloadClient.upgradeFormat(payload, "vnfName1"); \r
+               assertEquals(payloadResult, payloadClient.get());\r
+       }\r
+\r
+       @Test\r
+       public void resumeTrafficFormatTest()  throws Exception {\r
+               String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}";\r
+               Optional<String> payloadClient = PayloadClient.resumeTrafficFormat("vnfName1"); \r
+               assertEquals(payloadResult, payloadClient.get());\r
+       }       \r
+       \r
+       @Test\r
+       public void quiesceTrafficFormatTest()  throws Exception {\r
+               String payloadResult = "{\"configuration-parameters\":{\"vnf_name\":\"vnfName1\",\"operations_timeout\":\"operationTimeout\"}}";\r
+               JSONObject jsonObject = new JSONObject();\r
+               jsonObject.put("operations-timeout", "operationTimeout");\r
+               Optional<String> payload = Optional.of(jsonObject.toString());\r
+               Optional<String> payloadClient = PayloadClient.quiesceTrafficFormat(payload, "vnfName1"); \r
+               assertEquals(payloadResult, payloadClient.get());\r
+       }       \r
+       \r
+       @Test\r
+       public void startStopFormatTest()  throws Exception {\r
+               String payloadResult = "{\" AICIdentity \":\"aicIdentity1\"}";\r
+               Optional<String> payloadClient = PayloadClient.startStopFormat("aicIdentity1"); \r
+               assertEquals(payloadResult, payloadClient.get());\r
+       }       \r
+       \r
+       @Test\r
+       public void healthCheckFormatTest()  throws Exception {\r
+               String payloadResult = "{\"request-parameters\":{\"vnf-name\":\"vnfName1\"},\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}";\r
+               Optional<String> payloadClient = PayloadClient.healthCheckFormat("vnfName1", "vnfHostIpAddress1"); \r
+               assertEquals(payloadResult, payloadClient.get());\r
+       }       \r
+       \r
+       @Test\r
+       public void snapshotFormatTest()  throws Exception {\r
+               String payloadResult = "{\"vm-id\":\"vmId1\",\"identity-url\":\"identityUrl1\"}";\r
+               Optional<String> payloadClient = PayloadClient.snapshotFormat("vmId1", "identityUrl1"); \r
+               assertEquals(payloadResult, payloadClient.get());\r
+       }       \r
+       \r
+}
\ No newline at end of file
index 45645be..d7239fe 100644 (file)
@@ -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 (file)
index 0000000..724d3ed
--- /dev/null
@@ -0,0 +1,42 @@
+/*-\r
+ * ============LICENSE_START=======================================================\r
+ * ONAP - SO\r
+ * ================================================================================\r
+ * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. \r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+\r
+package org.openecomp.mso.bpmn.common.util;\r
+\r
+import static org.junit.Assert.assertEquals;\r
+\r
+import org.junit.Test;\r
+\r
+public class CryptoHandlerTest {\r
+\r
+       @Test\r
+       public void test()  throws Exception {\r
+               String plainPswd = "mso0206";\r
+               String encryptPwd = "C1FC4A39E16419DD41DFC1212843F440";\r
+               CryptoHandler cryptoHandler = new CryptoHandler();\r
+               String aaiPassword = cryptoHandler.getMsoAaiPassword();\r
+               assertEquals(plainPswd, aaiPassword);\r
+               String encryptPassword = cryptoHandler.encryptMsoPassword(plainPswd);\r
+               assertEquals(encryptPwd, encryptPassword);\r
+               String decryptPassword = cryptoHandler.decryptMsoPassword(encryptPwd);\r
+               assertEquals(plainPswd, decryptPassword);\r
+       }\r
+\r
+}
\ No newline at end of file
index 3559708..8087238 100644 (file)
@@ -31,6 +31,7 @@
             }
         ],
         "placementSolutions": [
+            [
             {
                 "resourceModuleName": "ALLOTTED_RESOURCE",
                 "serviceInstanceId": "testSIID1",
                         {
                             "key": "cloudRegionId",
                             "value": "testCloudRegionId3"
-                        }
+                        },
+                        {   "key":"flavors",
+                            "value":{"flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}}
                     ]
             }
         ]
+        ]
     }
 }
\ No newline at end of file
index 30fa09a..8766df8 100644 (file)
@@ -43,6 +43,7 @@
             },
         ],
         "placementSolutions": [
+            [
             {
                 "resourceModuleName": "ALLOTTED_RESOURCE",
                 "serviceResourceId": "testResourceIdAR",
                 },
                 "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
index b4e748c..8e6f2d4 100644 (file)
@@ -5,6 +5,7 @@
    "statusMessage": "success",
    "solutions": {
       "placementSolutions": [
+         [
          {
             "resourceModuleName": "vGMuxInfra",
             "serviceResourceId": "some_resource_id",
             },
             "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 (file)
index 0000000..100d70e
--- /dev/null
@@ -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;
+    }
+
+}
index 611c8df..f0193bc 100644 (file)
@@ -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;
        }
index 79b9239..1869b93 100644 (file)
@@ -931,7 +931,7 @@ public class JsonUtils {
                for (int i = 0; i < arr.length(); i++){\r
                        JSONObject jo = arr.getJSONObject(i);\r
                        String key = jo.getString(keyNode);\r
-                       String value =jo.getString(valueNode);\r
+                       String value = jo.getString(valueNode);\r
                        map.put(key, value);\r
                }\r
                msoLogger.debug("Outgoing Map is: " + map);\r
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 (file)
index 0000000..90cb736
--- /dev/null
@@ -0,0 +1,83 @@
+/*\r
+* ============LICENSE_START=======================================================\r
+* ONAP : SO\r
+* ================================================================================\r
+* Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.\r
+*=================================================================================\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+*     http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+* ============LICENSE_END=========================================================\r
+*/\r
+package org.openecomp.mso.bpmn.core.domain;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.junit.Before;\r
+import org.junit.Test;\r
+\r
+public class CompareModelsResultTest {\r
+       \r
+       private CompareModelsResult modelsResult;\r
+       private List<ResourceModelInfo> addedResourceList;\r
+       private List<ResourceModelInfo> deletedResourceList;\r
+       private ResourceModelInfo resourceModelInfo1;\r
+       private ResourceModelInfo resourceModelInfo2;\r
+       private List<String> requestInputs;\r
+       \r
+       @Before\r
+       public void before() {\r
+               resourceModelInfo1 = new ResourceModelInfo();\r
+               resourceModelInfo1.setResourceCustomizationUuid("f1d563e8-e714-4393-8f99-cc480144a05e");\r
+               resourceModelInfo1.setResourceInvariantUuid("e1d563e8-e714-4393-8f99-cc480144a05f");\r
+               resourceModelInfo1.setResourceName("resourceName1");\r
+               resourceModelInfo1.setResourceUuid("f1d563e8-e714-4393-8f99-cc480144a05g");\r
+               resourceModelInfo2 = new ResourceModelInfo();\r
+               resourceModelInfo2.setResourceCustomizationUuid("a1d563e8-e714-4393-8f99-cc480144a05d");\r
+               resourceModelInfo2.setResourceInvariantUuid("b1d563e8-e714-4393-8f99-cc480144a05e");\r
+               resourceModelInfo2.setResourceName("resourceName2");\r
+               resourceModelInfo2.setResourceUuid("c1d563e8-e714-4393-8f99-cc480144a05f");                             \r
+       }\r
+       \r
+       @Test\r
+       public void testSetAddedResourceList() {\r
+               addedResourceList = new ArrayList<ResourceModelInfo>();\r
+               addedResourceList.add(resourceModelInfo1);\r
+               addedResourceList.add(resourceModelInfo2);\r
+               modelsResult = new CompareModelsResult();\r
+               modelsResult.setAddedResourceList(addedResourceList);\r
+               assertEquals(addedResourceList, modelsResult.getAddedResourceList());\r
+       }\r
+\r
+       @Test\r
+       public void testSetDeletedResourceList() {\r
+               deletedResourceList = new ArrayList<ResourceModelInfo>();\r
+               deletedResourceList.add(resourceModelInfo1);\r
+               deletedResourceList.add(resourceModelInfo2);\r
+               modelsResult = new CompareModelsResult();\r
+               modelsResult.setDeletedResourceList(deletedResourceList);\r
+               assertEquals(deletedResourceList, modelsResult.getDeletedResourceList());\r
+       }       \r
+\r
+       @Test\r
+       public void testSetRequestInputs() {\r
+               requestInputs = new ArrayList<String>();\r
+               requestInputs.add("requestInput1");\r
+               requestInputs.add("requestInput2");\r
+               modelsResult = new CompareModelsResult();\r
+               modelsResult.setRequestInputs(requestInputs);\r
+               assertEquals(requestInputs, modelsResult.getRequestInputs());\r
+       }       \r
+       \r
+}\r
index c70c971..3652d56 100644 (file)
@@ -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)
        }
index a49a066..77b0657 100644 (file)
@@ -149,7 +149,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
             "modelUuid":"${modelUuid}",\r
             "modelVersion":""\r
              }"""\r
-            execution.setVariable("serviceModelInfo", serviceModelInfo)\r
+            \r
             execution.setVariable("serviceModelInfo_Target", serviceModelInfo)\r
 \r
             utils.log("DEBUG", " ***** Completed prepareDecomposeService_Target of update generic e2e service ***** ", isDebugEnabled)\r
@@ -187,7 +187,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor {
             "modelUuid":"${modelUuid}",\r
             "modelVersion":""\r
              }"""\r
-            execution.setVariable("serviceModelInfo", serviceModelInfo)\r
+            \r
             execution.setVariable("serviceModelInfo_Original", serviceModelInfo)\r
 \r
             utils.log("DEBUG", " ***** Completed prepareDecomposeService_Original of update generic e2e service ***** ", isDebugEnabled)\r
index 30db8c5..0172402 100644 (file)
@@ -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()
index b931946..95747d5 100644 (file)
@@ -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 (file)
index f89b6a7..0000000
+++ /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
-    }
-}
index f4483f5..417bb46 100644 (file)
@@ -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());
         }
     }
 }
index 6b49908..0d64f2c 100644 (file)
@@ -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 (file)
index 0000000..e6019f7
--- /dev/null
@@ -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;
+    }
+
+}
index bbb7adc..5fb7a43 100644 (file)
@@ -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);
-    }
 }
index 353a3bd..b982a69 100644 (file)
@@ -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 (file)
index 0000000..3c4dca4
--- /dev/null
@@ -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 (file)
index d071fda..0000000
+++ /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
index 46cea5d..f46cd06 100644 (file)
     <property name="aaiConnection" ref="aaiConnection"/>\r
   </bean>\r
 \r
+  <bean id="pnfEventReadyConsumer" class="org.openecomp.mso.bpmn.infrastructure.pnf.dmaap.PnfEventReadyConsumer">\r
+    <property name="dmaapHost" value="${dmaapHost}" />\r
+    <property name="dmaapPort" value="${dmaapPort}"/>\r
+    <property name="dmaapProtocol" value="${dmaapProtocol}"/>\r
+    <property name="dmaapUriPathPrefix" value="${dmaapUriPathPrefix}"/>\r
+    <property name="dmaapTopicName" value="${eventReadyTopicName}"/>\r
+    <property name= "consumerGroup" value="${consumerGroup}"/>\r
+    <property name="consumerId" value="${consumerId}"/>\r
+  </bean>\r
+\r
+  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">\r
+    <property name="locations" value="classpath:dmaap.properties"/>\r
+  </bean>\r
+\r
 </beans>\r
index d98a395..75a7450 100644 (file)
 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 (file)
index 0000000..2f6a00d
--- /dev/null
@@ -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 (file)
index 0000000..a8df15c
--- /dev/null
@@ -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 (file)
index 0000000..5abee9d
--- /dev/null
@@ -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>
index ec7435f..5e443a5 100644 (file)
@@ -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 (file)
index 0000000..f4741b9
--- /dev/null
@@ -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 (file)
index 0000000..66616e9
--- /dev/null
@@ -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 (file)
index 08e35f6..0000000
+++ /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 (file)
index 1561f75..0000000
+++ /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";
-        }
-    }
-
-}
index 10b894c..61bdcc8 100644 (file)
@@ -411,7 +411,7 @@ relatedInstance List
 |instanceName             |String            |Name of the instance                             |\r
 +-------------------------+------------------+-------------------------------------------------+\r
 \r
-Delete Volume Group\r
+Delete VF Module\r
 ++++++++++++++++++++++++\r
 \r
 +--------------------+--------------------------------------------------------------------------------------------------------------+\r
@@ -480,174 +480,6 @@ RequestInfo Object
 |Source                   |String            |source of the request                            |\r
 +-------------------------+------------------+-------------------------------------------------+\r
 \r
-Create Network\r
-+++++++++++++++\r
-\r
-+--------------------+------------------------------------------------------------------+\r
-|Interface Definition|Description                                                       |\r
-+====================+==================================================================+\r
-|URI                 |{serverRoot}/serviceInstances/v2/{serviceInstanceId}/networks     |\r
-+--------------------+------------------------------------------------------------------+\r
-|Operation Type      |POST                                                              |\r
-+--------------------+------------------------------------------------------------------+\r
-|Content-Type        |application/json                                                  |\r
-+--------------------+------------------------------------------------------------------+\r
-\r
-Request Body:\r
-\r
-+----------------+---------+-----------+--------------------------+-------------------------------------------+\r
-|Attribute       |Qualifier|Cardinality|Content                   |Description                                |\r
-+================+=========+===========+==========================+===========================================+\r
-|requestDetails  |M        |1          |requestDetails Object     |Content of requestDetails object.          |\r
-+----------------+---------+-----------+--------------------------+-------------------------------------------+\r
-\r
-RequestDetails Object \r
-\r
-+---------------------+-------------------------+-------------------------------------------------+\r
-|Attribute            |Content                  |Description                                      |\r
-+=====================+=========================+=================================================+\r
-|modelInfo            |modelInfo Object         |Content of modelInfo object.                     |\r
-+---------------------+-------------------------+-------------------------------------------------+\r
-|cloudConfiguration   |cloudConfiguration Object|Content of cloudConfiguration object.            |\r
-+---------------------+-------------------------+-------------------------------------------------+\r
-|requestInfo          |requestInfo Object       |Content of requestInfo object.                   |\r
-+---------------------+-------------------------+-------------------------------------------------+\r
-|relatedInstanceList  |List                     |Content of relatedInstanceList.                  |\r
-+---------------------+-------------------------+-------------------------------------------------+\r
-|requestParameters    |requestParameters Object |Content of requestParameters object.             |\r
-+---------------------+-------------------------+-------------------------------------------------+\r
-\r
-ModelInfo Object \r
-\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|Attribute                |Content           |Description                                      |\r
-+=========================+==================+=================================================+\r
-|ModelType                |String            |Type of model                                    |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|ModelName                |String            |Name of the Model                                |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-\r
-CloudConfiguration Object \r
-\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|Attribute                |Content           |Description                                      |\r
-+=========================+==================+=================================================+\r
-|lcpCloudRegionId         |String            |CloudRegion Id (in A&AI)                         |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|tenantId                 |String            |Name of the Subscriber                           |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-\r
-RequestInfo Object \r
-\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|Attribute                |Content           |Description                                      |\r
-+=========================+==================+=================================================+\r
-|InstanceName             |String            |The instance Name                                |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|ProductFamilyId          |String            |The product family Id.                           |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|Source                   |String            |source of the request                            |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|SuppressRollback         |Boolean           |SuppressRollback                                 |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-\r
-relatedInstance List  \r
-\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|Attribute                |Content           |Description                                      |\r
-+=========================+==================+=================================================+\r
-|relatedInstance          |Object            |relatedInstance Object                           |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-\r
-relatedInstance List  \r
-\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|Attribute                |Content           |Description                                      |\r
-+=========================+==================+=================================================+\r
-|instanceId               |String            |instanceId                                       |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|modelInfo                |Object            |Content of modelInfo object.                     |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-\r
-RequestParameters Object \r
-\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|Attribute                |Content           |Description                                      |\r
-+=========================+==================+=================================================+\r
-|UserParams               |Array             |The product family Id.                           |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-\r
-UserParams Object \r
-\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|Attribute                |Content           |Description                                      |\r
-+=========================+==================+=================================================+\r
-|name                     |String            |Tag name of attribute                            |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|value                    |String            |Value of the tag                                 |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-\r
-Delete Network\r
-+++++++++++++++\r
-\r
-+--------------------+--------------------------------------------------------------------------------------+\r
-|Interface Definition|Description                                                                           |\r
-+====================+======================================================================================+\r
-|URI                 |{serverRoot}/serviceInstances/v2/{serviceInstanceId}/networks/{networkInstanceId}     |\r
-+--------------------+--------------------------------------------------------------------------------------+\r
-|Operation Type      |DELETE                                                                                |\r
-+--------------------+--------------------------------------------------------------------------------------+\r
-|Content-Type        |application/json                                                                      |\r
-+--------------------+--------------------------------------------------------------------------------------+\r
-\r
-Request Body:\r
-\r
-+----------------+---------+-----------+--------------------------+-------------------------------------------+\r
-|Attribute       |Qualifier|Cardinality|Content                   |Description                                |\r
-+================+=========+===========+==========================+===========================================+\r
-|requestDetails  |M        |1          |requestDetails Object     |Content of requestDetails object.          |\r
-+----------------+---------+-----------+--------------------------+-------------------------------------------+\r
-\r
-RequestDetails Object \r
-\r
-+---------------------+-------------------------+-------------------------------------------------+\r
-|Attribute            |Content                  |Description                                      |\r
-+=====================+=========================+=================================================+\r
-|modelInfo            |modelInfo Object         |Content of modelInfo object.                     |\r
-+---------------------+-------------------------+-------------------------------------------------+\r
-|cloudConfiguration   |cloudConfiguration Object|Content of cloudConfiguration object.            |\r
-+---------------------+-------------------------+-------------------------------------------------+\r
-|requestInfo          |requestInfo Object       |Content of requestInfo object.                   |\r
-+---------------------+-------------------------+-------------------------------------------------+\r
-\r
-ModelInfo Object \r
-\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|Attribute                |Content           |Description                                      |\r
-+=========================+==================+=================================================+\r
-|ModelType                |String            |Type of model                                    |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|ModelName                |String            |Name of the Model                                |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-\r
-CloudConfiguration Object \r
-\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|Attribute                |Content           |Description                                      |\r
-+=========================+==================+=================================================+\r
-|lcpCloudRegionId         |String            |CloudRegion Id (in A&AI)                         |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|tenantId                 |String            |Name of the Subscriber                           |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-\r
-RequestInfo Object \r
-\r
-+-------------------------+------------------+-------------------------------------------------+\r
-|Attribute                |Content           |Description                                      |\r
-+=========================+==================+=================================================+\r
-|Source                   |String            |source of the request                            |\r
-+-------------------------+------------------+-------------------------------------------------+\r
-\r
 Create VNF\r
 +++++++++++++++\r
 \r
index 5f74cb9..08fe0f8 100644 (file)
@@ -182,7 +182,7 @@ public class E2EServiceInstances {
         * GET Requests for Comparing model of service instance with target version\r
         */\r
        \r
-       @GET\r
+       @POST\r
        @Path("/{version:[vV][3-5]}/{serviceId}/modeldifferences")\r
        @Consumes(MediaType.APPLICATION_JSON)\r
        @Produces(MediaType.APPLICATION_JSON)\r
index d199671..3fad9a4 100644 (file)
@@ -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());
                        }