summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorMateusz Gołuchowski <mateusz.goluchowski@nokia.com>2020-07-30 15:33:03 +0200
committerMateusz Gołuchowski <mateusz.goluchowski@nokia.com>2020-07-31 15:49:59 +0200
commit4180d54d46aebca6bba531241d01759615887e2c (patch)
tree54891ffeb08e1ec298f06dd469321b0951cc1908 /bpmn
parent57447eb2210e8d15f0f20c7f1b6b1a53db558102 (diff)
Create DeactivatePnfBB and include it into Service-Macro-Delete flow.
- created DeactivatePnfBB which changes orchestration status to inventoried when invoked - included BB into flow in R_MacroData script which initializes database - added support for mapping of service relations to PNFs - changed version of logging-analytics to 1.6.7 Issue-ID: SO-3111 Change-Id: I375db2014887f1f634adac31d4d1af3675f5911c Signed-off-by: Mateusz Goluchowski <mateusz.goluchowski@nokia.com>
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java15
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java13
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PnfExpected.json8
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiPnfInput.json38
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivatePnfBB.bpmn56
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java407
11 files changed, 336 insertions, 270 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index 0cdf8a6e5d..e65e1a8471 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -62,6 +62,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
@@ -1854,6 +1855,7 @@ public class BBInputSetup implements JavaDelegate {
this.mapOwningEntity(relationships.getByType(AAIObjectType.OWNING_ENTITY), serviceInstance);
this.mapL3Networks(relationships.getRelatedAAIUris(AAIObjectType.L3_NETWORK), serviceInstance.getNetworks());
this.mapGenericVnfs(relationships.getRelatedAAIUris(AAIObjectType.GENERIC_VNF), serviceInstance.getVnfs());
+ this.mapPnfs(relationships.getRelatedAAIUris(AAIObjectType.PNF), serviceInstance.getPnfs());
this.mapCollection(relationships.getByType(AAIObjectType.COLLECTION), serviceInstance);
this.mapConfigurations(relationships.getRelatedAAIUris(AAIObjectType.CONFIGURATION),
serviceInstance.getConfigurations());
@@ -1905,6 +1907,19 @@ public class BBInputSetup implements JavaDelegate {
return genericVnf;
}
+ protected void mapPnfs(List<AAIResourceUri> list, List<Pnf> pnfs) {
+ for (AAIResourceUri aaiResourceUri : list) {
+ pnfs.add(this.mapPnf(aaiResourceUri));
+ }
+ }
+
+ protected Pnf mapPnf(AAIResourceUri aaiResourceUri) {
+ AAIResultWrapper aaiPnfWrapper = this.bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri);
+ Optional<org.onap.aai.domain.yang.Pnf> aaiPnfWrapperOp =
+ aaiPnfWrapper.asBean(org.onap.aai.domain.yang.Pnf.class);
+ return aaiPnfWrapperOp.map(pnf -> this.mapperLayer.mapAAIPnfIntoPnf(pnf)).orElse(null);
+ }
+
protected List<InstanceGroup> mapInstanceGroups(List<AAIResultWrapper> instanceGroups) {
List<InstanceGroup> instanceGroupsList = new ArrayList<>();
for (AAIResultWrapper volumeGroupWrapper : instanceGroups) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
index 67d073d7b6..2bb383e4ec 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
@@ -52,6 +52,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
@@ -323,6 +324,10 @@ public class BBInputSetupMapperLayer {
return genericVnf;
}
+ protected Pnf mapAAIPnfIntoPnf(org.onap.aai.domain.yang.Pnf aaiPnf) {
+ return modelMapper.map(aaiPnf, Pnf.class);
+ }
+
protected void mapAllLicensesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf,
GenericVnf genericVnf) {
if (aaiGenericVnf.getLicenses() != null) {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
index 13d2b7d3d3..4755e58582 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
@@ -39,6 +39,7 @@ 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.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
@@ -75,7 +76,6 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.VnfcCustomization;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.RequestDetails;
@@ -422,6 +422,17 @@ public class BBInputSetupMapperLayerTest {
}
@Test
+ public void testMapAAIPnfIntoPnf() throws IOException {
+ Pnf expected = mapper.readValue(new File(RESOURCE_PATH + "PnfExpected.json"), Pnf.class);
+ org.onap.aai.domain.yang.Pnf aaiPnf =
+ mapper.readValue(new File(RESOURCE_PATH + "aaiPnfInput.json"), org.onap.aai.domain.yang.Pnf.class);
+
+ Pnf actual = bbInputSetupMapperLayer.mapAAIPnfIntoPnf(aaiPnf);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
public void testMapAAICollectionIntoCollection() throws JsonParseException, JsonMappingException, IOException {
org.onap.aai.domain.yang.Collection aaiCollection = mapper
.readValue(new File(RESOURCE_PATH + "CollectionInput.json"), org.onap.aai.domain.yang.Collection.class);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index 9e9c6f365f..dd79d2772f 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -69,6 +69,7 @@ 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.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
@@ -1815,6 +1816,29 @@ public class BBInputSetupTest {
}
@Test
+ public void testMapPnfs() throws JsonProcessingException {
+ org.onap.aai.domain.yang.Pnf expectedAAI = new org.onap.aai.domain.yang.Pnf();
+ org.onap.aai.domain.yang.RelationshipList relationshipList = new org.onap.aai.domain.yang.RelationshipList();
+ org.onap.aai.domain.yang.Relationship relationship = new org.onap.aai.domain.yang.Relationship();
+ relationshipList.getRelationship().add(relationship);
+ expectedAAI.setRelationshipList(relationshipList);
+
+ Pnf expected = new Pnf();
+ AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, "pnfId");
+ AAIResultWrapper pnfWrapper =
+ new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
+
+ doReturn(pnfWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthOne(aaiResourceUri);
+ doReturn(expected).when(bbInputSetupMapperLayer).mapAAIPnfIntoPnf(isA(org.onap.aai.domain.yang.Pnf.class));
+
+ List<Pnf> pnfs = new ArrayList<>();
+
+ SPY_bbInputSetup.mapPnfs(Arrays.asList(aaiResourceUri), pnfs);
+
+ assertEquals(expected, pnfs.get(0));
+ }
+
+ @Test
public void testMapVolumeGroups() throws JsonProcessingException {
org.onap.aai.domain.yang.VolumeGroup expectedAAI = new org.onap.aai.domain.yang.VolumeGroup();
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PnfExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PnfExpected.json
new file mode 100644
index 0000000000..460f72aa31
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PnfExpected.json
@@ -0,0 +1,8 @@
+{
+ "pnf-id":"pnfId",
+ "pnf-name":"pnfName",
+ "nf-role":"gNB",
+ "orchestration-status":"INVENTORIED",
+ "cloud-region":null,
+ "model-info-pnf":null
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiPnfInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiPnfInput.json
new file mode 100644
index 0000000000..da0039c923
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiPnfInput.json
@@ -0,0 +1,38 @@
+{
+ "pnfName":"pnfName",
+ "pnfName2":null,
+ "selflink":null,
+ "pnfName2Source":null,
+ "pnfId":"pnfId",
+ "nfNamingCode":null,
+ "equipType":null,
+ "equipVendor":null,
+ "equipModel":null,
+ "managementOption":null,
+ "orchestrationStatus":"INVENTORIED",
+ "ipaddressV4Oam":null,
+ "swVersion":null,
+ "inMaint":null,
+ "frameId":null,
+ "serialNumber":null,
+ "ipaddressV4Loopback0":null,
+ "ipaddressV6Loopback0":null,
+ "ipaddressV4Aim":null,
+ "ipaddressV6Aim":null,
+ "ipaddressV6Oam":null,
+ "invStatus":null,
+ "resourceVersion":null,
+ "provStatus":null,
+ "nfRole":"gNB",
+ "adminStatus":null,
+ "operationalStatus":null,
+ "modelCustomizationId":null,
+ "modelInvariantId":null,
+ "modelVersionId":null,
+ "pnfIpv4Address":null,
+ "pnfIpv6Address":null,
+ "softwareVersions":null,
+ "relationshipList":null,
+ "lagInterfaces":null,
+ "vrfs":null
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivatePnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivatePnfBB.bpmn
new file mode 100644
index 0000000000..f01f81073b
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivatePnfBB.bpmn
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1a52v2f" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
+ <bpmn:collaboration id="Collaboration_0go8wi3">
+ <bpmn:participant id="Participant_1dwc5st" name="SO&#10;Deactivate PNF" processRef="DeactivatePnfBB" />
+ <bpmn:participant id="Participant_0gycee4" name="AAI" />
+ <bpmn:messageFlow id="MessageFlow_0xh6bkn" sourceRef="UpdatePnfOrchestrationStatusToInventoried" targetRef="Participant_0gycee4" />
+ </bpmn:collaboration>
+ <bpmn:process id="DeactivatePnfBB" name="DeactivatePnfBB" isExecutable="true">
+ <bpmn:sequenceFlow id="SequenceFlow_0l6rtzy" sourceRef="UpdatePnfOrchestrationStatusToInventoried" targetRef="PnfInventoried" />
+ <bpmn:sequenceFlow id="SequenceFlow_1fu9o4x" sourceRef="DeactivatePnf_StartEvent" targetRef="UpdatePnfOrchestrationStatusToInventoried" />
+ <bpmn:endEvent id="PnfInventoried" name="Pnf Inventoried">
+ <bpmn:incoming>SequenceFlow_0l6rtzy</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="UpdatePnfOrchestrationStatusToInventoried" name="Update Pnf Orchestration Status to Inventoried" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusInventoriedPnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_1fu9o4x</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0l6rtzy</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:startEvent id="DeactivatePnf_StartEvent">
+ <bpmn:outgoing>SequenceFlow_1fu9o4x</bpmn:outgoing>
+ </bpmn:startEvent>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0go8wi3">
+ <bpmndi:BPMNShape id="Participant_1dwc5st_di" bpmnElement="Participant_1dwc5st" isHorizontal="true">
+ <dc:Bounds x="160" y="80" width="646" height="391" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1fu9o4x_di" bpmnElement="SequenceFlow_1fu9o4x">
+ <di:waypoint x="255" y="287" />
+ <di:waypoint x="461" y="287" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0l6rtzy_di" bpmnElement="SequenceFlow_0l6rtzy">
+ <di:waypoint x="561" y="287" />
+ <di:waypoint x="722" y="287" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_1wfgsdz_di" bpmnElement="PnfInventoried">
+ <dc:Bounds x="722" y="269" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="705" y="312" width="74" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1ix8822_di" bpmnElement="UpdatePnfOrchestrationStatusToInventoried">
+ <dc:Bounds x="461" y="247" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_1g3euow_di" bpmnElement="DeactivatePnf_StartEvent">
+ <dc:Bounds x="219" y="269" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Participant_0gycee4_di" bpmnElement="Participant_0gycee4" isHorizontal="true">
+ <dc:Bounds x="260" y="567" width="502" height="60" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="MessageFlow_0xh6bkn_di" bpmnElement="MessageFlow_0xh6bkn">
+ <di:waypoint x="511" y="327" />
+ <di:waypoint x="511" y="567" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
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 cc630232c2..6c989093ab 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
@@ -90,6 +90,13 @@ public class AAIUpdateTasks {
}
/**
+ * BPMN access method to update status of Pnf to Inventoried in AAI
+ */
+ public void updateOrchestrationStatusInventoriedPnf(BuildingBlockExecution execution) {
+ updateOrchestrationStatusForPnf(execution, OrchestrationStatus.INVENTORIED);
+ }
+
+ /**
* BPMN access method to update status of Pnf to Active in AAI
*/
public void updateOrchestrationStatusActivePnf(BuildingBlockExecution execution) {
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 6f11882281..985114abcd 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
@@ -936,6 +936,7 @@ public class WorkflowAction {
bbInputSetup.getExistingServiceInstance(serviceInstanceAAI);
resourceList.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false));
traverseServiceInstanceMSOVnfs(resourceList, aaiResourceIds, serviceInstanceMSO);
+ traverseServiceInstanceMSOPnfs(resourceList, aaiResourceIds, serviceInstanceMSO);
if (serviceInstanceMSO.getNetworks() != null) {
for (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network : serviceInstanceMSO
.getNetworks()) {
@@ -993,6 +994,18 @@ public class WorkflowAction {
}
}
+ private void traverseServiceInstanceMSOPnfs(List<Resource> resourceList,
+ List<Pair<WorkflowType, String>> aaiResourceIds,
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO) {
+ if (serviceInstanceMSO.getPnfs() == null) {
+ return;
+ }
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf pnf : serviceInstanceMSO.getPnfs()) {
+ aaiResourceIds.add(new Pair<>(WorkflowType.PNF, pnf.getPnfId()));
+ resourceList.add(new Resource(WorkflowType.PNF, pnf.getPnfId(), false));
+ }
+ }
+
private void traverseVnfModules(List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds,
org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf) {
if (vnf.getVfModules() == null) {
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 a7dfe7f7a4..28d2abc792 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
@@ -161,6 +161,26 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
}
@Test
+ public void updateOrchestrationStatusInventoriedPnfTest() throws Exception {
+ Pnf pnf = preparePnfAndExtractForPnf();
+ doNothing().when(aaiPnfResources).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.INVENTORIED);
+
+ aaiUpdateTasks.updateOrchestrationStatusInventoriedPnf(execution);
+
+ verify(aaiPnfResources, times(1)).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.INVENTORIED);
+ }
+
+ @Test
+ public void updateOrchestrationStatusInventoriedPnfExceptionTest() throws Exception {
+ Pnf pnf = preparePnfAndExtractForPnf();
+ doThrow(RuntimeException.class).when(aaiPnfResources).updateOrchestrationStatusPnf(pnf,
+ OrchestrationStatus.INVENTORIED);
+
+ expectedException.expect(BpmnError.class);
+ aaiUpdateTasks.updateOrchestrationStatusInventoriedPnf(execution);
+ }
+
+ @Test
public void updateOrchestrationStatusActivePnfTest() throws Exception {
Pnf pnf = preparePnfAndExtractForPnf();
doNothing().when(aaiPnfResources).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.ACTIVE);
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 e975f44426..407a844c4e 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
@@ -117,6 +117,15 @@ import org.springframework.core.env.Environment;
public class WorkflowActionTest extends BaseTaskTest {
+ private static final String MACRO_ACTIVATE_DELETE_UNASSIGN_JSON = "Macro/ServiceMacroActivateDeleteUnassign.json";
+ private static final String MACRO_ASSIGN_JSON = "Macro/ServiceMacroAssign.json";
+ private static final String MACRO_ASSIGN_NO_CLOUD_JSON = "Macro/ServiceMacroAssignNoCloud.json";
+ private static final String VF_MODULE_CREATE_WITH_FABRIC_JSON = "VfModuleCreateWithFabric.json";
+ private static final String VF_MODULE_REPLACE_REBUILD_VOLUME_GROUPS_JSON =
+ "VfModuleReplaceRebuildVolumeGroups.json";
+ private static final String MACRO_CREATE_NETWORK_COLLECTION_JSON = "Macro/CreateNetworkCollection.json";
+ private static final String MACRO_VNF_MACRO_REPLACE_JSON = "Macro/VnfMacroReplace.json";
+
@Mock
protected Environment environment;
@InjectMocks
@@ -164,13 +173,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteNetworkCreateTest() throws Exception {
String gAction = "createInstance";
String resource = "Network";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri", "v6/networks/123");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
@@ -189,13 +193,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteNetworkDeleteTest() throws Exception {
String gAction = "deleteInstance";
String resource = "Network";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri", "v6/networks/123");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
@@ -214,13 +213,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteServiceCreateTest() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri", "v6/serviceInstances/123");
@@ -238,14 +232,9 @@ public class WorkflowActionTest extends BaseTaskTest {
@Test
public void selectExecutionListDuplicateNameExceptionTest() throws Exception {
String gAction = "createInstance";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri", "v6/serviceInstances");
- execution.setVariable("requestAction", gAction);
doThrow(new DuplicateNameException(
"serviceInstance with name (instanceName) and different version id (3c40d244-808e-42ca-b09a-256d83d19d0a) already exists. The name must be unique."))
@@ -264,16 +253,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroAssignTest() throws Exception {
String gAction = "assignInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "AssignNetworkBB", "AssignVnfBB",
"AssignVolumeGroupBB", "AssignVfModuleBB");
@@ -318,16 +301,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroAssignNoCloudTest() throws Exception {
String gAction = "assignInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(
- Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssignNoCloud.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_NO_CLOUD_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "AssignNetworkBB", "AssignVnfBB",
"AssignVolumeGroupBB", "AssignVfModuleBB");
@@ -373,16 +350,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroActivateTest() throws Exception {
String gAction = "activateInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/si0");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows =
createFlowList("CreateNetworkBB", "ActivateNetworkBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB",
@@ -397,7 +368,6 @@ public class WorkflowActionTest extends BaseTaskTest {
new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
vnf.setVnfId("vnf0");
-
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = buildVfModule();
vnf.getVfModules().add(vfModule);
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = buildVfModule();
@@ -427,23 +397,16 @@ public class WorkflowActionTest extends BaseTaskTest {
assertEquals("testVfModuleId2", ebbs.get(5).getWorkflowResourceIds().getVfModuleId());
assertEquals("vnf0", ebbs.get(6).getWorkflowResourceIds().getVnfId());
assertEquals("si0", ebbs.get(7).getWorkflowResourceIds().getServiceInstanceId());
-
}
@Test
public void selectExecutionListServiceMacroDeactivateTest() throws Exception {
String gAction = "deactivateInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("DeactivateServiceInstanceBB");
northBoundRequest.setOrchestrationFlowList(orchFlows);
@@ -459,16 +422,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroEmptyServiceTest() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
northBoundRequest.setIsToplevelflow(true);
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
@@ -491,16 +448,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroCreateJustNetworkTest() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
northBoundRequest.setIsToplevelflow(true);
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
@@ -527,16 +478,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroCreateWithNetworkCollectionTest() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
northBoundRequest.setIsToplevelflow(true);
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
@@ -622,16 +567,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroCreateWithUserParams() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
"AssignNetworkBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "CreateNetworkBB",
@@ -704,21 +643,16 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroDeleteTest() throws Exception {
String gAction = "deleteInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
- "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB", "DeactivateNetworkBB",
- "DeleteNetworkBB", "DeleteNetworkCollectionBB", "DeactivateServiceInstanceBB", "UnassignVfModuleBB",
- "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignNetworkBB", "UnassignServiceInstanceBB");
+ "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB", "DeactivatePnfBB",
+ "DeactivateNetworkBB", "DeleteNetworkBB", "DeleteNetworkCollectionBB", "DeactivateServiceInstanceBB",
+ "UnassignVfModuleBB", "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignNetworkBB",
+ "UnassignServiceInstanceBB");
northBoundRequest.setOrchestrationFlowList(orchFlows);
ServiceInstance serviceInstanceAAI = new ServiceInstance();
@@ -727,7 +661,10 @@ public class WorkflowActionTest extends BaseTaskTest {
new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf =
new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
+ org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf pnf =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf();
vnf.setVnfId("vnfId123");
+ pnf.setPnfId("pnfId123");
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = buildVfModule();
vnf.getVfModules().add(vfModule);
@@ -740,6 +677,7 @@ public class WorkflowActionTest extends BaseTaskTest {
vnf.getVolumeGroups().add(volumeGroup);
serviceInstanceMSO.getVnfs().add(vnf);
+ serviceInstanceMSO.getPnfs().add(pnf);
doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
@@ -749,24 +687,53 @@ public class WorkflowActionTest extends BaseTaskTest {
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "DeactivateVfModuleBB", "DeactivateVfModuleBB", "DeleteVfModuleBB",
"DeleteVfModuleBB", "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB",
- "DeactivateServiceInstanceBB", "UnassignVfModuleBB", "UnassignVfModuleBB", "UnassignVolumeGroupBB",
- "UnassignVnfBB", "UnassignServiceInstanceBB");
+ "DeactivatePnfBB", "DeactivateServiceInstanceBB", "UnassignVfModuleBB", "UnassignVfModuleBB",
+ "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignServiceInstanceBB");
+ }
+
+ @Test
+ public void selectExecutionListServiceMacroDeleteWithPnfTest() throws Exception {
+ String gAction = "deleteInstance";
+ String resource = "Service";
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
+ execution.setVariable("requestUri", "v6/serviceInstances/123");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
+ "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB", "DeactivatePnfBB",
+ "DeactivateNetworkBB", "DeleteNetworkBB", "DeleteNetworkCollectionBB", "DeactivateServiceInstanceBB",
+ "UnassignVfModuleBB", "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignNetworkBB",
+ "UnassignServiceInstanceBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ ServiceInstance serviceInstanceAAI = new ServiceInstance();
+ serviceInstanceAAI.setServiceInstanceId("aaisi123");
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
+ org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf pnf =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf();
+ pnf.setPnfId("pnfId123");
+
+ serviceInstanceMSO.getPnfs().add(pnf);
+
+ doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
+ doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "DeactivatePnfBB", "DeactivateServiceInstanceBB", "UnassignServiceInstanceBB");
}
@Test
public void selectExecutionListServiceMacroUnassignTest() throws Exception {
String gAction = "unassignInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("UnassignVfModuleBB", "UnassignVolumeGroupBB",
"UnassignVnfBB", "UnassignNetworkBB", "UnassignServiceInstanceBB");
@@ -806,16 +773,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroDeleteNetworkCollectionTest() throws Exception {
String gAction = "deleteInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
"DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB", "DeactivateNetworkBB",
@@ -855,13 +816,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListVnfMacroRecreateTest() throws Exception {
String gAction = "recreateInstance";
String resource = "Vnf";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/VnfMacroReplace.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_VNF_MACRO_REPLACE_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v7/serviceInstances/123/vnfs/1234/recreate");
execution.setVariable("serviceInstanceId", "123");
execution.setVariable("vnfId", "1234");
@@ -909,13 +865,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListVnfMacroReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "Vnf";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/VnfMacroReplace.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_VNF_MACRO_REPLACE_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v7/serviceInstances/123/vnfs/1234/replace");
execution.setVariable("serviceInstanceId", "123");
execution.setVariable("vnfId", "1234");
@@ -982,16 +933,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListNetworkCollectionMacroCreate() throws Exception {
String gAction = "createInstance";
String resource = "NetworkCollection";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(
- Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/CreateNetworkCollection.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_CREATE_NETWORK_COLLECTION_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123/networkCollections/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("CreateNetworkCollectionBB", "AssignNetworkBB",
"CreateNetworkBB", "ActivateNetworkBB", "ActivateNetworkCollectionBB");
@@ -1019,13 +964,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListNetworkCollectionMacroDelete() throws Exception {
String gAction = "deleteInstance";
String resource = "NetworkCollection";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(
- Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/CreateNetworkCollection.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_CREATE_NETWORK_COLLECTION_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123/networkCollections/123");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
@@ -1054,17 +994,11 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleNoFabricCreateTest() throws Exception {
String gAction = "createInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB",
"AssignFabricConfigurationBB", "ActivateFabricConfigurationBB");
@@ -1081,13 +1015,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleFabricCreateTest() throws Exception {
String gAction = "createInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
@@ -1140,13 +1069,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleNoVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
@@ -1166,13 +1090,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleNoVolumeGroupReplaceRetainAssignmentsTest() throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
@@ -1191,13 +1110,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleVolumeGroupToNoVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1224,13 +1138,8 @@ public class WorkflowActionTest extends BaseTaskTest {
throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1257,13 +1166,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleKeepVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1298,13 +1202,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleWithFabricKeepVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1361,13 +1260,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleKeepVolumeGroupReplaceRetainAssignmentsTest() throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1401,13 +1295,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleNoVolumeGroupToVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1438,13 +1327,8 @@ public class WorkflowActionTest extends BaseTaskTest {
throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1474,13 +1358,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleRebuildVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(
- Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleReplaceRebuildVolumeGroups.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_REPLACE_REBUILD_VOLUME_GROUPS_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1516,13 +1395,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleRebuildVolumeGroupReplaceRetainAssignmentsTest() throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(
- Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleReplaceRebuildVolumeGroups.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_REPLACE_REBUILD_VOLUME_GROUPS_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1559,13 +1433,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleFabricDeleteTest() throws Exception {
String gAction = "deleteInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
@@ -1612,10 +1481,9 @@ public class WorkflowActionTest extends BaseTaskTest {
String gAction = "deleteInstance";
ObjectMapper mapper = new ObjectMapper();
WorkflowType resourceType = WorkflowType.VFMODULE;
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
execution.setVariable("bpmnRequest", bpmnRequest);
execution.setVariable("vnfId", "1234");
execution.setVariable("vfModuleId", "vfModuleId1234");
@@ -1736,13 +1604,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleNoFabricDeleteTest() throws Exception {
String gAction = "deleteInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
@@ -1777,13 +1640,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListMacroResumeTest() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
@@ -3017,8 +2875,7 @@ public class WorkflowActionTest extends BaseTaskTest {
doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a");
doReturn(collectionResourceCustomization).when(catalogDbClient)
.getNetworkCollectionResourceCustomizationByID("123");
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
ObjectMapper mapper = new ObjectMapper();
ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
List<Resource> resourceCounter = new ArrayList<>();
@@ -3194,4 +3051,16 @@ public class WorkflowActionTest extends BaseTaskTest {
assertEquals(ebbs.get(i).getBuildingBlock().getBpmnFlowName(), flowNames[i]);
}
}
+
+ private void initExecution(String gAction, String bpmnRequest, boolean isAlaCarte) {
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", isAlaCarte);
+ execution.setVariable("apiVersion", "7");
+ }
+
+ private String readBpmnRequestFromFile(String fileName) throws IOException {
+ return new String(Files.readAllBytes(Paths.get("src/test/resources/__files/" + fileName)));
+ }
}