summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBonkur, Venkat (vb8416) <vb8416@att.com>2019-03-15 16:16:21 -0400
committerBonkur, Venkat (vb8416) <vb8416@att.com>2019-03-15 23:13:44 -0400
commit853440d183783ebfe65f45b49ad8874d9c87ef8d (patch)
treee3359e5173543a684140bf05962478df6f6f3567
parent4ca3abdffa40e7777a233151f66ee0b4131ed538 (diff)
Add VnfInPlaceSoftwareUpdate for WFD
Added CheckPserversLocked,SetClosedLoopDisabled,UnsetClosedLoopDisabled, CheckClosedLoopDisabled, CheckInMain Change-Id: I6405b2c88d2109d952d452648bef2f99be6993df Issue-ID: SO-1518 Signed-off-by: Bonkur, Venkat (vb8416) <vb8416@att.com>
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckClosedLoopDisabledFlagActivity.bpmn50
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckInMaintFlagActivity.bpmn50
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckPserversLockedFlagActivity.bpmn50
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSetClosedLoopDisabledFlagActivity.bpmn50
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetClosedLoopDisabledFlagActivity.bpmn47
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java55
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java56
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java55
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetClosedLoopDisabledFlagActivityTest.java55
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java54
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java41
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java87
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java31
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java11
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java28
16 files changed, 727 insertions, 12 deletions
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckClosedLoopDisabledFlagActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckClosedLoopDisabledFlagActivity.bpmn
new file mode 100644
index 0000000000..9ac0f38835
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckClosedLoopDisabledFlagActivity.bpmn
@@ -0,0 +1,50 @@
+<?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_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0">
+ <bpmn:process id="VNFCheckClosedLoopDisabledFlagActivity" name="VNFCheckClosedLoopDisabledFlagActivity&#10;" isExecutable="true">
+ <bpmn:startEvent id="VNFCheckClosedLoopDisabledFlagActivity_Start">
+ <bpmn:outgoing>SequenceFlow_01c8z5u</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="VNFCheckClosedLoopDisabledFlagActivity_End">
+ <bpmn:incoming>SequenceFlow_12mzh2v</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="TaskCheckClosedLoopDisabledFlagActivity" name="VNF Check Closed Loop Disabled Flag (AAI)" camunda:expression="${AAIFlagTasks.checkVnfClosedLoopDisabledFlag(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_01c8z5u</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_12mzh2v</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_01c8z5u" sourceRef="VNFCheckClosedLoopDisabledFlagActivity_Start" targetRef="TaskCheckClosedLoopDisabledFlagActivity" />
+ <bpmn:sequenceFlow id="SequenceFlow_12mzh2v" sourceRef="TaskCheckClosedLoopDisabledFlagActivity" targetRef="VNFCheckClosedLoopDisabledFlagActivity_End" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFCheckClosedLoopDisabledFlagActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFCheckClosedLoopDisabledFlagActivity_Start">
+ <dc:Bounds x="104" y="76" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="122" y="112" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="VNFCheckClosedLoopDisabledFlagActivity_End">
+ <dc:Bounds x="320" y="76" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="338" y="116" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1r380lg_di" bpmnElement="TaskCheckClosedLoopDisabledFlagActivity">
+ <dc:Bounds x="192" y="54" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_01c8z5u_di" bpmnElement="SequenceFlow_01c8z5u">
+ <di:waypoint xsi:type="dc:Point" x="140" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="192" y="94" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="166" y="73" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_12mzh2v_di" bpmnElement="SequenceFlow_12mzh2v">
+ <di:waypoint xsi:type="dc:Point" x="292" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="320" y="94" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="306" y="73" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckInMaintFlagActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckInMaintFlagActivity.bpmn
new file mode 100644
index 0000000000..8709f399a5
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckInMaintFlagActivity.bpmn
@@ -0,0 +1,50 @@
+<?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_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0">
+ <bpmn:process id="VNFCheckInMaintFlagActivity" name="VNFCheckInMaintFlagActivity&#10;" isExecutable="true">
+ <bpmn:startEvent id="VNFCheckInMaintFlagActivity_Start">
+ <bpmn:outgoing>SequenceFlow_0h1gkvd</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="VNFCheckInMaintFlagActivity_End">
+ <bpmn:incoming>SequenceFlow_0xu6esl</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="TaskCheckInMaintFlag" name="VNF Check InMaint Flag (AAI)" camunda:expression="${AAIFlagTasks.checkVnfInMaintFlag(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0h1gkvd</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0xu6esl</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0h1gkvd" sourceRef="VNFCheckInMaintFlagActivity_Start" targetRef="TaskCheckInMaintFlag" />
+ <bpmn:sequenceFlow id="SequenceFlow_0xu6esl" sourceRef="TaskCheckInMaintFlag" targetRef="VNFCheckInMaintFlagActivity_End" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFCheckInMaintFlagActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFCheckInMaintFlagActivity_Start">
+ <dc:Bounds x="104" y="76" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="122" y="112" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="VNFCheckInMaintFlagActivity_End">
+ <dc:Bounds x="384" y="76" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="357" y="116" width="90" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1r380lg_di" bpmnElement="TaskCheckInMaintFlag">
+ <dc:Bounds x="194" y="54" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0h1gkvd_di" bpmnElement="SequenceFlow_0h1gkvd">
+ <di:waypoint xsi:type="dc:Point" x="140" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="194" y="94" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="167" y="73" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0xu6esl_di" bpmnElement="SequenceFlow_0xu6esl">
+ <di:waypoint xsi:type="dc:Point" x="294" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="384" y="94" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="339" y="73" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckPserversLockedFlagActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckPserversLockedFlagActivity.bpmn
new file mode 100644
index 0000000000..9c327a4da9
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFCheckPserversLockedFlagActivity.bpmn
@@ -0,0 +1,50 @@
+<?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_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0">
+ <bpmn:process id="VNFCheckPserversLockedFlagActivity" name="VNFCheckInMaintFlagActivity&#10;" isExecutable="true">
+ <bpmn:startEvent id="VNFCheckPserversLockedFlagActivity_Start">
+ <bpmn:outgoing>SequenceFlow_0a56huh</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="VNFCheckPserversLockedFlagActivity_End">
+ <bpmn:incoming>SequenceFlow_1f2j7tx</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="TaskCheckPserversLockedFlagActivity" name="VNF Check Pservers Locked Flag (AAI)" camunda:expression="${AAIFlagTasks.checkVnfPserversLockedFlag(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_0a56huh</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1f2j7tx</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0a56huh" sourceRef="VNFCheckPserversLockedFlagActivity_Start" targetRef="TaskCheckPserversLockedFlagActivity" />
+ <bpmn:sequenceFlow id="SequenceFlow_1f2j7tx" sourceRef="TaskCheckPserversLockedFlagActivity" targetRef="VNFCheckPserversLockedFlagActivity_End" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFCheckPserversLockedFlagActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFCheckPserversLockedFlagActivity_Start">
+ <dc:Bounds x="104" y="76" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="122" y="112" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="VNFCheckPserversLockedFlagActivity_End">
+ <dc:Bounds x="320" y="76" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="338" y="116" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1r380lg_di" bpmnElement="TaskCheckPserversLockedFlagActivity">
+ <dc:Bounds x="192" y="54" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0a56huh_di" bpmnElement="SequenceFlow_0a56huh">
+ <di:waypoint xsi:type="dc:Point" x="140" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="192" y="94" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="166" y="73" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1f2j7tx_di" bpmnElement="SequenceFlow_1f2j7tx">
+ <di:waypoint xsi:type="dc:Point" x="292" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="320" y="94" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="306" y="73" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSetClosedLoopDisabledFlagActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSetClosedLoopDisabledFlagActivity.bpmn
new file mode 100644
index 0000000000..f356634106
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFSetClosedLoopDisabledFlagActivity.bpmn
@@ -0,0 +1,50 @@
+<?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_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0">
+ <bpmn:process id="VNFSetClosedLoopDisabledFlagActivity" name="VNFSetClosedLoopDisabledFlagActivity&#10;" isExecutable="true">
+ <bpmn:startEvent id="VNFSetClosedLoopDisabledFlagActivity_Start">
+ <bpmn:outgoing>SequenceFlow_0pp6ze7</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="VNFSetClosedLoopDisabledFlagActivity_End">
+ <bpmn:incoming>SequenceFlow_0g0xfi3</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="TaskSetClosedLoopDisabledFlagActivity" name="VNF Set Closed Loop Disabled Flag (AAI)" camunda:expression="${AAIFlagTasks.modifyVnfClosedLoopDisabledFlag(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)), true)}">
+ <bpmn:incoming>SequenceFlow_0pp6ze7</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0g0xfi3</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0pp6ze7" sourceRef="VNFSetClosedLoopDisabledFlagActivity_Start" targetRef="TaskSetClosedLoopDisabledFlagActivity" />
+ <bpmn:sequenceFlow id="SequenceFlow_0g0xfi3" sourceRef="TaskSetClosedLoopDisabledFlagActivity" targetRef="VNFSetClosedLoopDisabledFlagActivity_End" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFSetClosedLoopDisabledFlagActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFSetClosedLoopDisabledFlagActivity_Start">
+ <dc:Bounds x="104" y="76" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="122" y="112" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="VNFSetClosedLoopDisabledFlagActivity_End">
+ <dc:Bounds x="320" y="76" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="338" y="116" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1r380lg_di" bpmnElement="TaskSetClosedLoopDisabledFlagActivity">
+ <dc:Bounds x="192" y="54" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0pp6ze7_di" bpmnElement="SequenceFlow_0pp6ze7">
+ <di:waypoint xsi:type="dc:Point" x="140" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="192" y="94" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="166" y="73" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0g0xfi3_di" bpmnElement="SequenceFlow_0g0xfi3">
+ <di:waypoint xsi:type="dc:Point" x="292" y="94" />
+ <di:waypoint xsi:type="dc:Point" x="320" y="94" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="306" y="73" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetClosedLoopDisabledFlagActivity.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetClosedLoopDisabledFlagActivity.bpmn
new file mode 100644
index 0000000000..0dbe989cb2
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/Activity/VNFUnsetClosedLoopDisabledFlagActivity.bpmn
@@ -0,0 +1,47 @@
+<?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_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.9.0">
+ <bpmn:process id="VNFUnsetInClosedLoopDisabledFlagActivity" name="VNFUnsetInClosedLoopDisabledFlagActivity" isExecutable="true">
+ <bpmn:startEvent id="VNFUnsetClosedLoopDisabledFlagActivity_Start">
+ <bpmn:outgoing>SequenceFlow_19it9ao</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="VNFUnsetClosedLoopDisabledFlagActivity_End">
+ <bpmn:incoming>SequenceFlow_1en9xbh</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="TaskVNFUnsetClosedLoopDisabledFlagActivity" name="VNF Unset Closed Loop Disabled Flag (AAI)" camunda:expression="${AAIFlagTasks.modifyVnfClosedLoopDisabledFlag(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)), false)}">
+ <bpmn:incoming>SequenceFlow_19it9ao</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1en9xbh</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_19it9ao" sourceRef="VNFUnsetClosedLoopDisabledFlagActivity_Start" targetRef="TaskVNFUnsetClosedLoopDisabledFlagActivity" />
+ <bpmn:sequenceFlow id="SequenceFlow_1en9xbh" sourceRef="TaskVNFUnsetClosedLoopDisabledFlagActivity" targetRef="VNFUnsetClosedLoopDisabledFlagActivity_End" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="VNFUnsetInClosedLoopDisabledFlagActivity">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="VNFUnsetClosedLoopDisabledFlagActivity_Start">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1phehn7_di" bpmnElement="VNFUnsetClosedLoopDisabledFlagActivity_End">
+ <dc:Bounds x="501" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="519" y="142" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_15fwoxi_di" bpmnElement="TaskVNFUnsetClosedLoopDisabledFlagActivity">
+ <dc:Bounds x="296" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_19it9ao_di" bpmnElement="SequenceFlow_19it9ao">
+ <di:waypoint xsi:type="dc:Point" x="209" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="296" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="252.5" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1en9xbh_di" bpmnElement="SequenceFlow_1en9xbh">
+ <di:waypoint xsi:type="dc:Point" x="396" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="501" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="448.5" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java
new file mode 100644
index 0000000000..ac4499bf89
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckClosedLoopDisabledFlagActivityTest.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+
+public class VNFCheckClosedLoopDisabledFlagActivityTest extends BaseBPMNTest{
+ @Test
+ public void sunnyDayVNFCheckClosedLoopDisabledFlagActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFCheckClosedLoopDisabledFlagActivity_Start",
+ "TaskCheckClosedLoopDisabledFlagActivity",
+ "VNFCheckClosedLoopDisabledFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFCheckClosedLoopDisabledFlagActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
+ .checkVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFCheckClosedLoopDisabledFlagActivity_Start",
+ "TaskCheckClosedLoopDisabledFlagActivity").hasNotPassed(
+ "VNFCheckClosedLoopDisabledFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java
new file mode 100644
index 0000000000..050d3124f6
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckInMaintFlagActivityTest.java
@@ -0,0 +1,56 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+
+
+public class VNFCheckInMaintFlagActivityTest extends BaseBPMNTest{
+ @Test
+ public void sunnyDayVNFCheckInMaintFlagActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckInMaintFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFCheckInMaintFlagActivity_Start",
+ "TaskCheckInMaintFlag",
+ "VNFCheckInMaintFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFCheckInMaintFlagActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
+ .checkVnfInMaintFlag(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckInMaintFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFCheckInMaintFlagActivity_Start",
+ "TaskCheckInMaintFlag").hasNotPassed(
+ "VNFCheckInMaintFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java
new file mode 100644
index 0000000000..e43f47fa6a
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFCheckPserversLockedFlagActivity.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+
+public class VNFCheckPserversLockedFlagActivity extends BaseBPMNTest{
+ @Test
+ public void sunnyDayVNFCheckInMaintFlagActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckPserversLockedFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFCheckPserversLockedFlagActivity_Start",
+ "TaskCheckPserversLockedFlagActivity",
+ "VNFCheckPserversLockedFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFCheckPserversLockedFlagActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
+ .checkVnfPserversLockedFlag(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFCheckPserversLockedFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFCheckPserversLockedFlagActivity_Start",
+ "TaskCheckPserversLockedFlagActivity").hasNotPassed(
+ "VNFCheckPserversLockedFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetClosedLoopDisabledFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetClosedLoopDisabledFlagActivityTest.java
new file mode 100644
index 0000000000..8e56051f47
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFSetClosedLoopDisabledFlagActivityTest.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.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.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+
+public class VNFSetClosedLoopDisabledFlagActivityTest extends BaseBPMNTest{
+ @Test
+ public void sunnyDayVNFSetClosedLoopDisabledFlagActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFSetClosedLoopDisabledFlagActivity_Start",
+ "TaskSetClosedLoopDisabledFlagActivity",
+ "VNFSetClosedLoopDisabledFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFSetClosedLoopDisabledFlagActivity_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
+ .modifyVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class), any(boolean.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFSetClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFSetClosedLoopDisabledFlagActivity_Start",
+ "TaskSetClosedLoopDisabledFlagActivity").hasNotPassed(
+ "VNFSetInMaintFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java
new file mode 100644
index 0000000000..4c9b33c2c7
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/VNFUnsetClosedLoopDisabledFlagActivityTest.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.BaseBPMNTest;
+
+public class VNFUnsetClosedLoopDisabledFlagActivityTest extends BaseBPMNTest{
+ @Test
+ public void sunnyDayVNFUnsetClosedLoopDisabledFlagActivity_Test() throws InterruptedException {
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetClosedLoopDisabledFlagActivity_Start",
+ "TaskVNFUnsetClosedLoopDisabledFlagActivity",
+ "VNFUnsetClosedLoopDisabledFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void rainyDayVNFUnsetClosedLoopFlag_Test() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiFlagTasks)
+ .modifyVnfClosedLoopDisabledFlag(any(BuildingBlockExecution.class), any(boolean.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("VNFUnsetInClosedLoopDisabledFlagActivity", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("VNFUnsetClosedLoopDisabledFlagActivity_Start",
+ "TaskVNFUnsetClosedLoopDisabledFlagActivity").hasNotPassed(
+ "VNFUnsetClosedLoopDisabledFlagActivity_End");
+ assertThat(pi).isEnded();
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java
index 94529f915b..ccc9fb0e43 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIFlagTasks.java
@@ -73,4 +73,45 @@ public class AAIFlagTasks {
}
}
+ public void checkVnfClosedLoopDisabledFlag(BuildingBlockExecution execution) {
+ boolean isClosedLoopDisabled = false;
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ String vnfId = vnf.getVnfId();
+ isClosedLoopDisabled = aaiVnfResources.checkVnfClosedLoopDisabledFlag(vnfId);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ if (isClosedLoopDisabled) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VNF Close Loop Disabled in A&AI");
+ }
+ }
+
+ public void modifyVnfClosedLoopDisabledFlag(BuildingBlockExecution execution, boolean closedLoopDisabled) {
+ try {
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+
+ GenericVnf copiedGenericVnf = genericVnf.shallowCopyId();
+ copiedGenericVnf.setClosedLoopDisabled(closedLoopDisabled);
+ genericVnf.setClosedLoopDisabled(closedLoopDisabled);
+
+ aaiVnfResources.updateObjectVnf(copiedGenericVnf);
+ } catch(Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void checkVnfPserversLockedFlag(BuildingBlockExecution execution) {
+ boolean inPserversLocked = false;
+ try {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ String vnfId = vnf.getVnfId();
+ inPserversLocked = aaiVnfResources.checkVnfPserversLockedFlag(vnfId);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ if (inPserversLocked) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "VNF PServers in Locked in A&AI");
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
index 0c65abfe0c..48a1c1e558 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java
@@ -22,6 +22,7 @@
package org.onap.so.client.orchestration;
+import java.io.IOException;
import java.util.Optional;
import org.onap.so.bpmn.common.InjectionHelper;
@@ -31,6 +32,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIValidatorImpl;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -50,6 +52,8 @@ public class AAIVnfResources {
@Autowired
private AAIObjectMapper aaiObjectMapper;
+ private AAIValidatorImpl aaiValidatorImpl= new AAIValidatorImpl();
+
public void createVnfandConnectServiceInstance(GenericVnf vnf, ServiceInstance serviceInstance) {
AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
vnf.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
@@ -125,4 +129,19 @@ public class AAIVnfResources {
AAIResourceUri vnfURI = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId());
injectionHelper.getAaiClient().connect(tenantURI, vnfURI);
}
+
+ public boolean checkVnfClosedLoopDisabledFlag(String vnfId) {
+ org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient()
+ .get(org.onap.aai.domain.yang.GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+ .orElse(new org.onap.aai.domain.yang.GenericVnf());
+ return vnf.isIsClosedLoopDisabled();
+ }
+
+ public boolean checkVnfPserversLockedFlag (String vnfId) throws IOException {
+ org.onap.aai.domain.yang.GenericVnf vnf = injectionHelper.getAaiClient()
+ .get(org.onap.aai.domain.yang.GenericVnf.class, AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
+ .orElse(new org.onap.aai.domain.yang.GenericVnf());
+ return aaiValidatorImpl.isPhysicalServerLocked(vnf.getVnfId());
+
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java
index cf28c114e8..cad97cad6e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/aai/tasks/AAIFlagTasksTest.java
@@ -29,6 +29,8 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.io.IOException;
+
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
@@ -119,4 +121,89 @@ public class AAIFlagTasksTest extends BaseTaskTest {
verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
}
}
+
+ @Test
+ public void checkVnfClosedLoopDisabledTestTrue() throws Exception {
+ doThrow(new BpmnError("VNF Closed Loop Disabled in A&AI")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doReturn(false).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
+ try {
+ aaiFlagTasks.checkVnfClosedLoopDisabledFlag(execution);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkVnfClosedLoopDisabledFlag(any(String.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), eq("VNF Closed Loop Disabled in A&AI"));
+ }
+ }
+
+ @Test
+ public void checkVnfClosedLoopDisabledTestFalse() throws Exception {
+ doReturn(false).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
+ aaiFlagTasks.checkVnfClosedLoopDisabledFlag(execution);
+ verify(exceptionUtil, times(0)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), any(int.class), any(String.class));
+ }
+
+ @Test
+ public void checkVnfClosedLoopDisabledFlagExceptionTest() {
+
+ doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doThrow(RuntimeException.class).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
+ try {
+ aaiFlagTasks.checkVnfClosedLoopDisabledFlag(execution);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkVnfClosedLoopDisabledFlag(any(String.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ }
+ }
+
+ @Test
+ public void modifyVnfClosedLoopDisabledFlagTest() throws Exception {
+ doNothing().when(aaiVnfResources).updateObjectVnf(ArgumentMatchers.any(GenericVnf.class));
+ aaiFlagTasks.modifyVnfClosedLoopDisabledFlag(execution, true);
+ verify(aaiVnfResources, times(1)).updateObjectVnf(ArgumentMatchers.any(GenericVnf.class));
+ }
+
+ @Test
+ public void modifyVnfClosedLoopDisabledFlagExceptionTest() {
+
+ doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doThrow(RuntimeException.class).when(aaiVnfResources).updateObjectVnf(isA(GenericVnf.class));
+ try {
+ aaiFlagTasks.modifyVnfClosedLoopDisabledFlag(execution, true);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkVnfClosedLoopDisabledFlag(any(String.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ }
+ }
+
+
+ @Test
+ public void checkVnfPserversLockedFlagTestTrue() throws Exception {
+ doThrow(new BpmnError("VNF PServers in Locked in A&AI")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doReturn(true).when(aaiVnfResources).checkVnfPserversLockedFlag(isA(String.class));
+ try {
+ aaiFlagTasks.checkVnfClosedLoopDisabledFlag(execution);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkVnfPserversLockedFlag(any(String.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), eq("VNF PServers in Locked in A&AI"));
+ }
+ }
+
+ @Test
+ public void checkVnfPserversLockedFlagTestFalse() throws Exception {
+ doReturn(false).when(aaiVnfResources).checkVnfPserversLockedFlag(isA(String.class));
+ aaiFlagTasks.checkVnfPserversLockedFlag(execution);
+ verify(exceptionUtil, times(0)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), any(int.class), any(String.class));
+ }
+
+ @Test
+ public void checkVnfPserversLockedFlagExceptionTest() throws IOException {
+
+ doThrow(new BpmnError("Unknown Error")).when(exceptionUtil).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ doThrow(RuntimeException.class).when(aaiVnfResources).checkVnfClosedLoopDisabledFlag(isA(String.class));
+ try {
+ aaiFlagTasks.checkVnfPserversLockedFlag(execution);
+ } catch (Exception e) {
+ verify(aaiVnfResources, times(1)).checkVnfPserversLockedFlag(any(String.class));
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(String.class));
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
index b87b5e4166..d499bcd36e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
@@ -21,6 +21,7 @@
package org.onap.so.client.orchestration;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
@@ -29,6 +30,7 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import java.io.IOException;
import java.util.Optional;
import org.junit.Before;
@@ -47,6 +49,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.AAIValidatorImpl;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
@@ -70,6 +73,9 @@ public class AAIVnfResourcesTest extends TestDataSetup {
@Mock
protected InjectionHelper MOCK_injectionHelper;
+ @Mock
+ protected AAIValidatorImpl MOCK_aaiValidatorImpl;
+
@InjectMocks
AAIVnfResources aaiVnfResources = new AAIVnfResources();
@@ -182,4 +188,29 @@ public class AAIVnfResourcesTest extends TestDataSetup {
eq(AAIUriFactory.createResourceUri(AAIObjectType.CLOUD_REGION,
cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId())));
}
+
+
+ @Test
+ public void checkVnfClosedLoopDisabledFlagTest () {
+ Optional<org.onap.aai.domain.yang.GenericVnf> vnf = Optional.of(new org.onap.aai.domain.yang.GenericVnf());
+ vnf.get().setVnfId("vnfId");
+ vnf.get().setIsClosedLoopDisabled(true);
+ doReturn(vnf).when(MOCK_aaiResourcesClient).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class));
+ boolean isCheckVnfClosedLoopDisabledFlag = aaiVnfResources.checkVnfClosedLoopDisabledFlag("vnfId");
+ verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class));
+ assertEquals(isCheckVnfClosedLoopDisabledFlag, true);
+ }
+
+ @Test
+ public void checkVnfPserversLockedFlagTest () throws IOException {
+
+ Optional<org.onap.aai.domain.yang.GenericVnf> vnf = Optional.of(new org.onap.aai.domain.yang.GenericVnf());
+ vnf.get().setVnfId("vnfId");
+ doReturn(vnf).when(MOCK_aaiResourcesClient).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class));
+ doReturn(true).when(MOCK_aaiValidatorImpl).isPhysicalServerLocked("vnfId");
+ boolean isVnfPserversLockedFlag = aaiVnfResources.checkVnfPserversLockedFlag("vnfId");
+ verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class),isA(AAIResourceUri.class));
+ verify(MOCK_aaiValidatorImpl, times(1)).isPhysicalServerLocked(isA(String.class));
+ assertTrue(isVnfPserversLockedFlag);
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java b/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java
index 6ece8a2620..1bd7720e55 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIValidatorImpl.java
@@ -26,8 +26,7 @@ import java.util.List;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.Pserver;
import org.springframework.beans.factory.annotation.Autowired;
-
-
+import org.springframework.stereotype.Component;
public class AAIValidatorImpl implements AAIValidator {
@@ -50,10 +49,12 @@ public class AAIValidatorImpl implements AAIValidator {
List<Pserver> pservers;
boolean isLocked = false;
pservers = client.getPhysicalServerByVnfId(vnfId);
- for (Pserver pserver : pservers)
- if (pserver.isInMaint())
+ for (Pserver pserver : pservers) {
+ if (pserver.isInMaint()) {
isLocked = true;
-
+ return isLocked;
+ }
+ }
return isLocked;
}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java b/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
index f32633122d..85d690feaf 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIValidatorTest.java
@@ -49,11 +49,25 @@ public class AAIValidatorTest {
validator.setClient(client);
}
- public List<Pserver> getPservers(boolean locked){
- Pserver pserver = new Pserver();
- pserver.setInMaint(locked);
+ public List<Pserver> getPserversLocked(){
+ Pserver pserver1 = new Pserver();
+ pserver1.setInMaint(true);
+ Pserver pserver2 = new Pserver();
+ pserver2.setInMaint(false);
List<Pserver> pservers = new ArrayList<Pserver>();
- pservers.add(pserver);
+ pservers.add(pserver1);
+ pservers.add(pserver2);
+ return pservers;
+ }
+
+ public List<Pserver> getPserversNotLocked(){
+ Pserver pserver1 = new Pserver();
+ pserver1.setInMaint(false);
+ Pserver pserver2 = new Pserver();
+ pserver2.setInMaint(false);
+ List<Pserver> pservers = new ArrayList<Pserver>();
+ pservers.add(pserver1);
+ pservers.add(pserver2);
return pservers;
}
@@ -64,15 +78,15 @@ public class AAIValidatorTest {
}
@Test
- public void test_IsPhysicalServerLocked_True() throws IOException{
- when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(getPservers(true));
+ public void test_IsPhysicalServerLocked_True() throws IOException{
+ when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(getPserversLocked());
boolean locked = validator.isPhysicalServerLocked(vnfName);
assertEquals(true, locked);
}
@Test
public void test_IsPhysicalServerLocked_False() throws IOException {
- when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(getPservers(false));
+ when(client.getPhysicalServerByVnfId(vnfName)).thenReturn(getPserversNotLocked());
boolean locked = validator.isPhysicalServerLocked(vnfName);
assertEquals(false, locked);
}