aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn241
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java14
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java79
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java109
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecutionTest.java127
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java72
15 files changed, 672 insertions, 61 deletions
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn
new file mode 100644
index 0000000000..32d3bce469
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn
@@ -0,0 +1,241 @@
+<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1ahlzqg" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.14.0">
+ <bpmn:process id="ControllerExecution" name="ControllerExecutionBB" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>SequenceFlow_0gmfit3</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0gmfit3" sourceRef="StartEvent_1" targetRef="ServiceTask_0inxg9l" />
+ <bpmn:endEvent id="EndEvent_0lgvk82">
+ <bpmn:incoming>SequenceFlow_1mkhog2</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0no1qag</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1mkhog2" sourceRef="Task_1hs1mn0" targetRef="EndEvent_0lgvk82" />
+ <bpmn:callActivity id="CallActivity_1gfzi2g" name="Abstract CDS&#10;(CDS Call)&#10;" calledElement="AbstractCDSProcessingBB">
+ <bpmn:extensionElements>
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="CDSStatus" target="CDSStatus" />
+ <camunda:in source="executionObject" target="executionObject" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_05qembo</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0cvsnuu</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:serviceTask id="Task_1hs1mn0" name="Update AAI" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)),InjectExecution.execute(execution, execution.getVariable(&#34;scope&#34;)),InjectExecution.execute(execution, execution.getVariable(&#34;action&#34;)))}">
+ <bpmn:incoming>SequenceFlow_07tqu82</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1mkhog2</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_05qembo" sourceRef="Task_0bhf6tp" targetRef="CallActivity_1gfzi2g" />
+ <bpmn:serviceTask id="Task_0bhf6tp" name="PreProcess Abstract CDS Processing" camunda:expression="${GenericCDSProcessing.buildPayloadBasedOnScopeAndAction(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0vzx2yr</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_05qembo</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:exclusiveGateway id="ExclusiveGateway_13q340y" default="SequenceFlow_15gxql1">
+ <bpmn:incoming>SequenceFlow_0cvsnuu</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_07tqu82</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_15gxql1</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_0cvsnuu" sourceRef="CallActivity_1gfzi2g" targetRef="ExclusiveGateway_13q340y" />
+ <bpmn:sequenceFlow id="SequenceFlow_07tqu82" name="success" sourceRef="ExclusiveGateway_13q340y" targetRef="Task_1hs1mn0">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("CDSStatus").equals("Success")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:endEvent id="EndEvent_0mnaj50">
+ <bpmn:incoming>SequenceFlow_15gxql1</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1s1hqgm" errorRef="Error_0aovtfv" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_15gxql1" sourceRef="ExclusiveGateway_13q340y" targetRef="EndEvent_0mnaj50" />
+ <bpmn:serviceTask id="ServiceTask_0inxg9l" name="Set Actor, Scope and Action Params" camunda:expression="${ControllerExecution.setControllerActorScopeAction(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0gmfit3</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_05j6hg6</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1lspfyy</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_05j6hg6" sourceRef="ServiceTask_0inxg9l" targetRef="ExclusiveGateway_0plxwkg" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0plxwkg" default="SequenceFlow_1t7hs4k">
+ <bpmn:incoming>SequenceFlow_1lspfyy</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_05j6hg6</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1t7hs4k</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0vzx2yr</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1lspfyy" sourceRef="ServiceTask_0inxg9l" targetRef="ExclusiveGateway_0plxwkg" />
+ <bpmn:callActivity id="BBToExecute" name="BB to Execute&#10;" calledElement="${bbName}">
+ <bpmn:extensionElements>
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="WorkflowExceptionErrorMessage" target="WorkflowExceptionErrorMessage" />
+ <camunda:in source="executionObject" target="executionObject" />
+ <camunda:in source="mso-request-id" target="mso-request-id" />
+ <camunda:in source="isRollback" target="isRollback" />
+ <camunda:out source="StatusMessage" target="StatusMessage" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0fv03vt</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0no1qag</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0op5irz</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_1t7hs4k" sourceRef="ExclusiveGateway_0plxwkg" targetRef="Task_1rc2j9" />
+ <bpmn:sequenceFlow id="SequenceFlow_0no1qag" sourceRef="BBToExecute" targetRef="EndEvent_0lgvk82" />
+ <bpmn:sequenceFlow id="SequenceFlow_0fv03vt" sourceRef="Task_1rc2j9" targetRef="BBToExecute" />
+ <bpmn:serviceTask id="Task_1rc2j9" name="select BB " camunda:expression="${ControllerExecution.selectBB(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_1t7hs4k</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0fv03vt</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:endEvent id="EndEvent_1lxwuh2">
+ <bpmn:incoming>SequenceFlow_0op5irz</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_0z001cu" errorRef="Error_0aovtfv" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0op5irz" sourceRef="BBToExecute" targetRef="EndEvent_1lxwuh2" />
+ <bpmn:sequenceFlow id="SequenceFlow_0vzx2yr" name="Actor= CDS" sourceRef="ExclusiveGateway_0plxwkg" targetRef="Task_0bhf6tp">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("controller_actor") == "CDS"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ </bpmn:process>
+ <bpmn:error id="Error_0aovtfv" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ControllerExecution">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="160" y="323" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="-17" y="279" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0gmfit3_di" bpmnElement="SequenceFlow_0gmfit3">
+ <di:waypoint x="196" y="341" />
+ <di:waypoint x="259" y="341" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="32.5" y="236" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_0lgvk82_di" bpmnElement="EndEvent_0lgvk82">
+ <dc:Bounds x="1129" y="323" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1025" y="251" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1mkhog2_di" bpmnElement="SequenceFlow_1mkhog2">
+ <di:waypoint x="1079" y="462" />
+ <di:waypoint x="1147" y="462" />
+ <di:waypoint x="1147" y="359" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="918" y="357" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_1gfzi2g_di" bpmnElement="CallActivity_1gfzi2g">
+ <dc:Bounds x="725" y="422" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0404s6a_di" bpmnElement="Task_1hs1mn0">
+ <dc:Bounds x="979" y="422" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_05qembo_di" bpmnElement="SequenceFlow_05qembo">
+ <di:waypoint x="672" y="462" />
+ <di:waypoint x="725" y="462" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="503.5" y="357" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_01mv1si_di" bpmnElement="Task_0bhf6tp">
+ <dc:Bounds x="572" y="422" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_13q340y_di" bpmnElement="ExclusiveGateway_13q340y" isMarkerVisible="true">
+ <dc:Bounds x="868" y="437" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="698" y="327" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0cvsnuu_di" bpmnElement="SequenceFlow_0cvsnuu">
+ <di:waypoint x="825" y="462" />
+ <di:waypoint x="868" y="462" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="651.5" y="357" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_07tqu82_di" bpmnElement="SequenceFlow_07tqu82">
+ <di:waypoint x="918" y="462" />
+ <di:waypoint x="979" y="462" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="856" y="409" width="41" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_0mnaj50_di" bpmnElement="EndEvent_0mnaj50">
+ <dc:Bounds x="875" y="565" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="698" y="531" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_15gxql1_di" bpmnElement="SequenceFlow_15gxql1">
+ <di:waypoint x="893" y="487" />
+ <di:waypoint x="893" y="565" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="713" y="436" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0inxg9l_di" bpmnElement="ServiceTask_0inxg9l">
+ <dc:Bounds x="259" y="301" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_05j6hg6_di" bpmnElement="SequenceFlow_05j6hg6">
+ <di:waypoint x="359" y="341" />
+ <di:waypoint x="399" y="341" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="184" y="240" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0plxwkg_di" bpmnElement="ExclusiveGateway_0plxwkg" isMarkerVisible="true">
+ <dc:Bounds x="399" y="316" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="309" y="255" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1lspfyy_di" bpmnElement="SequenceFlow_1lspfyy">
+ <di:waypoint x="359" y="341" />
+ <di:waypoint x="399" y="341" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="229" y="240" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_01dem38_di" bpmnElement="BBToExecute">
+ <dc:Bounds x="824" y="168" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1t7hs4k_di" bpmnElement="SequenceFlow_1t7hs4k">
+ <di:waypoint x="424" y="316" />
+ <di:waypoint x="424" y="208" />
+ <di:waypoint x="572" y="208" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="271" y="89" width="83" height="36" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0no1qag_di" bpmnElement="SequenceFlow_0no1qag">
+ <di:waypoint x="924" y="208" />
+ <di:waypoint x="1147" y="208" />
+ <di:waypoint x="1147" y="323" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="840.5" y="107" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0fv03vt_di" bpmnElement="SequenceFlow_0fv03vt">
+ <di:waypoint x="672" y="208" />
+ <di:waypoint x="824" y="208" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="598" y="107" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0qd9p4w_di" bpmnElement="Task_1rc2j9">
+ <dc:Bounds x="572" y="168" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1lxwuh2_di" bpmnElement="EndEvent_1lxwuh2">
+ <dc:Bounds x="856" y="84" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="679" y="50" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0op5irz_di" bpmnElement="SequenceFlow_0op5irz">
+ <di:waypoint x="874" y="168" />
+ <di:waypoint x="874" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="739" y="58" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0vzx2yr_di" bpmnElement="SequenceFlow_0vzx2yr">
+ <di:waypoint x="424" y="366" />
+ <di:waypoint x="424" y="462" />
+ <di:waypoint x="572" y="462" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="455" y="436" width="60" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions> \ No newline at end of file
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java
index 576f9c4f01..29d7a80f63 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/PauseForManualTaskRainyDayTest.java
@@ -20,24 +20,24 @@
package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
-import static org.camunda.bpm.engine.test.assertions.ProcessEngineTests.assertThat;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
import static org.junit.Assert.assertNotNull;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doThrow;
import org.camunda.bpm.engine.ManagementService;
import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.runtime.Job;
import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.task.Task;
import org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions;
+import org.junit.Ignore;
import org.junit.Test;
-import org.springframework.beans.factory.annotation.Autowired;
import org.onap.so.bpmn.BaseBPMNTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.springframework.beans.factory.annotation.Autowired;
-
+@Ignore
public class PauseForManualTaskRainyDayTest extends BaseBPMNTest {
private static final String TIMEOUT_10_S = "PT10S";
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java
index fb95ae3993..11707c4149 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIDeleteServiceInstance.java
@@ -7,9 +7,9 @@
* 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.
@@ -27,9 +27,15 @@ import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class AAIDeleteServiceInstance implements JavaDelegate {
+ private static final Logger logger = LoggerFactory.getLogger(AAIDeleteServiceInstance.class);
+ private static final String ERROR_MESSAGE =
+ "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI.";
+
ExceptionUtil exceptionUtil = new ExceptionUtil();
public void execute(DelegateExecution execution) throws Exception {
@@ -41,8 +47,8 @@ public class AAIDeleteServiceInstance implements JavaDelegate {
aaiRC.delete(serviceInstanceURI);
execution.setVariable("GENDS_SuccessIndicator", true);
} catch (Exception ex) {
- String msg = "Exception in Delete Serivce Instance. Service Instance could not be deleted in AAI."
- + ex.getMessage();
+ logger.debug(ERROR_MESSAGE, ex);
+ String msg = ERROR_MESSAGE + ex.getMessage();
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java
index 2d69351744..f7b0c662db 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/aai/groovyflows/AAIServiceInstance.java
@@ -7,9 +7,9 @@
* 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.
@@ -30,17 +30,70 @@ public class AAIServiceInstance {
String environmentContext;
String workloadContext;
- public AAIServiceInstance(String serviceInstanceName, String serviceType, String serviceRole,
- String orchestrationStatus, String modelInvariantUuid, String modelVersionId, String environmentContext,
- String workloadContext) {
- this.serviceInstanceName = serviceInstanceName;
- this.serviceType = serviceType;
- this.serviceRole = serviceRole;
- this.orchestrationStatus = orchestrationStatus;
- this.modelInvariantUuid = modelInvariantUuid;
- this.modelVersionId = modelVersionId;
- this.environmentContext = environmentContext;
- this.workloadContext = workloadContext;
+ public class AAIServiceInstanceBuilder {
+ private String serviceInstanceName;
+ private String serviceType;
+ private String serviceRole;
+ private String orchestrationStatus;
+ private String modelInvariantUuid;
+ private String modelVersionId;
+ private String environmentContext;
+ private String workloadContext;
+
+ public AAIServiceInstanceBuilder setServiceInstanceName(String serviceInstanceName) {
+ this.serviceInstanceName = serviceInstanceName;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setServiceType(String serviceType) {
+ this.serviceType = serviceType;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setServiceRole(String serviceRole) {
+ this.serviceRole = serviceRole;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setOrchestrationStatus(String orchestrationStatus) {
+ this.orchestrationStatus = orchestrationStatus;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setModelInvariantUuid(String modelInvariantUuid) {
+ this.modelInvariantUuid = modelInvariantUuid;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setEnvironmentContext(String environmentContext) {
+ this.environmentContext = environmentContext;
+ return this;
+ }
+
+ public AAIServiceInstanceBuilder setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ return this;
+ }
+
+ public AAIServiceInstance createAAIServiceInstance() {
+ return new AAIServiceInstance(this);
+ }
+ }
+
+ public AAIServiceInstance(AAIServiceInstanceBuilder aaiServiceInstanceBuilder) {
+ this.serviceInstanceName = aaiServiceInstanceBuilder.serviceInstanceName;
+ this.serviceType = aaiServiceInstanceBuilder.serviceType;
+ this.serviceRole = aaiServiceInstanceBuilder.serviceRole;
+ this.orchestrationStatus = aaiServiceInstanceBuilder.orchestrationStatus;
+ this.modelInvariantUuid = aaiServiceInstanceBuilder.modelInvariantUuid;
+ this.modelVersionId = aaiServiceInstanceBuilder.modelVersionId;
+ this.environmentContext = aaiServiceInstanceBuilder.environmentContext;
+ this.workloadContext = aaiServiceInstanceBuilder.workloadContext;
}
public String getServiceInstanceName() {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index 533dd89276..4522f7f2e7 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -24,6 +24,7 @@
package org.onap.so.bpmn.infrastructure.activity;
+import java.io.IOException;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
@@ -89,8 +90,8 @@ public class ExecuteActivity implements JavaDelegate {
@Override
public void execute(DelegateExecution execution) throws Exception {
final String requestId = (String) execution.getVariable(G_REQUEST_ID);
- WorkflowException workflowException = null;
- String handlingCode = null;
+ WorkflowException workflowException;
+ String handlingCode;
try {
Boolean workflowSyncAckSent = (Boolean) execution.getVariable(WORKFLOW_SYNC_ACK_SENT);
if (workflowSyncAckSent == null || workflowSyncAckSent == false) {
@@ -114,7 +115,7 @@ public class ExecuteActivity implements JavaDelegate {
if (execution.getVariables() != null) {
execution.getVariables().forEach((key, value) -> {
if (value instanceof Serializable) {
- variables.put(key, (Serializable) value);
+ variables.put(key, value);
}
});
}
@@ -153,25 +154,22 @@ public class ExecuteActivity implements JavaDelegate {
}
protected BuildingBlock buildBuildingBlock(String activityName) {
- BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName(activityName)
- .setMsoId(UUID.randomUUID().toString()).setKey("").setIsVirtualLink(false).setVirtualLinkKey("");
- return buildingBlock;
+ return new BuildingBlock().setBpmnFlowName(activityName).setMsoId(UUID.randomUUID().toString()).setKey("")
+ .setIsVirtualLink(false).setVirtualLinkKey("");
}
protected ExecuteBuildingBlock buildExecuteBuildingBlock(DelegateExecution execution, String requestId,
- BuildingBlock buildingBlock) throws Exception {
+ BuildingBlock buildingBlock) throws IOException {
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
workflowResourceIds.setServiceInstanceId((String) execution.getVariable(SERVICE_INSTANCE_ID));
workflowResourceIds.setVnfId((String) execution.getVariable(VNF_ID));
String bpmnRequest = (String) execution.getVariable(G_BPMN_REQUEST);
ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
RequestDetails requestDetails = sIRequest.getRequestDetails();
- ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setaLaCarte(true)
- .setRequestAction((String) execution.getVariable(G_ACTION))
+ return new ExecuteBuildingBlock().setaLaCarte(true).setRequestAction((String) execution.getVariable(G_ACTION))
.setResourceId((String) execution.getVariable(VNF_ID))
.setVnfType((String) execution.getVariable(VNF_TYPE)).setWorkflowResourceIds(workflowResourceIds)
.setRequestId(requestId).setBuildingBlock(buildingBlock).setRequestDetails(requestDetails);
- return executeBuildingBlock;
}
protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java
index 164480d7c7..ff0f9e76a3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java
@@ -6,6 +6,8 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* 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
@@ -46,17 +48,16 @@ public class AssignNetwork {
* @return
*/
public boolean networkFoundByName(BuildingBlockExecution execution) {
- boolean networkFound = false;
try {
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
if (!OrchestrationStatus.PRECREATED.equals(l3network.getOrchestrationStatus())) {
- networkFound = true;
logger.debug("network found in NOT PRECREATED status");
+ return true;
}
} catch (Exception ex) {
- // return false if no network present
+ return false;
}
- return networkFound;
+ return false;
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java
new file mode 100644
index 0000000000..86d56005f6
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java
@@ -0,0 +1,109 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Tech Mahindra
+ * ================================================================================
+ * 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.Optional;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+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.db.catalog.beans.BBNameSelectionReference;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ControllerExecution {
+ private static final Logger logger = LoggerFactory.getLogger(ControllerExecution.class);
+ private static final String CONTROLLER_ACTOR = "controllerActor";
+ private static final String BUILDING_BLOCK = "buildingBlock";
+ private static final String SCOPE = "scope";
+ private static final String ACTION = "action";
+ private static final String BBNAME = "bbName";
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+
+ /**
+ * Setting Controller Actor, Scope and Action Variables in BuildingBlockExecution object
+ *
+ * @param execution - BuildingBlockExecution object
+ */
+ public void setControllerActorScopeAction(BuildingBlockExecution execution) {
+ try {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ String modleUuid = genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid();
+ VnfResourceCustomization vnfResourceCustomization =
+ catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(modleUuid);
+
+ // Fetching Controller Actor at VNF level if null then Controller Actor is set as "APPC"
+ String controllerActor = Optional.ofNullable(vnfResourceCustomization.getControllerActor()).orElse("APPC");
+ ExecuteBuildingBlock executeBuildingBlock = execution.getVariable(BUILDING_BLOCK);
+ BuildingBlock buildingBlock = executeBuildingBlock.getBuildingBlock();
+ String scope = Optional.ofNullable(buildingBlock.getBpmnScope()).orElseThrow(
+ () -> new NullPointerException("BPMN Scope is NULL in the orchestration_flow_reference table "));
+ String action = Optional.ofNullable(buildingBlock.getBpmnAction()).orElseThrow(
+ () -> new NullPointerException("BPMN Action is NULL in the orchestration_flow_reference table "));
+ execution.setVariable(SCOPE, scope);
+ execution.setVariable(ACTION, action);
+ execution.setVariable(CONTROLLER_ACTOR, controllerActor);
+ logger.debug("Executing Controller Execution for ControllerActor: {}, Scope: {} , Action: {}",
+ controllerActor, scope, action);
+
+ } catch (Exception ex) {
+ logger.error("An exception occurred while fetching Controller Actor,Scope and Action ", ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ /**
+ * Selecting bbName from BBNameSelectionReference and setting the value in a variable of BuildingBlockExecution
+ *
+ * @param execution - BuildingBlockExecution object
+ */
+ public void selectBB(BuildingBlockExecution execution) {
+ try {
+
+ String controllerActor = execution.getVariable(CONTROLLER_ACTOR);
+ String action = Optional.of((String) execution.getVariable(ACTION)).get();
+ String scope = Optional.of((String) execution.getVariable(SCOPE)).get();
+ BBNameSelectionReference bbNameSelectionReference =
+ catalogDbClient.getBBNameSelectionReference(controllerActor, scope, action);
+ String bbName = bbNameSelectionReference.getBbName();
+ execution.setVariable(BBNAME, bbName);
+ logger.debug(" Executing {} BPMN", bbName);
+ } catch (Exception ex) {
+ logger.error("An exception occurred while getting bbname from catalogdb ", ex);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+
+ }
+
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java
index 36eab8f981..5e925bf9c6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/CreateNetworkCollection.java
@@ -6,6 +6,8 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* 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
@@ -29,8 +31,6 @@ 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.AAINetworkResources;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
index ea0b408e41..ccbce2de6a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceCreateTasks.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* 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
@@ -20,25 +22,16 @@
package org.onap.so.bpmn.infrastructure.namingservice.tasks;
-import java.util.List;
-import java.util.Optional;
-import org.onap.aai.domain.yang.Zone;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.InjectionHelper;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
-import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.onap.so.client.aai.entities.Relationships;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
+import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.namingservice.NamingRequestObject;
import org.onap.so.client.namingservice.NamingServiceConstants;
@@ -65,7 +58,7 @@ public class NamingServiceCreateTasks {
this.bbInputSetupUtils = bbInputSetupUtils;
}
- public void createInstanceGroupName(BuildingBlockExecution execution) throws Exception {
+ public void createInstanceGroupName(BuildingBlockExecution execution) throws BBObjectNotFoundException {
InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
String policyInstanceName = execution.getVariable("policyInstanceName");
String nfNamingCode = execution.getVariable("nfNamingCode");
@@ -79,7 +72,7 @@ public class NamingServiceCreateTasks {
instanceGroup.setInstanceGroupName(generatedInstanceGroupName);
}
- public void createWanTransportServiceName(BuildingBlockExecution execution) throws Exception {
+ public void createWanTransportServiceName(BuildingBlockExecution execution) throws BBObjectNotFoundException {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
NamingRequestObject namingRequestObject = new NamingRequestObject();
namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId());
@@ -98,7 +91,7 @@ public class NamingServiceCreateTasks {
serviceInstance.setServiceInstanceName(generatedWanTransportServiceName);
}
- public void createVpnBondingServiceName(BuildingBlockExecution execution) throws Exception {
+ public void createVpnBondingServiceName(BuildingBlockExecution execution) throws BBObjectNotFoundException {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
VpnBinding vpnBinding = extractPojosForBB.extractByKey(execution, ResourceKey.VPN_ID);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java
index 507e14e42a..8d14bd3e89 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/namingservice/tasks/NamingServiceDeleteTasks.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* 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
@@ -26,6 +28,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
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.namingservice.NamingRequestObject;
import org.onap.so.client.orchestration.NamingServiceResources;
@@ -43,7 +46,7 @@ public class NamingServiceDeleteTasks {
@Autowired
private NamingServiceResources namingServiceResources;
- public void deleteInstanceGroupName(BuildingBlockExecution execution) throws Exception {
+ public void deleteInstanceGroupName(BuildingBlockExecution execution) throws BBObjectNotFoundException {
InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
try {
@@ -53,7 +56,7 @@ public class NamingServiceDeleteTasks {
}
}
- public void deleteServiceInstanceName(BuildingBlockExecution execution) throws Exception {
+ public void deleteServiceInstanceName(BuildingBlockExecution execution) throws BBObjectNotFoundException {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
NamingRequestObject namingRequestObject = new NamingRequestObject();
namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId());
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
index 192cb3fc90..89d62e0752 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
@@ -6,6 +6,8 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* 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
@@ -64,7 +66,7 @@ public class SDNCQueryTasks {
* @param execution
* @throws Exception
*/
- public void queryVnf(BuildingBlockExecution execution) throws Exception {
+ public void queryVnf(BuildingBlockExecution execution) throws BBObjectNotFoundException {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -99,7 +101,7 @@ public class SDNCQueryTasks {
* @param execution
* @throws Exception
*/
- public void queryVfModule(BuildingBlockExecution execution) throws Exception {
+ public void queryVfModule(BuildingBlockExecution execution) throws BBObjectNotFoundException {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
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 80c6f0b969..2284c4af1a 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
@@ -431,7 +431,12 @@ public class WorkflowAction {
execution.setVariable("isRollbackComplete", false);
} catch (Exception ex) {
- buildAndThrowException(execution, "Exception while setting execution list. ", ex);
+ if (!(execution.hasVariable("WorkflowException")
+ || execution.hasVariable("WorkflowExceptionExceptionMessage"))) {
+ buildAndThrowException(execution, "Exception while setting execution list. ", ex);
+ } else {
+ throw ex;
+ }
}
}
@@ -537,7 +542,7 @@ public class WorkflowAction {
if (configurations.size() > 1) {
String multipleRelationshipsError =
"Multiple relationships exist from VNFC " + vnfc.getVnfcName() + " to Configurations";
- buildAndThrowException(dataObj.getExecution(), multipleRelationshipsError,
+ buildAndThrowException(dataObj.getExecution(), "Exception in getConfigBuildingBlock: ",
new Exception(multipleRelationshipsError));
}
for (org.onap.aai.domain.yang.Configuration configuration : configurations) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java
index 2ec63182a0..35e08563d1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java
@@ -6,6 +6,8 @@
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
+ * Modifications Copyright (c) 2020 Nokia
+ * ================================================================================
* 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
@@ -32,10 +34,9 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.adapter.vnf.VnfVolumeAdapterClientImpl;
import org.onap.so.client.adapter.vnf.mapper.VnfAdapterObjectMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import java.io.IOException;
@Component
public class VnfAdapterVolumeGroupResources {
@@ -48,13 +49,13 @@ public class VnfAdapterVolumeGroupResources {
public CreateVolumeGroupRequest createVolumeGroupRequest(RequestContext requestContext, CloudRegion cloudRegion,
OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, GenericVnf genericVnf,
- VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws Exception {
+ VolumeGroup volumeGroup, String sdncVfModuleQueryResponse) throws IOException {
return vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext,
serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse);
}
public DeleteVolumeGroupRequest deleteVolumeGroupRequest(RequestContext requestContext, CloudRegion cloudRegion,
- ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws Exception {
+ ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws IOException {
return vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance,
volumeGroup);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecutionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecutionTest.java
new file mode 100644
index 0000000000..72a987c395
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecutionTest.java
@@ -0,0 +1,127 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Tech Mahindra
+ * ================================================================================
+ * 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.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.when;
+import java.util.UUID;
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.ArgumentMatchers;
+import org.mockito.InjectMocks;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.db.catalog.beans.BBNameSelectionReference;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+
+
+public class ControllerExecutionTest extends BaseTaskTest {
+
+ @InjectMocks
+ private ControllerExecution controllerExecution = new ControllerExecution();
+
+ private static final String TEST_SCOPE = "vfModule";
+ private static final String TEST_BBNAME = "ConfigurationScaleOut";
+ private static final String TEST_ACTION = "configScaleOut";
+ private static final String TEST_CONTROLLER_ACTOR = "APPC";
+
+ private BuildingBlock buildingBlock = new BuildingBlock();
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ private ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
+ private GenericVnf genericVnf;
+ private ServiceInstance serviceInstance;
+ private RequestContext requestContext;
+ private String msoRequestId;
+
+
+ @Before
+ public void before() throws BBObjectNotFoundException {
+
+ genericVnf = setGenericVnf();
+ serviceInstance = setServiceInstance();
+ msoRequestId = UUID.randomUUID().toString();
+ requestContext = setRequestContext();
+ requestContext.setMsoRequestId(msoRequestId);
+ gBBInput.setRequestContext(requestContext);
+ buildingBlock.setBpmnAction(TEST_ACTION);
+ buildingBlock.setBpmnScope(TEST_SCOPE);
+ executeBuildingBlock.setBuildingBlock(buildingBlock);
+ execution.setVariable("buildingBlock", executeBuildingBlock);
+
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
+ .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
+
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
+ .thenReturn(genericVnf);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+
+
+ }
+
+ @Test
+ public void testSetControllerActorScopeAction() throws Exception {
+
+
+ doReturn(vnfResourceCustomization).when(catalogDbClient).getVnfResourceCustomizationByModelCustomizationUUID(
+ genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid());
+ controllerExecution.setControllerActorScopeAction(execution);
+ assertEquals(TEST_SCOPE, execution.getVariable("scope"));
+ assertEquals(TEST_ACTION, execution.getVariable("action"));
+ assertEquals(TEST_CONTROLLER_ACTOR, execution.getVariable("controllerActor"));
+
+ }
+
+
+ @Test
+ public void testSelectBB() throws Exception {
+ // given
+ BBNameSelectionReference bbNameSelectionReference = new BBNameSelectionReference();
+ bbNameSelectionReference.setBbName(TEST_BBNAME);
+ bbNameSelectionReference.setAction(TEST_ACTION);
+ bbNameSelectionReference.setControllerActor(TEST_CONTROLLER_ACTOR);
+ bbNameSelectionReference.setScope(TEST_SCOPE);
+ doReturn(bbNameSelectionReference).when(catalogDbClient).getBBNameSelectionReference(TEST_CONTROLLER_ACTOR,
+ TEST_SCOPE, TEST_ACTION);
+ execution.setVariable("controllerActor", TEST_CONTROLLER_ACTOR);
+ execution.setVariable("scope", TEST_SCOPE);
+ execution.setVariable("action", TEST_ACTION);
+
+ // when
+ controllerExecution.selectBB(execution);
+ // verify
+ assertEquals(TEST_BBNAME, execution.getVariable("bbName"));
+ }
+
+}
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 8e47c34cb0..4fdd97d95a 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
@@ -41,6 +41,7 @@ import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.when;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
@@ -228,6 +229,77 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void selectExecutionListExceptionAlreadyBuiltTest() throws Exception {
+ DelegateExecution delegateExecution = new DelegateExecutionFake();
+ String gAction = "deleteInstance";
+ String resource = "VfModule";
+ delegateExecution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ delegateExecution.setVariable("requestAction", gAction);
+ String bpmnRequest =
+ new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
+ delegateExecution.setVariable("bpmnRequest", bpmnRequest);
+ delegateExecution.setVariable("aLaCarte", true);
+ delegateExecution.setVariable("apiVersion", "7");
+ delegateExecution.setVariable("requestUri",
+ "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
+ "UnassignVfModuleBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+
+ doAnswer(invocation -> {
+ DelegateExecutionFake execution = invocation.getArgument(0);
+ execution.setVariable("WorkflowException", "exception");
+ execution.setVariable("WorkflowExceptionErrorMessage", "errorMessage");
+ throw new BpmnError("WorkflowException");
+ }).when(exceptionUtil).buildAndThrowWorkflowException(delegateExecution, 7000,
+ "Exception in getConfigBuildingBlock: Multiple relationships exist from VNFC testVnfcName to Configurations");
+
+
+ org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
+ vnf.setVnfId("vnf0");
+ vnf.setModelCustomizationId("modelCustomizationId");
+ when(bbSetupUtils.getAAIGenericVnf(any())).thenReturn(vnf);
+
+ org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule();
+ vfModule.setModelCustomizationId("modelCustomizationId");
+ when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModule);
+
+ List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>();
+ org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
+ vnfc.setModelInvariantId("modelInvariantId");
+ vnfc.setVnfcName("testVnfcName");
+ vnfcs.add(vnfc);
+ doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(), any(), any());
+
+ List<org.onap.aai.domain.yang.Configuration> configurations =
+ new ArrayList<org.onap.aai.domain.yang.Configuration>();
+ org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setModelCustomizationId("modelCustimizationId");
+ configuration.setConfigurationName("testConfigurationName");
+ configurations.add(configuration);
+ org.onap.aai.domain.yang.Configuration configuration1 = new org.onap.aai.domain.yang.Configuration();
+ configuration1.setConfigurationId("configurationId");
+ configuration1.setModelCustomizationId("modelCustimizationId");
+ configuration1.setConfigurationName("testConfigurationName");
+ configurations.add(configuration1);
+ doReturn(configurations).when(SPY_workflowAction).getRelatedResourcesInVnfc(any(), any(), any());
+
+ doReturn("testName").when(SPY_workflowAction).getVnfcNameForConfiguration(any());
+
+ thrown.expect(BpmnError.class);
+ SPY_workflowAction.selectExecutionList(delegateExecution);
+ assertEquals(
+ "Exception in getConfigBuildingBlock: Multiple relationships exist from VNFC testVnfcName to Configurations",
+ delegateExecution.getVariable("WorkflowException"));
+ }
+
+ @Test
public void selectExecutionListDuplicateNameExceptionTest() throws Exception {
String gAction = "createInstance";
execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");