summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java144
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java123
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java72
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java162
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java22
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java125
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java96
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/BaseClientTest.java50
25 files changed, 713 insertions, 223 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
index e534142471..887c51e179 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
@@ -24,6 +24,7 @@ import org.camunda.bpm.engine.delegate.BpmnError;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
@@ -40,6 +41,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.client.orchestration.AAINetworkResources;
import org.onap.so.client.orchestration.AAIServiceInstanceResources;
import org.onap.so.client.orchestration.AAIVfModuleResources;
@@ -74,6 +76,8 @@ public class AAICreateTasks {
private AAINetworkResources aaiNetworkResources;
@Autowired
private AAIVpnBindingResources aaiVpnBindingResources;
+ @Autowired
+ private AAIConfigurationResources aaiConfigurationResources;
public void createServiceInstance(BuildingBlockExecution execution) {
try {
@@ -376,4 +380,13 @@ public class AAICreateTasks {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+
+ public void createConfiguration(BuildingBlockExecution execution){
+ try{
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
+ aaiConfigurationResources.createConfiguration(configuration);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
index cb265b6e41..a00806a19c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
@@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.aai.tasks;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -31,6 +32,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.client.orchestration.AAINetworkResources;
import org.onap.so.client.orchestration.AAIServiceInstanceResources;
import org.onap.so.client.orchestration.AAIVfModuleResources;
@@ -56,6 +58,8 @@ public class AAIDeleteTasks {
private AAINetworkResources aaiNetworkResources;
@Autowired
private AAIVolumeGroupResources aaiVolumeGroupResources;
+ @Autowired
+ private AAIConfigurationResources aaiConfigurationResources;
public void deleteVfModule(BuildingBlockExecution execution) throws Exception {
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
@@ -133,4 +137,12 @@ public class AAIDeleteTasks {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ public void deleteConfiguration(BuildingBlockExecution execution) {
+ try {
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
+ aaiConfigurationResources.deleteConfiguration(configuration);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index b059a77641..58c51f6223 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -24,6 +24,7 @@ import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -35,6 +36,7 @@ import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAICollectionResources;
+import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.client.orchestration.AAINetworkResources;
import org.onap.so.client.orchestration.AAIServiceInstanceResources;
import org.onap.so.client.orchestration.AAIVfModuleResources;
@@ -64,6 +66,8 @@ public class AAIUpdateTasks {
private AAINetworkResources aaiNetworkResources;
@Autowired
private AAICollectionResources aaiCollectionResources;
+ @Autowired
+ private AAIConfigurationResources aaiConfigurationResources;
public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) {
try {
@@ -394,4 +398,21 @@ public class AAIUpdateTasks {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) {
+ try {
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
+ aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) {
+ try {
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
+ aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.java
new file mode 100644
index 0000000000..d13c5db871
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOut.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.flowspecific.tasks;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import org.onap.appc.client.lcm.model.Action;
+import org.onap.so.bpmn.appc.payload.beans.ConfigScaleOutPayload;
+import org.onap.so.bpmn.appc.payload.beans.RequestParametersConfigScaleOut;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+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.tasks.ExtractPojosForBB;
+import org.onap.so.client.appc.ApplicationControllerAction;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.db.catalog.beans.ControllerSelectionReference;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.jayway.jsonpath.JsonPath;
+
+@Component
+public class ConfigurationScaleOut {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ConfigurationScaleOut.class);
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+ @Autowired
+ private ApplicationControllerAction appCClient;
+ private static final String ACTION = "action";
+ private static final String MSO_REQUEST_ID = "msoRequestId";
+ private static final String VNF_ID = "vnfId";
+ private static final String VNF_NAME = "vnfName";
+ private static final String VFMODULE_ID = "vfModuleId";
+ private static final String CONTROLLER_TYPE = "controllerType";
+ private static final String PAYLOAD = "payload";
+
+ public void setParamsForConfigurationScaleOut(BuildingBlockExecution execution) {
+
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ try {
+ List<Map<String, String>> jsonPathForCfgParams = gBBInput.getRequestContext().getConfigurationParameters();
+ String key = null;
+ String paramValue = null;
+ ObjectMapper mapper = new ObjectMapper();
+ String configScaleOutPayloadString = null;
+ ControllerSelectionReference controllerSelectionReference;
+ ConfigScaleOutPayload configPayload = new ConfigScaleOutPayload();
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ String vnfId = vnf.getVnfId();
+ String vnfName = vnf.getVnfName();
+ String vnfType = vnf.getVnfType();
+ String actionCategory = Action.ConfigScaleOut.toString();
+ controllerSelectionReference = catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, actionCategory);
+ String controllerName = controllerSelectionReference.getControllerName();
+
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
+ String sdncVfModuleQueryResponse = execution.getVariable("SDNCQueryResponse_" + vfModule.getVfModuleId());
+
+ Map<String, String> paramsMap = new HashMap<>();
+ RequestParametersConfigScaleOut requestParameters = new RequestParametersConfigScaleOut();
+ String configScaleOutParam = null;
+ if (jsonPathForCfgParams != null) {
+ for (Map<String, String> param : jsonPathForCfgParams) {
+ for (Map.Entry<String,String> entry : param.entrySet()) {
+ key = entry.getKey();
+ paramValue = entry.getValue();
+ configScaleOutParam = JsonPath.parse(sdncVfModuleQueryResponse).read(paramValue);
+ if(configScaleOutParam != null){
+ paramsMap.put(key, configScaleOutParam);
+ }
+ }
+ }
+ }
+ requestParameters.setVfModuleId(vfModule.getVfModuleId());
+ requestParameters.setVnfHostIpAddress(vnf.getIpv4OamAddress());
+ configPayload.setConfigurationParameters(paramsMap);
+ configPayload.setRequestParameters(requestParameters);
+ configScaleOutPayloadString = mapper.writeValueAsString(configPayload);
+ configScaleOutPayloadString = configScaleOutPayloadString.replaceAll("\"", "\\\\\"");
+
+ execution.setVariable(ACTION, actionCategory);
+ execution.setVariable(MSO_REQUEST_ID, gBBInput.getRequestContext().getMsoRequestId());
+ execution.setVariable(VNF_ID, vnfId);
+ execution.setVariable(VNF_NAME, vnfName);
+ execution.setVariable(VFMODULE_ID, vfModule.getVfModuleId());
+ execution.setVariable(CONTROLLER_TYPE, controllerName);
+ execution.setVariable(PAYLOAD, configScaleOutPayloadString);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void callAppcClient(BuildingBlockExecution execution) {
+ try{
+ Action commandAction = Action.valueOf(execution.getVariable(ACTION));
+ String msoRequestId = execution.getVariable(MSO_REQUEST_ID);
+ String vnfId = execution.getVariable(VNF_ID);
+ Optional<String> payloadString = null;
+ if(execution.getVariable(PAYLOAD) != null){
+ String pay = execution.getVariable(PAYLOAD);
+ payloadString = Optional.of(pay);
+ }
+ String controllerType = execution.getVariable(CONTROLLER_TYPE);
+ HashMap<String, String> payloadInfo = new HashMap<>();
+ payloadInfo.put(VNF_NAME, execution.getVariable(VNF_NAME));
+ payloadInfo.put(VFMODULE_ID,execution.getVariable(VFMODULE_ID));
+ //PayloadInfo contains extra information that adds on to payload before making request to appc
+ appCClient.runAppCCommand(commandAction, msoRequestId, vnfId, payloadString, payloadInfo, controllerType);
+ }catch(Exception ex){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
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 b2b071e1ee..57d097e87a 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
@@ -27,6 +27,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -36,21 +37,26 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.javatuples.Pair;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aai.domain.yang.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
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.bpmn.servicedecomposition.tasks.BBInputSetup;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
-import org.onap.so.db.catalog.beans.InstanceGroup;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -103,6 +109,8 @@ public class WorkflowAction {
private ExceptionBuilder exceptionBuilder;
@Autowired
private CatalogDbClient catalogDbClient;
+ @Autowired
+ private AAIConfigurationResources aaiConfigurationResources;
public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) {
this.bbInputSetupUtils = bbInputSetupUtils;
@@ -125,7 +133,6 @@ public class WorkflowAction {
WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
List<Resource> resourceCounter = new ArrayList<>();
-
execution.setVariable("sentSyncResponse", false);
execution.setVariable("homing", false);
execution.setVariable("calledHoming", false);
@@ -212,7 +219,8 @@ public class WorkflowAction {
} else if (resourceType == WorkflowType.SERVICE
&& (requestAction.equalsIgnoreCase("activateInstance")
|| requestAction.equalsIgnoreCase("unassignInstance")
- || requestAction.equalsIgnoreCase("deleteInstance"))) {
+ || requestAction.equalsIgnoreCase("deleteInstance")
+ || requestAction.equalsIgnoreCase("activateFabricConfiguration"))) {
// SERVICE-MACRO-ACTIVATE, SERVICE-MACRO-UNASSIGN, and
// SERVICE-MACRO-DELETE
// Will never get user params with service, macro will have
@@ -230,7 +238,7 @@ public class WorkflowAction {
foundObjects = foundObjects + type + " - " + resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()).size() + " ";
}
msoLogger.info("Found " + foundObjects);
-
+
if (orchFlows == null || orchFlows.isEmpty()) {
orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte);
}
@@ -267,7 +275,6 @@ public class WorkflowAction {
execution.setVariable("flowsToExecute", flowsToExecute);
} catch (Exception ex) {
- msoLogger.error(ex);
buildAndThrowException(execution, "Exception in create execution list " + ex.getMessage(), ex);
}
}
@@ -278,7 +285,7 @@ public class WorkflowAction {
if(resource.isBaseVfModule()){
Collections.swap(vfModuleResources, 0, count);
break;
- }
+ }
count++;
}
return vfModuleResources;
@@ -294,7 +301,7 @@ public class WorkflowAction {
List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList());
for(int i = 0; i < resources.size(); i++){
updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type), null);
- }
+ }
});
}
@@ -317,7 +324,7 @@ public class WorkflowAction {
.collect(Collectors.toList()).get(i);
updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null, resource.getVirtualLinkKey()); }
});
- }
+ }
protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id, String virtualLinkKey){
String resourceId = id;
@@ -337,6 +344,8 @@ public class WorkflowAction {
workflowResourceIds.setNetworkId(resourceId);
}else if(resource == WorkflowType.NETWORKCOLLECTION){
workflowResourceIds.setNetworkCollectionId(resourceId);
+ }else if(resource == WorkflowType.CONFIGURATION){
+ workflowResourceIds.setConfigurationId(resourceId);
}
ebb.setWorkflowResourceIds(workflowResourceIds);
}
@@ -389,7 +398,7 @@ public class WorkflowAction {
String toscaNodeType = collectionResourceCustomization.getCollectionResource().getInstanceGroup().getToscaNodeType();
if (toscaNodeType != null && toscaNodeType.contains("NetworkCollection")) {
int minNetworks = 0;
- InstanceGroup instanceGroup = collectionResourceCustomization.getCollectionResource().getInstanceGroup();
+ org.onap.so.db.catalog.beans.InstanceGroup instanceGroup = collectionResourceCustomization.getCollectionResource().getInstanceGroup();
CollectionResourceInstanceGroupCustomization collectionInstCust = null;
if(!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
for(CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup.getCollectionInstanceGroupCustomizations()) {
@@ -418,14 +427,14 @@ public class WorkflowAction {
}
}
} else {
- msoLogger.debug("Instance Group tosca node type does not contain NetworkCollection: " + toscaNodeType);
+ msoLogger.debug("Instance Group tosca node type does not contain NetworkCollection: " + toscaNodeType);
+ }
+ }else{
+ msoLogger.debug("No Instance Group found for network collection.");
}
}else{
- msoLogger.debug("No Instance Group found for network collection.");
+ msoLogger.debug("No Network Collection found. collectionResource is null");
}
- }else{
- msoLogger.debug("No Network Collection found. collectionResource is null");
- }
} else {
msoLogger.debug("No Network Collection Customization found");
}
@@ -484,6 +493,20 @@ public class WorkflowAction {
aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId()));
resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,serviceInstanceMSO.getCollection().getId(),false));
}
+ if (serviceInstanceMSO.getConfigurations() !=null) {
+ for(Configuration config : serviceInstanceMSO.getConfigurations()){
+ Optional<org.onap.aai.domain.yang.Configuration> aaiConfig = aaiConfigurationResources.getConfiguration(config.getConfigurationId());
+ if(aaiConfig.isPresent() && aaiConfig.get().getRelationshipList()!=null){
+ for(Relationship relationship : aaiConfig.get().getRelationshipList().getRelationship()){
+ if(relationship.getRelatedTo().contains("vnfc")){
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION, config.getConfigurationId()));
+ resourceCounter.add(new Resource(WorkflowType.CONFIGURATION,config.getConfigurationId(),false));
+ break;
+ }
+ }
+ }
+ }
+ }
} catch (Exception ex) {
buildAndThrowException(execution,
"Could not find existing Service Instance or related Instances to execute the request on.");
@@ -495,6 +518,8 @@ public class WorkflowAction {
throws IOException {
boolean foundRelated = false;
boolean foundVfModuleOrVG = false;
+ String vnfCustomizationUUID = "";
+ String vfModuleCustomizationUUID = "";
if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams();
for (Map<String, Object> params : userParams) {
@@ -507,18 +532,23 @@ public class WorkflowAction {
for (Vnfs vnf : validate.getResources().getVnfs()) {
resourceCounter.add(new Resource(WorkflowType.VNF,vnf.getModelInfo().getModelCustomizationId(),false));
foundRelated = true;
+ if(vnf.getModelInfo()!=null && vnf.getModelInfo().getModelCustomizationUuid()!=null){
+ vnfCustomizationUUID = vnf.getModelInfo().getModelCustomizationUuid();
+ }
if (vnf.getVfModules() != null) {
for (VfModules vfModule : vnf.getVfModules()) {
VfModuleCustomization vfModuleCustomization = catalogDbClient
.getVfModuleCustomizationByModelCuztomizationUUID(
vfModule.getModelInfo().getModelCustomizationUuid());
if (vfModuleCustomization != null) {
- if(vfModuleCustomization.getVfModule()!=null && vfModuleCustomization.getVfModule().getVolumeHeatTemplate()!=null &&vfModuleCustomization.getVolumeHeatEnv() != null) {
+
+ if(vfModuleCustomization.getVfModule() != null && vfModuleCustomization.getVfModule().getVolumeHeatTemplate() != null && vfModuleCustomization.getVolumeHeatEnv() != null) {
resourceCounter.add(new Resource(WorkflowType.VOLUMEGROUP,vfModuleCustomization.getModelCustomizationUUID(),false));
foundRelated = true;
foundVfModuleOrVG = true;
}
- if(vfModuleCustomization.getVfModule()!=null && vfModuleCustomization.getVfModule().getModuleHeatTemplate()!=null && vfModuleCustomization.getHeatEnvironment()!=null){
+
+ if(vfModuleCustomization.getVfModule() != null && vfModuleCustomization.getVfModule().getModuleHeatTemplate() != null && vfModuleCustomization.getHeatEnvironment() != null){
foundRelated = true;
foundVfModuleOrVG = true;
Resource resource = new Resource(WorkflowType.VFMODULE,vfModuleCustomization.getModelCustomizationUUID(),false);
@@ -528,6 +558,15 @@ public class WorkflowAction {
resource.setBaseVfModule(false);
}
resourceCounter.add(resource);
+ if(vfModule.getModelInfo()!=null && vfModule.getModelInfo().getModelCustomizationUuid()!=null){
+ vfModuleCustomizationUUID = vfModule.getModelInfo().getModelCustomizationUuid();
+ }
+ if(!vnfCustomizationUUID.equals("")&&!vfModuleCustomizationUUID.equals("")){
+ List<String> configs = traverseCatalogDbForConfiguration(vnfCustomizationUUID,vfModuleCustomizationUUID);
+ for(String config : configs){
+ resourceCounter.add(new Resource(WorkflowType.CONFIGURATION,config,false));
+ }
+ }
}
if(!foundVfModuleOrVG){
buildAndThrowException(execution, "Could not determine if vfModule was a vfModule or volume group. Heat template and Heat env are null");
@@ -556,6 +595,25 @@ public class WorkflowAction {
}
return foundRelated;
}
+
+
+ private List<String> traverseCatalogDbForConfiguration(String vnfCustomizationUUID, String vfModuleCustomizationUUID) {
+ List<String> configurations = new ArrayList<>();
+ try{
+ List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(vnfCustomizationUUID, vfModuleCustomizationUUID);
+ for(CvnfcCustomization cvnfc : cvnfcCustomizations){
+ for(VnfVfmoduleCvnfcConfigurationCustomization customization : cvnfc.getVnfVfmoduleCvnfcConfigurationCustomization()){
+ if(customization.getConfigurationResource().getToscaNodeType().contains("FabricConfiguration")){
+ configurations.add(customization.getConfigurationResource().getModelUUID());
+ }
+ }
+ }
+ msoLogger.debug("found " + configurations.size() + " configurations");
+ return configurations;
+ } catch (Exception ex){
+ return configurations;
+ }
+ }
protected String queryCatalogDBforNetworkCollection(DelegateExecution execution, ServiceInstancesRequest sIRequest) {
org.onap.so.db.catalog.beans.Service service = catalogDbClient
@@ -664,7 +722,6 @@ 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.");
}
@@ -810,7 +867,7 @@ public class WorkflowAction {
.collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
}
- } else {
+ }else {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, "", apiVersion, resourceId,
requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
}
@@ -852,24 +909,24 @@ public class WorkflowAction {
buildAndThrowException(execution,"The request: Macro " + resourceName + " " + requestAction + " is not supported by GR_API.");
}
} else {
- if(northBoundRequest.getIsToplevelflow()!=null){
- execution.setVariable(G_ISTOPLEVELFLOW, northBoundRequest.getIsToplevelflow());
- }
- List<OrchestrationFlow> flows = northBoundRequest.getOrchestrationFlowList();
- if (flows == null)
- flows = new ArrayList<>();
- for (OrchestrationFlow flow : flows) {
- if (!flow.getFlowName().contains("BB")) {
- List<OrchestrationFlow> macroQueryFlows = catalogDbClient
- .getOrchestrationFlowByAction(flow.getFlowName());
- for (OrchestrationFlow macroFlow : macroQueryFlows) {
- listToExecute.add(macroFlow);
- }
- } else {
- listToExecute.add(flow);
+ if(northBoundRequest.getIsToplevelflow()!=null){
+ execution.setVariable(G_ISTOPLEVELFLOW, northBoundRequest.getIsToplevelflow());
+ }
+ List<OrchestrationFlow> flows = northBoundRequest.getOrchestrationFlowList();
+ if (flows == null)
+ flows = new ArrayList<>();
+ for (OrchestrationFlow flow : flows) {
+ if (!flow.getFlowName().contains("BB")) {
+ List<OrchestrationFlow> macroQueryFlows = catalogDbClient
+ .getOrchestrationFlowByAction(flow.getFlowName());
+ for (OrchestrationFlow macroFlow : macroQueryFlows) {
+ listToExecute.add(macroFlow);
}
+ } else {
+ listToExecute.add(flow);
}
}
+ }
return listToExecute;
}
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 101a355c2f..ab29e21dea 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,9 +30,10 @@ 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.db.request.RequestsDbClient;
+
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;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
index be19f25cca..4a1c3f512c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
@@ -7,15 +7,14 @@
* 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.
- * Modifications Copyright (C) 2018 IBM
* ============LICENSE_END=========================================================
*/
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
index b84f8b6459..e9dc3742f5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
@@ -157,6 +157,15 @@ public class AAIConfigurationResources {
AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
injectionHelper.getAaiClient().delete(aaiResourceUri);
}
+ /**
+ * method to delete Configuration details in A&AI
+ *
+ * @param configuration
+ */
+ public void deleteConfiguration(Configuration configuration) {
+ AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ injectionHelper.getAaiClient().delete(aaiResourceUri);
+ }
/**
* Get Configuration from AAI using related Link
@@ -167,4 +176,11 @@ public class AAIConfigurationResources {
return injectionHelper.getAaiClient()
.get(org.onap.aai.domain.yang.Configuration.class, AAIUriFactory.createResourceFromExistingURI(AAIObjectType.CONFIGURATION, UriBuilder.fromPath(relatedLink).build()));
}
+
+ public void updateOrchestrationStatusConfiguration(Configuration configuration, OrchestrationStatus orchestrationStatus) {
+ AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ configuration.setOrchestrationStatus(orchestrationStatus);
+ org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
+ injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java
deleted file mode 100644
index 50137cf985..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdnc;
-
-import org.springframework.core.ParameterizedTypeReference;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
-import org.springframework.http.client.BufferingClientHttpRequestFactory;
-import org.springframework.http.client.SimpleClientHttpRequestFactory;
-import org.springframework.web.client.RestClientException;
-import org.springframework.web.client.RestTemplate;
-
-//TODO move to common location
-public class BaseClient<I,O> {
-
- private HttpHeaders httpHeader;
- private String targetUrl;
-
- public HttpHeaders getHttpHeader() {
- return httpHeader;
- }
-
- public void setHttpHeader(HttpHeaders httpHeader) {
- this.httpHeader = httpHeader;
- }
-
- public String getTargetUrl() {
- return targetUrl;
- }
-
- public void setTargetUrl(String targetUrl) {
- this.targetUrl = targetUrl;
- }
-
- public O get(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException {
- return run(data, HttpMethod.GET, typeRef, uriVariables);
- }
-
- public O post(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException {
- return run(data, HttpMethod.POST, typeRef, uriVariables);
- }
-
- public O run(I data, HttpMethod method, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException {
- HttpEntity<I> requestEntity = new HttpEntity<I>(data, getHttpHeader());
- RestTemplate restTemplate = new RestTemplate();
- restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory()));
- ResponseEntity<O> responseEntity = restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef,
- uriVariables);
- return responseEntity.getBody();
- }
-
-} \ No newline at end of file
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 9e60196426..0061f50ba8 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
@@ -24,6 +24,7 @@ import java.util.LinkedHashMap;
import javax.ws.rs.core.UriBuilder;
+import org.onap.so.bpmn.common.baseclient.BaseClient;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCProperties;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
index cee94e28bd..eb12278528 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
@@ -23,9 +23,9 @@ package org.onap.so.client.sniro;
import java.util.LinkedHashMap;
import org.camunda.bpm.engine.delegate.BpmnError;
+import org.onap.so.bpmn.common.baseclient.BaseClient;
import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.client.exception.BadResponseException;
-import org.onap.so.client.sdnc.BaseClient;
import org.onap.so.client.sniro.beans.ManagerProperties;
import org.onap.so.client.sniro.beans.SniroConductorRequest;
import org.onap.so.client.sniro.beans.SniroManagerRequest;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java
index 6401d5516d..9244f7ee1f 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java
@@ -21,14 +21,8 @@ package org.onap.so;
-import java.io.IOException;
-
-import javax.annotation.PreDestroy;
-
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl;
-import org.onap.so.requestsdb.RequestsDBHelper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@@ -40,9 +34,7 @@ import org.springframework.context.annotation.Profile;
@Profile("test")
@EnableProcessApplication("MSO CommonBPMN Test Application")
@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
- @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) })
+ @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
public class TestApplication {
public static void main(String... args) {
SpringApplication.run(TestApplication.class, args);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
index 3fce15a6c4..2b25dfd9f1 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
@@ -28,8 +28,8 @@ import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper;
import org.onap.so.client.appc.ApplicationControllerAction;
-import org.onap.so.client.db.request.RequestsDbClient;
import org.onap.so.client.orchestration.AAICollectionResources;
+import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.client.orchestration.AAIInstanceGroupResources;
import org.onap.so.client.orchestration.AAINetworkResources;
import org.onap.so.client.orchestration.AAIServiceInstanceResources;
@@ -46,6 +46,8 @@ import org.onap.so.client.orchestration.VnfAdapterVfModuleResources;
import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.boot.test.mock.mockito.SpyBean;
@@ -111,6 +113,7 @@ public abstract class BaseTaskTest extends TestDataSetup {
protected CatalogDbClient catalogDbClient;
@MockBean
+ @Qualifier("RequestsDbClient")
protected RequestsDbClient requestsDbClient;
@Mock
@@ -118,10 +121,13 @@ public abstract class BaseTaskTest extends TestDataSetup {
@Mock
protected BBInputSetup bbInputSetup;
-
+
@SpyBean
protected SDNCClient SPY_sdncClient;
@MockBean
protected ApplicationControllerAction appCClient;
+
+ @MockBean
+ protected AAIConfigurationResources aaiConfigurationResources;
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
index a20b68b147..fb9533091b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
@@ -459,6 +459,7 @@ public class TestDataSetup{
genericVnf.setVnfId("testVnfId" + genericVnfCounter);
genericVnf.setVnfName("testVnfName" + genericVnfCounter);
genericVnf.setVnfType("testVnfType" + genericVnfCounter);
+ genericVnf.setIpv4OamAddress("10.222.22.2");
Platform platform = new Platform();
platform.setPlatformName("testPlatformName");
@@ -662,4 +663,20 @@ public class TestDataSetup{
return ar;
}
+
+ public Configuration setConfiguration () {
+ Configuration config = new Configuration();
+ config.setConfigurationId("testConfigurationId");
+ List<Configuration> configurations = new ArrayList<>();
+ configurations.add(config);
+ ServiceInstance serviceInstance = new ServiceInstance();
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ } catch(BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
+ lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "testConfigurationId");
+ serviceInstance.setConfigurations(configurations);
+ return config;
+ }
} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
index 51a7f1ab04..0b802a3385 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
@@ -26,6 +26,9 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import java.util.ArrayList;
+import java.util.List;
+
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Rule;
@@ -33,6 +36,7 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
@@ -54,6 +58,7 @@ public class AAICreateTasksTest extends BaseTaskTest{
private CloudRegion cloudRegion;
private VfModule vfModule;
private Customer customer;
+ private Configuration configuration;
@Rule
public final ExpectedException exception = ExpectedException.none();
@@ -67,6 +72,7 @@ public class AAICreateTasksTest extends BaseTaskTest{
volumeGroup = setVolumeGroup();
cloudRegion = setCloudRegion();
vfModule = setVfModule();
+ configuration = setConfiguration();
}
@@ -384,4 +390,12 @@ public class AAICreateTasksTest extends BaseTaskTest{
aaiCreateTasks.connectNetworkToTenant(execution);
verify(aaiNetworkResources, times(1)).connectNetworkToTenant(network, gBBInput.getCloudRegion());
}
+
+ @Test
+ public void createConfigurationTest() throws Exception {
+ gBBInput = execution.getGeneralBuildingBlock();
+ doNothing().when(aaiConfigurationResources).createConfiguration(configuration);
+ aaiCreateTasks.createConfiguration(execution);
+ verify(aaiConfigurationResources, times(1)).createConfiguration(configuration);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
new file mode 100644
index 0000000000..efe5b5d971
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
@@ -0,0 +1,162 @@
+/*-
+ * ============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.aai.tasks;
+
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class AAIDeleteTasksTest extends BaseTaskTest {
+ @Autowired
+ private AAIDeleteTasks aaiDeleteTasks;
+
+ private L3Network network;
+ private ServiceInstance serviceInstance;
+ private GenericVnf genericVnf;
+ private VfModule vfModule;
+ private VolumeGroup volumeGroup;
+ private CloudRegion cloudRegion;
+ private Configuration configuration;
+
+ @Before
+ public void before() {
+ serviceInstance = setServiceInstance();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ network = setL3Network();
+ volumeGroup = setVolumeGroup();
+ cloudRegion = setCloudRegion();
+ configuration = setConfiguration();
+ }
+
+ @Test
+ public void deleteVfModuleTest() throws Exception {
+ doNothing().when(aaiVfModuleResources).deleteVfModule(vfModule, genericVnf);
+ aaiDeleteTasks.deleteVfModule(execution);
+ verify(aaiVfModuleResources, times(1)).deleteVfModule(vfModule, genericVnf);
+ }
+
+ @Test
+ public void deleteVfModuleExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(Exception.class).when(aaiVfModuleResources).deleteVfModule(vfModule, genericVnf);
+ aaiDeleteTasks.deleteVfModule(execution);
+ }
+
+ @Test
+ public void deleteServiceInstanceTest() throws Exception {
+ doNothing().when(aaiServiceInstanceResources).deleteServiceInstance(serviceInstance);
+
+ aaiDeleteTasks.deleteServiceInstance(execution);
+
+ verify(aaiServiceInstanceResources, times(1)).deleteServiceInstance(serviceInstance);
+ }
+
+ @Test
+ public void deleteServiceInstanceExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(aaiServiceInstanceResources).deleteServiceInstance(serviceInstance);
+
+ aaiDeleteTasks.deleteServiceInstance(execution);
+ }
+
+ @Test
+ public void deleteVnfTest() throws Exception {
+ doNothing().when(aaiVnfResources).deleteVnf(genericVnf);
+ aaiDeleteTasks.deleteVnf(execution);
+ verify(aaiVnfResources, times(1)).deleteVnf(genericVnf);
+ }
+
+ @Test
+ public void deleteVnfTestException() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(Exception.class).when(aaiVnfResources).deleteVnf(genericVnf);
+
+ aaiDeleteTasks.deleteVnf(execution);
+ verify(aaiVnfResources, times(1)).deleteVnf(genericVnf);
+ }
+
+ @Test
+ public void deleteNetworkTest() throws Exception {
+ doNothing().when(aaiNetworkResources).deleteNetwork(network);
+ aaiDeleteTasks.deleteNetwork(execution);
+ verify(aaiNetworkResources, times(1)).deleteNetwork(network);
+ }
+
+ @Test
+ public void deleteCollectionTest() throws Exception {
+ doNothing().when(aaiNetworkResources).deleteCollection(serviceInstance.getCollection());
+ aaiDeleteTasks.deleteCollection(execution);
+ verify(aaiNetworkResources, times(1)).deleteCollection(serviceInstance.getCollection());
+ }
+
+ @Test
+ public void deleteInstanceGroupTest() throws Exception {
+ doNothing().when(aaiNetworkResources).deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
+ aaiDeleteTasks.deleteInstanceGroup(execution);
+ verify(aaiNetworkResources, times(1)).deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
+ }
+
+ @Test
+ public void deleteVolumeGroupTest() {
+ doNothing().when(aaiVolumeGroupResources).deleteVolumeGroup(volumeGroup, cloudRegion);
+
+ aaiDeleteTasks.deleteVolumeGroup(execution);
+
+ verify(aaiVolumeGroupResources, times(1)).deleteVolumeGroup(volumeGroup, cloudRegion);
+ }
+
+ @Test
+ public void deleteVolumeGroupExceptionTest() {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(aaiVolumeGroupResources).deleteVolumeGroup(volumeGroup, cloudRegion);
+
+ aaiDeleteTasks.deleteVolumeGroup(execution);
+ }
+
+ @Test
+ public void deleteConfigurationTest() throws Exception {
+ gBBInput = execution.getGeneralBuildingBlock();
+ doNothing().when(aaiConfigurationResources).deleteConfiguration(configuration);
+ aaiDeleteTasks.deleteConfiguration(execution);
+ verify(aaiConfigurationResources, times(1)).deleteConfiguration(configuration);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
index b45752957e..d800ae9618 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
@@ -32,6 +32,7 @@ import org.junit.Test;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -50,6 +51,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
private GenericVnf genericVnf;
private VolumeGroup volumeGroup;
private CloudRegion cloudRegion;
+ private Configuration configuration;
@Before
public void before() {
@@ -59,6 +61,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
volumeGroup = setVolumeGroup();
cloudRegion = setCloudRegion();
network = setL3Network();
+ configuration = setConfiguration();
}
@Test
@@ -462,4 +465,23 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
doThrow(Exception.class).when(aaiVfModuleResources).changeAssignVfModule(vfModule, genericVnf);
aaiUpdateTasks.updateModelVfModule(execution);
}
+
+ @Test
+ public void updateOrchestrationStatusDeactivateFabricConfigurationTest() throws Exception {
+ gBBInput = execution.getGeneralBuildingBlock();
+ doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED);
+
+ aaiUpdateTasks.updateOrchestrationStatusDeactivateFabricConfiguration(execution);
+
+ verify(aaiConfigurationResources, times(1)).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED);
+ }
+ @Test
+ public void updateOrchestrationStatusActivateFabricConfigurationTest() throws Exception {
+ gBBInput = execution.getGeneralBuildingBlock();
+ doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
+
+ aaiUpdateTasks.updateOrchestrationStatusActivateFabricConfiguration(execution);
+
+ verify(aaiConfigurationResources, times(1)).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java
new file mode 100644
index 0000000000..dabdc6811c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigurationScaleOutTest.java
@@ -0,0 +1,125 @@
+/*-
+ * ============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.flowspecific.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.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.appc.client.lcm.model.Action;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.db.catalog.beans.ControllerSelectionReference;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class ConfigurationScaleOutTest extends BaseTaskTest {
+
+ @Autowired
+ private ConfigurationScaleOut configurationScaleOut;
+
+ private GenericVnf genericVnf;
+ private VfModule vfModule;
+ private RequestContext requestContext;
+ private String msoRequestId;
+ private List<Map<String, String>> configurationParameters = new ArrayList<>();
+ private Map<String, String> configParamsMap = new HashMap<>();
+
+
+
+ @Before
+ public void before() {
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ msoRequestId = UUID.randomUUID().toString();
+ requestContext = setRequestContext();
+ requestContext.setMsoRequestId(msoRequestId);
+ configParamsMap.put("availability-zone", "$.vnf-topology.vnf-resource-assignments.availability-zones.availability-zone[0]");
+ configParamsMap.put("vnf-id", "$.vnf-topology.vnf-topology-identifier-structure.vnf-id");
+ configurationParameters.add(configParamsMap);
+ requestContext.setConfigurationParameters(configurationParameters);
+ gBBInput.setRequestContext(requestContext);
+ }
+
+ @Test
+ public void setParamsForConfigurationScaleOutTest() throws Exception {
+ ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference();
+ controllerSelectionReference.setControllerName("testName");
+ controllerSelectionReference.setActionCategory("testAction");
+ controllerSelectionReference.setVnfType("testVnfType");
+ String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNCClientGetResponse.json")));
+ String expectedPayload = "{\\\"request-parameters\\\":{\\\"vnf-host-ip-address\\\":\\\"10.222.22.2\\\","
+ + "\\\"vf-module-id\\\":\\\"testVfModuleId1\\\"},\\\"configuration-parameters\\\""
+ + ":{\\\"vnf-id\\\":\\\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\\\",\\\"availability-zone\\\":\\\"AZ-MN02\\\"}}";
+ execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncResponse);
+
+ doReturn(controllerSelectionReference).when(catalogDbClient).getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(), Action.ConfigScaleOut.toString());
+
+ configurationScaleOut.setParamsForConfigurationScaleOut(execution);
+
+ assertEquals(genericVnf.getVnfId(), execution.getVariable("vnfId"));
+ assertEquals(genericVnf.getVnfName(), execution.getVariable("vnfName"));
+ assertEquals("ConfigScaleOut", execution.getVariable("action"));
+ assertEquals(requestContext.getMsoRequestId(), execution.getVariable("msoRequestId"));
+ assertEquals(controllerSelectionReference.getControllerName(), execution.getVariable("controllerType"));
+ assertEquals(vfModule.getVfModuleId(), execution.getVariable("vfModuleId"));
+ assertEquals(expectedPayload, execution.getVariable("payload"));
+ }
+ @Test
+ public void callAppcClientTest() throws Exception {
+ Action action = Action.ConfigScaleOut;
+ String vnfId = genericVnf.getVnfId();
+ String controllerType = "testType";
+ String payload = "{\\\"request-parameters\\\":{\\\"vnf-host-ip-address\\\":\\\"10.222.22.2\\\","
+ + "\\\"vf-module-id\\\":\\\"testVfModuleId1\\\"},\\\"configuration-parameters\\\""
+ + ":{\\\"vnf-id\\\":\\\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\\\",\\\"availability-zone\\\":\\\"AZ-MN02\\\"}}";
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", "testVnfName");
+ payloadInfo.put("vfModuleId", "testVfModuleId");
+
+ execution.setVariable("action", Action.ConfigScaleOut.toString());
+ execution.setVariable("msoRequestId", msoRequestId);
+ execution.setVariable("controllerType", controllerType);
+ execution.setVariable("vnfId", "testVnfId1");
+ execution.setVariable("vnfName", "testVnfName");
+ execution.setVariable("vfModuleId", "testVfModuleId");
+ execution.setVariable("payload", payload);
+
+ doNothing().when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
+
+ configurationScaleOut.callAppcClient(execution);
+ 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/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index 3869988c40..65d16adb40 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -36,7 +36,6 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
@@ -74,7 +73,6 @@ import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
-import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.RequestParameters;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
@@ -304,7 +302,7 @@ public class WorkflowActionTest extends BaseTaskTest {
orchFlows.add(orch7);
OrchestrationFlow orch8 = new OrchestrationFlow();
orch8.setFlowName("ActivateServiceInstanceBB");
- orchFlows.add(orch8);
+ orchFlows.add(orch8);
ServiceInstance serviceInstanceAAI = new ServiceInstance();
serviceInstanceAAI.setServiceInstanceId("si0");
@@ -718,6 +716,9 @@ public class WorkflowActionTest extends BaseTaskTest {
orch15.setFlowName("ActivateServiceInstanceBB");
orchFlows.add(orch15);
+ Service service = new Service();
+ service.setModelUUID("3c40d244-808e-42ca-b09a-256d83d19d0a");
+
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
vfModuleCustomization.setModelCustomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
HeatEnvironment volumeHeatEnv = new HeatEnvironment();
@@ -743,6 +744,7 @@ public class WorkflowActionTest extends BaseTaskTest {
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f")).thenReturn(vfModuleCustomization);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8")).thenReturn(vfModuleCustomization2);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("da4d4327-fb7d-4311-ac7a-be7ba60cf969")).thenReturn(vfModuleCustomization3);
+ when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
@@ -796,48 +798,48 @@ public class WorkflowActionTest extends BaseTaskTest {
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = new LinkedList<>();
northBoundRequest.setOrchestrationFlowList(orchFlows);
- OrchestrationFlow orch1 = new OrchestrationFlow();
- orch1.setFlowName("DeactivateVfModuleBB");
- orchFlows.add(orch1);
- OrchestrationFlow orch2 = new OrchestrationFlow();
- orch2.setFlowName("DeleteVfModuleBB");
- orchFlows.add(orch2);
OrchestrationFlow orch3 = new OrchestrationFlow();
- orch3.setFlowName("DeactivateVolumeGroupBB");
+ orch3.setFlowName("DeactivateVfModuleBB");
orchFlows.add(orch3);
OrchestrationFlow orch4 = new OrchestrationFlow();
- orch4.setFlowName("DeleteVolumeGroupBB");
+ orch4.setFlowName("DeleteVfModuleBB");
orchFlows.add(orch4);
OrchestrationFlow orch5 = new OrchestrationFlow();
- orch5.setFlowName("DeactivateVnfBB");
+ orch5.setFlowName("DeactivateVolumeGroupBB");
orchFlows.add(orch5);
OrchestrationFlow orch6 = new OrchestrationFlow();
- orch6.setFlowName("DeactivateNetworkBB");
+ orch6.setFlowName("DeleteVolumeGroupBB");
orchFlows.add(orch6);
OrchestrationFlow orch7 = new OrchestrationFlow();
- orch7.setFlowName("DeleteNetworkBB");
+ orch7.setFlowName("DeactivateVnfBB");
orchFlows.add(orch7);
OrchestrationFlow orch8 = new OrchestrationFlow();
- orch8.setFlowName("DeleteNetworkCollectionBB");
+ orch8.setFlowName("DeactivateNetworkBB");
orchFlows.add(orch8);
OrchestrationFlow orch9 = new OrchestrationFlow();
- orch9.setFlowName("DeactivateServiceInstanceBB");
+ orch9.setFlowName("DeleteNetworkBB");
orchFlows.add(orch9);
OrchestrationFlow orch10 = new OrchestrationFlow();
- orch10.setFlowName("UnassignVfModuleBB");
+ orch10.setFlowName("DeleteNetworkCollectionBB");
orchFlows.add(orch10);
OrchestrationFlow orch11 = new OrchestrationFlow();
- orch11.setFlowName("UnassignVolumeGroupBB");
+ orch11.setFlowName("DeactivateServiceInstanceBB");
orchFlows.add(orch11);
OrchestrationFlow orch12 = new OrchestrationFlow();
- orch12.setFlowName("UnassignVnfBB");
+ orch12.setFlowName("UnassignVfModuleBB");
orchFlows.add(orch12);
OrchestrationFlow orch13 = new OrchestrationFlow();
- orch13.setFlowName("UnassignNetworkBB");
+ orch13.setFlowName("UnassignVolumeGroupBB");
orchFlows.add(orch13);
OrchestrationFlow orch14 = new OrchestrationFlow();
- orch14.setFlowName("UnassignServiceInstanceBB");
+ orch14.setFlowName("UnassignVnfBB");
orchFlows.add(orch14);
+ OrchestrationFlow orch15 = new OrchestrationFlow();
+ orch15.setFlowName("UnassignNetworkBB");
+ orchFlows.add(orch15);
+ OrchestrationFlow orch16 = new OrchestrationFlow();
+ orch16.setFlowName("UnassignServiceInstanceBB");
+ orchFlows.add(orch16);
ServiceInstance serviceInstanceAAI = new ServiceInstance();
serviceInstanceAAI.setServiceInstanceId("aaisi123");
@@ -954,49 +956,49 @@ public class WorkflowActionTest extends BaseTaskTest {
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = new LinkedList<>();
- northBoundRequest.setOrchestrationFlowList(orchFlows);
- OrchestrationFlow orch1 = new OrchestrationFlow();
- orch1.setFlowName("DeactivateVfModuleBB");
- orchFlows.add(orch1);
- OrchestrationFlow orch2 = new OrchestrationFlow();
- orch2.setFlowName("DeleteVfModuleBB");
- orchFlows.add(orch2);
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
OrchestrationFlow orch3 = new OrchestrationFlow();
- orch3.setFlowName("DeactivateVolumeGroupBB");
+ orch3.setFlowName("DeactivateVfModuleBB");
orchFlows.add(orch3);
OrchestrationFlow orch4 = new OrchestrationFlow();
- orch4.setFlowName("DeleteVolumeGroupBB");
+ orch4.setFlowName("DeleteVfModuleBB");
orchFlows.add(orch4);
OrchestrationFlow orch5 = new OrchestrationFlow();
- orch5.setFlowName("DeactivateVnfBB");
+ orch5.setFlowName("DeactivateVolumeGroupBB");
orchFlows.add(orch5);
OrchestrationFlow orch6 = new OrchestrationFlow();
- orch6.setFlowName("DeactivateNetworkBB");
+ orch6.setFlowName("DeleteVolumeGroupBB");
orchFlows.add(orch6);
OrchestrationFlow orch7 = new OrchestrationFlow();
- orch7.setFlowName("DeleteNetworkBB");
+ orch7.setFlowName("DeactivateVnfBB");
orchFlows.add(orch7);
OrchestrationFlow orch8 = new OrchestrationFlow();
- orch8.setFlowName("DeleteNetworkCollectionBB");
- orchFlows.add(orch8);
+ orch8.setFlowName("DeactivateNetworkBB");
+ orchFlows.add(orch8);
OrchestrationFlow orch9 = new OrchestrationFlow();
- orch9.setFlowName("DeactivateServiceInstanceBB");
- orchFlows.add(orch9);
+ orch9.setFlowName("DeleteNetworkBB");
+ orchFlows.add(orch9);
OrchestrationFlow orch10 = new OrchestrationFlow();
- orch10.setFlowName("UnassignVfModuleBB");
- orchFlows.add(orch10);
+ orch10.setFlowName("DeleteNetworkCollectionBB");
+ orchFlows.add(orch10);
OrchestrationFlow orch11 = new OrchestrationFlow();
- orch11.setFlowName("UnassignVolumeGroupBB");
- orchFlows.add(orch11);
+ orch11.setFlowName("DeactivateServiceInstanceBB");
+ orchFlows.add(orch11);
OrchestrationFlow orch12 = new OrchestrationFlow();
- orch12.setFlowName("UnassignVnfBB");
- orchFlows.add(orch12);
+ orch12.setFlowName("UnassignVfModuleBB");
+ orchFlows.add(orch12);
OrchestrationFlow orch13 = new OrchestrationFlow();
- orch13.setFlowName("UnassignNetworkBB");
- orchFlows.add(orch13);
+ orch13.setFlowName("UnassignVolumeGroupBB");
+ orchFlows.add(orch13);
OrchestrationFlow orch14 = new OrchestrationFlow();
- orch14.setFlowName("UnassignServiceInstanceBB");
- orchFlows.add(orch14);
+ orch14.setFlowName("UnassignVnfBB");
+ orchFlows.add(orch14);
+ OrchestrationFlow orch15 = new OrchestrationFlow();
+ orch15.setFlowName("UnassignNetworkBB");
+ orchFlows.add(orch15);
+ OrchestrationFlow orch16 = new OrchestrationFlow();
+ orch16.setFlowName("UnassignServiceInstanceBB");
+ orchFlows.add(orch16);
ServiceInstance serviceInstanceAAI = new ServiceInstance();
serviceInstanceAAI.setServiceInstanceId("aaisi123");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
index 0355006d15..99f1b188c9 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
@@ -562,7 +562,7 @@ public class AAIObjectMapperTest {
AAIObjectMapper aaiObjectMapper = new AAIObjectMapper();
org.onap.aai.domain.yang.CtagAssignments v12CtagAssingments = aaiObjectMapper.mapToAAICtagAssignmentList(ctagAssignments);
- assertEquals(ctagAssignments.get(0).getVlanIdInner().longValue(), v12CtagAssingments.getCtagAssignment().get(0).getVlanIdInner());
+ assertEquals(new Long(ctagAssignments.get(0).getVlanIdInner().longValue()), new Long(v12CtagAssingments.getCtagAssignment().get(0).getVlanIdInner()));
String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiCtagAssingmentsMapped_to_aai.json")));
ObjectMapper omapper = new ObjectMapper();
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java
index 207b9f3f98..352eb20630 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/NetworkAdapterClientIT.java
@@ -30,7 +30,6 @@ import static org.junit.Assert.assertEquals;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.onap.so.BaseTest;
import org.onap.so.adapters.nwrest.CreateNetworkError;
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
@@ -45,6 +44,7 @@ import org.onap.so.adapters.nwrest.RollbackNetworkResponse;
import org.onap.so.adapters.nwrest.UpdateNetworkError;
import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
+import org.onap.so.BaseTest;
import org.onap.so.openstack.beans.NetworkRollback;
import com.fasterxml.jackson.core.JsonProcessingException;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java
index 85f787faa7..f7ad5f5ff4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfAdapterClientIT.java
@@ -31,7 +31,6 @@ import static org.junit.Assert.assertEquals;
import org.junit.BeforeClass;
import org.junit.Test;
-import org.onap.so.BaseTest;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
@@ -43,7 +42,7 @@ import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest;
import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse;
import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse;
import org.onap.so.adapters.vnfrest.VfModuleRollback;
-
+import org.onap.so.BaseTest;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java
index b356b21de4..e3d849f925 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientIT.java
@@ -33,7 +33,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
-import org.onap.so.BaseTest;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupResponse;
import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
@@ -43,6 +42,7 @@ import org.onap.so.adapters.vnfrest.RollbackVolumeGroupResponse;
import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
import org.onap.so.client.adapter.rest.AdapterRestClient;
+import org.onap.so.BaseTest;
@RunWith(MockitoJUnitRunner.class)
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
index cc48c46508..5948c66baa 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
@@ -177,4 +177,13 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{
aaiConfigurationResources.deleteConfiguration("configurationId");
verify(MOCK_aaiResourcesClient, times(1)).delete(aaiResourceUri);
}
+
+ @Test
+ public void updateOrchestrationStatusConfigurationTest() throws Exception {
+ configuration.setOrchestrationStatus(OrchestrationStatus.ACTIVE);
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class));
+ aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration,OrchestrationStatus.ACTIVE);
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Configuration.class));
+ assertEquals(OrchestrationStatus.ACTIVE, configuration.getOrchestrationStatus());
+ }
} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/BaseClientTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/BaseClientTest.java
deleted file mode 100644
index a564d8a21d..0000000000
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/BaseClientTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.onap.so.client.sdnc;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.junit.Assert.assertThat;
-
-import java.util.Map;
-
-import javax.ws.rs.core.UriBuilder;
-
-import org.junit.Rule;
-import org.junit.Test;
-import org.springframework.core.ParameterizedTypeReference;
-
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
-
-import wiremock.org.apache.http.entity.ContentType;
-public class BaseClientTest {
-
-
- @Rule
- public WireMockRule wm = new WireMockRule(options().dynamicPort());
-
- @Test
- public void verifyString() {
- BaseClient<String, String> client = new BaseClient<>();
- String response = "{\"hello\" : \"world\"}";
- client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(wm.port()).build().toString());
- wm.stubFor(get(urlEqualTo("/test"))
- .willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString())));
-
- String result = client.get("", new ParameterizedTypeReference<String>() {});
- assertThat(result, equalTo(response));
- }
-
- @Test
- public void verifyMap() {
- BaseClient<String, Map<String, Object>> client = new BaseClient<>();
- String response = "{\"hello\" : \"world\"}";
- client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(wm.port()).build().toString());
- wm.stubFor(get(urlEqualTo("/test"))
- .willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString())));
-
- Map<String, Object> result = client.get("", new ParameterizedTypeReference<Map<String, Object>>() {});
- assertThat("world", equalTo(result.get("hello")));
- }
-}