diff options
72 files changed, 1574 insertions, 745 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduArtifact.java b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduArtifact.java index 394d13d8d2..7696f3bc24 100644 --- a/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduArtifact.java +++ b/adapters/mso-adapter-utils/src/main/java/org/openecomp/mso/adapters/vdu/VduArtifact.java @@ -20,6 +20,9 @@ package org.openecomp.mso.adapters.vdu;
+import java.util.Arrays;
+import java.util.Objects;
+
public class VduArtifact {
// Enumerate the types of artifacts permitted. This may need to be a variable string
@@ -59,6 +62,19 @@ public class VduArtifact { }
public void setType(ArtifactType type) {
this.type = type;
- }
-
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ VduArtifact that = (VduArtifact) o;
+ return Objects.equals(name, that.name) &&
+ Arrays.equals(content, that.content) &&
+ type == that.type;
+ }
}
\ No newline at end of file diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java index 450ffd6d93..b249b58d48 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/openecomp/mso/adapters/catalogdb/catalogrest/QueryAllottedResourceCustomization.java @@ -96,8 +96,8 @@ public class QueryAllottedResourceCustomization extends CatalogQuery { put(valueMap, "MODEL_CUSTOMIZATION_UUID", o.getModelCustomizationUuid()); put(valueMap, "MODEL_INSTANCE_NAME", o.getModelInstanceName()); put(valueMap, "TOSCA_NODE_TYPE", arNull ? null : o.getAllottedResource().getToscaNodeType()); - put(valueMap, "ALLOTTED_RESOURCE_TYPE", arNull ? null : o.getAllottedResource().getSubcategory()); - put(valueMap, "ALLOTTED_RESOURCE_ROLE", o.getTargetNetworkRole()); + put(valueMap, "ALLOTTED_RESOURCE_TYPE", o.getNfType()); + put(valueMap, "ALLOTTED_RESOURCE_ROLE", o.getNfRole()); put(valueMap, "NF_TYPE", o.getNfType()); put(valueMap, "NF_ROLE", o.getNfRole()); put(valueMap, "NF_FUNCTION", o.getNfFunction()); diff --git a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vdu/mapper/VfModuleCustomizationToVduMapper.java b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vdu/mapper/VfModuleCustomizationToVduMapper.java index b04f3c30db..d26d3f62f8 100644 --- a/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vdu/mapper/VfModuleCustomizationToVduMapper.java +++ b/adapters/mso-vnf-adapter/src/main/java/org/openecomp/mso/adapters/vdu/mapper/VfModuleCustomizationToVduMapper.java @@ -20,7 +20,6 @@ package org.openecomp.mso.adapters.vdu.mapper; -import java.sql.SQLException; import java.util.List; import java.util.Map; import org.openecomp.mso.adapters.vdu.VduArtifact; @@ -39,11 +38,10 @@ public class VfModuleCustomizationToVduMapper { private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); - public VduModelInfo mapVfModuleCustomizationToVdu(VfModuleCustomization vfModuleCustom) throws SQLException { - CatalogDatabase db = CatalogDatabase.getInstance(); + public VduModelInfo mapVfModuleCustomizationToVdu(VfModuleCustomization vfModuleCustom) { VduModelInfo vduModel = new VduModelInfo(); vduModel.setModelCustomizationUUID(vfModuleCustom.getModelCustomizationUuid()); - try { + try (CatalogDatabase db = CatalogDatabase.getInstance()) { // Map the cloud templates, attached files, and environment file mapCloudTemplates( db.getHeatTemplateByArtifactUuid(vfModuleCustom.getVfModule().getHeatTemplateArtifactUUId()), @@ -51,22 +49,14 @@ public class VfModuleCustomizationToVduMapper { mapCloudFiles(vfModuleCustom, vduModel); mapEnvironment(db.getHeatEnvironmentByArtifactUuid(vfModuleCustom.getHeatEnvironmentArtifactUuid()), vduModel); - } catch (SQLException e) { - LOGGER.debug("unhandled exception in mapVfModuleCustomizationToVdu", e); - throw new SQLException("Exception during mapVfModuleCustomizationToVdu " + e.getMessage()); - } finally { - // Make sure DB session is closed - db.close(); } - return vduModel; } - public VduModelInfo mapVfModuleCustVolumeToVdu(VfModuleCustomization vfModuleCustom) throws SQLException { - CatalogDatabase db = CatalogDatabase.getInstance(); + public VduModelInfo mapVfModuleCustVolumeToVdu(VfModuleCustomization vfModuleCustom) { VduModelInfo vduModel = new VduModelInfo(); vduModel.setModelCustomizationUUID(vfModuleCustom.getModelCustomizationUuid()); - try { + try (CatalogDatabase db = CatalogDatabase.getInstance()) { // Map the cloud templates, attached files, and environment file mapCloudTemplates( db.getHeatTemplateByArtifactUuid(vfModuleCustom.getVfModule().getVolHeatTemplateArtifactUUId()), @@ -74,29 +64,20 @@ public class VfModuleCustomizationToVduMapper { mapCloudFiles(vfModuleCustom, vduModel); mapEnvironment(db.getHeatEnvironmentByArtifactUuid(vfModuleCustom.getVolEnvironmentArtifactUuid()), vduModel); - } catch (SQLException e) { - LOGGER.debug("unhandled exception in mapVfModuleCustVolumeToVdu", e); - throw new SQLException("Exception during mapVfModuleCustVolumeToVdu " + e.getMessage()); - } finally { - // Make sure DB session is closed - db.close(); } - return vduModel; } - private void mapCloudTemplates(HeatTemplate heatTemplate, VduModelInfo vduModel) throws SQLException { + private void mapCloudTemplates(HeatTemplate heatTemplate, VduModelInfo vduModel) { // TODO: These catalog objects will be refactored to be // non-Heat-specific - CatalogDatabase db = CatalogDatabase.getInstance(); - try { + try (CatalogDatabase db = CatalogDatabase.getInstance()) { List<VduArtifact> vduArtifacts = vduModel.getArtifacts(); // Main template. Also set the VDU timeout based on the main // template. vduArtifacts.add(mapHeatTemplateToVduArtifact(heatTemplate, ArtifactType.MAIN_TEMPLATE)); vduModel.setTimeoutMinutes(heatTemplate.getTimeoutMinutes()); - // Nested templates Map<String,Object> nestedTemplates = db.getNestedTemplates(heatTemplate.getArtifactUuid()); if (nestedTemplates != null) { @@ -106,13 +87,9 @@ public class VfModuleCustomizationToVduMapper { vduArtifacts.add(vduArtifact); } } - } catch (IllegalArgumentException e) { LOGGER.debug("unhandled exception in mapCloudTemplates", e); throw new IllegalArgumentException("Exception during mapCloudTemplates " + e.getMessage()); - } finally { - // Make sure DB session is closed - db.close(); } } @@ -124,26 +101,20 @@ public class VfModuleCustomizationToVduMapper { return vduArtifact; } - private void mapCloudFiles(VfModuleCustomization vfModuleCustom, VduModelInfo vduModel) throws SQLException { + private void mapCloudFiles(VfModuleCustomization vfModuleCustom, VduModelInfo vduModel) { // TODO: These catalog objects will be refactored to be // non-Heat-specific - CatalogDatabase db = CatalogDatabase.getInstance(); - - try{ + try (CatalogDatabase db = CatalogDatabase.getInstance()) { Map <String, HeatFiles> heatFiles = db.getHeatFilesForVfModule(vfModuleCustom.getVfModuleModelUuid()); if (heatFiles != null) { for (HeatFiles heatFile: heatFiles.values()) { - mapCloudFileToVduArtifact(heatFile, ArtifactType.TEXT_FILE); + vduModel.getArtifacts().add(mapCloudFileToVduArtifact(heatFile, ArtifactType.TEXT_FILE)); } } } catch (IllegalArgumentException e) { LOGGER.debug("unhandled exception in mapCloudFiles", e); throw new IllegalArgumentException("Exception during mapCloudFiles " + e.getMessage()); - } finally { - // Make sure DB session is closed - db.close(); } - } private VduArtifact mapCloudFileToVduArtifact(HeatFiles heatFile, ArtifactType artifactType) { diff --git a/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java new file mode 100644 index 0000000000..ffa6bcd961 --- /dev/null +++ b/adapters/mso-vnf-adapter/src/test/java/org/openecomp/mso/adapters/vdu/mapper/VfModuleCustomizationToVduMapperTest.java @@ -0,0 +1,158 @@ +/*- + * ============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.adapters.vdu.mapper; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.util.HashMap; +import java.util.Map; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.openecomp.mso.adapters.vdu.VduArtifact; +import org.openecomp.mso.adapters.vdu.VduArtifact.ArtifactType; +import org.openecomp.mso.adapters.vdu.VduModelInfo; +import org.openecomp.mso.db.catalog.CatalogDatabase; +import org.openecomp.mso.db.catalog.beans.HeatEnvironment; +import org.openecomp.mso.db.catalog.beans.HeatFiles; +import org.openecomp.mso.db.catalog.beans.HeatTemplate; +import org.openecomp.mso.db.catalog.beans.VfModule; +import org.openecomp.mso.db.catalog.beans.VfModuleCustomization; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +@RunWith(PowerMockRunner.class) +@PrepareForTest({CatalogDatabase.class}) +public class VfModuleCustomizationToVduMapperTest { + + private static final String HEAT_TEMPLATE_ARTIFACT_UUID = "testHeatTemplate"; + private static final String VF_MODULE_MODEL_UUID = "vfModuleUuid"; + private static final String HEAT_ENV_ARTIFACT_UUID = "heatEnvArtifactUuid"; + private static final String MAIN_TEMPLATE_NAME = "testTempName"; + private static final String MAIN_TEMPLATE_BODY = "testTempBody"; + private static final String NESTED_TEMPLATE_KEY = "testKey"; + private static final String NESTED_TEMPLATE_VALUE = "nestedTemplateTest"; + private static final String HEAT_FILE_NAME = "heatFileName"; + private static final String HEAT_FILE_BODY = "heatFileBodyTest"; + private static final String HEAT_ENV_NAME = "heatEnvName"; + private static final String HEAT_ENV = "heatEnv"; + private static final String VOL_HEAT_TEMPLATE_ARTIFACT = "volEnvArtifact"; + private static final String VOL_ENV_ARTIFACT_UUID = "volEnvArtifactUuid"; + + private VfModuleCustomizationToVduMapper testedObject; + private CatalogDatabase catalogDatabaseMock; + + @Before + public void init() { + PowerMockito.mockStatic(CatalogDatabase.class); + catalogDatabaseMock = mock(CatalogDatabase.class); + testedObject = new VfModuleCustomizationToVduMapper(); + PowerMockito.when(CatalogDatabase.getInstance()).thenReturn(catalogDatabaseMock); + when(catalogDatabaseMock.getNestedTemplates(HEAT_TEMPLATE_ARTIFACT_UUID)).thenReturn(createNestedTemplates()); + when(catalogDatabaseMock.getHeatFilesForVfModule(VF_MODULE_MODEL_UUID)).thenReturn(createHeatFileMap()); + } + + @Test + public void mapVfModuleCustomizationToVdu_successful() { + when(catalogDatabaseMock.getHeatTemplateByArtifactUuid(HEAT_TEMPLATE_ARTIFACT_UUID)) + .thenReturn(createHeatTemplate()); + when(catalogDatabaseMock.getHeatEnvironmentByArtifactUuid(HEAT_ENV_ARTIFACT_UUID)) + .thenReturn(createHeatEnvironment()); + VduModelInfo result = testedObject.mapVfModuleCustomizationToVdu(createVfModuleCustomization()); + assertThat(result.getArtifacts()).containsExactly(createExpectedResultArray()); + } + + @Test + public void mapVfModuleCustVolumeToVdu_successful() { + when(catalogDatabaseMock.getHeatTemplateByArtifactUuid(VOL_HEAT_TEMPLATE_ARTIFACT)) + .thenReturn(createHeatTemplate()); + when(catalogDatabaseMock.getHeatEnvironmentByArtifactUuid(VOL_ENV_ARTIFACT_UUID)) + .thenReturn(createHeatEnvironment()); + VduModelInfo result = testedObject.mapVfModuleCustVolumeToVdu(createVfModuleCustomization()); + assertThat(result.getArtifacts()).containsExactly(createExpectedResultArray()); + } + + private VfModuleCustomization createVfModuleCustomization() { + VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); + VfModule vfModule = new VfModule(); + vfModule.setHeatTemplateArtifactUUId(HEAT_TEMPLATE_ARTIFACT_UUID); + vfModule.setVolHeatTemplateArtifactUUId(VOL_HEAT_TEMPLATE_ARTIFACT); + vfModuleCustomization.setVfModule(vfModule); + vfModuleCustomization.setVfModuleModelUuid(VF_MODULE_MODEL_UUID); + vfModuleCustomization.setHeatEnvironmentArtifactUuid(HEAT_ENV_ARTIFACT_UUID); + vfModuleCustomization.setVolEnvironmentArtifactUuid(VOL_ENV_ARTIFACT_UUID); + return vfModuleCustomization; + } + + private HeatTemplate createHeatTemplate() { + HeatTemplate heatTemplate = new HeatTemplate(); + heatTemplate.setTemplateName(MAIN_TEMPLATE_NAME); + heatTemplate.setTemplateBody(MAIN_TEMPLATE_BODY); + heatTemplate.setArtifactUuid(HEAT_TEMPLATE_ARTIFACT_UUID); + return heatTemplate; + } + + private Map<String, Object> createNestedTemplates() { + Map<String, Object> map = new HashMap<>(); + map.put(NESTED_TEMPLATE_KEY, NESTED_TEMPLATE_VALUE); + return map; + } + + private Map<String, HeatFiles> createHeatFileMap() { + HeatFiles heatFiles = new HeatFiles(); + heatFiles.setFileName(HEAT_FILE_NAME); + heatFiles.setFileBody(HEAT_FILE_BODY); + Map<String, HeatFiles> map = new HashMap<>(); + map.put("heatFileKey", heatFiles); + return map; + } + + private HeatEnvironment createHeatEnvironment() { + HeatEnvironment heatEnvironment = new HeatEnvironment(); + heatEnvironment.setName(HEAT_ENV_NAME); + heatEnvironment.setEnvironment(HEAT_ENV); + return heatEnvironment; + } + + + private VduArtifact[] createExpectedResultArray() { + VduArtifact[] vduArtifactsArray = new VduArtifact[4]; + vduArtifactsArray[0] = new VduArtifact(MAIN_TEMPLATE_NAME, MAIN_TEMPLATE_BODY.getBytes(), + ArtifactType.MAIN_TEMPLATE); + vduArtifactsArray[1] = new VduArtifact(NESTED_TEMPLATE_KEY, NESTED_TEMPLATE_VALUE.getBytes(), + ArtifactType.NESTED_TEMPLATE); + vduArtifactsArray[2] = createVduArtifact(HEAT_FILE_NAME, HEAT_FILE_BODY, ArtifactType.TEXT_FILE); + vduArtifactsArray[3] = createVduArtifact(HEAT_ENV_NAME, HEAT_ENV, ArtifactType.ENVIRONMENT); + return vduArtifactsArray; + } + + private VduArtifact createVduArtifact(String name, String content, ArtifactType artifactType) { + VduArtifact vduArtifact = new VduArtifact(); + vduArtifact.setName(name); + vduArtifact.setContent(content.getBytes()); + vduArtifact.setType(artifactType); + return vduArtifact; + } + +} diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 317413556c..1d255c4eb4 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -416,12 +416,12 @@ <dependency> <groupId>org.onap.appc.client</groupId> <artifactId>client-lib</artifactId> - <version>1.3.0-SNAPSHOT</version> + <version>1.3.0</version> </dependency> <dependency> <groupId>org.onap.appc.client</groupId> <artifactId>client-kit</artifactId> - <version>1.3.0-SNAPSHOT</version> + <version>1.3.0</version> </dependency> <dependency> <groupId>org.aspectj</groupId> diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy index f0f239b50f..1b5a2ecdcb 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy @@ -28,6 +28,7 @@ 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.ResourceType import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition import org.openecomp.mso.bpmn.core.domain.Subscriber import org.openecomp.mso.bpmn.core.domain.VnfResource @@ -73,6 +74,8 @@ class OofHoming extends AbstractServiceTaskProcessor { utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled) String serviceInstanceId = execution.getVariable("serviceInstanceId") utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + String serviceInstanceName = execution.getVariable("serviceInstanceName") + utils.log("DEBUG", "Incoming Service Instance Name is: " + serviceInstanceName, isDebugEnabled) ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") utils.log("DEBUG", "Incoming Service Decomposition is: " + serviceDecomposition, isDebugEnabled) String subscriberInfo = execution.getVariable("subscriberInfo") @@ -86,21 +89,24 @@ class OofHoming extends AbstractServiceTaskProcessor { if (isBlank(requestId) || isBlank(serviceInstanceId) || + isBlank(serviceInstanceName) || isBlank(serviceDecomposition.toString()) || - isBlank(subscriberInfo) || - isBlank(customerLocation.toString()) || - isBlank(cloudOwner) || - isBlank(cloudRegionId)) { + isBlank(customerLocation.toString())) { exceptionUtil.buildAndThrowWorkflowException(execution, 4000, "A required input variable is missing or null") } else { - String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId") - String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName") - String subCommonSiteId = "" - if (jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")) { - subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId") + Subscriber subscriber = null + if (isBlank(subscriberInfo)) { + subscriber = new Subscriber("", "", "") + } else { + String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId") + String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName") + String subCommonSiteId = "" + if (jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")) { + subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId") + } + subscriber = new Subscriber(subId, subName, subCommonSiteId) } - Subscriber subscriber = new Subscriber(subId, subName, subCommonSiteId) //Authentication def authHeader = "" @@ -205,9 +211,16 @@ class OofHoming extends AbstractServiceTaskProcessor { JSONObject placement = arrSol.getJSONObject(j) utils.log("DEBUG", "****** JSONObject is: " + placement + " *****", "true") String jsonServiceResourceId = placement.getString("serviceResourceId") + String jsonResourceModuleName = placement.getString("resourceModuleName") for (Resource resource : resourceList) { String serviceResourceId = resource.getResourceId() - if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) { + String resourceModuleName = "" + if (resource.getResourceType() == ResourceType.ALLOTTED_RESOURCE || + resource.getResourceType() == ResourceType.VNF) { + resourceModuleName = resource.getNfFunction() + } + if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId) || + resourceModuleName.equalsIgnoreCase(jsonResourceModuleName)) { JSONObject solution = placement.getJSONObject("solution") String solutionType = solution.getString("identifierType") String inventoryType = "" @@ -244,14 +257,17 @@ class OofHoming extends AbstractServiceTaskProcessor { flavorsArrayList.add(cloudFlavor) } } - Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "key", "value") + Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, + assignmentArr.toString(), "key", "value") String cloudOwner = assignmentMap.get("cloudOwner") - String cloudRegionId = assignmentMap.get("cloudRegionId") + String cloudRegionId = assignmentMap.get("locationId") resource.getHomingSolution().setCloudOwner(cloudOwner) resource.getHomingSolution().setCloudRegionId(cloudRegionId) if (flavorsArrayList != null && flavorsArrayList.size != 0) { resource.getHomingSolution().setFlavors(flavorsArrayList) execution.setVariable(cloudRegionId + "_flavorList", flavorsArrayList) + utils.log("DEBUG", "***** _flavorList is: " + flavorsArrayList.toString() + + " *****", "true") } if (inventoryType.equalsIgnoreCase("service")) { diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy index 79134fe757..b61739f32c 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy @@ -1,19 +1,21 @@ package org.openecomp.mso.bpmn.common.scripts -import org.apache.commons.lang3.StringUtils -import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.camunda.bpm.engine.delegate.DelegateExecution import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil import org.openecomp.mso.bpmn.common.scripts.MsoUtils import org.openecomp.mso.bpmn.core.domain.HomingSolution import org.openecomp.mso.bpmn.core.domain.ModelInfo import org.openecomp.mso.bpmn.core.domain.Resource +import org.openecomp.mso.bpmn.core.domain.AllottedResource import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition import org.openecomp.mso.bpmn.core.domain.ServiceInstance import org.openecomp.mso.bpmn.core.domain.Subscriber import org.openecomp.mso.bpmn.core.domain.VnfResource import org.openecomp.mso.bpmn.core.json.JsonUtils +import java.lang.reflect.Array + import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.* class OofUtils { @@ -47,7 +49,7 @@ class OofUtils { String buildRequest(DelegateExecution execution, String requestId, ServiceDecomposition decomposition, - Subscriber subscriber, + Subscriber subscriber = null, Map customerLocation, ArrayList existingCandidates = null, ArrayList excludedCandidates = null, @@ -60,13 +62,19 @@ class OofUtils { ServiceInstance serviceInstance = decomposition.getServiceInstance() def serviceInstanceId = "" def serviceInstanceName = "" - if (serviceInstance == null) { - utils.log("DEBUG", "Unable to obtain Service Instance Id, ServiceInstance Object is null", isDebugEnabled) + + serviceInstanceId = execution.getVariable("serviceInstanceId") + serviceInstanceName = execution.getVariable("serviceInstanceName") + + if (serviceInstanceId == null || serviceInstanceId == "null") { + utils.log("DEBUG", "Unable to obtain Service Instance Id", isDebugEnabled) exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " + - "obtain Service Instance Id, ServiceInstance Object is null") - } else { - serviceInstanceId = serviceInstance.getInstanceId() - serviceInstanceName = serviceInstance.getInstanceName() + "obtain Service Instance Id, execution.getVariable(\"serviceInstanceName\") is null") + } + if (serviceInstanceName == null || serviceInstanceName == "null") { + utils.log("DEBUG", "Unable to obtain Service Instance Name", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " + + "obtain Service Instance Name, execution.getVariable(\"serviceInstanceName\") is null") } //Model Info ModelInfo model = decomposition.getModelInfo() @@ -76,9 +84,14 @@ class OofUtils { String modelName = model.getModelName() String modelVersion = model.getModelVersion() //Subscriber Info - String subscriberId = subscriber.getGlobalId() - String subscriberName = subscriber.getName() - String commonSiteId = subscriber.getCommonSiteId() + String subscriberId = "" + String subscriberName = "" + String commonSiteId = "" + if (subscriber != null){ + subscriberId = subscriber.getGlobalId() + subscriberName = subscriber.getName() + commonSiteId = subscriber.getCommonSiteId() + } //Determine RequestType //TODO Figure out better way to determine this @@ -94,28 +107,40 @@ class OofUtils { //Demands String placementDemands = "" StringBuilder sb = new StringBuilder() - List<Resource> resourceList = decomposition.getServiceAllottedResources() + List<AllottedResource> allottedResourceList = decomposition.getServiceAllottedResources() List<VnfResource> vnfResourceList = decomposition.getServiceVnfs() - if (resourceList.isEmpty() || resourceList == null) { + if (allottedResourceList.isEmpty() || allottedResourceList == null) { utils.log("DEBUG", "Allotted Resources List is empty - will try to get service VNFs instead.", isDebugEnabled) - resourceList = decomposition.getServiceVnfs() + allottedResourceList = decomposition.getServiceVnfs() } - if (resourceList.isEmpty() || resourceList == null) { + if (allottedResourceList.isEmpty() || allottedResourceList == null) { utils.log("DEBUG", "Resources List is Empty", isDebugEnabled) } else { - for (Resource resource : resourceList) { - ModelInfo resourceModelInfo = resource.getModelInfo() + for (AllottedResource resource : allottedResourceList) { + utils.log("DEBUG", "Allotted Resource: " + resource.toString(), + isDebugEnabled) def serviceResourceId = resource.getResourceId() - def resourceModuleName = resource.getResourceType() - def resouceModelInvariantId = resourceModelInfo.getModelInvariantUuid() - def resouceModelName = resourceModelInfo.getModelName() - def resouceModelVersion = resourceModelInfo.getModelVersion() - def resouceModelVersionId = resourceModelInfo.getModelUuid() - def resouceModelType = resourceModelInfo.getModelType() - def tenantId = execution.getTenantId() + def resourceModuleName = resource.getNfFunction() + utils.log("DEBUG", "resourceModuleName: " + resourceModuleName, + isDebugEnabled) + def resourceModelInvariantId = "no-resourceModelInvariantId" + def resourceModelVersionId = "no-resourceModelVersionId" + + List modelIdLst = execution.getVariable("homingModelIds") + utils.log("DEBUG", "Incoming modelIdLst is: " + modelIdLst.toString(), isDebugEnabled) + for (Map modelId : modelIdLst ) + if (resourceModuleName == modelId.resourceModuleName) { + resourceModelInvariantId = modelId.resourceModelInvariantId + resourceModelVersionId = modelId.resourceModelVersionId + } + + def resourceModelName = "" //Optional + def resourceModelVersion = "" //Optional + def resourceModelType = "" //Optional + def tenantId = "" //Optional def requiredCandidatesJson = "" requiredCandidatesJson = createCandidateJson( @@ -124,22 +149,56 @@ class OofUtils { requiredCandidates) String demand = - "{\n" + - "\"resourceModuleName\": \"${resourceModuleName}\",\n" + - "\"serviceResourceId\": \"${serviceResourceId}\",\n" + - "\"tenantId\": \"${tenantId}\",\n" + - "\"resourceModelInfo\": {\n" + - " \"modelInvariantId\": \"${resouceModelInvariantId}\",\n" + - " \"modelVersionId\": \"${resouceModelVersionId}\",\n" + - " \"modelName\": \"${resouceModelName}\",\n" + - " \"modelType\": \"${resouceModelType}\",\n" + - " \"modelVersion\": \"${resouceModelVersion}\",\n" + - " \"modelCustomizationName\": \"\"\n" + - " }" + requiredCandidatesJson + "\n" + - "}," + " {\n" + + " \"resourceModuleName\": \"${resourceModuleName}\",\n" + + " \"serviceResourceId\": \"${serviceResourceId}\",\n" + + " \"tenantId\": \"${tenantId}\",\n" + + " \"resourceModelInfo\": {\n" + + " \"modelInvariantId\": \"${resourceModelInvariantId}\",\n" + + " \"modelVersionId\": \"${resourceModelVersionId}\",\n" + + " \"modelName\": \"${resourceModelName}\",\n" + + " \"modelType\": \"${resourceModelType}\",\n" + + " \"modelVersion\": \"${resourceModelVersion}\",\n" + + " \"modelCustomizationName\": \"\"\n" + + " }" + requiredCandidatesJson + "\n" + + " }," placementDemands = sb.append(demand) } + for (VnfResource vnfResource : vnfResourceList) { + utils.log("DEBUG", "VNF Resource: " + vnfResource.toString(), + isDebugEnabled) + ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo() + def serviceResourceId = vnfResource.getResourceId() + def resourceModuleName = vnfResource.getNfFunction() + utils.log("DEBUG", "resourceModuleName: " + resourceModuleName, + isDebugEnabled) + def resourceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid() + def resourceModelName = vnfResourceModelInfo.getModelName() + def resourceModelVersion = vnfResourceModelInfo.getModelVersion() + def resourceModelVersionId = vnfResourceModelInfo.getModelUuid() + def resourceModelType = vnfResourceModelInfo.getModelType() + def tenantId = "" //Optional + def requiredCandidatesJson = "" + + + String placementDemand = + " {\n" + + " \"resourceModuleName\": \"${resourceModuleName}\",\n" + + " \"serviceResourceId\": \"${serviceResourceId}\",\n" + + " \"tenantId\": \"${tenantId}\",\n" + + " \"resourceModelInfo\": {\n" + + " \"modelInvariantId\": \"${resourceModelInvariantId}\",\n" + + " \"modelVersionId\": \"${resourceModelVersionId}\",\n" + + " \"modelName\": \"${resourceModelName}\",\n" + + " \"modelType\": \"${resourceModelType}\",\n" + + " \"modelVersion\": \"${resourceModelVersion}\",\n" + + " \"modelCustomizationName\": \"\"\n" + + " }" + requiredCandidatesJson + "\n" + + " }," + + placementDemands = sb.append(placementDemand) + } placementDemands = placementDemands.substring(0, placementDemands.length() - 1) } @@ -265,11 +324,14 @@ class OofUtils { } else { return } - } else if (JsonUtils.jsonElementExist(response, "requestError") == true) { + } else if (response.contains("error") || response.contains("Error") ) { String errorMessage = "" if (response.contains("policyException")) { String text = jsonUtil.getJsonValue(response, "requestError.policyException.text") errorMessage = "OOF Async Callback Response contains a Request Error Policy Exception: " + text + } else if (response.contains("Unable to find any candidate for demand")) { + errorMessage = "OOF Async Callback Response contains error: Unable to find any candidate for " + + "demand *** Response: " + response.toString() } else if (response.contains("serviceException")) { String text = jsonUtil.getJsonValue(response, "requestError.serviceException.text") errorMessage = "OOF Async Callback Response contains a Request Error Service Exception: " + text diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java index 713e25abf0..3c00627bff 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerAction.java @@ -84,6 +84,7 @@ public class ApplicationControllerAction { } break; case ConfigModify: + case ConfigScaleOut: appCStatus = payloadAction(action, msoRequestId, vnfId, payload, controllerType); break; case UpgradePreCheck: diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java index 4255df3e87..5182a75a79 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/client/appc/ApplicationControllerClient.java @@ -86,6 +86,9 @@ public class ApplicationControllerClient { * @param controllerType the controller type: "appc" or "sdnc". */ public ApplicationControllerClient(String controllerType) { + if (controllerType == null) { + controllerType = DEFAULT_CONTROLLER_TYPE; + } this.controllerType = controllerType; appCSupport = new ApplicationControllerSupport(); } @@ -109,6 +112,9 @@ public class ApplicationControllerClient { protected LifeCycleManagerStateful createAppCClient(String controllerType) { try { + if (controllerType == null) { + controllerType = DEFAULT_CONTROLLER_TYPE; + } return AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class) .createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType)); } catch (AppcClientException e) { @@ -142,21 +148,15 @@ public class ApplicationControllerClient { Properties properties = new Properties(); Map<String, String> globalProperties = PropertyConfiguration.getInstance() .getProperties("mso.bpmn.urn.properties"); - if (controllerType==null || controllerType.length()==0 || controllerType.equalsIgnoreCase("appc")) { - properties.put("topic.read", globalProperties.get("appc.client.topic.read")); - properties.put("topic.write", globalProperties.get("appc.client.topic.write")); - } else { - properties.put("topic.read", globalProperties.get("appc.client.topic." + controllerType + ".read")); - properties.put("topic.write", globalProperties.get("appc.client.topic." + controllerType + ".write")); - } - properties.put("topic.sdnc.read", globalProperties.get("appc.client.topic.sdnc.read")); - properties.put("topic.sdnc.write", globalProperties.get("appc.client.topic.sdnc.write")); - properties.put("sdnc-topic.read", globalProperties.get("appc.client.topic.sdnc.read")); - properties.put("sdnc-topic.write", globalProperties.get("appc.client.topic.sdnc.write")); + + properties.put("topic.read", globalProperties.get("appc.client.topic.read")); + properties.put("topic.write", globalProperties.get("appc.client.topic.write")); + properties.put("SDNC-topic.read", globalProperties.get("appc.client.topic.sdnc.read")); + properties.put("SDNC-topic.write", globalProperties.get("appc.client.topic.sdnc.write")); properties.put("topic.read.timeout", globalProperties.get("appc.client.topic.read.timeout")); properties.put("client.response.timeout", globalProperties.get("appc.client.response.timeout")); properties.put("poolMembers", globalProperties.get("appc.client.poolMembers")); - properties.put("client.controllerType", controllerType); + properties.put("controllerType", controllerType); properties.put("client.key", globalProperties.get("appc.client.key")); properties.put("client.secret", globalProperties.get("appc.client.secret")); properties.put("client.name", CLIENT_NAME); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java index 9020701ed3..1f64fb55f8 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java @@ -41,6 +41,7 @@ import org.openecomp.mso.bpmn.mock.FileUtil; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.UUID; @@ -97,7 +98,7 @@ public class OofHomingTest extends WorkflowTest { List<AllottedResource> arList = new ArrayList<AllottedResource>(); AllottedResource ar = new AllottedResource(); ar.setResourceId("testResourceIdAR"); - ar.setResourceInstanceName("testARInstanceName"); + ar.setNfFunction("testARFunctionName"); ModelInfo arModel = new ModelInfo(); arModel.setModelCustomizationUuid("testModelCustomizationUuidAR"); arModel.setModelInvariantUuid("testModelInvariantIdAR"); @@ -108,7 +109,7 @@ public class OofHomingTest extends WorkflowTest { ar.setModelInfo(arModel); AllottedResource ar2 = new AllottedResource(); ar2.setResourceId("testResourceIdAR2"); - ar2.setResourceInstanceName("testAR2InstanceName"); + ar2.setNfFunction("testAR2FunctionName"); ModelInfo arModel2 = new ModelInfo(); arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2"); arModel2.setModelInvariantUuid("testModelInvariantIdAR2"); @@ -123,7 +124,7 @@ public class OofHomingTest extends WorkflowTest { List<VnfResource> vnfList = new ArrayList<VnfResource>(); VnfResource vnf = new VnfResource(); vnf.setResourceId("testResourceIdVNF"); - vnf.setResourceInstanceName("testVnfInstanceName"); + vnf.setNfFunction("testVnfFunctionName"); ArrayList<CloudFlavor> flavors = new ArrayList<>(); CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx"); CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx"); @@ -478,9 +479,9 @@ public class OofHomingTest extends WorkflowTest { //Get Variables WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - - assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found " + - "for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString()); + Boolean errorMatch = workflowException.toString().contains("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " + + "Response contains error: Unable to find any candidate for demand *** Response:"); + assert(errorMatch); } @Test @@ -546,10 +547,12 @@ public class OofHomingTest extends WorkflowTest { variables.put("customerLocation", customerLocation); variables.put("cloudOwner", "amazon"); variables.put("cloudRegionId", "TNZED"); - variables.put("isDebugLogEnabled", "true"); + variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR"); + variables.put("vgMuxInfraModelId", "testArModelUuid"); // variables.put("mso-request-id", "testRequestId"); variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceInstanceId", "testServiceInstanceId123"); + variables.put("serviceInstanceName", "testServiceName"); variables.put("serviceDecomposition", serviceDecomposition); variables.put("subscriberInfo", subscriber2); } @@ -588,9 +591,12 @@ public class OofHomingTest extends WorkflowTest { variables.put("customerLocation", customerLocation); variables.put("cloudOwner", "amazon"); variables.put("cloudRegionId", "TNZED"); + variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR"); + variables.put("vgMuxInfraModelId", "testArModelUuid"); variables.put("isDebugLogEnabled", "true"); variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceInstanceId", "testServiceInstanceId123"); + variables.put("serviceInstanceName", "testServiceName"); variables.put("serviceDecomposition", serviceDecomposition); variables.put("subscriberInfo", subscriber2); } @@ -607,10 +613,13 @@ public class OofHomingTest extends WorkflowTest { variables.put("customerLocation", customerLocation); variables.put("cloudOwner", "amazon"); variables.put("cloudRegionId", "TNZED"); + variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR"); + variables.put("vgMuxInfraModelId", "testArModelUuid"); variables.put("isDebugLogEnabled", "true"); // variables.put("mso-request-id", "testRequestId"); variables.put("msoRequestId", "testRequestId"); - variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceInstanceId", "testServiceInstanceId123"); + variables.put("serviceInstanceName", "testServiceName"); variables.put("serviceDecomposition", null); variables.put("subscriberInfo", subscriber2); } @@ -717,18 +726,22 @@ public class OofHomingTest extends WorkflowTest { "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":" + "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":" + "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," + - "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"ALLOTTED_RESOURCE\"" + + "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"testARFunctionName\"" + ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":" + - "\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR\"," + - "\"modelVersionId\":\"testARModelUuid\",\"modelName\":\"testModelNameAR\",\"modelType\":" + - "\"testModelTypeAR\",\"modelVersion\":\"testModelVersionAR\",\"modelCustomizationName\":\"\"}}," + - "{\"resourceModuleName\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\"," + - "\"tenantId\":\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR2\"," + - "\"modelVersionId\":\"testAr2ModelUuid\",\"modelName\":\"testModelNameAR2\"," + - "\"modelType\":\"testModelTypeAR2\",\"modelVersion\":\"testModelVersionAR2\"," + - "\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":" + + "\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\"," + + "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\",\"modelType\":" + + "\"\",\"modelVersion\":\"\",\"modelCustomizationName\":\"\"}}," + + "{\"resourceModuleName\":\"testAR2FunctionName\",\"serviceResourceId\":\"testResourceIdAR2\"," + + "\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\"," + + "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\"," + + "\"modelType\":\"\",\"modelVersion\":\"\"," + + "\"modelCustomizationName\":\"\"}},{\"resourceModuleName\":\"testVnfFunctionName\",\"serviceResourceId\":\"" + + "testResourceIdVNF\",\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\"" + + ":\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":\"" + + "testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\"" + + ",\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":" + "{\"serviceInstanceId\":\"testServiceInstanceId123\"," + - "\"serviceName\":\"null\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":" + + "\"serviceName\":\"testServiceName\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":" + "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\"," + "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\"" + "\"}}}"; diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java index ec093bebbd..6c2b23b926 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/appc/ApplicationControllerClientTest.java @@ -99,14 +99,15 @@ public class ApplicationControllerClientTest { Properties properties = client.getLCMProperties();
assertEquals(properties.get("topic.read"), "APPC-TEST-AMDOCS2");
assertEquals(properties.get("topic.write"), "APPC-TEST-AMDOCS1-DEV3");
- assertEquals(properties.get("topic.sdnc.read"), "SDNC-LCM-READ");
- assertEquals(properties.get("topic.sdnc.write"), "SDNC-LCM-WRITE");
+ assertEquals(properties.get("SDNC-topic.read"), "SDNC-LCM-READ");
+ assertEquals(properties.get("SDNC-topic.write"), "SDNC-LCM-WRITE");
assertEquals(properties.get("topic.read.timeout"), "120000");
assertEquals(properties.get("client.response.timeout"), "120000");
assertEquals(properties.get("poolMembers"),
"uebsb93kcdc.it.att.com:3904,uebsb92kcdc.it.att.com:3904,uebsb91kcdc.it.att.com:3904");
assertEquals(properties.get("client.key"), "iaEMAfjsVsZnraBP");
assertEquals(properties.get("client.secret"), "wcivUjsjXzmGFBfxMmyJu9dz");
+ assertEquals(properties.get("controllerType"), "appc");
}
}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf index 808723828a..53cd70c514 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf @@ -54,7 +54,7 @@ "value": "False" }, { - "key": "cloudRegionId", + "key": "locationId", "value": "dfwtx" } ] @@ -79,7 +79,7 @@ "value": "False" }, { - "key": "cloudRegionId", + "key": "locationId", "value": "testCloudRegionId2" } ] @@ -100,7 +100,7 @@ "value": "aic" }, { - "key": "cloudRegionId", + "key": "locationId", "value": "testCloudRegionId3" }, { "key":"flavors", diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net index 8766df8dba..d95587746b 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net @@ -55,7 +55,7 @@ { "key": "cloudOwner", "value": "aic" }, { "key": "vnfHostName", "value": "MDTNJ01" }, { "key": "isRehome", "value": "False" }, - { "key": "cloudRegionId", "value": "dfwtx" } + { "key": "locationId", "value": "dfwtx" } ] }, { @@ -69,7 +69,7 @@ { "key": "cloudOwner", "value": "aic" }, { "key": "vnfHostName", "value": "testVnfHostname2" }, { "key": "isRehome", "value": "False" }, - { "key": "cloudRegionId", "value": "testCloudRegionId2" } + { "key": "locationId", "value": "testCloudRegionId2" } ] }, { @@ -83,7 +83,7 @@ { "key": "cloudOwner", "value": "aic" }, { "key": "vnfHostName", "value": "testVnfHostNameNet" }, { "key": "isRehome", "value": "False" }, - { "key": "cloudRegionId", "value": "testCloudRegionIdNet" } + { "key": "locationId", "value": "testCloudRegionIdNet" } ] }, { @@ -96,7 +96,7 @@ }, "assignmentInfo": [ { "key": "cloudOwner", "value": "aic" }, - { "key": "cloudRegionId", "value": "testCloudRegionIdNet2" } + { "key": "locationId", "value": "testCloudRegionIdNet2" } ] }, { @@ -109,7 +109,7 @@ }, "assignmentInfo": [ { "key": "cloudOwner", "value": "aic" }, - { "key": "cloudRegionId", "value": "testCloudRegionId3" }, + { "key": "locationId", "value": "testCloudRegionId3" }, { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}} ] } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf index 8e6f2d46be..15e601bae8 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf @@ -17,7 +17,7 @@ { "key": "cloudOwner", "value": "amazon" }, { "key": "vnfHostName", "value": "ahr344gh" }, { "key": "isRehome", "value": "False" }, - { "key": "cloudRegionId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" } + { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" } ] }, { @@ -30,7 +30,7 @@ }, "assignmentInfo": [ { "key": "cloudOwner", "value": "amazon" }, - { "key": "cloudRegionId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" }, + { "key": "locationId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" }, { "key":"flavors", "value":{ "flavorLabel1xxx":"vimFlavorxxx", "flavorLabel2xxx":"vimFlavorxxx"}} ] } diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound index 8bb29f0c0a..2024df401b 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound @@ -1,10 +1,18 @@ { - "solutions": { - "placementSolutions": [], - "licenseSolutions": [] - }, - "transactionId": "08e1b8cf-144a-4bac-b293-d5e2eedc97e8", - "requestId": "02c2e322-5839-4c97-9d46-0a5fa6bb642e", - "requestStatus": "completed", - "statusMessage": "No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8" + "plans":[ + { + "name":"356fdb73-cef2-4dda-8865-31fd6733d6e4", + "message":"Unable to find any candidate for demand vGW", + "links":[ + [ + { + "rel":"self", + "href":"http://172.17.0.6:8091/v1/plans/1c15e194-6df5-43fe-a5ff-42e6093b8ddd" + } + ] + ], + "id":"1c15e194-6df5-43fe-a5ff-42e6093b8ddd", + "status":"error" + } + ] }
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json index 09026d1d8c..889431663d 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json @@ -37,7 +37,7 @@ }, "nfRole": "", "nfType": "", - "nfFunction": "", + "nfFunction": "ADIoDvCE", "nfNamingCode": "", "multiStageDesign": "N" } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy index 1ec1df1f0e..fd819fd3d5 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy @@ -241,7 +241,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { String serviceId = execution.getVariable("serviceInstanceId")
String addRelationPayload = """<relationship xmlns="http://org.openecomp.aai.inventory/v11">
<related-to>service-instance</related-to>
- <related-link>/aai/v11/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${nsInstanceId}</related-link>
+ <related-link>/aai/v11/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${serviceId}</related-link>
<relationship-data>
<relationship-key>customer.global-customer-id</relationship-key>
<relationship-value>${globalSubscriberId}</relationship-value>
@@ -252,12 +252,12 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { </relationship-data>
<relationship-data>
<relationship-key>service-instance.service-instance-id</relationship-key>
- <relationship-value>${nsInstanceId}</relationship-value>
+ <relationship-value>${serviceId}</relationship-value>
</relationship-data>
</relationship>"""
String endpoint = execution.getVariable("URN_aai_endpoint")
utils.log("INFO","Add Relationship req:\n" + addRelationPayload, isDebugEnabled)
- String url = endpoint + "/aai/v11/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + serviceId + "/relationship-list/relationship"
+ String url = endpoint + "/aai/v11/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + nsInstanceId + "/relationship-list/relationship"
APIResponse aaiRsp = executeAAIPutCall(execution, url, addRelationPayload)
utils.log("INFO","aai response status code:" + aaiRsp.getStatusCode(), isDebugEnabled)
utils.log("INFO","aai response content:" + aaiRsp.getResponseBodyAsString(), isDebugEnabled)
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy index 797086b125..0a53526263 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy @@ -23,6 +23,15 @@ package org.openecomp.mso.bpmn.infrastructure.scripts; import groovy.json.JsonSlurper
import groovy.json.JsonOutput
+import javax.xml.parsers.DocumentBuilder
+import javax.xml.parsers.DocumentBuilderFactory
+
+import org.w3c.dom.Document
+import org.w3c.dom.Element
+import org.w3c.dom.Node
+import org.w3c.dom.NodeList
+import org.xml.sax.InputSource
+
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.appc.client.lcm.model.Action
@@ -42,6 +51,12 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
+
+ private AbstractServiceTaskProcessor taskProcessor
+
+ public SDNCAdapterUtils(AbstractServiceTaskProcessor taskProcessor) {
+ this.taskProcessor = taskProcessor
+ }
/**
* Validates the request message and sets up the workflow.
@@ -217,6 +232,7 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { execution.setVariable(prefix + 'vfModuleId', newVfModuleId)
execution.setVariable('actionHealthCheck', Action.HealthCheck)
execution.setVariable('actionConfigScaleOut', Action.ConfigScaleOut)
+ execution.setVariable('controllerType', "APPC")
def controllerType = execution.getVariable('controllerType')
execution.setVariable(prefix + 'controllerType', controllerType)
execution.setVariable('healthCheckIndex0', 0)
@@ -303,11 +319,55 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor { if(vnf.isPresent()){
def vnfOrchestrationStatus = vnf.get().getOrchestrationStatus();
if("active".equalsIgnoreCase(vnfOrchestrationStatus)){
- execution.setVariable("runHealthCheck", true);
+ execution.setVariable("runHealthCheck", false);
execution.setVariable("runConfigScaleOut", true);
}
}
}
+
+ /**
+ * Retrieve data for ConfigScaleOut from SDNC topology
+ */
+
+ public void retreiveConfigScaleOutData(DelegateExecution execution){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ def vfModuleId = execution.getVariable("CVFMI_vfModuleId")
+ String ipAddress = "";
+ String oamIpAddress = "";
+ String vnfHostIpAddress = "";
+
+ String vnfGetSDNC = execution.getVariable("DCVFM_getSDNCAdapterResponse");
+
+ String data = utils.getNodeXml(vnfGetSDNC, "response-data")
+ data = data.replaceAll("<", "<")
+ data = data.replaceAll(">", ">")
+
+ InputSource source = new InputSource(new StringReader(data));
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ docFactory.setNamespaceAware(true)
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
+ Document responseXml = docBuilder.parse(source)
+
+ NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters")
+ for (int z = 0; z < paramsList.getLength(); z++) {
+ Node node = paramsList.item(z)
+ Element eElement = (Element) node
+ String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name")
+ String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value")
+ if (vnfParameterName.equals("vlb_private_ip_1")) {
+ vnfHostIpAddress = vnfParameterValue
+ }
+ else if (vnfParameterName.equals("vdns_private_ip_0")) {
+ ipAddress = vnfParameterValue
+ }
+ else if (vnfParameterName.equals("vdns_private_ip_1")) {
+ oamIpAddress = vnfParameterValue
+ }
+ }
+
+ String payload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"" + vnfHostIpAddress + "\",\"vf-module-id\":\"" + vfModuleId + "\"},\"configuration-parameters\":{\"ip-addr\":\"" + ipAddress +"\", \"oam-ip-addr\":\""+ oamIpAddress +"\",\"enabled\":\"true\"}}"
+ execution.setVariable("payload", payload);
+ }
/**
*
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy index ae75d54afe..ab84168007 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy @@ -105,7 +105,10 @@ public class DoCreateResources extends AbstractServiceTaskProcessor List<NetworkResource> networkResourceList = new ArrayList<NetworkResource>() List<Resource> sequencedResourceList = new ArrayList<Resource>() - def resourceSequence = BPMNProperties.getResourceSequenceProp() + + String serviceDecompose = execution.getVariable("serviceDecomposition") + String serviceModelName = jsonUtil.getJsonValue(serviceDecompose, "serviceResources.modelInfo.modelName") + def resourceSequence = BPMNProperties.getResourceSequenceProp(serviceModelName) if(resourceSequence != null) { // sequence is defined in config file @@ -245,10 +248,19 @@ public class DoCreateResources extends AbstractServiceTaskProcessor //String requestAction = resourceInput.getOperationType() String requestAction = "createInstance" JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceModelInfo().getModelUuid(), requestAction) - String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri") - int recipeTimeOut = resourceRecipe.getInt("recipeTimeout") - String recipeParamXsd = resourceRecipe.get("paramXSD") - HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) + + if (resourceRecipe != null) { + String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + resourceRecipe.getString("orchestrationUri") + int recipeTimeOut = resourceRecipe.getInt("recipeTimeout") + String recipeParamXsd = resourceRecipe.get("paramXSD") + HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) + } else { + String exceptionMessage = "Resource receipe is not found for resource modeluuid: " + + resourceInput.getResourceModelInfo().getModelUuid() + utils.log("ERROR", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, exceptionMessage) + } + utils.log("INFO", "======== end executeResourceRecipe Process ======== ", isDebugEnabled) } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy index f0ecbab82c..d3e89df7bf 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy @@ -107,7 +107,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces */
public void deleteNSRelationship(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("INFO"," ***** addNSRelationship *****", isDebugEnabled)
+ utils.log("INFO"," ***** deleteNSRelationship *****", isDebugEnabled)
String nsInstanceId = execution.getVariable("resourceInstanceId")
if(nsInstanceId == null || nsInstanceId == ""){
utils.log("INFO"," Delete NS failed", isDebugEnabled)
@@ -133,13 +133,13 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces </relationship-data>
</relationship>"""
String endpoint = execution.getVariable("URN_aai_endpoint")
- utils.log("INFO","Add Relationship req:\n" + deleteRelationPayload, isDebugEnabled)
+ utils.log("INFO","Delete Relationship req:\n" + deleteRelationPayload, isDebugEnabled)
String url = endpoint + "/aai/v11/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + serviceId + "/relationship-list/relationship"
APIResponse aaiRsp = executeAAIDeleteCall(execution, url, deleteRelationPayload)
utils.log("INFO","aai response status code:" + aaiRsp.getStatusCode(), isDebugEnabled)
utils.log("INFO","aai response content:" + aaiRsp.getResponseBodyAsString(), isDebugEnabled)
- utils.log("INFO"," *****Exit addNSRelationship *****", isDebugEnabled)
+ utils.log("INFO"," *****Exit deleteNSRelationship *****", isDebugEnabled)
}
public APIResponse executeAAIDeleteCall(DelegateExecution execution, String url, String payload){
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy index 0e4aea00ae..c1ffc5abef 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy @@ -95,15 +95,15 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess * scale NS task */ public void scaleNetworkService(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") String saleNsRequest = execution.getVariable("reqBody") String[] nsReqStr = saleNsRequest.split("\\|") - def jobIdArray = ['jobId001', 'jobId002'] as String[] - for (int i = 0; i < nsReqStr.length; i++) { JSONObject reqBodyJsonObj = new JSONObject(nsReqStr[i]) String nsInstanceId = reqBodyJsonObj.getJSONObject("nsScaleParameters").getString("nsInstanceId") + String nodeTemplateUUID = reqBodyJsonObj.getJSONObject("nsOperationKey").getString("nodeTemplateUUID") reqBodyJsonObj.getJSONObject("nsScaleParameters").remove("nsInstanceId") String reqBody = reqBodyJsonObj.toString() @@ -113,15 +113,19 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess String returnCode = apiResponse.getStatusCode() String aaiResponseAsString = apiResponse.getResponseBodyAsString() - String jobId = ""; - if (returnCode == "200") { + String jobId = "" + if (returnCode == "200" || returnCode == "202") { jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") } - - execution.setVariable("jobId", jobIdArray[i]) + utils.log("INFO", "scaleNetworkService get a ns scale job Id:" + jobId, isDebugEnabled) + execution.setVariable("jobId", jobId) + execution.setVariable("nodeTemplateUUID", nodeTemplateUUID) String isScaleFinished = "" + if(jobId =="" || jobId == null){ + continue + } // query the requested network service scale status, if finished, then start the next one, otherwise, wait while (isScaleFinished != "finished" && isScaleFinished != "error"){ timeDelay() diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy index dff1ecf68e..74c991e637 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy @@ -126,11 +126,16 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { // user params
String uuiRequest = execution.getVariable("uuiRequest")
+
+ // target model Invariant uuid
+ String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid")
+ execution.setVariable("modelInvariantUuid", modelInvariantUuid)
+ utils.log("INFO", "modelInvariantUuid: " + modelInvariantUuid, isDebugEnabled)
+
// target model uuid
String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid")
- execution.setVariable("modelUuid", modelUuid)
-
- utils.log("INFO","modelUuid: " + modelUuid, isDebugEnabled)
+ execution.setVariable("modelUuid", modelUuid)
+ utils.log("INFO", "modelUuid: " + modelUuid, isDebugEnabled)
} catch (BpmnError e) {
throw e;
@@ -327,9 +332,20 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { String msg = ""
utils.log("INFO"," ***** preProcessAAIPUT *****", isDebugEnabled)
- String modelUuid = execution.getVariable("modelUuid")
+
String serviceInstanceVersion = execution.getVariable("serviceInstanceVersion")
- execution.setVariable("GENPS_serviceResourceVersion", serviceInstanceVersion)
+ //execution.setVariable("GENPS_serviceResourceVersion", serviceInstanceVersion)
+
+ //requestDetails.modelInfo.for AAI PUT servieInstanceData
+ //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData
+ String serviceInstanceName = execution.getVariable("serviceInstanceName")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ //aai serviceType and Role can be setted as fixed value now.
+ String aaiServiceType = "E2E Service"
+ String aaiServiceRole = "E2E Service"
+ String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
+ String modelUuid = execution.getVariable("modelUuid")
+
AaiUtil aaiUriUtil = new AaiUtil(this)
utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled)
@@ -341,7 +357,13 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { //update target model to aai
String serviceInstanceData =
"""<service-instance xmlns=\"${namespace}\">
- <model-version-id">${modelUuid}</model-version-id>
+ <service-instance-id>${serviceInstanceId}</service-instance-id>
+ <service-instance-name>${serviceInstanceName}</service-instance-name>
+ <service-type>${aaiServiceType}</service-type>
+ <service-role>${aaiServiceRole}</service-role>
+ <resource-version>${serviceInstanceVersion}</resource-version>
+ <model-invariant-id>${modelInvariantUuid}</model-invariant-id>
+ <model-version-id>${modelUuid}</model-version-id>
</service-instance>""".trim()
execution.setVariable("serviceInstanceData", serviceInstanceData)
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy index 1e70f95bd3..a55ca0225a 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstanceRollback.groovy @@ -25,7 +25,9 @@ import groovy.xml.XmlUtil import groovy.json.* import org.openecomp.mso.bpmn.core.json.JsonUtils +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.core.RollbackData import org.openecomp.mso.bpmn.core.WorkflowException @@ -64,6 +66,7 @@ import org.springframework.web.util.UriUtils; public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProcessor{ String Prefix="DUPDSIRB_" + ExceptionUtil exceptionUtil = new ExceptionUtil() public void preProcessRequest(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") @@ -259,13 +262,36 @@ public class DoUpdateE2EServiceInstanceRollback extends AbstractServiceTaskProce String msg = "" utils.log("INFO"," ***** preProcessAAIPUT *****", isDebugEnabled) - String modelUuid = execution.getVariable("model-version-id-original") String serviceInstanceVersion = execution.getVariable("serviceInstanceVersion_n") - execution.setVariable("GENPS_serviceResourceVersion", serviceInstanceVersion) +// execution.setVariable("GENPS_serviceResourceVersion", serviceInstanceVersion) + + //requestDetails.modelInfo.for AAI PUT servieInstanceData + //requestDetails.requestInfo. for AAI GET/PUT serviceInstanceData + String serviceInstanceName = execution.getVariable("serviceInstanceName") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + //aai serviceType and Role can be setted as fixed value now. + String aaiServiceType = "E2E Service" + String aaiServiceRole = "E2E Service" + String modelInvariantUuid = execution.getVariable("modelInvariantUuid") + String modelUuid = execution.getVariable("model-version-id-original") + + //AAI PUT + AaiUtil aaiUriUtil = new AaiUtil(this) + utils.log("INFO","start create aai uri: " + aaiUriUtil, isDebugEnabled) + String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution) + utils.log("INFO","aai_uri: " + aai_uri, isDebugEnabled) + String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri) + utils.log("INFO","namespace: " + namespace, isDebugEnabled) String serviceInstanceData = """<service-instance xmlns=\"${namespace}\"> - <resource-version">${modelUuid}</resource-version> + <service-instance-id>${serviceInstanceId}</service-instance-id> + <service-instance-name>${serviceInstanceName}</service-instance-name> + <service-type>${aaiServiceType}</service-type> + <service-role>${aaiServiceRole}</service-role> + <resource-version>${serviceInstanceVersion}</resource-version> + <model-invariant-id>${modelInvariantUuid}</model-invariant-id> + <model-version-id>${modelUuid}</model-version-id> </service-instance>""".trim() execution.setVariable("serviceInstanceData", serviceInstanceData) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy index 58f644d53f..4eca37b304 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy @@ -125,9 +125,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor String operationId = execution.getVariable("operationId") String serviceInstanceId = execution.getVariable("serviceInstanceId") // RESTResponse for API Handler (APIH) Reply Task - String scaleServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${ - operationId - }"}}""".trim() + String scaleServiceRestRequest = """{"operationId":"${operationId}"}""".trim() utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + scaleServiceRestRequest, isDebugEnabled) sendWorkflowResponse(execution, 202, scaleServiceRestRequest) execution.setVariable("sentSyncResponse", true) @@ -256,7 +254,7 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor utils.log("INFO", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) try{ String serviceId = execution.getVariable("serviceInstanceId") - String serviceName = execution.getVariable("serviceInstanceName") + //String serviceName = execution.getVariable("serviceInstanceName") String operationId = execution.getVariable("operationId") String operationType = "SCALE" String userId = "" @@ -280,7 +278,6 @@ public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb"> <serviceId>${serviceId}</serviceId> <operationId>${operationId}</operationId> - <serviceName>${serviceName}</serviceName> <operationType>${operationType}</operationType> <userId>${userId}</userId> <result>${result}</result> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy index a964a7e32a..f3f1a96258 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy @@ -413,7 +413,6 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb"> <serviceId>${serviceId}</serviceId> <operationId>${operationId}</operationId> - <serviceName>${serviceName}</serviceName> <operationType>${operationType}</operationType> <userId>${userId}</userId> <result>${result}</result> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index 694aafc887..68f50e033c 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy @@ -76,6 +76,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable("homingService", "") execution.setVariable("cloudOwner", "") execution.setVariable("cloudRegionId", "") + execution.setVariable("homingModelIds", "") //TODO execution.setVariable("sdncVersion", "1707") @@ -129,6 +130,11 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8") execution.setVariable("serviceInstanceId", serviceInstanceId) + utils.log("DEBUG", "Incoming serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + + String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.instanceName") + execution.setVariable("serviceInstanceName", serviceInstanceName) + utils.log("DEBUG", "Incoming serviceInstanceName is: " + serviceInstanceName, isDebugEnabled) String requestAction = execution.getVariable("requestAction") execution.setVariable("requestAction", requestAction) @@ -194,28 +200,47 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { def userParams = reqMap.requestDetails?.requestParameters?.userParams Map<String, String> inputMap = [:] - - if (userParams) { + if (userParams) { userParams.each { - userParam -> - if("BRG_WAN_MAC_Address".equals(userParam?.name)) { - execution.setVariable("brgWanMacAddress", userParam.value) - inputMap.put("BRG_WAN_MAC_Address", userParam.value) - } - if("Customer_Location".equals(userParam?.name)) { - execution.setVariable("customerLocation", userParam.value) - userParam.value.each { - customerLocParam -> - inputMap.put(customerLocParam.key, customerLocParam.value) + userParam -> + if ("Customer_Location".equals(userParam?.name)) { + execution.setVariable("customerLocation", userParam.value) + userParam.value.each { + param -> + inputMap.put(param.key, param.value) + } + } + if ("Homing_Model_Ids".equals(userParam?.name)) { + utils.log("DEBUG", "Homing_Model_Ids: " + userParam.value.toString() + " ---- Type is:" + + userParam.value.getClass() , isDebugEnabled) + def modelIdLst = [] + userParam.value.each { + param -> + def valueMap = [:] + param.each { + entry -> + valueMap.put(entry.key, entry.value) } - } - if("Homing_Solution".equals(userParam?.name)) { - execution.setVariable("homingService", userParam.value) - inputMap.put("Homing_Solution", userParam.value) - } else { - execution.setVariable("homingService", "oof") - } - } + modelIdLst.add(valueMap) + utils.log("DEBUG", "Param: " + param.toString() + " ---- Type is:" + + param.getClass() , isDebugEnabled) + } + execution.setVariable("homingModelIds", modelIdLst) + } + if ("BRG_WAN_MAC_Address".equals(userParam?.name)) { + execution.setVariable("brgWanMacAddress", userParam.value) + inputMap.put("BRG_WAN_MAC_Address", userParam.value) + } + if ("Homing_Solution".equals(userParam?.name)) { + execution.setVariable("homingService", userParam.value) + inputMap.put("Homing_Solution", userParam.value) + } + } + } + + if (execution.getVariable("homingService") == "") { + // Set Default Homing to OOF if not set + execution.setVariable("homingService", "oof") } utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) @@ -417,7 +442,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { VnfResource vr = it.next() String role = vr.getNfRole() - if (role == "BRG" || role == "TunnelXConn") { + if (role == "BRG" || role == "TunnelXConn" || role == "Tunnel XConn") { it.remove() } } @@ -451,7 +476,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName(), isDebugEnabled) utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled) - if ("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())) { + if ("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType()) || "Tunnel XConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())) { //set create flag to true execution.setVariable("createTXCAR", true) ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy index aa16d3b280..08edb88c61 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy @@ -242,8 +242,8 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { if(isBlank(type) || isBlank(id)) {
- } else if(type == "TunnelXConn") {
- utils.log("DEBUG","TunnelXConn AR found", isDebugEnabled)
+ } else if(type == "TunnelXConn" || type == "Tunnel XConn") {
+ utils.log("DEBUG","Tunnel XConn AR found", isDebugEnabled)
TXC_found = true
TXC_id = id
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java index dbb552c818..64d8530df1 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/properties/BPMNProperties.java @@ -47,8 +47,8 @@ public class BPMNProperties { return value; } - public static List<String> getResourceSequenceProp() { - String resourceSequence = getProperty("mso.workflow.custom.VolTE.resource.sequence", null); + public static List<String> getResourceSequenceProp(String input) { + String resourceSequence = getProperty("mso.workflow.custom." + input + ".resource.sequence", null); if (resourceSequence != null) { return Arrays.asList(resourceSequence.split(",")); } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn index ea48104ba7..876f91ff42 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustService.bpmn @@ -451,6 +451,8 @@ CreateVcpeResCustService.prepareCreateAllottedResourceTXC(execution)]]></bpmn2:s <camunda:in source="customerLocation" target="customerLocation" /> <camunda:in source="cloudOwner" target="cloudOwner" /> <camunda:in source="cloudRegionId" target="cloudRegionId" /> + <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="homingModelIds" target="homingModelIds" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_11efpvh</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1jbuf1t</bpmn2:outgoing> @@ -514,6 +516,7 @@ CreateVcpeResCustService.prepareCreateAllottedResourceBRG(execution)]]></bpmn2:s <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> <camunda:in source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:in source="RegionOne_flavorList" target="RegionOne_flavorList" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_0ws7fjn</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1mkdhw9</bpmn2:outgoing> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn index 94b88f7c3c..99b1ff51e9 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVcpeResCustServiceV2.bpmn @@ -585,6 +585,7 @@ CreateVcpeResCustService.validateVnfCreate(execution)]]></bpmn2:script> <bpmn2:extensionElements> <camunda:in source="timeoutForPnfEntryNotification" target="timeoutForPnfEntryNotification" /> <camunda:in source="correlationId" target="correlationId" /> + <camunda:in businessKey="#{execution.processBusinessKey}" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_0gj4vud</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0clhseq</bpmn2:outgoing> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn index f882094851..c0c2f26035 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_pNTO8MRhEeWv36YLr7PC3Q" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_pNTO8MRhEeWv36YLr7PC3Q" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="CreateVfModuleInfra" name="CreateVfModuleInfra" isExecutable="true"> <bpmn2:startEvent id="StartEvent_1" name="Start"> <bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing> @@ -38,6 +38,7 @@ <camunda:in source="CVFMI_usePreload" target="usePreload" /> <camunda:in source="CVFMI_vfModuleInputParams" target="vfModuleInputParams" /> <camunda:in source="CVFMI_aLaCarte" target="aLaCarte" /> + <camunda:out source="DCVFM_getSDNCAdapterResponse" target="DCVFM_getSDNCAdapterResponse" /> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_1y7d5qk</bpmn2:incoming> <bpmn2:incoming>SequenceFlow_1vx081s</bpmn2:incoming> @@ -215,7 +216,7 @@ exceptionUtil.processJavaException(execution)]]></bpmn2:script> <camunda:in source="CVFMI_vnfId" target="vnfId" /> <camunda:in source="CVFMI_requestId" target="msoRequestId" /> <camunda:in source="CVFMI_vnfName" target="vnfName" /> - <camunda:in source="CVFMO_controllerType" target="controllerType" /> + <camunda:in source="CVFMI_controllerType" target="controllerType" /> <camunda:in source="healthCheckIndex0" target="healthCheckIndex" /> <camunda:out source="errorCode" target="errorCode" /> <camunda:out source="errorText" target="errorText" /> @@ -247,7 +248,8 @@ exceptionUtil.processJavaException(execution)]]></bpmn2:script> <camunda:in source="CVFMI_vnfId" target="vnfId" /> <camunda:in source="CVFMI_requestId" target="msoRequestId" /> <camunda:in source="CVFMI_vnfName" target="vnfName" /> - <camunda:in source="CVFMO_controllerType" target="controllerType" /> + <camunda:in source="CVFMI_controllerType" target="controllerType" /> + <camunda:in source="payload" target="payload" /> <camunda:in source="healthCheckIndex0" target="healthCheckIndex" /> <camunda:out source="errorCode" target="errorConfigScaleOutCode" /> <camunda:out source="errorText" target="errorText" /> @@ -255,7 +257,7 @@ exceptionUtil.processJavaException(execution)]]></bpmn2:script> <camunda:out source="failedActivity" target="failedActivity" /> <camunda:in source="CVFMI_vfModuleId" target="vfModuleId" /> </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_020dbkp</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_09i6f7t</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_1tk5ru7</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:sequenceFlow id="SequenceFlow_1crl7uf" sourceRef="ServiceTask_1" targetRef="UpdateInfraRequestResponseCheck" /> @@ -287,7 +289,7 @@ exceptionUtil.processJavaException(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_020dbkp</bpmn2:outgoing> <bpmn2:outgoing>SequenceFlow_0u8zesf</bpmn2:outgoing> </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_020dbkp" name="yes" sourceRef="ExclusiveGateway_0c8x2mq" targetRef="CallActivity_17ukiqm"> + <bpmn2:sequenceFlow id="SequenceFlow_020dbkp" name="yes" sourceRef="ExclusiveGateway_0c8x2mq" targetRef="Task_09om99x"> <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[execution.getVariable("runConfigScaleOut")]]></bpmn2:conditionExpression> </bpmn2:sequenceFlow> <bpmn2:sequenceFlow id="SequenceFlow_0u8zesf" name="no" sourceRef="ExclusiveGateway_0c8x2mq" targetRef="PrepareMSOCompletionHandler" /> @@ -299,6 +301,14 @@ exceptionUtil.processJavaException(execution)]]></bpmn2:script> def createVfModule = new CreateVfModuleInfra() createVfModule.queryAAIForVnfOrchestrationStatus(execution)]]></bpmn2:script> </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_09i6f7t" sourceRef="Task_09om99x" targetRef="CallActivity_17ukiqm" /> + <bpmn2:scriptTask id="Task_09om99x" name="Retreive Data for Config ScaleOut" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_020dbkp</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_09i6f7t</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def createVfModule = new CreateVfModuleInfra() +createVfModule.retreiveConfigScaleOutData(execution)]]></bpmn2:script> + </bpmn2:scriptTask> </bpmn2:process> <bpmn2:error id="Error_1" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_2" name="REST Fault" errorCode="RESTFault" /> @@ -582,7 +592,7 @@ createVfModule.queryAAIForVnfOrchestrationStatus(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_17ukiqm_di" bpmnElement="CallActivity_17ukiqm"> - <dc:Bounds x="472" y="189" width="145" height="80" /> + <dc:Bounds x="472" y="120" width="145" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1crl7uf_di" bpmnElement="SequenceFlow_1crl7uf"> <di:waypoint xsi:type="dc:Point" x="377" y="367" /> @@ -592,36 +602,36 @@ createVfModule.queryAAIForVnfOrchestrationStatus(execution)]]></bpmn2:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_1hncvjy_di" bpmnElement="ExclusiveGateway_1hncvjy" isMarkerVisible="true"> - <dc:Bounds x="675" y="204" width="50" height="50" /> + <dc:Bounds x="675" y="135" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="657" y="170" width="86" height="24" /> + <dc:Bounds x="659" y="101" width="82" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1tk5ru7_di" bpmnElement="SequenceFlow_1tk5ru7"> - <di:waypoint xsi:type="dc:Point" x="617" y="229" /> - <di:waypoint xsi:type="dc:Point" x="675" y="229" /> + <di:waypoint xsi:type="dc:Point" x="617" y="160" /> + <di:waypoint xsi:type="dc:Point" x="675" y="160" /> <bpmndi:BPMNLabel> - <dc:Bounds x="601" y="208" width="90" height="12" /> + <dc:Bounds x="601" y="139" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0td7d9m_di" bpmnElement="SequenceFlow_0td7d9m"> - <di:waypoint xsi:type="dc:Point" x="700" y="254" /> - <di:waypoint xsi:type="dc:Point" x="701" y="327" /> + <di:waypoint xsi:type="dc:Point" x="700" y="185" /> + <di:waypoint xsi:type="dc:Point" x="702" y="327" /> <bpmndi:BPMNLabel> - <dc:Bounds x="706.5002014596164" y="260.46992001430345" width="15" height="12" /> + <dc:Bounds x="708" y="122" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="EndEvent_0a97jcr_di" bpmnElement="EndEvent_0a97jcr"> - <dc:Bounds x="773" y="211" width="36" height="36" /> + <dc:Bounds x="773" y="142" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="701" y="252" width="90" height="12" /> + <dc:Bounds x="701" y="183" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0h5cld9_di" bpmnElement="SequenceFlow_0h5cld9"> - <di:waypoint xsi:type="dc:Point" x="725" y="229" /> - <di:waypoint xsi:type="dc:Point" x="773" y="229" /> + <di:waypoint xsi:type="dc:Point" x="725" y="160" /> + <di:waypoint xsi:type="dc:Point" x="773" y="160" /> <bpmndi:BPMNLabel> - <dc:Bounds x="729" y="235" width="20" height="12" /> + <dc:Bounds x="730" y="166" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ExclusiveGateway_1qozral_di" bpmnElement="ExclusiveGateway_1qozral" isMarkerVisible="true"> @@ -652,9 +662,9 @@ createVfModule.queryAAIForVnfOrchestrationStatus(execution)]]></bpmn2:script> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_020dbkp_di" bpmnElement="SequenceFlow_020dbkp"> <di:waypoint xsi:type="dc:Point" x="545" y="342" /> - <di:waypoint xsi:type="dc:Point" x="545" y="269" /> + <di:waypoint xsi:type="dc:Point" x="545" y="309" /> <bpmndi:BPMNLabel> - <dc:Bounds x="550" y="307" width="20" height="12" /> + <dc:Bounds x="515" y="321.9537912405942" width="18" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0u8zesf_di" bpmnElement="SequenceFlow_0u8zesf"> @@ -674,6 +684,16 @@ createVfModule.queryAAIForVnfOrchestrationStatus(execution)]]></bpmn2:script> <bpmndi:BPMNShape id="ScriptTask_19vqej7_di" bpmnElement="Task_1o3z68c"> <dc:Bounds x="460" y="-6" width="100" height="80" /> </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_09i6f7t_di" bpmnElement="SequenceFlow_09i6f7t"> + <di:waypoint xsi:type="dc:Point" x="545" y="229" /> + <di:waypoint xsi:type="dc:Point" x="545" y="200" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="560" y="208.5" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1s0bky7_di" bpmnElement="Task_09om99x"> + <dc:Bounds x="495" y="229" width="100" height="80" /> + </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn index 675b8fadb5..8cbc7e97cd 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateVnfAndModules.bpmn @@ -40,6 +40,7 @@ doCreateVnfAndModules.preProcessRequest(execution)]]></bpmn:script> <camunda:in source="tenantId" target="tenantId" /> <camunda:in source="false" target="usePreload" /> <camunda:in source="aLaCarte" target="aLaCarte" /> + <camunda:in source="RegionOne_flavorList" target="RegionOne_flavorList" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1hf7k7q</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1ixcnb6</bpmn:outgoing> @@ -127,6 +128,7 @@ doCreateVnfAndModules.validateAddOnModule(execution)]]></bpmn:script> <camunda:in source="tenantId" target="tenantId" /> <camunda:in source="rollbackData" target="rollbackData" /> <camunda:in source="vnfResourceDecomposition" target="vnfResourceDecomposition" /> + <camunda:in source="RegionOne_flavorList" target="RegionOne_flavorList" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_19ohb1a</bpmn:incoming> <bpmn:outgoing>SequenceFlow_07u8e3l</bpmn:outgoing> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn index 35cd0399cf..41c9a674ed 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn @@ -156,17 +156,17 @@ csi.postConfigRequest(execution)]]></bpmn2:script> <bpmn2:scriptTask id="ScriptTask_1awrp72" name="Pre Process Exception" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_05j3sat</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_19ly8h7</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def dcsi = new DoCreateResources()
-dcsi.preProcessRollback(execution)
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoUpdateE2EServiceInstance() +dcsi.preProcessRollback(execution) ]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:scriptTask id="ScriptTask_0vc9jgo" name="Post Process Exception" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_19ly8h7</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_02znk15</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
-def dcsi = new DoCreateResources()
-dcsi.postProcessRollback(execution)
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoUpdateE2EServiceInstance() +dcsi.postProcessRollback(execution) ]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:sequenceFlow id="SequenceFlow_05j3sat" sourceRef="StartEvent_06768u3" targetRef="ScriptTask_1awrp72" /> diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy index 5b5a70006a..c301b65c41 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCustomDeleteE2EServiceInstanceTest.groovy @@ -1,6 +1,7 @@ package org.openecomp.mso.bpmn.infrastructure.scripts import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity import org.junit.Before import org.junit.BeforeClass @@ -8,18 +9,14 @@ import org.junit.Ignore import org.junit.Rule import org.junit.Test import org.mockito.MockitoAnnotations -import org.openecomp.mso.bpmn.infrastructure.scripts.DoCustomDeleteE2EServiceInstance import org.openecomp.mso.bpmn.mock.FileUtil import org.openecomp.mso.bpmn.vcpe.scripts.GroovyTestBase +import static org.assertj.core.api.Assertions.assertThatThrownBy +import static org.mockito.Matchers.anyString import static org.mockito.Mockito.verify import static org.mockito.Mockito.when -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when -import static org.mockito.Mockito.when +import static org.mockito.Mockito.eq class DoCustomDeleteE2EServiceInstanceTest extends GroovyTestBase { @@ -58,9 +55,8 @@ class DoCustomDeleteE2EServiceInstanceTest extends GroovyTestBase { verify(mex).setVariable("siParamsXml", "") } - @Ignore @Test - public void postProcessAAIGETTest(){ + public void postProcessAAIGETSuccessTest(){ ExecutionEntity mex = setupMock() def map = setupMap(mex) initPreProcess(mex) @@ -70,11 +66,22 @@ class DoCustomDeleteE2EServiceInstanceTest extends GroovyTestBase { when(mex.getVariable("GENGS_service")).thenReturn(aaiGetResponse) DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() instance.postProcessAAIGET(mex) - // TODO: what to test here? -// verify(mex).setVariable("subscriptionServiceType", "e2eserviceInstance/delete") + + verify(mex).setVariable(eq("serviceRelationShip"), anyString()) + } + + @Test + public void postProcessAAIGETFailureTest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + when(mex.getVariable("GENGS_FoundIndicator")).thenReturn(false) + when(mex.getVariable("GENGS_SuccessIndicator")).thenReturn(false) + + DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() + assertThatThrownBy { instance.postProcessAAIGET(mex) } isInstanceOf BpmnError.class } - @Ignore @Test public void preInitResourcesOperStatusTest(){ ExecutionEntity mex = setupMock() @@ -83,8 +90,8 @@ class DoCustomDeleteE2EServiceInstanceTest extends GroovyTestBase { when(mex.getVariable("serviceRelationShip")).thenReturn("[{\"resourceInstanceId\":\"3333\",\"resourceType\":\"overlay\"},{\"resourceInstanceId\":\"4444\",\"resourceType\":\"underlay\"},{\"resourceInstanceId\":\"1111\",\"resourceType\":\"vIMS\"},{\"resourceInstanceId\":\"222\",\"resourceType\":\"vEPC\"}]") DoCustomDeleteE2EServiceInstance instance = new DoCustomDeleteE2EServiceInstance() instance.preInitResourcesOperStatus(mex) - // TODO: what to test here? -// verify(mex).setVariable("CVFMI_dbAdapterEndpoint", "http://localhost:8080/mso") + + verify(mex).setVariable(eq("CVFMI_initResOperStatusRequest"), anyString()) } @Test @@ -98,7 +105,6 @@ class DoCustomDeleteE2EServiceInstanceTest extends GroovyTestBase { verify(mex).setVariable("resourceType", "overlay") } - @Ignore @Test public void postProcessSDNCDeleteTest(){ ExecutionEntity mex = setupMock() @@ -111,8 +117,7 @@ class DoCustomDeleteE2EServiceInstanceTest extends GroovyTestBase { String response = FileUtil.readResourceFile("__files/GenericFlows/SDNCDeleteResponse.xml") String method = "deleteE2E"; instance.postProcessSDNCDelete(mex, response, method) - // TODO: what to test here? -// verify(mex).setVariable("DDELSI_sdncRequestDataResponseCode", "0") + // following method doesn't do anything currently -> nothing to check } @Test diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy index e7ffe05424..063f4b571b 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy @@ -89,7 +89,6 @@ class SacleCustomE2EServiceInstanceTest{ <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb"> <serviceId>56c881ad-6c9d-4b79-aacc-401e5640b47f</serviceId> <operationId>0a5b1651-c56e-4263-8c26-c8f8a6ef72d8</operationId> - <serviceName>XXXX</serviceName> <operationType>SCALE</operationType> <userId></userId> <result>processing</result> @@ -163,7 +162,7 @@ class SacleCustomE2EServiceInstanceTest{ ExecutionEntity mockExecution = mock(ExecutionEntity.class) when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") - when(mockExecution.getVariable("serviceInstanceName")).thenReturn("XXXX") + //when(mockExecution.getVariable("serviceInstanceName")).thenReturn("XXXX") when(mockExecution.getVariable("operationId")).thenReturn("0a5b1651-c56e-4263-8c26-c8f8a6ef72d8") ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance() diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy index a735121002..a8401d7a02 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy @@ -469,7 +469,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { verify(mex).setVariable("createTXCAR", true) verify(mex).setVariable("allottedResourceModelInfoTXC", "modelB") verify(mex).setVariable("allottedResourceRoleTXC", "TXCr") - verify(mex).setVariable("allottedResourceTypeTXC", "TunnelXConn") + verify(mex).setVariable("allottedResourceTypeTXC", "Tunnel XConn") verify(mex).setVariable("parentServiceInstanceIdTXC", "homeB") } @@ -489,7 +489,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { verify(mex, never()).setVariable("createTXCAR", true) verify(mex, never()).setVariable("allottedResourceModelInfoTXC", "modelB") verify(mex, never()).setVariable("allottedResourceRoleTXC", "TXCr") - verify(mex, never()).setVariable("allottedResourceTypeTXC", "TunnelXConn") + verify(mex, never()).setVariable("allottedResourceTypeTXC", "Tunnel XConn") verify(mex, never()).setVariable("parentServiceInstanceIdTXC", "homeB") } @@ -1087,7 +1087,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { private ServiceDecomposition initFilterVnfs(ExecutionEntity mex) { List<VnfResource> vnflst = new LinkedList<>() vnflst.add(makeVnf("", "BRG")) - vnflst.add(makeVnf("2", "TunnelXConn")) + vnflst.add(makeVnf("2", "Tunnel XConn")) vnflst.add(makeVnf("3", "")) vnflst.add(makeVnf("4", "BRG")) vnflst.add(makeVnf("5", "other")) @@ -1149,7 +1149,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { HomingSolution home = mock(HomingSolution.class) when(ar.toJsonStringNoRootName()).thenReturn("json"+id) - when(ar.getAllottedResourceType()).thenReturn("TunnelXConn") + when(ar.getAllottedResourceType()).thenReturn("Tunnel XConn") when(ar.getModelInfo()).thenReturn(mod) when(ar.getAllottedResourceRole()).thenReturn("TXCr") when(ar.getHomingSolution()).thenReturn(home) @@ -1186,7 +1186,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { vnflst.add(makeVnf("A", "BRG")) vnflst.add(makeVnf("B", "")) vnflst.add(makeVnf("C", "")) - vnflst.add(makeVnf("D", "TunnelXConn")) + vnflst.add(makeVnf("D", "Tunnel XConn")) when(mex.getVariable(DBGFLAG)).thenReturn("true") when(mex.getVariable("createVcpeServiceRequest")).thenReturn(request) diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml index bb7f4c20fd..f2063442d6 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/arGetById.xml @@ -1,9 +1,9 @@ <allotted-resource xmlns="http://org.openecomp.aai.inventory/v9"> <id>ar-1</id> <orchestration-status>Active</orchestration-status> - <role>TunnelXConn</role> - <type>TunnelXConn</type> - <description>TunnelXConn</description> + <role>Tunnel XConn</role> + <type>Tunnel XConn</type> + <description>Tunnel XConn</description> <selflink/> <resource-version>1490627351232</resource-version> <relationship-list> diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json index 81fdcc76d0..e99dd9ccda 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/getCatalogServiceResourcesData.json @@ -63,8 +63,8 @@ "modelInstanceName" : "Pri_IP_MUX_Demux 1" }, "toscaNodeType" : null, - "allottedResourceType" : "TunnelXConn", - "allottedResourceRole" : "TunnelXConn", + "allottedResourceType" : "Tunnel XConn", + "allottedResourceRole" : "Tunnel XConn", "providingServiceModelInvariantUuid" : null, "nfFunction" : null, "nfType" : null, diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml index 65cee9f662..97992fc00b 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DeleteVcpeResCustService/arGetTXCById.xml @@ -1,9 +1,9 @@ <allotted-resource xmlns="http://org.openecomp.aai.inventory/v9"> <id>ar-txcA</id> <orchestration-status>Active</orchestration-status> - <role>TunnelXConn</role> - <type>TunnelXConn</type> - <description>TunnelXConn</description> + <role>Tunnel XConn</role> + <type>Tunnel XConn</type> + <description>Tunnel XConn</description> <selflink/> <resource-version>1490627351232</resource-version> <relationship-list> diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml index bb7f4c20fd..f2063442d6 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoCreateAllottedResourceTXCRollback/arGetById.xml @@ -1,9 +1,9 @@ <allotted-resource xmlns="http://org.openecomp.aai.inventory/v9"> <id>ar-1</id> <orchestration-status>Active</orchestration-status> - <role>TunnelXConn</role> - <type>TunnelXConn</type> - <description>TunnelXConn</description> + <role>Tunnel XConn</role> + <type>Tunnel XConn</type> + <description>Tunnel XConn</description> <selflink/> <resource-version>1490627351232</resource-version> <relationship-list> diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml index bb7f4c20fd..f2063442d6 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/DoDeleteAllottedResourceTXC/arGetById.xml @@ -1,9 +1,9 @@ <allotted-resource xmlns="http://org.openecomp.aai.inventory/v9"> <id>ar-1</id> <orchestration-status>Active</orchestration-status> - <role>TunnelXConn</role> - <type>TunnelXConn</type> - <description>TunnelXConn</description> + <role>Tunnel XConn</role> + <type>Tunnel XConn</type> + <description>Tunnel XConn</description> <selflink/> <resource-version>1490627351232</resource-version> <relationship-list> diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.urn.properties b/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.urn.properties index fc84d9ea85..6dac08dc56 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.urn.properties +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/mso.bpmn.urn.properties @@ -114,10 +114,10 @@ policy.environment=TEST policy.endpoint=http://localhost:28090/pdp/api/
policy.default.disposition=Skip
-appc.client.topic.read=APPC-CL-FUSION-LCM-RESPONSE
-appc.client.topic.write=APPC-CL-FUSION-LCM
-appc.client.topic.sdnc.read=SDNC-LCM-READ
-appc.client.topic.sdnc.write=SDNC-LCM-WRITE
+appc.client.topic.read=APPC-LCM-WRITE
+appc.client.topic.write=APPC-LCM-READ
+appc.client.topic.sdnc.read=SDNC-LCM-WRITE
+appc.client.topic.sdnc.write=SDNC-LCM-READ
appc.client.topic.read.timeout=100
appc.client.response.timeout=300
appc.client.poolMembers=localhost:28090
diff --git a/common/pom.xml b/common/pom.xml index aa3b09597a..86b9f36e50 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -123,12 +123,12 @@ <dependency> <groupId>org.onap.appc.client</groupId> <artifactId>client-kit</artifactId> - <version>1.3.0-SNAPSHOT</version> + <version>1.3.0</version> </dependency> <dependency> <groupId>org.onap.appc.client</groupId> <artifactId>client-lib</artifactId> - <version>1.3.0-SNAPSHOT</version> + <version>1.3.0</version> </dependency> <dependency> <groupId>org.springframework</groupId> diff --git a/docs/Install_Docker.rst b/docs/Install_Docker.rst index 5712691dbf..22a76a4fbf 100644 --- a/docs/Install_Docker.rst +++ b/docs/Install_Docker.rst @@ -1,6 +1,6 @@ .. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
-.. Copyright 2017 Huawei Technologies Co., Ltd.
+.. Copyright 2018 Huawei Technologies Co., Ltd.
Install Docker
===============
diff --git a/docs/SO_R1_Interface.rst b/docs/SO_Interface.rst index bd654083e3..15e75fa8c6 100644 --- a/docs/SO_R1_Interface.rst +++ b/docs/SO_Interface.rst @@ -1,11 +1,11 @@ .. This work is licensed under a Creative Commons Attribution 4.0 International License. .. http://creativecommons.org/licenses/by/4.0 -.. Copyright 2017 Huawei Technologies Co., Ltd. +.. Copyright 2018 Huawei Technologies Co., Ltd. SO Interfaces ================================ -.. image:: images/SO_R1_1.png +.. image:: images/SO_1.png SO APIs ================================= @@ -1771,33 +1771,65 @@ Service Object +------------------------------+-----------------+------------------------------------+ |Attribute |Content |Description | +==============================+=================+====================================+ -|modelName |String |Service instance name. | +|name |String |Service instance name. | +------------------------------+-----------------+------------------------------------+ |description |String |Service instance description | +------------------------------+-----------------+------------------------------------+ -|modelUUID |String |Model UUID | +|serviceUuid |String |Model UUID | +------------------------------+-----------------+------------------------------------+ -|modelInvariantUUID |String |Model Invariant UUID | +|serviceInvariantUuid |String |Model Invariant UUID | +------------------------------+-----------------+------------------------------------+ -|created |Timestamp |Cretaed Timestamp | +|gloabalSubscriberId |String |Customer Id | +------------------------------+-----------------+------------------------------------+ -|toscaCsarArtifactUUID |String |tosca Csar Artifact UUID | +|serviceType |String |service Type | +------------------------------+-----------------+------------------------------------+ -|modelVersion |String |Model Version | +|parameters |Object |Parameter Object | +------------------------------+-----------------+------------------------------------+ -|category |String |category | + +Parameter Object + +------------------------------+-----------------+------------------------------------+ -|serviceType |String |service Type | +|Attribute |Content |Description | ++==============================+=================+====================================+ +|locationConstraints |List of object |location infor for each vnf | ++------------------------------+-----------------+------------------------------------+ +|resource |List of Resource |resource of service/resource | ++------------------------------+-----------------+------------------------------------+ +|requestInputs |key-value map |input of service/resource ++------------------------------+-----------------+------------------------------------+ + +LocationConstraint Object + ++------------------------------+-----------------+------------------------------------+ +|Attribute |Content |Description | ++==============================+=================+====================================+ +|vnfProfileId |String |Customization id for VNF | ++------------------------------+-----------------+------------------------------------+ +|locationConstraints |Object |DC location info of VNF | +------------------------------+-----------------+------------------------------------+ -|serviceRole |String |service Role | + +VnfLocationConstraint Object + ++------------------------------+-----------------+------------------------------------+ +|Attribute |Content |Description | ++==============================+=================+====================================+ +|vimId |String |VIM id from ESR definition | ++------------------------------+-----------------+------------------------------------+ + +Resource Object + ++------------------------------+-----------------+------------------------------------+ +|Attribute |Content |Description | ++==============================+=================+====================================+ +|resourceName |String |The resource name | +------------------------------+-----------------+------------------------------------+ -|environmentContext |String |environment Context | +|resourceInvariantUuid |String |The resource invariant UUID. | +------------------------------+-----------------+------------------------------------+ -|workloadContext |String |workload Context | +|resourceUuid |String |The resource UUID. | +------------------------------+-----------------+------------------------------------+ -|recipes |Object |recipes | +|resourceCustomizationUuid |String |The resource customization UUID. | +------------------------------+-----------------+------------------------------------+ -|serviceResourceCustomizations |Object |serviceResourceCustomizations | +|parameters |Object |Parameter of resource | +------------------------------+-----------------+------------------------------------+ Response: @@ -4257,4 +4289,191 @@ HTTP Response Code: |401 |Unauthorized | +------------------+---------------------+ |500 |Error | -+------------------+---------------------+
\ No newline at end of file ++------------------+---------------------+ + + +OOF/HAS create update API ++++++++++++++++++++++++++ + ++--------------------+--------------------------+ +|Interface Definition|Description | ++====================+==========================+ +|URI |/api/oof/v1/placement | ++--------------------+--------------------------+ +|Operation Type |POST | ++--------------------+--------------------------+ + + +Request Parameters: + ++-------------------+---------+-----------+-------+-------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content|Description | ++===================+=========+===========+=======+=============================================================+ +|requestInfo |Y |1 |Object |The content of the RequestInfo object. | ++-------------------+---------+-----------+-------+-------------------------------------------------------------+ +|placementInfo |Y |1 |Object |The Content of the PlacementInfo object. | ++-------------------+---------+-----------+-------+-------------------------------------------------------------+ +|licenseInfo |N |1 |Object |The Content of the LicenseInfo object. | ++-------------------+---------+-----------+-------+-------------------------------------------------------------+ +|serviceInfo |Y |1 |Object |The Content of the ServiceInfo object. | ++-------------------+---------+-----------+-------+-------------------------------------------------------------+ + + ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content|Description | ++===================+=========+===========+=======+=======================================================================+ +|transactionId |Y |1 |String |A unique ID to track an ONAP transaction. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|requestId |Y |1 |String |A unique ID to track multiple requests. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|callbackUrl |Y |1 |String |The end point of a callback service where recommendations are posted. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|callbackHeader |N |1 |String |The header information a client expecting in a async callback. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|sourceId |Y |1 |String |The unique ID of a client making an optimization call. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|requestType |Y |1 |String |The type of a request | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|numSolutions |N |1 |Integer|Expected number of solutions. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|optimizers |Y |1..N |List of Strings|A list of optimization services. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|timeout |N |1 |Integer|A tolerance window (in secs) for expecting solutions. Default is 600 secs.| ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ + + +PlacementInfo Object + ++-------------------+---------+-----------+-------+-------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content|Description | ++===================+=========+===========+=======+=============================================================+ +|requestParameters |C |1 |String |A JSON object conaining service and customer-specific data. A client or service designer is required to specify the parameters of interest for a given service and their location in the JSON blob through optimization query policies. This attribute is only required if a request contains service or customer-specific information.| ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|placementDemands |Y |1..N |List of PlacementDemand Object|The resource information for a placement service.| ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|subscriberInfo |N |1 |Object |The information of a service subscriber. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ + +PlacementDemand Object + ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content|Description | ++===================+=========+===========+=======+=======================================================================+ +|resourceModuleName |Y |1 |String |A resource name as defined in a service model. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|serviceResourceId |Y |1 |String |A unique resource Id with a local scope between client and OOF. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|tenantId |N |1 |String |A tenant Id as defined in the ordering system. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|resourceModelInfo |Y |1 |Object |Resource model information as defined in SDC. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|existingCandidates |N |1..N |List of Candidates Objects | The existing placement information of a resource. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|excludedCandidates |N |1..N |List of Candidates Objects |Candidates that need to be excluded from solutions.| ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|requiredCandidates |N |1..N |List of Candidates Objects |Candidates that must be included in solutions. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ + + +SubscriberInfo Object + ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content|Description | ++===================+=========+===========+=======+=======================================================================+ +|globalSubscriberId |Y |1 |String |An ID of a subscriber. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|subscriberName |Y |1.N |String |The name of a subscriber. If the name is not known, the value must be 'unknown'.| ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|subscriberCommonSiteId |N |1 |String |Id representing a subscriber location. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ + +ModelMetaData Object + ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content|Description | ++===================+=========+===========+=======+=======================================================================+ +|modelInvariantId |Y |1 |String |A model invariant Id as defined in a service model. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|modelVersionId |Y |1 |String |A unique model Id as defined in a service model. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|modelName |N |1 |String |A model name as defined in a service model. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|modelType |N |1 |String |A model type as defined in a service model. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|modelVersion |N |1 |String |A model version as defined in a service model. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|modelCustomizationName |N |1 |String |A model customization name as defined in a service model. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ + + +Candidates Object + ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content|Description | ++===================+=========+===========+=======+=======================================================================+ +|identifierType |Y |1 |String |The type of a candidate. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|identifiers |Y |1..N |List |A list of identifiers. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|cloudOwner |C |1 |String |The name of a cloud owner. Only required if identifierType is cloud_region_id.| ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ + + +ServiceInfo Object + ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content|Description | ++===================+=========+===========+=======+=======================================================================+ +|serviceInstanceId |Y |1 |String |A service instance id associated with a request. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|modelInfo |Y |1 |ModelMetaData Object |A list of identifiers. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|serviceName |Y |1 |String |The name of a service | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ + +LicenseInfo Object + ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content|Description | ++===================+=========+===========+=======+=======================================================================+ +|licenseDemands |Y |1..N |List of LicenseDemands Object |A list of resources for license selection. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ + +LicenseDemand Object + ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content|Description | ++===================+=========+===========+=======+=======================================================================+ +|resourceModuleName |Y |1 |String |A resource name as defined in a service model. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|serviceResourceId |Y |1 |String |A unique resource Id with a local scope between client and OOF. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|resourceModelInfo |Y |1 |ModelMetaData Object |Resource model information as defined in a service model.| ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|existingLicenses |N |1 |LicenseModel Object |Existing license information assigned to a resource. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ + +LicenseModel Object + ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content|Description | ++===================+=========+===========+=======+=======================================================================+ +|entitlementPoolUUID|Y |1..N |List |Entitlement pool UUIDs associated with a resource. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|licenseKeyGroupUUID|Y |1..N |List |License key groups associated with a resource. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ + + +Response Body + ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|Attribute |Required |Cardinality|Content|Description | ++===================+=========+===========+=======+=======================================================================+ +|requestId |Y |1 |String |A unique Id for an ONAP transaction. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|transactionId |Y |1 |String |A unique ID to track multiple requests associated with a transaction. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|statusMessage |N |1 |String |Reasoning if a requestStatus is failed. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+ +|requestStatus |Y |1 |String |The status of a request. | ++-------------------+---------+-----------+-------+-----------------------------------------------------------------------+
\ No newline at end of file diff --git a/docs/images/SO_1.png b/docs/images/SO_1.png Binary files differnew file mode 100644 index 0000000000..8e477acc46 --- /dev/null +++ b/docs/images/SO_1.png diff --git a/docs/images/SO_Architecture_1.png b/docs/images/SO_Architecture_1.png Binary files differindex a50c01bdd9..53836ffd8c 100644 --- a/docs/images/SO_Architecture_1.png +++ b/docs/images/SO_Architecture_1.png diff --git a/docs/images/SO_R1_1.png b/docs/images/SO_R1_1.png Binary files differdeleted file mode 100644 index 06d9eb3727..0000000000 --- a/docs/images/SO_R1_1.png +++ /dev/null diff --git a/docs/index.rst b/docs/index.rst index 9fd4cc3f97..86b6447017 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,6 +1,6 @@ .. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
-.. Copyright 2017 Huawei Technologies Co., Ltd.
+.. Copyright 2018 Huawei Technologies Co., Ltd.
ONAP SO
========================================
diff --git a/docs/installation.rst b/docs/installation.rst index 07f534e1b3..cde26e021a 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -1,7 +1,7 @@ -.. _open_cli_schema_version_1_0: +.. _onap_so_schema_version_2_0: .. This work is licensed under a Creative Commons Attribution 4.0 International License. .. http://creativecommons.org/licenses/by/4.0 -.. Copyright 2017 Huawei Technologies Co., Ltd. +.. Copyright 2018 Huawei Technologies Co., Ltd. Install and Configure Service Orchestrator ========================================== diff --git a/docs/offered_consumed_apis.rst b/docs/offered_consumed_apis.rst index 8888c6437e..f18b5bdd60 100644 --- a/docs/offered_consumed_apis.rst +++ b/docs/offered_consumed_apis.rst @@ -1,6 +1,6 @@ .. This work is licensed under a Creative Commons Attribution 4.0 International License.
.. http://creativecommons.org/licenses/by/4.0
-.. Copyright 2017 Huawei Technologies Co., Ltd.
+.. Copyright 2018 Huawei Technologies Co., Ltd.
SO Offered and Consumed APIs
=====================================
@@ -12,4 +12,4 @@ All the Service Orchestrator APIs, both inward and outward are documented in the .. toctree::
:maxdepth: 1
- SO_R1_Interface.rst
+ SO_Interface.rst
diff --git a/docs/release-notes.rst b/docs/release-notes.rst index f05f9ce938..b27b2a3eca 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -1,6 +1,6 @@ .. This work is licensed under a Creative Commons Attribution 4.0 International License. .. http://creativecommons.org/licenses/by/4.0 -.. Copyright 2017 Huawei Intellectual Property. All rights reserved. +.. Copyright 2018 Huawei Intellectual Property. All rights reserved. Service Orchestrator Release Notes @@ -11,11 +11,12 @@ The SO provides the highest level of service orchestration in the ONAP architect Version: 1.2.2 -------------- -:Release Date: 2018-05-24 +:Release Date: 2018-06-07 The Beijing release is the second release of the Service Orchestrator (SO) project. **New Features** + * Enhance Platform maturity by improving CLAMP maturity matrix see `Wiki <https://wiki.onap.org/display/DW/Beijing+Release+Platform+Maturity>`_. * Manual scaling of network services and VNFs. * Homing and placement capabiliities through OOF interaction. @@ -24,20 +25,30 @@ The Beijing release is the second release of the Service Orchestrator (SO) proje * Integrated to OOF * Integrated to OOM -Bug Fixes ---------- -The defects fixed in this release could be found `here<https://jira.onap.org/issues/?jql=project%20%3D%20SO%20AND%20affectedVersion%20%3D%20%22Beijing%20Release%22%20AND%20status%20%3D%20Closed%20>`_. +**Bug Fixes** + + The defects fixed in this release could be found `here <https://jira.onap.org/issues/?jql=project%20%3D%20SO%20AND%20affectedVersion%20%3D%20%22Beijing%20Release%22%20AND%20status%20%3D%20Closed%20>`_. **Known Issues** - -**Security Issues** -SO CII Badging details can be found `here<https://bestpractices.coreinfrastructure.org/en/projects/1702>`_. -The remaining security issues and their workarounds are captured `here <https://wiki.onap.org/pages/viewpage.action?pageId=28377799>`_. + + SO docker image is still on ecmop and not onap in the repository. + This will be addressed in the next release. + +**Security Notes** + + SO code has been formally scanned during build time using NexusIQ and all Critical vulnerabilities have been addressed, items that remain open have been assessed for risk and determined to be false positive. The SO open Critical security vulnerabilities and their risk assessment have been documented as part of the `project <https://wiki.onap.org/pages/viewpage.action?pageId=28377799>`_. + +Quick Links: + +- `SO project page <https://wiki.onap.org/display/DW/Service+Orchestrator+Project>`_ +- `Passing Badge information for SO <https://bestpractices.coreinfrastructure.org/en/projects/1702>`_ +- `Project Vulnerability Review Table for SO <https://wiki.onap.org/pages/viewpage.action?pageId=28377799>`_ **Upgrade Notes** + NA **Deprecation Notes** - + NA Version: 1.1.2 -------------- @@ -93,6 +104,7 @@ Following are the deprecated SO projects in gerrit repo: - mso/mso-config **Other** + NA =========== diff --git a/mso-api-handlers/mso-api-handler-common/pom.xml b/mso-api-handlers/mso-api-handler-common/pom.xml index 5b15c5f0d4..6ca1f3de28 100644 --- a/mso-api-handlers/mso-api-handler-common/pom.xml +++ b/mso-api-handlers/mso-api-handler-common/pom.xml @@ -50,6 +50,12 @@ <artifactId>mso-requests-db</artifactId> <version>${project.version}</version> </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <version>3.10.0</version> + <scope>test</scope> + </dependency> </dependencies> <build> diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java index faa669133f..9f30e67897 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/camundabeans/CamundaVIDRequest.java @@ -34,7 +34,7 @@ import com.fasterxml.jackson.annotation.JsonRootName; CommonConstants.REQUEST_ID_HEADER, CommonConstants.IS_BASE_VF_MODULE_VARIABLE, CommonConstants.RECIPE_TIMEOUT_VARIABLE, CommonConstants.REQUEST_ACTION_VARIABLE, CommonConstants.SERVICE_INSTANCE_ID_VARIABLE, - CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE, + CommonConstants.CORRELATION_ID, CommonConstants.VNF_ID_VARIABLE, CommonConstants.VF_MODULE_ID_VARIABLE, CommonConstants.VOLUME_GROUP_ID_VARIABLE, CommonConstants.NETWORK_ID_VARIABLE, CommonConstants.CONFIGURATION_ID_VARIABLE, CommonConstants.SERVICE_TYPE_VARIABLE, CommonConstants.VNF_TYPE_VARIABLE, CommonConstants.VF_MODULE_TYPE_VARIABLE, @@ -55,7 +55,6 @@ public class CamundaVIDRequest { @JsonProperty(CommonConstants.REQUEST_ID_HEADER) private CamundaInput msoRequestId; - @JsonProperty(CommonConstants.IS_BASE_VF_MODULE_VARIABLE) private CamundaBooleanInput isBaseVfModule; @@ -68,6 +67,9 @@ public class CamundaVIDRequest { @JsonProperty(CommonConstants.SERVICE_INSTANCE_ID_VARIABLE) private CamundaInput serviceInstanceId; + @JsonProperty(CommonConstants.CORRELATION_ID) + private CamundaInput correlationId; + @JsonProperty(CommonConstants.VNF_ID_VARIABLE) private CamundaInput vnfId; @@ -177,6 +179,16 @@ public class CamundaVIDRequest { this.serviceInstanceId = serviceInstanceId; } + @JsonProperty(CommonConstants.CORRELATION_ID) + public CamundaInput getCorrelationId() { + return correlationId; + } + + @JsonProperty(CommonConstants.CORRELATION_ID) + public void setCorrelationId(CamundaInput correlationId) { + this.correlationId = correlationId; + } + @JsonProperty(CommonConstants.VNF_ID_VARIABLE) public CamundaInput getVnfId() { return vnfId; diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java index 1a086ac35c..85fe52f24c 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/BPELRestClient.java @@ -85,14 +85,10 @@ public class BPELRestClient extends RequestClient { } @Override - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, String serviceInstanceId, - String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, - String serviceType, String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater params) { return null; } - + @Override public HttpResponse get() { return null; diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java index 9cc89530c4..c0cfdf9bec 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaClient.java @@ -20,13 +20,12 @@ package org.openecomp.mso.apihandler.common; - import java.io.IOException; import javax.xml.bind.DatatypeConverter; +import org.apache.commons.lang3.StringUtils; import org.apache.http.HttpResponse; -import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.openecomp.mso.apihandler.camundabeans.CamundaBooleanInput; @@ -51,8 +50,7 @@ public class CamundaClient extends RequestClient{ @Override public HttpResponse post(String camundaReqXML, String requestId, - String requestTimeout, String schemaVersion, String serviceInstanceId, String action) - throws ClientProtocolException, IOException{ + String requestTimeout, String schemaVersion, String serviceInstanceId, String action) throws IOException { HttpPost post = new HttpPost(url); msoLogger.debug(CAMUNDA_URL_MESAGE + url); String jsonReq = wrapRequest(camundaReqXML, requestId, serviceInstanceId, requestTimeout, schemaVersion); @@ -77,7 +75,7 @@ public class CamundaClient extends RequestClient{ } @Override - public HttpResponse post(String jsonReq) throws ClientProtocolException, IOException{ + public HttpResponse post(String jsonReq) throws IOException { HttpPost post = new HttpPost(url); msoLogger.debug(CAMUNDA_URL_MESAGE + url); @@ -102,21 +100,13 @@ public class CamundaClient extends RequestClient{ } @Override - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, String serviceInstanceId, - String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, - String serviceType, String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) - throws ClientProtocolException, IOException{ + public HttpResponse post(RequestClientParamater params) throws IOException { HttpPost post = new HttpPost(url); msoLogger.debug(CAMUNDA_URL_MESAGE + url); - String jsonReq = wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction, - serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, configurationId, - serviceType, vnfType, vfModuleType, networkType, requestDetails, recipeParamXsd); + String jsonReq = wrapVIDRequest(params); StringEntity input = new StringEntity(jsonReq); input.setContentType(CommonConstants.CONTENT_TYPE_JSON); - String encryptedCredentials; if(props!=null){ encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null); @@ -128,12 +118,10 @@ public class CamundaClient extends RequestClient{ } } } - post.setEntity(input); - return client.execute(post); } - + @Override public HttpResponse get() { return null; @@ -150,8 +138,6 @@ public class CamundaClient extends RequestClient{ if(schemaVersion == null){ schemaVersion = ""; } - - try{ CamundaRequest camundaRequest = new CamundaRequest(); CamundaInput camundaInput = new CamundaInput(); @@ -183,52 +169,8 @@ public class CamundaClient extends RequestClient{ return jsonReq; } - private String wrapVIDRequest(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, String serviceInstanceId, - String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, - String serviceType, String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParams){ + private String wrapVIDRequest(RequestClientParamater requestClientParamater) { String jsonReq = null; - if(requestId == null){ - requestId =""; - } - if(requestAction == null){ - requestAction =""; - } - if(serviceInstanceId == null){ - serviceInstanceId =""; - } - if(vnfId == null){ - vnfId =""; - } - if(vfModuleId == null){ - vfModuleId =""; - } - if(volumeGroupId == null){ - volumeGroupId =""; - } - if(networkId == null){ - networkId =""; - } - if(configurationId == null){ - configurationId =""; - } - if(serviceType == null){ - serviceType =""; - } - if(vnfType == null){ - vnfType =""; - } - if(vfModuleType == null){ - vfModuleType =""; - } - if(networkType == null){ - networkType =""; - } - if(requestDetails == null){ - requestDetails =""; - } - try{ CamundaVIDRequest camundaRequest = new CamundaVIDRequest(); CamundaInput serviceInput = new CamundaInput(); @@ -238,6 +180,7 @@ public class CamundaClient extends RequestClient{ CamundaIntegerInput recipeTimeoutInput = new CamundaIntegerInput(); CamundaInput requestActionInput = new CamundaInput(); CamundaInput serviceInstanceIdInput = new CamundaInput(); + CamundaInput correlationIdInput = new CamundaInput(); CamundaInput vnfIdInput = new CamundaInput(); CamundaInput vfModuleIdInput = new CamundaInput(); CamundaInput volumeGroupIdInput = new CamundaInput(); @@ -249,22 +192,23 @@ public class CamundaClient extends RequestClient{ CamundaInput networkTypeInput = new CamundaInput(); CamundaInput recipeParamsInput = new CamundaInput(); host.setValue(parseURL()); - requestIdInput.setValue(requestId); - isBaseVfModuleInput.setValue(isBaseVfModule); - recipeTimeoutInput.setValue(recipeTimeout); - requestActionInput.setValue(requestAction); - serviceInstanceIdInput.setValue(serviceInstanceId); - vnfIdInput.setValue(vnfId); - vfModuleIdInput.setValue(vfModuleId); - volumeGroupIdInput.setValue(volumeGroupId); - networkIdInput.setValue(networkId); - configurationIdInput.setValue(configurationId); - serviceTypeInput.setValue(serviceType); - vnfTypeInput.setValue(vnfType); - vfModuleTypeInput.setValue(vfModuleType); - networkTypeInput.setValue(networkType); - recipeParamsInput.setValue(recipeParams); - serviceInput.setValue(requestDetails); + requestIdInput.setValue(StringUtils.defaultString(requestClientParamater.getRequestId())); + isBaseVfModuleInput.setValue(requestClientParamater.isBaseVfModule()); + recipeTimeoutInput.setValue(requestClientParamater.getRecipeTimeout()); + requestActionInput.setValue(StringUtils.defaultString(requestClientParamater.getRequestAction())); + serviceInstanceIdInput.setValue(StringUtils.defaultString(requestClientParamater.getServiceInstanceId())); + correlationIdInput.setValue(StringUtils.defaultString(requestClientParamater.getCorrelationId())); + vnfIdInput.setValue(StringUtils.defaultString(requestClientParamater.getVnfId())); + vfModuleIdInput.setValue(StringUtils.defaultString(requestClientParamater.getVfModuleId())); + volumeGroupIdInput.setValue(StringUtils.defaultString(requestClientParamater.getVolumeGroupId())); + networkIdInput.setValue(StringUtils.defaultString(requestClientParamater.getNetworkId())); + configurationIdInput.setValue(StringUtils.defaultString(requestClientParamater.getConfigurationId())); + serviceTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getServiceType())); + vnfTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getVnfType())); + vfModuleTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getVfModuleType())); + networkTypeInput.setValue(StringUtils.defaultString(requestClientParamater.getNetworkType())); + recipeParamsInput.setValue(requestClientParamater.getRecipeParamXsd()); + serviceInput.setValue(StringUtils.defaultString(requestClientParamater.getRequestDetails())); camundaRequest.setServiceInput(serviceInput); camundaRequest.setHost(host); camundaRequest.setRequestId(requestIdInput); @@ -273,6 +217,7 @@ public class CamundaClient extends RequestClient{ camundaRequest.setRecipeTimeout(recipeTimeoutInput); camundaRequest.setRequestAction(requestActionInput); camundaRequest.setServiceInstanceId(serviceInstanceIdInput); + camundaRequest.setCorrelationId(correlationIdInput); camundaRequest.setVnfId(vnfIdInput); camundaRequest.setVfModuleId(vfModuleIdInput); camundaRequest.setVolumeGroupId(volumeGroupIdInput); @@ -306,5 +251,4 @@ public class CamundaClient extends RequestClient{ return host; } - } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java index 3941e1e5af..cbbbff3dff 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CamundaTaskClient.java @@ -25,7 +25,6 @@ import java.io.IOException; import javax.xml.bind.DatatypeConverter;
import org.apache.http.HttpResponse;
-import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
@@ -39,8 +38,7 @@ public class CamundaTaskClient extends RequestClient{ }
@Override
- public HttpResponse post(String jsonReq)
- throws ClientProtocolException, IOException{
+ public HttpResponse post(String jsonReq) throws IOException{
HttpPost post = new HttpPost(url);
msoLogger.debug("Camunda Task url is: "+ url);
@@ -65,27 +63,19 @@ public class CamundaTaskClient extends RequestClient{ @Override
public HttpResponse post(String camundaReqXML, String requestId,
- String requestTimeout, String schemaVersion, String serviceInstanceId, String action)
- throws ClientProtocolException, IOException{
- msoLogger.debug("Method not supported");
- return null;
+ String requestTimeout, String schemaVersion, String serviceInstanceId, String action) {
+ throw new UnsupportedOperationException("Method not supported.");
}
-
+
@Override
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd)
- throws ClientProtocolException, IOException{
- msoLogger.debug("Method not supported");
- return null;
+ public HttpResponse post(RequestClientParamater params) {
+ throw new UnsupportedOperationException("Method not supported.");
}
-
+
@Override
- public HttpResponse get() throws ClientProtocolException, IOException{
+ public HttpResponse get() throws IOException {
HttpGet get = new HttpGet(url);
- msoLogger.debug("Camunda Task url is: "+ url);
+ msoLogger.debug("Camunda Task url is: "+ url);
String encryptedCredentials;
if(props!=null){
encryptedCredentials = props.getProperty(CommonConstants.CAMUNDA_AUTH,null);
@@ -97,7 +87,6 @@ public class CamundaTaskClient extends RequestClient{ }
}
}
-
return client.execute(get);
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java index 4dac998527..daa411a963 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/CommonConstants.java @@ -25,13 +25,11 @@ public final class CommonConstants { public static final String DEFAULT_BPEL_AUTH = "admin:admin"; public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; - public static final String REQUEST_ID_HEADER = "mso-request-id"; public static final String REQUEST_TIMEOUT_HEADER = "mso-service-request-timeout"; public static final String SCHEMA_VERSION_HEADER = "mso-schema-version"; public static final String SERVICE_INSTANCE_ID_HEADER = "mso-service-instance-id"; public static final String ACTION_HEADER = "mso-action"; - public static final String CAMUNDA_SERVICE_INPUT = "bpmnRequest"; public static final String CAMUNDA_ROOT_INPUT = "variables"; public static final String CONTENT_TYPE_JSON= "application/json"; @@ -47,13 +45,12 @@ public final class CommonConstants { public static final int CAMUNDA = 1; public static final int CAMUNDATASK = 2; public static final String CAMUNDA_HOST = "host"; - public static final String SDNC_UUID_HEADER = "mso-sdnc-request-id"; - public static final String REQUEST_ID_VARIABLE = "requestId"; public static final String IS_BASE_VF_MODULE_VARIABLE = "isBaseVfModule"; public static final String RECIPE_TIMEOUT_VARIABLE = "recipeTimeout"; public static final String REQUEST_ACTION_VARIABLE = "requestAction"; public static final String SERVICE_INSTANCE_ID_VARIABLE = "serviceInstanceId"; + public static final String CORRELATION_ID = "correlationId"; public static final String VNF_ID_VARIABLE = "vnfId"; public static final String VF_MODULE_ID_VARIABLE = "vfModuleId"; public static final String VOLUME_GROUP_ID_VARIABLE = "volumeGroupId"; diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java index d702a63fda..66369a8b69 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClient.java @@ -24,7 +24,6 @@ import java.io.IOException; import java.security.GeneralSecurityException; import org.apache.http.HttpResponse; -import org.apache.http.client.ClientProtocolException; import org.apache.http.client.HttpClient; import org.openecomp.mso.logger.MsoLogger; import org.openecomp.mso.properties.MsoJavaProperties; @@ -65,19 +64,13 @@ public abstract class RequestClient { this.client = client; } - public abstract HttpResponse post(String request, String requestId, String requestTimeout, String schemaVersion, String serviceInstanceId, String action) throws ClientProtocolException, IOException; + public abstract HttpResponse post(String request, String requestId, String requestTimeout, String schemaVersion, String serviceInstanceId, String action) throws IOException; - public abstract HttpResponse post(String request) throws ClientProtocolException, IOException; - - public abstract HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, String serviceInstanceId, - String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, - String serviceType, String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) - throws ClientProtocolException, IOException; + public abstract HttpResponse post(String request) throws IOException; + + public abstract HttpResponse post(RequestClientParamater params) throws IOException; - public abstract HttpResponse get() - throws ClientProtocolException, IOException; + public abstract HttpResponse get() throws IOException; protected String getEncryptedPropValue (String prop, String defaultValue, String encryptionKey) { try { diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientParamater.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientParamater.java new file mode 100644 index 0000000000..4db69199da --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/openecomp/mso/apihandler/common/RequestClientParamater.java @@ -0,0 +1,242 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.apihandler.common; + +public class RequestClientParamater { + + private String requestId; + private boolean isBaseVfModule; + private int recipeTimeout; + private String requestAction; + private String serviceInstanceId; + private String correlationId; + private String vnfId; + private String vfModuleId; + private String volumeGroupId; + private String networkId; + private String configurationId; + private String serviceType; + private String vnfType; + private String vfModuleType; + private String networkType; + private String requestDetails; + private String recipeParamXsd; + + private RequestClientParamater(Builder builder) { + requestId = builder.requestId; + isBaseVfModule = builder.isBaseVfModule; + recipeTimeout = builder.recipeTimeout; + requestAction = builder.requestAction; + serviceInstanceId = builder.serviceInstanceId; + correlationId = builder.correlationId; + vnfId = builder.vnfId; + vfModuleId = builder.vfModuleId; + volumeGroupId = builder.volumeGroupId; + networkId = builder.networkId; + configurationId = builder.configurationId; + serviceType = builder.serviceType; + vnfType = builder.vnfType; + vfModuleType = builder.vfModuleType; + networkType = builder.networkType; + requestDetails = builder.requestDetails; + recipeParamXsd = builder.recipeParamXsd; + } + + public String getRequestId() { + return requestId; + } + + public boolean isBaseVfModule() { + return isBaseVfModule; + } + + public int getRecipeTimeout() { + return recipeTimeout; + } + + public String getRequestAction() { + return requestAction; + } + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public String getCorrelationId() { + return correlationId; + } + + public String getVnfId() { + return vnfId; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public String getVolumeGroupId() { + return volumeGroupId; + } + + public String getNetworkId() { + return networkId; + } + + public String getConfigurationId() { + return configurationId; + } + + public String getServiceType() { + return serviceType; + } + + public String getVnfType() { + return vnfType; + } + + public String getVfModuleType() { + return vfModuleType; + } + + public String getNetworkType() { + return networkType; + } + + public String getRequestDetails() { + return requestDetails; + } + + public String getRecipeParamXsd() { + return recipeParamXsd; + } + + public static class Builder { + private String requestId; + private boolean isBaseVfModule; + private int recipeTimeout; + private String requestAction; + private String serviceInstanceId; + private String correlationId; + private String vnfId; + private String vfModuleId; + private String volumeGroupId; + private String networkId; + private String configurationId; + private String serviceType; + private String vnfType; + private String vfModuleType; + private String networkType; + private String requestDetails; + private String recipeParamXsd; + + public Builder setRequestId(String requestId) { + this.requestId = requestId; + return this; + } + + public Builder setBaseVfModule(boolean baseVfModule) { + isBaseVfModule = baseVfModule; + return this; + } + + public Builder setRecipeTimeout(int recipeTimeout) { + this.recipeTimeout = recipeTimeout; + return this; + } + + public Builder setRequestAction(String requestAction) { + this.requestAction = requestAction; + return this; + } + + public Builder setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + return this; + } + + public Builder setCorrelationId(String correlationId) { + this.correlationId = correlationId; + return this; + } + + public Builder setVnfId(String vnfId) { + this.vnfId = vnfId; + return this; + } + + public Builder setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + return this; + } + + public Builder setVolumeGroupId(String volumeGroupId) { + this.volumeGroupId = volumeGroupId; + return this; + } + + public Builder setNetworkId(String networkId) { + this.networkId = networkId; + return this; + } + + public Builder setConfigurationId(String configurationId) { + this.configurationId = configurationId; + return this; + } + + public Builder setServiceType(String serviceType) { + this.serviceType = serviceType; + return this; + } + + public Builder setVnfType(String vnfType) { + this.vnfType = vnfType; + return this; + } + + public Builder setVfModuleType(String vfModuleType) { + this.vfModuleType = vfModuleType; + return this; + } + + public Builder setNetworkType(String networkType) { + this.networkType = networkType; + return this; + } + + public Builder setRequestDetails(String requestDetails) { + this.requestDetails = requestDetails; + return this; + } + + public Builder setRecipeParamXsd(String recipeParamXsd) { + this.recipeParamXsd = recipeParamXsd; + return this; + } + + public RequestClientParamater build(){ + return new RequestClientParamater(this); + } + } + + +} diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/apihandler/common/CamundaTaskClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/apihandler/common/CamundaTaskClientTest.java new file mode 100644 index 0000000000..f892d13599 --- /dev/null +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/apihandler/common/CamundaTaskClientTest.java @@ -0,0 +1,132 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.apihandler.common; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import org.apache.http.HttpEntity; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpRequestBase; +import org.junit.Before; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.openecomp.mso.properties.MsoJavaProperties; + +public class CamundaTaskClientTest { + + private CamundaTaskClient testedObject = new CamundaTaskClient(); + private HttpClient httpClientMock; + private static final String JSON_REQUEST = "{\"value1\": \"aaa\",\"value2\": \"bbb\"}"; + private static final String URL_SCHEMA = "http"; + private static final String HOST = "testhost"; + private static final int PORT = 1234; + private static final String URL_PATH = "/requestMethodSuccessful"; + private static final String URL = URL_SCHEMA + "://" + HOST + ":" + PORT + URL_PATH; + private static final String AUTHORIZATION_HEADER_NAME = "Authorization"; + + @Before + public void init() { + testedObject = new CamundaTaskClient(); + httpClientMock = mock(HttpClient.class); + testedObject.setClient(httpClientMock); + testedObject.setUrl(URL); + } + + @Test + public void postMethodSuccessful() throws IOException { + ArgumentCaptor<HttpPost> httpPostCaptor = ArgumentCaptor.forClass(HttpPost.class); + testedObject.post(JSON_REQUEST); + verify(httpClientMock).execute(httpPostCaptor.capture()); + checkUri(httpPostCaptor.getValue()); + assertThat(httpPostCaptor.getValue().getEntity().getContentType().getValue()). + isEqualTo(CommonConstants.CONTENT_TYPE_JSON); + assertThat(getJsonFromEntity(httpPostCaptor.getValue().getEntity())).isEqualTo(JSON_REQUEST); + } + + @Test + public void postMethodSuccessfulWithCredentials() throws IOException { + ArgumentCaptor<HttpPost> httpPostCaptor = ArgumentCaptor.forClass(HttpPost.class); + testedObject.setProps(createMsoJavaProperties()); + testedObject.post(JSON_REQUEST); + verify(httpClientMock).execute(httpPostCaptor.capture()); + assertThat(httpPostCaptor.getValue().getHeaders(AUTHORIZATION_HEADER_NAME)).isNotEmpty(); + } + + @Test + public void getMethodSuccessful() throws IOException { + ArgumentCaptor<HttpGet> httpGetCaptor = ArgumentCaptor.forClass(HttpGet.class); + testedObject.get(); + verify(httpClientMock).execute(httpGetCaptor.capture()); + checkUri(httpGetCaptor.getValue()); + } + + @Test + public void getMethodSuccessfulWithCredentials() throws IOException { + ArgumentCaptor<HttpGet> httpGetCaptor = ArgumentCaptor.forClass(HttpGet.class); + testedObject.setUrl(URL); + testedObject.setProps(createMsoJavaProperties()); + testedObject.get(); + verify(httpClientMock).execute(httpGetCaptor.capture()); + assertThat(httpGetCaptor.getValue().getHeaders(AUTHORIZATION_HEADER_NAME)).isNotEmpty(); + } + + @Test(expected = UnsupportedOperationException.class) + public void postMethodUnsupported() { + testedObject.post("", "", "", "", "", ""); + } + + @Test(expected = UnsupportedOperationException.class) + public void postMethodUnsupported2() { + testedObject.post(new RequestClientParamater.Builder().build()); + } + + private void checkUri(HttpRequestBase httpRequestBase) { + assertThat(httpRequestBase.getURI().getScheme()).isEqualTo(URL_SCHEMA); + assertThat(httpRequestBase.getURI().getHost()).isEqualTo(HOST); + assertThat(httpRequestBase.getURI().getPort()).isEqualTo(PORT); + assertThat(httpRequestBase.getURI().getPath()).isEqualTo(URL_PATH); + } + + private MsoJavaProperties createMsoJavaProperties() { + MsoJavaProperties msoJavaProperties = new MsoJavaProperties(); + msoJavaProperties.setProperty(CommonConstants.CAMUNDA_AUTH, ""); + return msoJavaProperties; + } + + private String getJsonFromEntity(HttpEntity httpEntity) throws IOException { + BufferedReader rd = new BufferedReader( + new InputStreamReader(httpEntity.getContent())); + StringBuilder result = new StringBuilder(); + String line; + while ((line = rd.readLine()) != null) { + result.append(line); + } + return result.toString(); + } + +}
\ No newline at end of file diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java index 8bfc4ced76..69927e2126 100644 --- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java +++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/openecomp/mso/camunda/tests/CamundaClientTest.java @@ -24,7 +24,6 @@ package org.openecomp.mso.camunda.tests; import static org.junit.Assert.assertEquals; import java.io.IOException; -import java.util.UUID; import org.apache.http.HttpResponse; import org.apache.http.HttpStatus; @@ -42,12 +41,9 @@ import org.mockito.MockitoAnnotations; import org.openecomp.mso.apihandler.common.CommonConstants; import org.openecomp.mso.apihandler.common.RequestClient; import org.openecomp.mso.apihandler.common.RequestClientFactory; +import org.openecomp.mso.apihandler.common.RequestClientParamater; import org.openecomp.mso.properties.MsoJavaProperties; -import com.fasterxml.jackson.core.JsonGenerationException; -import com.fasterxml.jackson.databind.JsonMappingException; - - /** * This class implements test methods of Camunda Beans. * @@ -66,8 +62,7 @@ public class CamundaClientTest { } @Test - public void tesCamundaPost() throws JsonGenerationException, - JsonMappingException, IOException { + public void tesCamundaPost() throws IOException { String responseBody ="{\"links\":[{\"method\":\"GET\",\"href\":\"http://localhost:9080/engine-rest/process-instance/2047c658-37ae-11e5-9505-7a1020524153\",\"rel\":\"self\"}],\"id\":\"2047c658-37ae-11e5-9505-7a1020524153\",\"definitionId\":\"dummy:10:73298961-37ad-11e5-9505-7a1020524153\",\"businessKey\":null,\"caseInstanceId\":null,\"ended\":true,\"suspended\":false}"; HttpResponse mockResponse = createResponse(200, responseBody); @@ -106,8 +101,6 @@ public class CamundaClientTest { mockHttpClient = Mockito.mock(HttpClient.class); Mockito.when(mockHttpClient.execute(Mockito.any(HttpPost.class))) .thenReturn(mockResponse); - - String reqXML = "<xml>test</xml>"; String orchestrationURI = "/engine-rest/process-definition/key/dummy/start"; MsoJavaProperties props = new MsoJavaProperties(); @@ -115,9 +108,7 @@ public class CamundaClientTest { RequestClient requestClient = RequestClientFactory.getRequestClient(orchestrationURI, props); requestClient.setClient(mockHttpClient); - HttpResponse response = requestClient.post("mso-req-id", false, 180, - "createInstance", "svc-inst-id", "vnf-id", "vf-module-id", "vg-id", "nw-id", "conf-id", "svc-type", - "vnf-type", "vf-module-type", "nw-type", "", ""); + HttpResponse response = requestClient.post(createParams()); assertEquals(requestClient.getType(), CommonConstants.CAMUNDA); assertEquals(response.getStatusLine().getStatusCode(), HttpStatus.SC_OK); } @@ -137,6 +128,15 @@ public class CamundaClientTest { return response; } + private RequestClientParamater createParams(){ + return new RequestClientParamater.Builder().setRequestId("mso-req-id").setBaseVfModule(false). + setRecipeTimeout(180).setRequestAction("createInstance").setServiceInstanceId("svc-inst-id"). + setVnfId("vnf-id").setVfModuleId("vf-module-id").setVolumeGroupId("vg-id").setNetworkId("nw-id"). + setConfigurationId("conf-id").setServiceType("svc-type").setVnfType("vnf-type"). + setVfModuleType("vf-module-type").setNetworkType("nw-type").setRequestDetails(""). + setRecipeParamXsd("").build(); + } + diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java index 23adafd08e..275351d55d 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstances.java @@ -43,6 +43,7 @@ import org.json.JSONObject; import org.openecomp.mso.apihandler.common.ErrorNumbers; import org.openecomp.mso.apihandler.common.RequestClient; import org.openecomp.mso.apihandler.common.RequestClientFactory; +import org.openecomp.mso.apihandler.common.RequestClientParamater; import org.openecomp.mso.apihandler.common.ResponseHandler; import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.CompareModelsRequest; import org.openecomp.mso.apihandlerinfra.e2eserviceinstancebeans.E2EServiceInstanceDeleteRequest; @@ -82,8 +83,6 @@ public class E2EServiceInstances { private ServiceInstancesRequest sir = null; public static final String END_OF_THE_TRANSACTION = "End of the transaction, the final response is: "; - public static final String EXCEPTION_CREATING_DB_RECORD = "Exception while creating record in DB"; - public static final String EXCEPTION_COMMUNICATE_BPMN_ENGINE = "Exception while communicate with BPMN engine"; /** * POST Requests for E2E Service create Instance on a version provided @@ -216,10 +215,7 @@ public class E2EServiceInstances { return response; } - Response returnResp = runCompareModelBPMWorkflow(e2eCompareModelReq, msoRequest, requestJSON, requestId, - startTime, action); - - return returnResp; + return runCompareModelBPMWorkflow(e2eCompareModelReq, msoRequest, requestJSON, requestId, startTime, action); } @@ -228,7 +224,6 @@ public class E2EServiceInstances { // Define RecipeLookupResult info here instead of query DB for efficiency String workflowUrl = "/mso/async/services/CompareModelofE2EServiceInstance"; - int recipeTimeout = 180; RequestClient requestClient = null; HttpResponse response = null; @@ -239,14 +234,15 @@ public class E2EServiceInstances { requestClient = RequestClientFactory.getRequestClient(workflowUrl, MsoPropertiesUtils.loadMsoProperties()); JSONObject jjo = new JSONObject(requestJSON); - String bpmnRequest = jjo.toString(); // Capture audit event msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); - String serviceId = instanceIdMap.get("serviceId"); - String serviceType = e2eCompareModelReq.getServiceType(); - response = requestClient.post(requestId, false, recipeTimeout, action.name(), serviceId, null, null, null, - null, null, serviceType, null, null, null, bpmnRequest, null); + RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId). + setBaseVfModule(false).setRecipeTimeout(180).setRequestAction(action.name()). + setServiceInstanceId(instanceIdMap.get("serviceId")).setServiceType(e2eCompareModelReq.getServiceType()). + setRequestDetails(jjo.toString()).build(); + + response = requestClient.post(requestClientParamater); msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", workflowUrl, null); @@ -280,8 +276,6 @@ public class E2EServiceInstances { ResponseHandler respHandler = new ResponseHandler(response, requestClient.getType()); int bpelStatus = respHandler.getStatus(); - // String responseBody = respHandler.getResponseBody(); - // CompareModelsResult modelDiffResponse = new CompareModelsResult(); return beplStatusUpdate(requestId, startTime, msoRequest, requestClient, respHandler, bpelStatus, action, instanceIdMap); @@ -440,8 +434,6 @@ public class E2EServiceInstances { HttpResponse response = null; long subStartTime = System.currentTimeMillis(); - // String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON); - try { requestClient = RequestClientFactory.getRequestClient( recipeLookupResult.getOrchestrationURI(), @@ -449,19 +441,17 @@ public class E2EServiceInstances { JSONObject jjo = new JSONObject(requestJSON); jjo.put("operationId", UUIDChecker.generateUUID(msoLogger)); - - String bpmnRequest = jjo.toString(); - // Capture audit event msoLogger .debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); - String serviceId = instanceIdMap.get("serviceId"); - String serviceInstanceType = e2eDelReq.getServiceType(); - response = requestClient.post(requestId, false, - recipeLookupResult.getRecipeTimeout(), action.name(), - serviceId, null, null, null, null, null, serviceInstanceType, - null, null, null, bpmnRequest, recipeLookupResult.getRecipeParamXsd()); + + RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId). + setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()). + setRequestAction(action.name()).setServiceInstanceId(instanceIdMap.get("serviceId")). + setServiceType(e2eDelReq.getServiceType()).setRequestDetails(jjo.toString()). + setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build(); + response = requestClient.post(requestClientParamater); msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, @@ -564,12 +554,6 @@ public class E2EServiceInstances { return response; } - //check for the current operation status -// Response resp = checkE2ESvcInstStatus(action, serviceId, startTime, msoRequest); -// if(resp != null && resp.getStatus() != 200) { -// return resp; -// } - CatalogDatabase db = null; RecipeLookupResult recipeLookupResult = null; try { @@ -615,18 +599,19 @@ public class E2EServiceInstances { HttpResponse response = null; long subStartTime = System.currentTimeMillis(); - String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON); - try { requestClient = RequestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI(), MsoPropertiesUtils.loadMsoProperties()); // Capture audit event msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); + RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId). + setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name()). + setServiceInstanceId(serviceId).setServiceType(serviceInstanceType). + setRequestDetails(mapReqJsonToSvcInstReq(e2eSir, requestJSON)). + setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build(); - response = requestClient.post(requestId, false, recipeLookupResult.getRecipeTimeout(), action.name(), - serviceId, null, null, null, null, null, serviceInstanceType, null, null, null, sirRequestJson, - recipeLookupResult.getRecipeParamXsd()); + response = requestClient.post(requestClientParamater); msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(), @@ -752,25 +737,23 @@ public class E2EServiceInstances { return response; } - String serviceInstanceType = e2eSir.getService().getServiceType(); - - String serviceId = ""; RequestClient requestClient = null; HttpResponse response = null; long subStartTime = System.currentTimeMillis(); - String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON); - try { requestClient = RequestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI(), MsoPropertiesUtils.loadMsoProperties()); // Capture audit event msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); + RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId). + setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name()). + setServiceInstanceId("").setServiceType(e2eSir.getService().getServiceType()). + setRequestDetails(mapReqJsonToSvcInstReq(e2eSir, requestJSON)). + setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build(); - response = requestClient.post(requestId, false, recipeLookupResult.getRecipeTimeout(), action.name(), - serviceId, null, null, null, null, null, serviceInstanceType, null, null, null, sirRequestJson, - recipeLookupResult.getRecipeParamXsd()); + response = requestClient.post(requestClientParamater); msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(), @@ -897,8 +880,6 @@ public class E2EServiceInstances { HttpResponse response = null; long subStartTime = System.currentTimeMillis(); - // String sirRequestJson = mapReqJsonToSvcInstReq(e2eSir, requestJSON); - try { requestClient = RequestClientFactory.getRequestClient( recipeLookupResult.getOrchestrationURI(), @@ -907,18 +888,18 @@ public class E2EServiceInstances { JSONObject jjo = new JSONObject(requestJSON); jjo.put("operationId", UUIDChecker.generateUUID(msoLogger)); - String bpmnRequest = jjo.toString(); - // Capture audit event msoLogger .debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); - String serviceId = instanceIdMap.get("serviceId"); - String serviceInstanceType = e2eScaleReq.getService().getServiceType(); - response = requestClient.post(requestId, false, - recipeLookupResult.getRecipeTimeout(), action.name(), - serviceId, null, null, null, null, null, serviceInstanceType, - null, null, null, bpmnRequest, recipeLookupResult.getRecipeParamXsd()); + RequestClientParamater requestClientParamater = new RequestClientParamater.Builder().setRequestId(requestId). + setBaseVfModule(false).setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.name()). + setServiceInstanceId(instanceIdMap.get("serviceId")). + setServiceType(e2eScaleReq.getService().getServiceType()). + setRequestDetails(jjo.toString()). + setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build(); + + response = requestClient.post(requestClientParamater); msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java index 2f2ef313f4..3f6cc35432 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/MsoRequest.java @@ -85,7 +85,6 @@ public class MsoRequest { private String requestId; private String requestXML; - private String requestJSON; private String requestUri; private VnfRequest vnfReq; private RequestInfo requestInfo; @@ -118,8 +117,6 @@ public class MsoRequest { private OwningEntity owningEntity; private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH); - private static final String NOT_PROVIDED = "not provided"; - protected AbstractSessionFactoryManager requestsDbSessionFactoryManager = new RequestsDbSessionFactoryManager (); MsoRequest (String requestId) { @@ -1153,7 +1150,7 @@ public class MsoRequest { mapper.setSerializationInclusion(Include.NON_NULL); //mapper.configure(Feature.WRAP_ROOT_VALUE, true); msoLogger.debug ("building sir from object " + sir); - requestJSON = mapper.writeValueAsString(sir); + String requestJSON = mapper.writeValueAsString(sir); // Perform mapping from VID-style modelInfo fields to ASDC-style modelInfo fields diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java index e16963db3b..581ad34939 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/openecomp/mso/apihandlerinfra/ServiceInstances.java @@ -20,6 +20,7 @@ */ package org.openecomp.mso.apihandlerinfra; +import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -42,6 +43,7 @@ import org.openecomp.mso.apihandler.common.CommonConstants; import org.openecomp.mso.apihandler.common.ErrorNumbers; import org.openecomp.mso.apihandler.common.RequestClient; import org.openecomp.mso.apihandler.common.RequestClientFactory; +import org.openecomp.mso.apihandler.common.RequestClientParamater; import org.openecomp.mso.apihandler.common.ResponseHandler; import org.openecomp.mso.apihandler.common.ValidationException; import org.openecomp.mso.serviceinstancebeans.ModelInfo; @@ -690,37 +692,7 @@ public class ServiceInstances { } db.close(); - - String serviceInstanceId = ""; - String vnfId = ""; - String vfModuleId = ""; - String volumeGroupId = ""; - String networkId = ""; - ServiceInstancesRequest siReq = msoRequest.getServiceInstancesRequest(); - - if(siReq.getServiceInstanceId () != null){ - serviceInstanceId = siReq.getServiceInstanceId (); - } - - if(siReq.getVnfInstanceId () != null){ - vnfId = siReq.getVnfInstanceId (); - } - - if(siReq.getVfModuleInstanceId () != null){ - vfModuleId = siReq.getVfModuleInstanceId (); - } - - if(siReq.getVolumeGroupInstanceId () != null){ - volumeGroupId = siReq.getVolumeGroupInstanceId (); - } - - if(siReq.getNetworkInstanceId () != null){ - networkId = siReq.getNetworkInstanceId (); - } - - - requestId = msoRequest.getRequestId (); - msoLogger.debug ("requestId is: " + requestId); + msoLogger.debug ("requestId is: " + msoRequest.getRequestId()); msoLogger.debug ("About to insert a record"); try { @@ -736,15 +708,32 @@ public class ServiceInstances { return response; } - return postBPELRequest(action, requestId, startTime, msoRequest, recipeLookupResult.getOrchestrationURI(), recipeLookupResult.getRecipeTimeout(), - isBaseVfModule, serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, null, - msoRequest.getServiceInstanceType(), msoRequest.getVnfType(), msoRequest.getVfModuleType(), msoRequest.getNetworkType()); + return postBPELRequest(action, startTime, msoRequest, recipeLookupResult.getOrchestrationURI(), + recipeLookupResult.getRecipeTimeout(), isBaseVfModule); } - private Response postBPELRequest(Action action, String requestId, long startTime, MsoRequest msoRequest, - String orchestrationUri, int timeOut, Boolean isBaseVfModule, - String serviceInstanceId, String vnfId, String vfModuleId, String volumeGroupId, String networkId, - String configurationId, String serviceInstanceType, String vnfType, String vfModuleType, String networkType) { + private RequestClientParamater buildRequestClientParameter(MsoRequest msoRequest, boolean isBaseVfModule, + int timeOut, String requestAction) throws IOException { + return new RequestClientParamater.Builder(). + setRequestId(msoRequest.getRequestId()). + setBaseVfModule(isBaseVfModule).setRecipeTimeout(timeOut). + setRequestAction(requestAction). + setServiceInstanceId(msoRequest.getServiceInstancesRequest().getServiceInstanceId()). + setCorrelationId(msoRequest.getServiceInstancesRequest().getCorrelationId()). + setVnfId(msoRequest.getServiceInstancesRequest().getVnfInstanceId()). + setVfModuleId(msoRequest.getServiceInstancesRequest().getVfModuleInstanceId()). + setVolumeGroupId(msoRequest.getServiceInstancesRequest().getVolumeGroupInstanceId()). + setNetworkId(msoRequest.getServiceInstancesRequest().getNetworkInstanceId()). + setConfigurationId(msoRequest.getServiceInstancesRequest().getConfigurationId()). + setServiceType(msoRequest.getServiceInstanceType()). + setVnfType(msoRequest.getVnfType()). + setVfModuleType(msoRequest.getVfModuleType()). + setNetworkType(msoRequest.getNetworkType()). + setRequestDetails(msoRequest.getRequestJSON()).build(); + } + + private Response postBPELRequest(Action action, long startTime, MsoRequest msoRequest, + String orchestrationUri, int timeOut, Boolean isBaseVfModule) { RequestClient requestClient = null; HttpResponse response = null; long subStartTime = System.currentTimeMillis(); @@ -754,12 +743,7 @@ public class ServiceInstances { System.out.println("URL : " + requestClient.getUrl ()); - response = requestClient.post(requestId, isBaseVfModule, timeOut, action.name (), - serviceInstanceId, vnfId, vfModuleId, volumeGroupId, networkId, configurationId, - msoRequest.getServiceInstanceType (), - msoRequest.getVnfType (), msoRequest.getVfModuleType (), - msoRequest.getNetworkType (), msoRequest.getRequestJSON(), null); - + response = requestClient.post(buildRequestClientParameter(msoRequest, isBaseVfModule, timeOut, action.name())); msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from BPMN engine", "BPMN", orchestrationUri, null); } catch (Exception e) { msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", orchestrationUri, null); @@ -1191,7 +1175,6 @@ public class ServiceInstances { return new RecipeLookupResult (vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout()); } - private RecipeLookupResult getNetworkUri (CatalogDatabase db, MsoRequest msoRequest, Action action) throws Exception { String defaultNetworkType = msoRequest.getRequestInfo().getSource() + "_DEFAULT"; @@ -1299,18 +1282,6 @@ public class ServiceInstances { return response; } - - String serviceInstanceId = ""; - String configurationId = ""; - ServiceInstancesRequest siReq = msoRequest.getServiceInstancesRequest(); - - if(siReq.getServiceInstanceId () != null){ - serviceInstanceId = siReq.getServiceInstanceId (); - } - - if(siReq.getConfigurationId() != null){ - configurationId = siReq.getConfigurationId(); - } requestId = msoRequest.getRequestId (); msoLogger.debug ("requestId is: " + requestId); @@ -1328,7 +1299,6 @@ public class ServiceInstances { return response; } - return postBPELRequest(action, requestId, startTime, msoRequest, orchestrationUri, Integer.parseInt(timeOut), false, - serviceInstanceId, null, null, null, null, configurationId, null, null, null, null); + return postBPELRequest(action, startTime, msoRequest, orchestrationUri, Integer.parseInt(timeOut), false); } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java index 60ac6b98c9..901e03fc17 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/E2EServiceInstancesTest.java @@ -40,12 +40,12 @@ import org.junit.Test; import org.openecomp.mso.apihandler.common.CamundaClient; import org.openecomp.mso.apihandler.common.RequestClient; import org.openecomp.mso.apihandler.common.RequestClientFactory; +import org.openecomp.mso.apihandler.common.RequestClientParamater; import org.openecomp.mso.apihandler.common.ValidationException; import org.openecomp.mso.db.AbstractSessionFactoryManager; import org.openecomp.mso.db.catalog.CatalogDatabase; import org.openecomp.mso.db.catalog.beans.Service; import org.openecomp.mso.db.catalog.beans.ServiceRecipe; -import org.openecomp.mso.properties.MsoDatabaseException; import org.openecomp.mso.properties.MsoJavaProperties; import org.openecomp.mso.properties.MsoPropertiesFactory; import org.openecomp.mso.requestsdb.OperationStatus; @@ -194,12 +194,7 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 202, "test response"); @@ -258,12 +253,7 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 500, "test response"); @@ -323,12 +313,7 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 500, "test response"); @@ -388,12 +373,7 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { HttpResponse resp = null; return resp; } @@ -625,12 +605,7 @@ public class E2EServiceInstancesTest { final MockUp<CamundaClient> mockCmaundaClient = new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, String serviceInstanceId, - String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, - String serviceType, String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) - throws ClientProtocolException, IOException { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 200, "test response"); BasicHttpEntity entity = new BasicHttpEntity(); @@ -822,12 +797,7 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 202, "test response"); @@ -888,12 +858,7 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 202, "test response"); @@ -955,12 +920,7 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 202, "test response"); @@ -1027,12 +987,7 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 202, "test response"); @@ -1093,12 +1048,7 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 202, "test response"); @@ -1160,12 +1110,7 @@ public class E2EServiceInstancesTest { MockUp<CamundaClient> client = new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) throws Exception { + public HttpResponse post(RequestClientParamater requestClientParamater) throws Exception { throw new Exception(); } }; @@ -1192,13 +1137,7 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, String serviceInstanceId, - String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, - String serviceType, String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) - throws ClientProtocolException, IOException { - + public HttpResponse post(RequestClientParamater requestClientParamater) throws IOException { throw new ClientProtocolException(); } }; @@ -1216,13 +1155,7 @@ public class E2EServiceInstancesTest { new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, String serviceInstanceId, - String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId, - String serviceType, String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) - throws ClientProtocolException, IOException { - + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 202, "compareModelwithTargetVersion, test response"); @@ -1291,12 +1224,7 @@ public class E2EServiceInstancesTest { final MockUp<CamundaClient> mockCamundaClient = new MockUp<CamundaClient>() { @Mock - public HttpResponse post(String requestId, boolean isBaseVfModule, - int recipeTimeout, String requestAction, - String serviceInstanceId, String vnfId, String vfModuleId, - String volumeGroupId, String networkId, String configurationId, String serviceType, - String vnfType, String vfModuleType, String networkType, - String requestDetails, String recipeParamXsd) { + public HttpResponse post(RequestClientParamater requestClientParamater) { ProtocolVersion pv = new ProtocolVersion("HTTP", 1, 1); HttpResponse resp = new BasicHttpResponse(pv, 202, "test response"); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java index 50f00ef6a4..938a1038a4 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/openecomp/mso/apihandlerinfra/ServiceInstanceTest.java @@ -21,6 +21,16 @@ package org.openecomp.mso.apihandlerinfra;
+import static org.junit.Assert.assertTrue;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import javax.ws.rs.core.Response;
+import mockit.Mock;
+import mockit.MockUp;
import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
import org.apache.http.entity.BasicHttpEntity;
@@ -30,33 +40,23 @@ import org.hibernate.criterion.Order; import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
-
-import javax.ws.rs.core.Response;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-
import org.openecomp.mso.apihandler.common.CamundaClient;
import org.openecomp.mso.apihandler.common.RequestClient;
import org.openecomp.mso.apihandler.common.RequestClientFactory;
+import org.openecomp.mso.apihandler.common.RequestClientParamater;
import org.openecomp.mso.db.catalog.CatalogDatabase;
-import org.openecomp.mso.db.catalog.beans.*;
+import org.openecomp.mso.db.catalog.beans.Service;
+import org.openecomp.mso.db.catalog.beans.ServiceRecipe;
+import org.openecomp.mso.db.catalog.beans.VfModule;
+import org.openecomp.mso.db.catalog.beans.VfModuleCustomization;
+import org.openecomp.mso.db.catalog.beans.VnfComponentsRecipe;
+import org.openecomp.mso.db.catalog.beans.VnfRecipe;
+import org.openecomp.mso.db.catalog.beans.VnfResource;
import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesException;
import org.openecomp.mso.properties.MsoPropertiesFactory;
import org.openecomp.mso.requestsdb.InfraActiveRequests;
import org.openecomp.mso.requestsdb.RequestsDatabase;
-import mockit.Mock;
-import mockit.MockUp;
-
public class ServiceInstanceTest {
/*** Create Service Instance Test Cases ***/
@@ -225,11 +225,7 @@ public class ServiceInstanceTest { new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
+ public HttpResponse post(RequestClientParamater requestClientParamater) {
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
@@ -295,11 +291,7 @@ public class ServiceInstanceTest { new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
+ public HttpResponse post(RequestClientParamater requestClientParamater) {
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
@@ -366,11 +358,7 @@ public class ServiceInstanceTest { new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
+ public HttpResponse post(RequestClientParamater requestClientParamater) {
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,500, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
@@ -437,11 +425,7 @@ public class ServiceInstanceTest { new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
+ public HttpResponse post(RequestClientParamater requestClientParamater){
return null;
}
};
@@ -923,11 +907,7 @@ public class ServiceInstanceTest { new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
+ public HttpResponse post(RequestClientParamater requestClientParamater) {
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
@@ -1092,11 +1072,7 @@ public class ServiceInstanceTest { new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
+ public HttpResponse post(RequestClientParamater requestClientParamater){
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
@@ -1143,11 +1119,7 @@ public class ServiceInstanceTest { new MockUp<CamundaClient>() {
@Mock
- public HttpResponse post(String requestId, boolean isBaseVfModule,
- int recipeTimeout, String requestAction, String serviceInstanceId,
- String vnfId, String vfModuleId, String volumeGroupId, String networkId, String configurationId,
- String serviceType, String vnfType, String vfModuleType, String networkType,
- String requestDetails, String recipeParamXsd){
+ public HttpResponse post(RequestClientParamater requestClientParamater) {
ProtocolVersion pv = new ProtocolVersion("HTTP",1,1);
HttpResponse resp = new BasicHttpResponse(pv,200, "test response");
BasicHttpEntity entity = new BasicHttpEntity();
diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java index 91c19dd97f..af0ea101f4 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/CatalogDatabase.java @@ -95,7 +95,9 @@ public class CatalogDatabase implements Closeable { private static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUuid"; private static final String VF_MODULE_MODEL_UUID = "vfModuleModelUUId"; private static final String NETWORK_SERVICE = "network service"; - + private static final String TEMPLATE_NAME = "template_name"; + private static final String GET_VNF_RECIPE = "getVnfRecipe"; + protected static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.GENERAL); protected Session session = null; @@ -123,6 +125,7 @@ public class CatalogDatabase implements Closeable { return session; } + /** * Close an open Catalog Database session. * This method should always be called when a client is finished using a @@ -198,7 +201,7 @@ public class CatalogDatabase implements Closeable { String hql = "FROM HeatTemplate WHERE templateName = :template_name"; Query query = getSession().createQuery (hql); - query.setParameter("template_name", templateName); + query.setParameter(TEMPLATE_NAME, templateName); @SuppressWarnings("unchecked") List <HeatTemplate> resultList = query.list(); @@ -231,8 +234,8 @@ public class CatalogDatabase implements Closeable { String hql = "FROM HeatTemplate WHERE templateName = :template_name AND version = :version"; Query query = getSession().createQuery(hql); - query.setParameter("template_name", templateName); - query.setParameter("version", version); + query.setParameter(TEMPLATE_NAME, templateName); + query.setParameter(MODEL_VERSION, version); @SuppressWarnings("unchecked") List <HeatTemplate> resultList = query.list(); @@ -1121,14 +1124,14 @@ public class CatalogDatabase implements Closeable { List <VnfRecipe> resultList = query.list(); if (resultList.isEmpty()) { - LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", "getVnfRecipe", null); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", GET_VNF_RECIPE, null); return null; } resultList.sort(new MavenLikeVersioningComparator()); Collections.reverse(resultList); - LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfRecipe", null); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", GET_VNF_RECIPE, null); return resultList.get(0); } @@ -1156,14 +1159,14 @@ public class CatalogDatabase implements Closeable { List <VnfRecipe> resultList = query.list(); if (resultList.isEmpty()) { - LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", "getVnfRecipe", null); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", GET_VNF_RECIPE, null); return null; } resultList.sort(new MavenLikeVersioningComparator()); Collections.reverse(resultList); - LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfRecipe", null); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", GET_VNF_RECIPE, null); return resultList.get(0); } @@ -1189,14 +1192,14 @@ public class CatalogDatabase implements Closeable { List <VnfRecipe> resultList = query.list(); if (resultList.isEmpty()) { - LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", "getVnfRecipe", null); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", GET_VNF_RECIPE, null); return null; } resultList.sort(new MavenLikeVersioningComparator()); Collections.reverse(resultList); - LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfRecipe", null); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", GET_VNF_RECIPE, null); return resultList.get(0); } @@ -1237,11 +1240,11 @@ public class CatalogDatabase implements Closeable { List <VnfRecipe> resultList = query.list(); if (resultList.isEmpty()) { - LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", "getVnfRecipe", null); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully. VNF recipe not found", "CatalogDB", GET_VNF_RECIPE, null); return null; } - LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", "getVnfRecipe", null); + LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully", "CatalogDB", GET_VNF_RECIPE, null); return resultList.get(0); } @@ -1342,7 +1345,7 @@ public class CatalogDatabase implements Closeable { String hql = "FROM VfModule WHERE type = :type and version = :version"; Query query = getSession().createQuery(hql); query.setParameter ("type", type); - query.setParameter ("version", version); + query.setParameter (MODEL_VERSION, version); VfModule module = null; try { module = (VfModule) query.uniqueResult (); @@ -2867,7 +2870,7 @@ public class CatalogDatabase implements Closeable { query = getSession ().createQuery (hql.toString ()); query.setParameter ("modelCustomizationUuid", modelCustomizationUuid); - query.setParameter ("version", asdcServiceModelVersion); + query.setParameter (MODEL_VERSION, asdcServiceModelVersion); }else{ hql = new StringBuilder ("FROM VfModule WHERE type = :type AND version = :version AND modelVersion = :modelVersion"); @@ -2875,7 +2878,7 @@ public class CatalogDatabase implements Closeable { query = getSession ().createQuery (hql.toString ()); query.setParameter (TYPE, vfModuleType); - query.setParameter ("version", asdcServiceModelVersion); + query.setParameter (MODEL_VERSION, asdcServiceModelVersion); query.setParameter ("modelVersion", modelVersion); } @@ -3490,8 +3493,8 @@ public class CatalogDatabase implements Closeable { String hql = "FROM HeatTemplate WHERE templateName = :template_name AND version = :version AND asdcResourceName = :asdcResourceName"; Query query = getSession ().createQuery (hql); - query.setParameter ("template_name", templateName); - query.setParameter ("version", version); + query.setParameter (TEMPLATE_NAME, templateName); + query.setParameter (MODEL_VERSION, version); query.setParameter ("asdcResourceName", asdcResourceName); @SuppressWarnings("unchecked") @@ -3603,7 +3606,7 @@ public class CatalogDatabase implements Closeable { String hql = "FROM HeatEnvironment WHERE name=:name AND version=:version AND asdcResourceName=:asdcResourceName"; Query query = getSession ().createQuery (hql); query.setParameter ("name", name); - query.setParameter ("version", version); + query.setParameter (MODEL_VERSION, version); query.setParameter ("asdcResourceName", asdcResourceName); HeatEnvironment env = null; try { @@ -3645,7 +3648,7 @@ public class CatalogDatabase implements Closeable { String hql = "FROM HeatEnvironment WHERE artifactUuid=:artifactUuid AND version=:version"; Query query = getSession ().createQuery (hql); query.setParameter ("artifactUuid", artifactUuid); - query.setParameter ("version", version); + query.setParameter (MODEL_VERSION, version); HeatEnvironment env = null; try { env = (HeatEnvironment) query.uniqueResult (); @@ -4283,7 +4286,7 @@ public class CatalogDatabase implements Closeable { query.setParameter ("fileName", fileName); query.setParameter ("vnfResourceId", vnfResourceId); query.setParameter ("asdcResourceName", asdcResourceName); - query.setParameter ("version", version); + query.setParameter (MODEL_VERSION, version); @SuppressWarnings("unchecked") diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java index 899127c048..8baf62018c 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatEnvironment.java @@ -38,8 +38,6 @@ public class HeatEnvironment extends MavenLikeVersioning implements Serializable private Timestamp created = null; - public HeatEnvironment() {} - public String getArtifactUuid() { return this.artifactUuid; } diff --git a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java index 8d7da22673..542cd45081 100644 --- a/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java +++ b/mso-catalog-db/src/main/java/org/openecomp/mso/db/catalog/beans/HeatFiles.java @@ -38,7 +38,6 @@ public class HeatFiles extends MavenLikeVersioning implements Serializable { private String version = null; private String artifactChecksum = null; - public HeatFiles() {} public String getArtifactUuid() { return this.artifactUuid; diff --git a/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final b/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final index 7b5f06ae98..bbb3d1e4bf 100644 --- a/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final +++ b/packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final @@ -54,22 +54,40 @@ RUN echo "deb http://archive.ubuntu.com/ubuntu/ artful main restricted" >> /etc/ # For CVE-2016-6303 CVE-2016-2182 CVE-2016-2177 # libpcre3 2:8.39-5ubuntu3 # For CVE-2016-3191 CVE-2016-1283 +# berkeleydb +# For CVE-2016-3418 CVE-2016-0694 CVE-2016-0689 CVE-2016-0682 +# jetty +# For CVE-2017-9735 +# libxi +# For CVE-2016-7946 CVE-2016-7945 +# xalan +# For CVE-2014-0107 +# git +# For CVE-2017-14867 +# + USER root -RUN apt-get -y install \ - libkrb5-3=1.16-2build1 krb5-locales=1.16-2build1 \ - libvorbis0a=1.3.5-4ubuntu0.2 \ - libx11-6=2:1.6.4-3 libx11-data=2:1.6.4-3 libx11-doc=2:1.6.4-3 libx11-xcb1=2:1.6.4-3 \ - libxtst6=2:1.2.3-1 \ - ncurses-base=6.1-1ubuntu1 ncurses-bin=6.1-1ubuntu1 libncurses5=6.1-1ubuntu1 libncursesw5=6.1-1ubuntu1 \ - libsqlite3-0=3.22.0-1 \ - libtiff5=4.0.8-5ubuntu0.1 \ - passwd=1:4.5-1ubuntu1 \ - perl-base=5.26.0-8ubuntu1.1 \ - zlib1g=1:1.2.11.dfsg-0ubuntu2 \ - libexpat1=2.2.5-3 \ - libc-bin=2.26-0ubuntu2.1 libc6=2.26-0ubuntu2.1 \ - openssl=1.1.0g-2ubuntu4 \ - libpcre3=2:8.39-5ubuntu3 +RUN apt-get -y --only-upgrade install \ + libkrb5-3 krb5-locales \ + libvorbis0a \ + libx11-6 libx11-data libx11-doc libx11-xcb1 \ + libxtst6 \ + ncurses-base ncurses-bin libncurses5 libncursesw5 \ + libsqlite3-0 \ + libtiff5 \ + passwd \ + perl-base \ + openssl \ + zlib1g \ + libdb5.3 \ + libc-bin libc6 multiarch-support \ + libxi6 \ + libpcre3 \ + expat \ + jetty9 \ + xalan \ + git + RUN apt-get install -y netcat curl && curl -LO https://packages.chef.io/files/stable/chefdk/2.5.3/ubuntu/16.04/chefdk_2.5.3-1_amd64.deb && curl -LO http://central.maven.org/maven2/org/mariadb/jdbc/mariadb-java-client/1.5.4/mariadb-java-client-1.5.4.jar && apt-get remove --purge -y curl && apt-get autoremove -y diff --git a/version.properties b/version.properties index d3e09bb170..e1e6b0b337 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=1 minor=2 -patch=1 +patch=2 base_version=${major}.${minor}.${patch} |