aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java144
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java171
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java29
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java66
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java25
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java76
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java48
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksITTest.java103
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java36
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientLogResponseTest.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java59
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopology.json3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopology.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json5
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml53
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DeleteVfModuleVolumeCallbackResponse.xml5
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteResponse.xml56
39 files changed, 952 insertions, 90 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
index 66de6b389d..7bc48519b0 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
@@ -244,8 +244,8 @@ public class SniroHomingV2 {
ModelInfoServiceInstance modelInfo = serviceInstance.getModelInfoServiceInstance();
if(isNotBlank(modelInfo.getModelInvariantUuid()) && isNotBlank(modelInfo.getModelUuid())){
info.put("serviceInstanceId", serviceInstance.getServiceInstanceId());
- if(modelInfo.getServiceType() != null){ //temp solution
- info.put("serviceName", serviceInstance.getModelInfoServiceInstance().getServiceType());
+ if(modelInfo.getServiceType() != null && modelInfo.getServiceType().length() > 0){ //temp solution
+ info.put("serviceName", modelInfo.getServiceType());
}
info.put("modelInfo", buildModelInfo(serviceInstance.getModelInfoServiceInstance()));
}else{
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
new file mode 100644
index 0000000000..94eead2d05
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -0,0 +1,144 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.activity;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables;
+import org.camunda.bpm.engine.variable.VariableMap;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Component("ExecuteActivity")
+public class ExecuteActivity implements JavaDelegate {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExecuteActivity.class);
+ private static final String G_BPMN_REQUEST = "bpmnRequest";
+ private static final String VNF_TYPE = "vnfType";
+ private static final String G_ACTION = "requestAction";
+ private static final String G_REQUEST_ID = "mso-request-id";
+ private static final String VNF_ID = "vnfId";
+ private static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
+
+ private static final String SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE = "implementation";
+ private static final String ACTIVITY_PREFIX = "activity:";
+
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @Autowired
+ private RuntimeService runtimeService;
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+
+ try {
+ final String implementationString = execution.getBpmnModelElementInstance().getAttributeValue(SERVICE_TASK_IMPLEMENTATION_ATTRIBUTE);
+ msoLogger.debug("activity implementation String: " + implementationString);
+ if (!implementationString.startsWith(ACTIVITY_PREFIX)) {
+ buildAndThrowException(execution, "Implementation attribute has a wrong format");
+ }
+ String activityName = implementationString.replaceFirst(ACTIVITY_PREFIX, "");
+ msoLogger.info("activityName is: " + activityName);
+
+ BuildingBlock buildingBlock = buildBuildingBlock(activityName);
+ ExecuteBuildingBlock executeBuildingBlock = buildExecuteBuildingBlock(execution, requestId, buildingBlock);
+
+ Map<String, Object> variables = new HashMap<>();
+ variables.put("buildingBlock", executeBuildingBlock);
+ variables.put("mso-request-id", requestId);
+ variables.put("retryCount", 1);
+
+ ProcessInstanceWithVariables buildingBlockResult = runtimeService.createProcessInstanceByKey("ExecuteBuildingBlock").setVariables(variables).executeWithVariablesInReturn();
+ VariableMap variableMap = buildingBlockResult.getVariables();
+
+ WorkflowException workflowException = (WorkflowException) variableMap.get("WorklfowException");
+ if (workflowException != null) {
+ msoLogger.error("Workflow exception is: " + workflowException.getErrorMessage());
+ }
+ execution.setVariable("WorkflowException", workflowException);
+ }
+ catch (Exception e) {
+ buildAndThrowException(execution, e.getMessage());
+ }
+ }
+
+ protected BuildingBlock buildBuildingBlock(String activityName) {
+ BuildingBlock buildingBlock = new BuildingBlock();
+ buildingBlock.setBpmnFlowName(activityName);
+ buildingBlock.setMsoId(UUID.randomUUID().toString());
+ buildingBlock.setKey("");
+ buildingBlock.setIsVirtualLink(false);
+ buildingBlock.setVirtualLinkKey("");
+ return buildingBlock;
+ }
+
+ protected ExecuteBuildingBlock buildExecuteBuildingBlock(DelegateExecution execution, String requestId,
+ BuildingBlock buildingBlock) throws Exception {
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
+ String bpmnRequest = (String) execution.getVariable(G_BPMN_REQUEST);
+ ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
+ RequestDetails requestDetails = sIRequest.getRequestDetails();
+ executeBuildingBlock.setaLaCarte(true);
+ executeBuildingBlock.setRequestAction((String) execution.getVariable(G_ACTION));
+ executeBuildingBlock.setResourceId((String) execution.getVariable(VNF_ID));
+ executeBuildingBlock.setVnfType((String) execution.getVariable(VNF_TYPE));
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId((String) execution.getVariable(SERVICE_INSTANCE_ID));
+ workflowResourceIds.setVnfId((String) execution.getVariable(VNF_ID));
+ executeBuildingBlock.setWorkflowResourceIds(workflowResourceIds);
+ executeBuildingBlock.setRequestId(requestId);
+ executeBuildingBlock.setBuildingBlock(buildingBlock);
+ executeBuildingBlock.setRequestDetails(requestDetails);
+ return executeBuildingBlock;
+ }
+
+ protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
+ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, msg, ex);
+ execution.setVariable("ExecuteActivityErrorMessage", msg);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+
+ protected void buildAndThrowException(DelegateExecution execution, String msg) {
+ msoLogger.error(msg);
+ execution.setVariable("ExecuteActuvityErrorMessage", msg);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java
index 6ec9007cd0..48b4ebb982 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.adapter.vnf.tasks;
import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -57,7 +58,9 @@ public class VnfAdapterDeleteTasks {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
- vnfAdapterVolumeGroupResources.deleteVolumeGroup(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, volumeGroup);
+ DeleteVolumeGroupRequest deleteVolumeGroupRequest = vnfAdapterVolumeGroupResources.deleteVolumeGroupRequest(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, volumeGroup);
+ execution.setVariable(VNFREST_REQUEST, deleteVolumeGroupRequest.toXmlString());
+ execution.setVariable("deleteVolumeGroupRequest", "true");
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
index 554af37924..db54b219a9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
@@ -24,6 +24,7 @@ import org.apache.commons.lang3.StringUtils;
import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
import org.onap.so.adapters.vnfrest.DeleteVfModuleResponse;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
@@ -72,8 +73,8 @@ public class VnfAdapterImpl {
}
public void postProcessVnfAdapter(BuildingBlockExecution execution) {
- try {
- String vnfAdapterResponse = execution.getVariable("vnfAdapterRestV1Response");
+ try {
+ String vnfAdapterResponse = execution.getVariable("vnfAdapterRestV1Response");
if (!StringUtils.isEmpty( vnfAdapterResponse)) {
Object vnfRestResponse = unMarshal(vnfAdapterResponse);
if(vnfRestResponse instanceof CreateVfModuleResponse) {
@@ -98,8 +99,15 @@ public class VnfAdapterImpl {
execution.setVariable("heatStackId", heatStackId);
}else{
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "HeatStackId is missing from create VolumeGroup Vnf Adapter response.");
- }
- }
+ }
+ } else if(vnfRestResponse instanceof DeleteVolumeGroupResponse) {
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
+ Boolean volumeGroupDelete = ((DeleteVolumeGroupResponse) vnfRestResponse).getVolumeGroupDeleted();
+ if(null!= volumeGroupDelete && volumeGroupDelete) {
+ volumeGroup.setHeatStackId(null);
+ execution.setVariable("heatStackId", null);
+ }
+ }
}
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -116,7 +124,7 @@ public class VnfAdapterImpl {
XMLReader xmlReader = spf.newSAXParser().getXMLReader();
JAXBContext jaxbContext = JAXBContext.newInstance(CreateVfModuleResponse.class,
- CreateVolumeGroupResponse.class,DeleteVfModuleResponse.class);
+ CreateVolumeGroupResponse.class,DeleteVfModuleResponse.class,DeleteVolumeGroupResponse.class);
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
InputSource inputSource = new InputSource(new StringReader(input));
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
new file mode 100644
index 0000000000..798837fa7d
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
@@ -0,0 +1,171 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.appc.tasks;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Optional;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.catalog.beans.ControllerSelectionReference;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.appc.client.lcm.model.Action;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.client.appc.ApplicationControllerAction;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AppcRunTasks {
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AppcRunTasks.class);
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+ @Autowired
+ private ApplicationControllerAction appCClient;
+
+ public void preProcessActivity(BuildingBlockExecution execution) {
+ execution.setVariable("actionSnapshot", Action.Snapshot);
+ execution.setVariable("actionLock", Action.Lock);
+ execution.setVariable("actionUnlock", Action.Unlock);
+ execution.setVariable("actionUpgradePreCheck", Action.UpgradePreCheck);
+ execution.setVariable("actionUpgradePostCheck", Action.UpgradePostCheck);
+ execution.setVariable("actionQuiesceTraffic", Action.QuiesceTraffic);
+ execution.setVariable("actionUpgradeBackup", Action.UpgradeBackup);
+ execution.setVariable("actionUpgradeSoftware", Action.UpgradeSoftware);
+ execution.setVariable("actionResumeTraffic", Action.ResumeTraffic);
+ execution.setVariable("actionStop", Action.Stop);
+ execution.setVariable("actionStart", Action.Start);
+ execution.setVariable("rollbackVnfStop", false);
+ execution.setVariable("rollbackVnfLock", false);
+ execution.setVariable("rollbackQuiesceTraffic", false);
+ }
+
+ public void runAppcCommand(BuildingBlockExecution execution, Action action) {
+ msoLogger.trace("Start runAppcCommand ");
+ String appcCode = "1002";
+ String appcMessage = "";
+ try {
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ GenericVnf vnf = null;
+ try {
+ vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ } catch (BBObjectNotFoundException e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "No valid VNF exists");
+ }
+ String vnfId = vnf.getVnfId();
+ String msoRequestId = gBBInput.getRequestContext().getMsoRequestId();
+ String vnfName = vnf.getVnfName();
+ String vnfType = vnf.getVnfType();
+
+ String aicIdentity = execution.getVariable("aicIdentity");
+ String vnfHostIpAddress = vnf.getIpv4OamAddress();
+ String vmIdList = execution.getVariable("vmIdList");
+ String vserverIdList = execution.getVariable("vserverIdList");
+ String identityUrl = execution.getVariable("identityUrl");
+
+ ControllerSelectionReference controllerSelectionReference = catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString());
+ String controllerType = controllerSelectionReference.getControllerName();
+
+ String vfModuleId = null;
+ VfModule vfModule = null;
+ try {
+ vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ } catch (BBObjectNotFoundException e) {
+ }
+ if (vfModule != null) {
+ vfModuleId = vfModule.getVfModuleId();
+ }
+
+ HashMap<String, String> payloadInfo = buildPayloadInfo(vnfName, aicIdentity, vnfHostIpAddress, vmIdList, vserverIdList,
+ identityUrl, vfModuleId);
+ Optional<String> payload = null;
+ RequestParameters requestParameters = gBBInput.getRequestContext().getRequestParameters();
+ if(requestParameters != null){
+ String pay = requestParameters.getPayload();
+ if (pay != null) {
+ payload = Optional.of(pay);
+ }
+ }
+ msoLogger.debug("Running APP-C action: " + action.toString());
+ msoLogger.debug("VNFID: " + vnfId);
+ appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+ appcCode = appCClient.getErrorCode();
+ appcMessage = appCClient.getErrorMessage();
+ mapRollbackVariables(execution, action, appcCode);
+ }
+ catch (Exception e) {
+ msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "Caught exception in runAppcCommand", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "APPC Error", e);
+ appcMessage = e.getMessage();
+ }
+
+ msoLogger.error("Error Message: " + appcMessage);
+ msoLogger.error("ERROR CODE: " + appcCode);
+ msoLogger.trace("End of runAppCommand ");
+ if (appcCode != null && !appcCode.equals("0")) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
+ }
+ }
+
+ protected void mapRollbackVariables(BuildingBlockExecution execution, Action action, String appcCode) {
+ if (appcCode.equals("0") && action != null) {
+ if (action.equals(Action.Lock)) {
+ execution.setVariable("rollbackVnfLock", true);
+ } else if (action.equals(Action.Unlock)) {
+ execution.setVariable("rollbackVnfLock", false);
+ } else if (action.equals(Action.Start)) {
+ execution.setVariable("rollbackVnfStop", false);
+ } else if (action.equals(Action.Stop)) {
+ execution.setVariable("rollbackVnfStop", true);
+ } else if (action.equals(Action.QuiesceTraffic)) {
+ execution.setVariable("rollbackQuiesceTraffic", true);
+ } else if (action.equals(Action.ResumeTraffic)) {
+ execution.setVariable("rollbackQuiesceTraffic", false);
+ }
+ }
+ }
+
+ private HashMap<String,String> buildPayloadInfo(String vnfName, String aicIdentity, String vnfHostIpAddress,
+ String vmIdList, String vserverIdList, String identityUrl, String vfModuleId) {
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", vnfName);
+ payloadInfo.put("aicIdentity", aicIdentity);
+ payloadInfo.put("vnfHostIpAddress", vnfHostIpAddress);
+ payloadInfo.put("vmIdList", vmIdList);
+ payloadInfo.put("vserverIdList", vserverIdList);
+ payloadInfo.put("identityUrl", identityUrl);
+ payloadInfo.put("vfModuleId",vfModuleId);
+ return payloadInfo;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
index 772def739b..61162f4d85 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
@@ -67,6 +67,7 @@ public class GenericVnfHealthCheck {
execution.setVariable("vnfId", vnfId);
execution.setVariable("vnfName", vnfName);
execution.setVariable("oamIpAddress", oamIpAddress);
+ execution.setVariable("vnfHostIpAddress", oamIpAddress);
execution.setVariable("msoRequestId", gBBInput.getRequestContext().getMsoRequestId());
execution.setVariable("action", actionCategory);
execution.setVariable("controllerType", controllerName);
@@ -93,6 +94,7 @@ public class GenericVnfHealthCheck {
payloadInfo.put("vnfName", execution.getVariable("vnfName"));
payloadInfo.put("vfModuleId",execution.getVariable("vfModuleId"));
payloadInfo.put("oamIpAddress",execution.getVariable("oamIpAddress"));
+ payloadInfo.put("vnfHostIpAddress",execution.getVariable("vnfHostIpAddress"));
//PayloadInfo contains extra information that adds on to payload before making request to appc
appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 5809d16492..a998f6934f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -727,6 +727,7 @@ public class WorkflowAction {
}
return generatedResourceId;
} catch (Exception ex) {
+ msoLogger.error(ex);
throw new IllegalStateException(
"WorkflowAction was unable to verify if the instance name already exist in AAI.");
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index ab29e21dea..9e4b01eea5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -30,13 +30,13 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
-
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.RequestReferences;
import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -50,7 +50,7 @@ public class WorkflowActionBBTasks {
private static final String G_REQUEST_ID = "mso-request-id";
private static final String G_ALACARTE = "aLaCarte";
private static final String G_ACTION = "requestAction";
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowActionBBTasks.class);
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class);
@Autowired
private RequestsDbClient requestDbclient;
@@ -84,10 +84,14 @@ public class WorkflowActionBBTasks {
}
public void updateFlowStatistics(DelegateExecution execution) {
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
- if(currentSequence > 1) {
- InfraActiveRequests request = this.getUpdatedRequest(execution, currentSequence);
- requestDbclient.updateInfraActiveRequests(request);
+ try{
+ int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ if(currentSequence > 1) {
+ InfraActiveRequests request = this.getUpdatedRequest(execution, currentSequence);
+ requestDbclient.updateInfraActiveRequests(request);
+ }
+ }catch (Exception ex){
+ logger.warn("Bpmn Flow Statistics was unable to update Request Db with the new completion percentage. Competion percentage may be invalid.");
}
}
@@ -146,7 +150,7 @@ public class WorkflowActionBBTasks {
.getProcessDefinition(execution.getProcessDefinitionId()).getKey();
WorkflowContextHolder.getInstance().processCallback(processKey, execution.getProcessInstanceId(), requestId,
callbackResponse);
- msoLogger.info("Successfully sent sync ack.");
+ logger.info("Successfully sent sync ack.");
}
public void sendErrorSyncAck(DelegateExecution execution) {
@@ -169,7 +173,7 @@ public class WorkflowActionBBTasks {
callbackResponse);
execution.setVariable("sentSyncResponse", true);
} catch (Exception ex) {
- msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage());
+ logger.error(" Sending Sync Error Activity Failed. {}" , ex.getMessage(), ex);
}
}
@@ -265,8 +269,7 @@ public class WorkflowActionBBTasks {
public void abortCallErrorHandling(DelegateExecution execution) {
String msg = "Flow has failed. Rainy day handler has decided to abort the process.";
- Exception exception = new Exception(msg);
- msoLogger.error(exception);
+ logger.error(msg);
throw new BpmnError(msg);
}
@@ -280,14 +283,14 @@ public class WorkflowActionBBTasks {
request.setStatusMessage(exception.getErrorMessage());
} catch (Exception ex) {
//log error and attempt to extact WorkflowExceptionMessage
- msoLogger.error(ex);
+ logger.error("Failed to extract workflow exception from execution.",ex);
}
if (errorMsg == null){
try {
errorMsg = (String) execution.getVariable("WorkflowExceptionErrorMessage");
request.setStatusMessage(errorMsg);
} catch (Exception ex) {
- msoLogger.error(ex);
+ logger.error("Failed to extract workflow exception message from WorkflowException",ex);
request.setStatusMessage("Unexpected Error in BPMN");
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java
index 67e7afb599..ec202b8a3f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java
@@ -31,6 +31,7 @@ import javax.annotation.PostConstruct;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleTopology;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduletopologyVfModuleTopology;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
@@ -108,8 +109,9 @@ public class VnfAdapterObjectMapper {
final String USER_PARAM_NAME_KEY = "name";
final String USER_PARAM_VALUE_KEY = "value";
// sdncVfModuleQueryResponse will not be available in aLaCarte case
- if (sdncVfModuleQueryResponse != null) {
- GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfmoduletopologyVfModuleTopology.class);
+ if (sdncVfModuleQueryResponse != null) {
+ GenericResourceApiVfModuleTopology vfModuleTop = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfModuleTopology.class);
+ GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = vfModuleTop.getVfModuleTopology();
buildParamsMapFromSdncParams(volumeGroupParams, vfModuleTopology.getVfModuleParameters());
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
index 515f04b218..2b58b7bdd7 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
@@ -31,11 +31,13 @@ import java.util.Map;
import java.util.Optional;
import javax.annotation.PostConstruct;
+import javax.validation.Valid;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam;
import org.onap.sdnc.northbound.client.model.GenericResourceApiSubInterfaceNetworkData;
import org.onap.sdnc.northbound.client.model.GenericResourceApiSubinterfacenetworkdataSubInterfaceNetworkData;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleTopology;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleassignmentsVfModuleAssignments;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleassignmentsVfmoduleassignmentsVms;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduletopologyVfModuleTopology;
@@ -52,6 +54,7 @@ import org.onap.sdnc.northbound.client.model.GenericResourceApiVmtopologydataVmN
import org.onap.sdnc.northbound.client.model.GenericResourceApiVmtopologydataVmNetworks;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVmtopologydataVmnamesVnfcNames;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfNetworkData;
+import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfTopology;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcNetworkData;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcnetworkdataVnfcNetworkData;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcPorts;
@@ -157,11 +160,14 @@ public class VnfAdapterVfModuleObjectMapper {
private Map<String,String> buildVfModuleParamsMap(RequestContext requestContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
VfModule vfModule, String sdncVnfQueryResponse, String sdncVfModuleQueryResponse) throws JsonParseException, JsonMappingException, IOException {
- GenericResourceApiVnftopologyVnfTopology vnfTopology = mapper.readValue(sdncVnfQueryResponse, GenericResourceApiVnftopologyVnfTopology.class);
- GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfmoduletopologyVfModuleTopology.class);
+
+ GenericResourceApiVnfTopology vnfTop= mapper.readValue(sdncVnfQueryResponse, GenericResourceApiVnfTopology.class);
+ GenericResourceApiVfModuleTopology vfModuleTop = mapper.readValue(sdncVfModuleQueryResponse, GenericResourceApiVfModuleTopology.class);
+ GenericResourceApiVnftopologyVnfTopology vnfTopology = vnfTop.getVnfTopology();
+ GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = vfModuleTop.getVfModuleTopology();
Map<String,String> paramsMap = new HashMap<>();
- if(vnfTopology.getSdncGeneratedCloudResources() && vfModuleTopology.getSdncGeneratedCloudResources()) {
+ if( vfModuleTopology.getSdncGeneratedCloudResources()) {
buildParamsMapFromVfModuleSdncResponse(paramsMap, vfModuleTopology, true);
buildParamsMapFromVnfSdncResponse(paramsMap, vnfTopology, null, true);
}
@@ -506,33 +512,35 @@ public class VnfAdapterVfModuleObjectMapper {
String vmTypeKey = vnfcNetworkdata.getVnfcType();
GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcPorts vnfcPorts = vnfcNetworkdata.getVnfcPorts();
- List<GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcportsVnfcPort> vnfcPortList = vnfcPorts.getVnfcPort();
- if (vnfcPortList != null) {
- for(int portIdx = 0; portIdx < vnfcPortList.size(); portIdx++){
-
- GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcportsVnfcPort vnfcPort = vnfcPortList.get(portIdx);
- GenericResourceApiSubInterfaceNetworkData vnicSubInterfaces = vnfcPort.getVnicSubInterfaces();
-
- String vnicSubInterfacesString = convertToString(vnicSubInterfaces);
- String networkRoleKey = vnfcPort.getCommonSubInterfaceRole();
- String subInterfaceKey = createVnfcSubInterfaceKey(vmTypeKey, networkDataIdx, networkRoleKey, portIdx);
- String globalSubInterfaceKey = createGlobalVnfcSubInterfaceKey(vmTypeKey, networkRoleKey, portIdx);
+ if (vnfcPorts != null) {
+ List<GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcportsVnfcPort> vnfcPortList = vnfcPorts.getVnfcPort();
+ if (vnfcPortList != null) {
+ for(int portIdx = 0; portIdx < vnfcPortList.size(); portIdx++){
- buildVfModuleSubInterfacesCount(paramsMap, globalSubInterfaceKey, vnicSubInterfaces);
-
- buildVfModuleVlanTag(paramsMap, subInterfaceKey, vnicSubInterfacesString);
-
- buildVfModuleNetworkName(paramsMap, subInterfaceKey, vnicSubInterfacesString);
-
- buildVfModuleNetworkId(paramsMap, subInterfaceKey, vnicSubInterfacesString);
-
- buildVfModuleIpV4AddressHeatTemplate(paramsMap, subInterfaceKey, vnicSubInterfacesString);
-
- buildVfModuleIpV6AddressHeatTemplate(paramsMap, subInterfaceKey, vnicSubInterfacesString);
-
- buildVfModuleFloatingIpV4HeatTemplate(paramsMap, globalSubInterfaceKey, vnicSubInterfacesString);
-
- buildVfModuleFloatingIpV6HeatTemplate(paramsMap, globalSubInterfaceKey, vnicSubInterfacesString);
+ GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcportsVnfcPort vnfcPort = vnfcPortList.get(portIdx);
+ GenericResourceApiSubInterfaceNetworkData vnicSubInterfaces = vnfcPort.getVnicSubInterfaces();
+
+ String vnicSubInterfacesString = convertToString(vnicSubInterfaces);
+ String networkRoleKey = vnfcPort.getCommonSubInterfaceRole();
+ String subInterfaceKey = createVnfcSubInterfaceKey(vmTypeKey, networkDataIdx, networkRoleKey, portIdx);
+ String globalSubInterfaceKey = createGlobalVnfcSubInterfaceKey(vmTypeKey, networkRoleKey, portIdx);
+
+ buildVfModuleSubInterfacesCount(paramsMap, globalSubInterfaceKey, vnicSubInterfaces);
+
+ buildVfModuleVlanTag(paramsMap, subInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleNetworkName(paramsMap, subInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleNetworkId(paramsMap, subInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleIpV4AddressHeatTemplate(paramsMap, subInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleIpV6AddressHeatTemplate(paramsMap, subInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleFloatingIpV4HeatTemplate(paramsMap, globalSubInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleFloatingIpV6HeatTemplate(paramsMap, globalSubInterfaceKey, vnicSubInterfacesString);
+ }
}
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java
index 8655104830..efbbeae737 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java
@@ -22,7 +22,6 @@ package org.onap.so.client.orchestration;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -49,9 +48,7 @@ public class VnfAdapterVolumeGroupResources {
return vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse);
}
- public DeleteVolumeGroupResponse deleteVolumeGroup(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws Exception {
- DeleteVolumeGroupRequest deleteVolumeGroupRequest = vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup);
- msoLogger.debug(deleteVolumeGroupRequest.toString());
- return vnfVolumeAdapterClient.deleteVNFVolumes(volumeGroup.getVolumeGroupId(), deleteVolumeGroupRequest);
+ public DeleteVolumeGroupRequest deleteVolumeGroupRequest(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws Exception {
+ return vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
index 0061f50ba8..a4b40393a3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
@@ -21,6 +21,7 @@
package org.onap.so.client.sdnc;
import java.util.LinkedHashMap;
+import java.util.Optional;
import javax.ws.rs.core.UriBuilder;
@@ -35,6 +36,9 @@ import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
@Component
public class SDNCClient {
@@ -62,10 +66,25 @@ public class SDNCClient {
STOClient.setHttpHeader(httpHeader);
msoLogger.info("Running SDNC CLIENT for TargetUrl: " + targetUrl);
LinkedHashMap<?, ?> output = STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {});
+ Optional<String> sdncResponse = logSDNCResponse(output);
+ if(sdncResponse.isPresent()){
+ msoLogger.info(sdncResponse.get());
+ }
msoLogger.info("Validating output...");
return sdnCommonTasks.validateSDNResponse(output);
}
+ protected Optional<String> logSDNCResponse(LinkedHashMap<?, ?> output) {
+ ObjectMapper mapper = new ObjectMapper();
+ String sdncOutput = "";
+ try {
+ sdncOutput = mapper.writeValueAsString(output);
+ return Optional.of(sdncOutput);
+ } catch (JsonProcessingException e) {
+ msoLogger.debug("Failed to map response from sdnc to json string for logging purposes.");
+ }
+ return Optional.empty();
+ }
/**
*
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
index d35296af9b..aefb84c606 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
@@ -20,7 +20,9 @@
package org.onap.so.client.sdnc;
+import java.util.ArrayList;
import java.util.LinkedHashMap;
+import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpStatus;
@@ -29,10 +31,16 @@ import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
+import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.BufferingClientHttpRequestFactory;
+import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
+import org.springframework.web.client.RestTemplate;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -79,6 +87,9 @@ public class SdnCommonTasks {
HttpHeaders httpHeader = new HttpHeaders();
httpHeader.set("Authorization", auth);
httpHeader.setContentType(MediaType.APPLICATION_JSON);
+ List<MediaType> acceptMediaTypes = new ArrayList<MediaType>();
+ acceptMediaTypes.add(MediaType.APPLICATION_JSON);
+ httpHeader.setAccept(acceptMediaTypes);
return httpHeader;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
index 53e7dc4536..432399b1b8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
@@ -25,6 +25,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.*;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.springframework.stereotype.Component;
+import org.onap.so.client.exception.MapperException;
@Component
public class GeneralTopologyObjectMapper {
@@ -82,6 +83,8 @@ public class GeneralTopologyObjectMapper {
onapModelInformation.setModelCustomizationUuid(network.getModelInfoNetwork().getModelCustomizationUUID());
networkInformation.setOnapModelInformation(onapModelInformation);
}
+
+ networkInformation.setFromPreload(null);
networkInformation.setNetworkId(network.getNetworkId());
//TODO fix this after network type filed included in L3Network object type
//networkInformation.setNetworkType(network.getNetwork);
@@ -109,21 +112,27 @@ public class GeneralTopologyObjectMapper {
/*
* Build GenericResourceApiVfModuleinformationVfModuleInformation
*/
- public GenericResourceApiVfmoduleinformationVfModuleInformation buildVfModuleInformation(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance, boolean includeModelInformation){
+ public GenericResourceApiVfmoduleinformationVfModuleInformation buildVfModuleInformation(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance, boolean includeModelInformation) throws MapperException {
GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = new GenericResourceApiVfmoduleinformationVfModuleInformation();
if (includeModelInformation) {
- GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation();
- onapModelInformation.setModelInvariantUuid(vfModule.getModelInfoVfModule().getModelInvariantUUID());
- onapModelInformation.setModelName(vfModule.getModelInfoVfModule().getModelName());
- onapModelInformation.setModelVersion(vfModule.getModelInfoVfModule().getModelVersion());
- onapModelInformation.setModelUuid(vfModule.getModelInfoVfModule().getModelUUID());
- onapModelInformation.setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID());
- vfModuleInformation.setOnapModelInformation(onapModelInformation);
+ if (vfModule.getModelInfoVfModule() == null) {
+ throw new MapperException("VF Module model info is null for " + vfModule.getVfModuleId());
+ }
+ else {
+ GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation();
+ onapModelInformation.setModelInvariantUuid(vfModule.getModelInfoVfModule().getModelInvariantUUID());
+ onapModelInformation.setModelName(vfModule.getModelInfoVfModule().getModelName());
+ onapModelInformation.setModelVersion(vfModule.getModelInfoVfModule().getModelVersion());
+ onapModelInformation.setModelUuid(vfModule.getModelInfoVfModule().getModelUUID());
+ onapModelInformation.setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID());
+ vfModuleInformation.setOnapModelInformation(onapModelInformation);
+ }
}
if (vfModule.getModelInfoVfModule() != null) {
vfModuleInformation.setVfModuleType(vfModule.getModelInfoVfModule().getModelName());
}
vfModuleInformation.setVfModuleId(vfModule.getVfModuleId());
+ vfModuleInformation.setFromPreload(null);
return vfModuleInformation;
}
public GenericResourceApiSdncrequestheaderSdncRequestHeader buildSdncRequestHeader(SDNCSvcAction svcAction, String sdncReqId){
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
index af670d13d5..7013a50dcf 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
@@ -30,6 +30,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.so.logger.MessageEnum;
@@ -58,7 +59,7 @@ public class VfModuleTopologyOperationRequestMapper {
public GenericResourceApiVfModuleOperationInformation reqMapper(SDNCSvcOperation svcOperation,
SDNCSvcAction svcAction, VfModule vfModule, VolumeGroup volumeGroup, GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext, String sdncAssignResponse) {
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, String sdncAssignResponse) throws MapperException {
GenericResourceApiVfModuleOperationInformation req = new GenericResourceApiVfModuleOperationInformation();
boolean includeModelInformation = false;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
new file mode 100644
index 0000000000..d4956f9349
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.activity;
+
+
+import static org.junit.Assert.assertEquals;
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Before;
+
+import org.junit.Test;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class ExecuteActivityTest extends BaseTaskTest {
+ @Autowired
+ protected ExecuteActivity executeActivity;
+
+ private DelegateExecution execution;
+
+ @Before
+ public void before() throws Exception {
+ execution = new DelegateExecutionFake();
+ execution.setVariable("vnfType", "testVnfType");
+ execution.setVariable("requestAction", "testRequestAction");
+ execution.setVariable("mso-request-id", "testMsoRequestId");
+ execution.setVariable("vnfId", "testVnfId");
+ execution.setVariable("serviceInstanceId", "testServiceInstanceId");
+ String bpmnRequest = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ }
+
+ @Test
+ public void buildBuildingBlock_Test(){
+ BuildingBlock bb = executeActivity.buildBuildingBlock("testActivityName");
+ assertEquals(bb.getBpmnFlowName(), "testActivityName");
+ assertEquals(bb.getKey(), "");
+ }
+
+ @Test
+ public void executeBuildingBlock_Test() throws Exception {
+ BuildingBlock bb = executeActivity.buildBuildingBlock("testActivityName");
+ ExecuteBuildingBlock ebb = executeActivity.buildExecuteBuildingBlock(execution, "testMsoRequestId", bb);
+ assertEquals(ebb.getVnfType(), "testVnfType");
+ assertEquals(ebb.getRequestAction(), "testRequestAction");
+ assertEquals(ebb.getRequestId(), "testMsoRequestId");
+ assertEquals(ebb.getWorkflowResourceIds().getVnfId(), "testVnfId");
+ assertEquals(ebb.getWorkflowResourceIds().getServiceInstanceId(), "testServiceInstanceId");
+ assertEquals(ebb.getBuildingBlock(), bb);
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java
index 4ea11c235b..3ff9ce605e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java
@@ -30,7 +30,7 @@ import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
-import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -95,20 +95,22 @@ public class VnfAdapterDeleteTasksTest extends BaseTaskTest{
@Test
public void test_deleteVolumeGroup() throws Exception {
- DeleteVolumeGroupResponse deleteVolumeGroupResponse = new DeleteVolumeGroupResponse();
+ DeleteVolumeGroupRequest deleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
+ deleteVolumeGroupRequest.setVolumeGroupId("volumeGroupId");
- doReturn(deleteVolumeGroupResponse).when(vnfAdapterVolumeGroupResources).deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup);
+ doReturn(deleteVolumeGroupRequest).when(vnfAdapterVolumeGroupResources).deleteVolumeGroupRequest(requestContext, cloudRegion, serviceInstance, volumeGroup);
vnfAdapterDeleteTasks.deleteVolumeGroup(execution);
- verify(vnfAdapterVolumeGroupResources, times(1)).deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup);
+ verify(vnfAdapterVolumeGroupResources, times(1)).deleteVolumeGroupRequest(requestContext, cloudRegion, serviceInstance, volumeGroup);
+ assertEquals(execution.getVariable("VNFREST_Request"), deleteVolumeGroupRequest.toXmlString());
}
@Test
public void deleteVolumeGroupExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
- doThrow(Exception.class).when(vnfAdapterVolumeGroupResources).deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup);
+ doThrow(Exception.class).when(vnfAdapterVolumeGroupResources).deleteVolumeGroupRequest(requestContext, cloudRegion, serviceInstance, volumeGroup);
vnfAdapterDeleteTasks.deleteVolumeGroup(execution);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
index 24a99c97f4..2a8046b1be 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImplTest.java
@@ -46,8 +46,9 @@ public class VnfAdapterImplTest extends BaseTaskTest {
private static final String VNF_ADAPTER_REST_DELETE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/VNFAdapterRestDeleteResponse.xml");
private static final String VNF_ADAPTER_REST_CREATE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/VNFAdapterRestCreateCallback.xml");
private static final String VNF_ADAPTER_VOLUME_CREATE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml");
+ private static final String VNF_ADAPTER_VOLUME_DELETE_RESPONSE = FileUtil.readResourceFile("__files/VfModularity/DeleteVfModuleVolumeCallbackResponse.xml");
private static final String TEST_VFMODULE_HEATSTACK_ID = "slowburn";
- private static final String TEST_VOLUME_HEATSTACK_ID = "testHeatStackId1";
+ private static final String TEST_VOLUME_HEATSTACK_ID = "testHeatStackId1";
@Before
public void before() {
@@ -56,6 +57,7 @@ public class VnfAdapterImplTest extends BaseTaskTest {
vfModule = setVfModule();
volumeGroup = setVolumeGroup();
vfModule.setHeatStackId(null);
+ volumeGroup.setHeatStackId(null);
}
@Test
@@ -98,13 +100,14 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest() {
+ vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_DELETE_RESPONSE);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
}
@Test
- public void postProcessVnfAdapter_ResponseNullTest() {
+ public void postProcessVnfAdapter_ResponseNullTest() {
execution.setVariable("vnfAdapterRestV1Response", null);
vnfAdapterImpl.postProcessVnfAdapter(execution);
assertNull(vfModule.getHeatStackId());
@@ -119,9 +122,10 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_VfModuleDeletedFalse() {
+ vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
execution.setVariable("vnfAdapterRestV1Response", "<deleteVfModuleResponse><vfModuleDeleted>false</vfModuleDeleted></deleteVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
- assertNull(vfModule.getHeatStackId());
+ assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId());
}
@Test
@@ -133,9 +137,10 @@ public class VnfAdapterImplTest extends BaseTaskTest {
@Test
public void postProcessVnfAdapter_DeleteResponseTest_EmptyVfModuleDeletedTag() {
+ vfModule.setHeatStackId(TEST_VFMODULE_HEATSTACK_ID);
execution.setVariable("vnfAdapterRestV1Response", "<deleteVfModuleResponse></deleteVfModuleResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
- assertNull(vfModule.getHeatStackId());
+ assertEquals(TEST_VFMODULE_HEATSTACK_ID, vfModule.getHeatStackId());
}
@Test
@@ -157,10 +162,43 @@ public class VnfAdapterImplTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
execution.setVariable("vnfAdapterRestV1Response", "<createVolumeGroupResponse></createVolumeGroupResponse>");
vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertNull(volumeGroup.getHeatStackId());
}
+
+ @Test
+ public void postProcessVnfAdapter_DeleteResponseTest_DeleteVolumeGroup() {
+ volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
+ execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_VOLUME_DELETE_RESPONSE);
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertNull(volumeGroup.getHeatStackId());
+ }
+
+
+ @Test
+ public void postProcessVnfAdapter_DeleteResponseTest_VolumeGroupDeletedFalse() {
+ volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
+ execution.setVariable("vnfAdapterRestV1Response", "<deleteVolumeGroupResponse><volumeGroupDeleted>false</volumeGroupDeleted></deleteVolumeGroupResponse>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId());
+ }
+
+ @Test
+ public void postProcessVnfAdapter_DeleteResponseTest_EmptyDeleteVolumeGroupResponseTag() {
+ expectedException.expect(BpmnError.class);
+ execution.setVariable("vnfAdapterRestV1Response", "<volumeGroupDeleted></volumeGroupDeleted>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ }
+
+ @Test
+ public void postProcessVnfAdapter_DeleteResponseTest_EmptyVolumeGroupDeletedTag() {
+ volumeGroup.setHeatStackId(TEST_VOLUME_HEATSTACK_ID);
+ execution.setVariable("vnfAdapterRestV1Response", "<deleteVolumeGroupResponse></deleteVolumeGroupResponse>");
+ vnfAdapterImpl.postProcessVnfAdapter(execution);
+ assertEquals(TEST_VOLUME_HEATSTACK_ID, volumeGroup.getHeatStackId());
+ }
@Test
- public void postProcessVnfAdapterExceptionTest() {
+ public void postProcessVnfAdapterExceptionTest() {
execution.setVariable("vnfAdapterRestV1Response", VNF_ADAPTER_REST_CREATE_RESPONSE);
expectedException.expect(BpmnError.class);
lookupKeyMap.clear();
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksITTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksITTest.java
new file mode 100644
index 0000000000..9e1dac69e0
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksITTest.java
@@ -0,0 +1,103 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.appc.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.util.HashMap;
+import java.util.Optional;
+import java.util.UUID;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.appc.client.lcm.model.Action;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
+import org.onap.so.db.catalog.beans.ControllerSelectionReference;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class AppcRunTasksITTest extends BaseTaskTest {
+
+ @Autowired
+ private AppcRunTasks appcRunTasks;
+
+ private GenericVnf genericVnf;
+ private RequestContext requestContext;
+ private String msoRequestId;
+
+ @Before
+ public void before() {
+ genericVnf = setGenericVnf();
+ msoRequestId = UUID.randomUUID().toString();
+ requestContext = setRequestContext();
+ requestContext.setMsoRequestId(msoRequestId);
+ gBBInput.setRequestContext(requestContext);
+ }
+
+ @Test
+ public void preProcessActivityTest() throws Exception {
+ appcRunTasks.preProcessActivity(execution);
+ assertEquals(execution.getVariable("actionQuiesceTraffic"), Action.QuiesceTraffic);
+ assertEquals(execution.getVariable("rollbackQuiesceTraffic"), false);
+ }
+
+ @Test
+ public void runAppcCommandTest() throws Exception {
+ Action action = Action.QuiesceTraffic;
+ ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference();
+ controllerSelectionReference.setControllerName("testName");
+ controllerSelectionReference.setActionCategory(action.toString());
+ controllerSelectionReference.setVnfType("testVnfType");
+
+ doReturn(controllerSelectionReference).when(catalogDbClient).getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(), Action.QuiesceTraffic.toString());
+
+ execution.setVariable("aicIdentity", "testAicIdentity");
+
+ String vnfId = genericVnf.getVnfId();
+ genericVnf.setIpv4OamAddress("testOamIpAddress");
+ String payload = "{\"testName\":\"testValue\",}";
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setPayload(payload);
+ gBBInput.getRequestContext().setRequestParameters(requestParameters);
+
+ String controllerType = "testName";
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", "testVnfName1");
+ payloadInfo.put("aicIdentity", "testAicIdentity");
+ payloadInfo.put("vnfHostIpAddress", "testOamIpAddress");
+ payloadInfo.put("vserverIdList", null);
+ payloadInfo.put("vfModuleId", null);
+ payloadInfo.put("identityUrl", null);
+ payloadInfo.put("vmIdList", null);
+
+ doNothing().when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
+
+ appcRunTasks.runAppcCommand(execution, action);
+ verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
new file mode 100644
index 0000000000..7cade7703a
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
@@ -0,0 +1,36 @@
+package org.onap.so.bpmn.infrastructure.appc.tasks;
+
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+
+import org.junit.Test;
+import org.onap.appc.client.lcm.model.Action;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+
+public class AppcRunTasksTest {
+
+
+ private AppcRunTasks appcRunTasks = new AppcRunTasks();
+ @Test
+ public void mapRollbackVariablesTest() {
+
+ BuildingBlockExecution mock = mock(BuildingBlockExecution.class);
+
+ appcRunTasks.mapRollbackVariables(mock, Action.Lock, "1");
+ verify(mock, times(0)).setVariable(any(String.class), any());
+ appcRunTasks.mapRollbackVariables(mock, Action.Lock, "0");
+ verify(mock, times(1)).setVariable("rollbackVnfLock", true);
+ appcRunTasks.mapRollbackVariables(mock, Action.Unlock, "0");
+ verify(mock, times(1)).setVariable("rollbackVnfLock", false);
+ appcRunTasks.mapRollbackVariables(mock, Action.Start, "0");
+ verify(mock, times(1)).setVariable("rollbackVnfStop", false);
+ appcRunTasks.mapRollbackVariables(mock, Action.Stop, "0");
+ verify(mock, times(1)).setVariable("rollbackVnfStop", true);
+ appcRunTasks.mapRollbackVariables(mock, Action.QuiesceTraffic, "0");
+ verify(mock, times(1)).setVariable("rollbackQuiesceTraffic", true);
+ appcRunTasks.mapRollbackVariables(mock, Action.ResumeTraffic, "0");
+ verify(mock, times(1)).setVariable("rollbackQuiesceTraffic", false);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java
index 3aaf15cf11..9f0bb910e6 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java
@@ -84,6 +84,7 @@ public class GenericVnfHealthCheckTest extends BaseTaskTest {
payloadInfo.put("vnfName", "testVnfName");
payloadInfo.put("vfModuleId", "testVfModuleId");
payloadInfo.put("oamIpAddress", "testOamIpAddress");
+ payloadInfo.put("vnfHostIpAddress", "testOamIpAddress");
execution.setVariable("action", Action.HealthCheck.toString());
execution.setVariable("msoRequestId", msoRequestId);
execution.setVariable("controllerType", controllerType);
@@ -91,6 +92,7 @@ public class GenericVnfHealthCheckTest extends BaseTaskTest {
execution.setVariable("vnfName", "testVnfName");
execution.setVariable("vfModuleId", "testVfModuleId");
execution.setVariable("oamIpAddress", "testOamIpAddress");
+ execution.setVariable("vnfHostIpAddress", "testOamIpAddress");
execution.setVariable("payload", payload);
doNothing().when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java
index ee0e60c38a..d582253df1 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java
@@ -110,13 +110,10 @@ public class VnfAdapterVolumeGroupResourcesTest extends TestDataSetup {
DeleteVolumeGroupRequest deleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
doReturn(deleteVolumeGroupRequest).when(MOCK_vnfAdapterObjectMapper).deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup);
- DeleteVolumeGroupResponse expectedDeleteVolumeGroupResponse = new DeleteVolumeGroupResponse();
- doReturn(expectedDeleteVolumeGroupResponse).when(MOCK_vnfVolumeAdapterClient).deleteVNFVolumes(volumeGroup.getVolumeGroupId(), deleteVolumeGroupRequest);
+ DeleteVolumeGroupRequest expectedDeleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
+ DeleteVolumeGroupRequest actualDeleteVolumeGroupRequest = vnfAdapterVolumeGroupResources.deleteVolumeGroupRequest(requestContext, cloudRegion, serviceInstance, volumeGroup);
- DeleteVolumeGroupResponse actualDeleteVolumeGroupResponse = vnfAdapterVolumeGroupResources.deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup);
-
- verify(MOCK_vnfVolumeAdapterClient, times(1)).deleteVNFVolumes(volumeGroup.getVolumeGroupId(), deleteVolumeGroupRequest);
verify(MOCK_vnfAdapterObjectMapper, times(1)).deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup);
- assertThat(expectedDeleteVolumeGroupResponse, Matchers.sameBeanAs(actualDeleteVolumeGroupResponse));
+ assertThat(expectedDeleteVolumeGroupRequest, Matchers.sameBeanAs(actualDeleteVolumeGroupRequest));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientLogResponseTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientLogResponseTest.java
new file mode 100644
index 0000000000..e28c465437
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientLogResponseTest.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.sdnc;
+
+import static org.junit.Assert.*;
+
+import java.util.LinkedHashMap;
+import java.util.Optional;
+
+import org.junit.Test;
+
+public class SDNCClientLogResponseTest {
+
+ private SDNCClient sdncClient = new SDNCClient();
+
+ @Test
+ public void logSDNCResponseTest() {
+ LinkedHashMap<String, String> output = new LinkedHashMap<>();
+ output.put("response-code", "404");
+ output.put("response-message", "not found");
+ Optional<String> response = sdncClient.logSDNCResponse(output);
+ assertEquals(true, response.isPresent());
+ assertEquals("{\"response-code\":\"404\",\"response-message\":\"not found\"}",response.get());
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
index b3999a788c..04397c499d 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
@@ -29,7 +29,9 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -41,6 +43,7 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
+import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
@@ -50,6 +53,10 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class VfModuleTopologyOperationRequestMapperTest {
private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
+ private final static String ERRORMESSAGE = "VF Module model info is null for testVfModuleId";
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
@Test
public void assignGenericResourceApiVfModuleInformationTest() throws Exception {
@@ -220,5 +227,57 @@ public class VfModuleTopologyOperationRequestMapperTest {
assertEquals("vnfModelCustomizationUuid", vfModuleSDNCrequest.getVnfInformation().getOnapModelInformation().getModelCustomizationUuid());
assertEquals("vfModuleModelCustomizationUuid", vfModuleSDNCrequest.getVfModuleInformation().getOnapModelInformation().getModelCustomizationUuid());
}
+
+ @Test
+ public void reqMapperNoModelInfoTest() throws Exception {
+
+ // prepare and set service instance
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
+ modelInfoServiceInstance.setModelName("serviceModelName");
+ modelInfoServiceInstance.setModelUuid("serviceModelUuid");
+ modelInfoServiceInstance.setModelVersion("serviceModelVersion");
+
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ // prepare Customer object
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("globalCustomerId");
+ customer.setServiceSubscription(new ServiceSubscription());
+ // set Customer on service instance
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ //
+ RequestContext requestContext = new RequestContext();
+ HashMap<String, String> userParams = new HashMap<String, String>();
+ userParams.put("key1", "value1");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("testVnfId");
+ vnf.setVnfType("testVnfType");
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid");
+ modelInfoGenericVnf.setModelName("vnfModelName");
+ modelInfoGenericVnf.setModelVersion("vnfModelVersion");
+ modelInfoGenericVnf.setModelUuid("vnfModelUuid");
+ modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid");
+ vnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("testVfModuleId");
+ vfModule.setVfModuleName("testVfModuleName");
+ vfModule.setModelInfoVfModule(null);
+
+ CloudRegion cloudRegion = new CloudRegion();
+
+ VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper();
+ expectedException.expect(MapperException.class);
+ expectedException.expectMessage(ERRORMESSAGE);
+
+ mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, null, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, null);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopology.json
index a24f8bf125..8e43f2a1e5 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopology.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopology.json
@@ -1,4 +1,5 @@
{
+"vf-module-topology":{
"vf-module-assignments": {
"vms": {
"vm": [
@@ -175,4 +176,4 @@
}
]
}
-} \ No newline at end of file
+}} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json
index eaedb92281..2036501572 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVfModuleTopologyWithCloudResources.json
@@ -1,4 +1,5 @@
{
+"vf-module-topology":{
"vf-module-assignments": {
"vms": {
"vm": [
@@ -176,4 +177,4 @@
]
},
"sdnc-generated-cloud-resources": "true"
-} \ No newline at end of file
+}} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopology.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopology.json
index 39c6708631..5a5b2febbd 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopology.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopology.json
@@ -1,4 +1,5 @@
{
+"vnf-topology":{
"vnf-resource-assignments": {
"availability-zones": {
"availability-zone": [
@@ -45,4 +46,5 @@
"vnf-topology-identifier-structure": {},
"onap-model-information": {},
"aic-cloud-region": ""
+}
} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json
index 21ba0876f5..73e36758fc 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetDhcpDisabled.json
@@ -1,4 +1,5 @@
{
+"vnf-topology":{
"vnf-resource-assignments": {
"availability-zones": {
"availability-zone": [
@@ -45,4 +46,4 @@
"vnf-topology-identifier-structure": {},
"onap-model-information": {},
"aic-cloud-region": ""
-} \ No newline at end of file
+}} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json
index 5062a06117..e6ea0b2e5c 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologySubnetMultipleDhcp.json
@@ -1,4 +1,5 @@
{
+"vnf-topology":{
"vnf-resource-assignments": {
"availability-zones": {
"availability-zone": [
@@ -65,4 +66,4 @@
"vnf-topology-identifier-structure": {},
"onap-model-information": {},
"aic-cloud-region": ""
-} \ No newline at end of file
+}} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json
index fedee49609..3ca3403d47 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithCloudResources.json
@@ -1,4 +1,5 @@
{
+"vnf-topology":{
"vnf-resource-assignments": {
"availability-zones": {
"availability-zone": [
@@ -44,4 +45,4 @@
"onap-model-information": {},
"aic-cloud-region": "",
"sdnc-generated-cloud-resources": "true"
-} \ No newline at end of file
+}} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json
index a6964a323f..7690c6bf54 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/genericResourceApiVfModuleSdncVnfTopologyWithSingletonArray.json
@@ -1,4 +1,5 @@
{
+"vnf-topology":{
"vnf-resource-assignments": {
"availability-zones": {
"availability-zone": "zone0"
@@ -41,4 +42,4 @@
"vnf-topology-identifier-structure": {},
"onap-model-information": {},
"aic-cloud-region": ""
-} \ No newline at end of file
+}} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json
index cc32040f38..91d64b98ca 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json
@@ -47,6 +47,7 @@
"model-uuid" : "modelUuid",
"model-invariant-uuid" : "modelInvariantUuid"
},
+ "from-preload": null,
"network-id" : "TEST_NETWORK_ID",
"network-type" : null
}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json
index 40946725d9..95a2af3880 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json
@@ -46,6 +46,7 @@
"model-uuid" : "modelUuid",
"model-invariant-uuid" : "modelInvariantUuid"
},
+ "from-preload": null,
"network-id" : "TEST_NETWORK_ID",
"network-type" : null
}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json
index 7ca8153def..a7cf1e1434 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json
@@ -47,6 +47,7 @@
"model-uuid" : "modelUuid",
"model-invariant-uuid" : "modelInvariantUuid"
},
+ "from-preload": null,
"network-id" : "TEST_NETWORK_ID",
"network-type" : null
}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json
index 50d5642fee..a344e8081e 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json
@@ -55,6 +55,7 @@
"model-invariant-uuid" : "vfModuleModelInvariantUuid"
},
"vf-module-id" : "testVfModuleId",
+ "from-preload" : null,
"vf-module-type": "vfModuleModelName"
},
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json
index 64192ff8d0..f06d72a806 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json
@@ -21,8 +21,9 @@
"svc-action" : "unassign"
},
"vf-module-information" : {
- "vf-module-id" : "testVfModuleId"
- },
+ "vf-module-id" : "testVfModuleId",
+ "from-preload": null
+ },
"vnf-information" : {
"vnf-id" : "testVnfId",
"vnf-type" : "testVnfType"
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml
new file mode 100644
index 0000000000..feb7ede50b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/CreateVfModuleVolumeCallbackResponse.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<createVolumeGroupResponse>
+ <messageId>{{MESSAGE-ID}}</messageId>
+ <volumeGroupCreated>true</volumeGroupCreated>
+ <volumeGroupId>d485ecee-957c-4a0a-8b95-27a22b90103f</volumeGroupId>
+ <volumeGroupOutputs>
+ <entry>
+ <key>mmsc_vol_1</key>
+ <value>a73e0fe9-1ce8-49c2-8fef-e2788605be29</value>
+ </entry>
+ <entry>
+ <key>mmsc_vol_2</key>
+ <value>37b6455a-5ea8-463a-89e3-0efeaf7b7c6d</value>
+ </entry>
+ <entry>
+ <key>nemsfe_vol_1</key>
+ <value>b7ff1c21-d138-49a3-bf13-4cfd91efaf48</value>
+ </entry>
+ <entry>
+ <key>nemsbe_vol_1</key>
+ <value>a5988471-cd42-44d8-b078-64f2f13d3d4c</value>
+ </entry>
+ <entry>
+ <key>mmsc_vol_5</key>
+ <value>f7b91c1e-ab8c-413a-a850-ba80a246c7e0</value>
+ </entry>
+ <entry>
+ <key>nemsfe_vol_2</key>
+ <value>957ea3f3-2d4a-4707-bfd2-ba66f42037c2</value>
+ </entry>
+ <entry>
+ <key>mmsc_vol_3</key>
+ <value>de6fccfe-d61a-48b0-b03b-87bf1bf749b3</value>
+ </entry>
+ <entry>
+ <key>mmsc_vol_4</key>
+ <value>76162310-2c38-4c32-981c-5c2880190077</value>
+ </entry>
+ </volumeGroupOutputs>
+ <volumeGroupRollback>
+ <cloudSiteId>RDM2WAGPLCP</cloudSiteId>
+ <messageId>e585e4f4-9452-437a-b294-45a2d6d3b7a3</messageId>
+ <msoRequest>
+ <requestId>c30b9453-4b68-4c2e-aacf-58a5ba648bf5</requestId>
+ <serviceInstanceId>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</serviceInstanceId>
+ </msoRequest>
+ <tenantId>1bbab536a19b4756926e7d0ec1eb543c</tenantId>
+ <volumeGroupCreated>true</volumeGroupCreated>
+ <volumeGroupId>78987</volumeGroupId>
+ <volumeGroupStackId>ZRDM1MMSC01_base_vol/7f74e5e1-5fc1-4593-ac7e-cc9899a106ef</volumeGroupStackId>
+ </volumeGroupRollback>
+ <volumeGroupStackId>testHeatStackId1</volumeGroupStackId>
+</createVolumeGroupResponse>
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DeleteVfModuleVolumeCallbackResponse.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DeleteVfModuleVolumeCallbackResponse.xml
new file mode 100644
index 0000000000..25aa45afd9
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/DeleteVfModuleVolumeCallbackResponse.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<deleteVolumeGroupResponse>
+ <messageId>{{MESSAGE-ID}}</messageId>
+ <volumeGroupDeleted>true</volumeGroupDeleted>
+</deleteVolumeGroupResponse>
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteResponse.xml b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteResponse.xml
new file mode 100644
index 0000000000..b5b61192f7
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/VfModularity/VNFAdapterRestDeleteResponse.xml
@@ -0,0 +1,56 @@
+<deleteVfModuleResponse>
+ <messageId>testMessageId</messageId>
+ <vfModuleDeleted>true</vfModuleDeleted>
+ <vfModuleId>testVfModuleId</vfModuleId>
+ <vfModuleOutputs>
+ <entry>
+ <key>key1</key>
+ <value>value1</value>
+ </entry>
+ <entry>
+ <key>key2</key>
+ <value>value2</value>
+ </entry>
+ <entry>
+ <key>server1_private_ip</key>
+ <value>192.168.28.3</value>
+ </entry>
+ <entry>
+ <key>contrail-service-instance-fqdn</key>
+ <value>default-domain:MSOTest:MsoNW-RA</value>
+ </entry>
+ <entry>
+ <key>policyKey1_contrail_network_policy_fqdn</key>
+ <value>MSOTest:DefaultPolicyFQDN1</value>
+ </entry>
+ <entry>
+ <key>policyKey2_contrail_network_policy_fqdn</key>
+ <value>MSOTest:DefaultPolicyFQDN2</value>
+ </entry>
+ <entry>
+ <key>oam_management_v6_address</key>
+ <value>2000:abc:bce:1111</value>
+ </entry>
+ <entry>
+ <key>oam_management_v4_address</key>
+ <value>127.0.0.1</value>
+ </entry>
+ <entry>
+ <key>internal_security_group</key>
+ <value>test_internal_security_group</value>
+ </entry>
+ <entry>
+ <key>int_internal_net_id</key>
+ <value>test_int_internal_net_id</value>
+ </entry>
+ <entry>
+ <key>dsx_server_group_id</key>
+ <value>test_dsx_server_group_id</value>
+ </entry>
+ <entry>
+ <key>mcas_host_key</key>
+ <value>test_mcas_host_key</value>
+ </entry>
+ </vfModuleOutputs>
+ <vnfId>testVnfId</vnfId>
+</deleteVfModuleResponse> \ No newline at end of file