summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CommonTimestampGenerator.java26
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/TimestampGeneratorUtil.java19
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java23
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/ControllerExecutionBB.bpmn188
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java56
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelTest.java35
-rw-r--r--so-sdn-clients/src/test/java/org/onap/so/client/sdnc/SdnCommonTasksTest.java (renamed from so-sdn-clients/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java)33
9 files changed, 272 insertions, 136 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CommonTimestampGenerator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CommonTimestampGenerator.java
new file mode 100644
index 0000000000..02ce540265
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/CommonTimestampGenerator.java
@@ -0,0 +1,26 @@
+package org.onap.so.bpmn.common.util;
+
+import java.time.Instant;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
+
+public class CommonTimestampGenerator {
+
+ private final DateTimeFormatter formatter;
+
+ public CommonTimestampGenerator(String format) {
+ this.formatter = DateTimeFormatter.ofPattern(format).withZone(ZoneId.systemDefault());
+ }
+
+ public CommonTimestampGenerator() {
+ this.formatter = null;
+ }
+
+ public String generateCurrentTimestamp() {
+ if (formatter != null) {
+ return formatter.format(Instant.now());
+ } else {
+ return Instant.now().toString();
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/TimestampGeneratorUtil.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/TimestampGeneratorUtil.java
new file mode 100644
index 0000000000..f74bd57c00
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/TimestampGeneratorUtil.java
@@ -0,0 +1,19 @@
+package org.onap.so.bpmn.common.util;
+
+public final class TimestampGeneratorUtil {
+
+ private static final String APPC_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'.0Z'";
+ private static final CommonTimestampGenerator APPC_TIMESTAMP_GENERATOR = new CommonTimestampGenerator(APPC_FORMAT);
+
+ public static final CommonTimestampGenerator COMMON_GENERATOR = new CommonTimestampGenerator();
+
+ private TimestampGeneratorUtil() {}
+
+ public static String generateCurrentTimestamp(String contollerType) {
+ if (contollerType.equals("APPC")) {
+ return APPC_TIMESTAMP_GENERATOR.generateCurrentTimestamp();
+ } else {
+ return COMMON_GENERATOR.generateCurrentTimestamp();
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java
index e810fc0259..c73299ffc3 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerClient.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.
@@ -20,15 +20,12 @@
package org.onap.so.client.appc;
+import static org.onap.so.bpmn.common.util.TimestampGeneratorUtil.generateCurrentTimestamp;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import java.time.Instant;
import java.util.Properties;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
-import org.onap.so.bpmn.core.UrnPropertiesReader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.onap.appc.client.lcm.api.AppcClientServiceFactoryProvider;
import org.onap.appc.client.lcm.api.AppcLifeCycleManagerServiceFactory;
import org.onap.appc.client.lcm.api.ApplicationContext;
@@ -43,6 +40,9 @@ import org.onap.appc.client.lcm.model.Flags.Mode;
import org.onap.appc.client.lcm.model.Payload;
import org.onap.appc.client.lcm.model.Status;
import org.onap.appc.client.lcm.model.ZULU;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class ApplicationControllerClient {
@@ -77,7 +77,7 @@ public class ApplicationControllerClient {
/**
* Creates an ApplicationControllerClient for the specified controller type.
- *
+ *
* @param controllerType the controller type: "appc" or "sdnc".
*/
public ApplicationControllerClient(String controllerType) {
@@ -90,7 +90,7 @@ public class ApplicationControllerClient {
/**
* Gets the controller type.
- *
+ *
* @return the controllertype
*/
public String getControllerType() {
@@ -100,11 +100,11 @@ public class ApplicationControllerClient {
/**
* Returns the AppC client object associated with this ApplicationControllerClient. AppC client objects are shared
* objects. One is created if it does not exist.
- *
+ *
* @return the client object, or null if creation failed
*/
public LifeCycleManagerStateful getAppCClient() {
- return appCClients.computeIfAbsent(controllerType, k -> createAppCClient(k));
+ return appCClients.computeIfAbsent(controllerType, this::createAppCClient);
}
protected LifeCycleManagerStateful createAppCClient(String controllerType) {
@@ -194,8 +194,7 @@ public class ApplicationControllerClient {
flags.setForce(force);
flags.setTtl(FLAGS_TTL);
commonHeader.setFlags(flags);
- Instant timestamp = Instant.now();
- ZULU zulu = new ZULU(timestamp.toString());
+ ZULU zulu = new ZULU(generateCurrentTimestamp(this.controllerType));
commonHeader.setTimestamp(zulu);
return commonHeader;
}
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
index c46d504186..065d7e0c4b 100644
--- 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
@@ -7,7 +7,7 @@
<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:incoming>Flow_0qmjpxv</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_1mkhog2" sourceRef="Task_1hs1mn0" targetRef="EndEvent_0lgvk82" />
<bpmn:serviceTask id="Task_1hs1mn0" name="Update AAI" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatus(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)), execution.getVariable(&#34;scope&#34;), execution.getVariable(&#34;action&#34;))}">
@@ -24,7 +24,7 @@
<bpmn:outgoing>SequenceFlow_07tqu82</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_15gxql1</bpmn:outgoing>
</bpmn:exclusiveGateway>
- <bpmn:sequenceFlow id="SequenceFlow_07tqu82" name="success" sourceRef="ExclusiveGateway_13q340y" targetRef="Task_1hs1mn0">
+ <bpmn:sequenceFlow id="SequenceFlow_07tqu82" name="successCDS" sourceRef="ExclusiveGateway_13q340y" targetRef="Task_1hs1mn0">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:endEvent id="EndEvent_0mnaj50">
@@ -44,8 +44,10 @@
<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:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:out source="WorkflowExceptionErrorMessage" target="WorkflowExceptionErrorMessage" />
+ <camunda:out source="ControllerStatus" target="ControllerStatus" />
<camunda:in source="executionObject" target="executionObject" />
<camunda:in source="mso-request-id" target="mso-request-id" />
<camunda:in source="isRollback" target="isRollback" />
@@ -53,10 +55,9 @@
</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_0no1qag" sourceRef="BBToExecute" targetRef="Gateway_065nxpu" />
<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>
@@ -66,33 +67,94 @@
<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_0op5irz" sourceRef="Gateway_065nxpu" 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("actor") == "CDS"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("actor") == "CDS"}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:exclusiveGateway id="Gateway_065nxpu" default="SequenceFlow_0op5irz">
+ <bpmn:incoming>SequenceFlow_0no1qag</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0op5irz</bpmn:outgoing>
+ <bpmn:outgoing>Flow_0qmjpxv</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="Flow_0qmjpxv" name="success" sourceRef="Gateway_065nxpu" targetRef="EndEvent_0lgvk82">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</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="ControllerExecutionBB">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
- <dc:Bounds x="160" y="323" width="36" height="36" />
+ <bpmndi:BPMNEdge id="Flow_0qmjpxv_di" bpmnElement="Flow_0qmjpxv">
+ <di:waypoint x="1147" y="233" />
+ <di:waypoint x="1147" y="323" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="-17" y="279" width="90" height="20" />
+ <dc:Bounds x="1170" y="263" width="41" height="14" />
</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: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="32.5" y="236" width="90" height="20" />
+ <dc:Bounds x="455" y="436" width="60" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="EndEvent_0lgvk82_di" bpmnElement="EndEvent_0lgvk82">
- <dc:Bounds x="1129" y="323" width="36" height="36" />
+ <bpmndi:BPMNEdge id="SequenceFlow_0op5irz_di" bpmnElement="SequenceFlow_0op5irz">
+ <di:waypoint x="1147" y="183" />
+ <di:waypoint x="1147" y="128" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1025" y="251" width="90" height="20" />
+ <dc:Bounds x="739" y="58" width="0" height="12" />
</bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
+ </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:BPMNEdge id="SequenceFlow_0no1qag_di" bpmnElement="SequenceFlow_0no1qag">
+ <di:waypoint x="924" y="208" />
+ <di:waypoint x="1122" y="208" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="840.5" y="107" width="90" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <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_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: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: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="908" y="443" width="64" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_05qembo_di" bpmnElement="SequenceFlow_05qembo">
+ <di:waypoint x="672" y="462" />
+ <di:waypoint x="868" y="462" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="725" y="437" width="90" height="20" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1mkhog2_di" bpmnElement="SequenceFlow_1mkhog2">
<di:waypoint x="1079" y="462" />
<di:waypoint x="1147" y="462" />
@@ -101,16 +163,28 @@
<dc:Bounds x="918" y="357" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <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="868" y="462" />
+ <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="725" y="437" width="90" height="20" />
+ <dc:Bounds x="32.5" y="236" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <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: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:BPMNShape id="ServiceTask_0404s6a_di" bpmnElement="Task_1hs1mn0">
+ <dc:Bounds x="979" y="422" width="100" height="80" />
+ </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_01mv1si_di" bpmnElement="Task_0bhf6tp">
<dc:Bounds x="572" y="422" width="100" height="80" />
</bpmndi:BPMNShape>
@@ -120,26 +194,12 @@
<dc:Bounds x="698" y="327" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <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>
@@ -149,63 +209,21 @@
<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" />
+ <dc:Bounds x="1129" y="92" 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:BPMNShape id="Gateway_065nxpu_di" bpmnElement="Gateway_065nxpu" isMarkerVisible="true">
+ <dc:Bounds x="1122" y="183" width="50" height="50" />
+ </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java
index 1220dc05c1..f49cf48ff5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java
@@ -109,12 +109,15 @@ public class CnfAdapterCreateTasks {
protected InstanceRequest createInstanceRequest(VfModule vfModule, CloudRegion cloudRegion,
Map<String, String> sdncDirectives) {
InstanceRequest request = new InstanceRequest();
- request.setRbName(vfModule.getModelInfoVfModule().getModelInvariantUUID());
- request.setRbVersion(vfModule.getModelInfoVfModule().getModelUUID());
+ request.setModelInvariantId(vfModule.getModelInfoVfModule().getModelInvariantUUID());
+ request.setModelVersionId(vfModule.getModelInfoVfModule().getModelUUID());
+ request.setModelCustomizationId(vfModule.getModelInfoVfModule().getModelCustomizationUUID());
request.setCloudRegion(cloudRegion.getLcpCloudRegionId());
request.setVfModuleUUID(vfModule.getVfModuleId());
request.setProfileName(sdncDirectives.get("k8s-rb-profile-name"));
request.setReleaseName(sdncDirectives.get("k8s-rb-instance-release-name"));
+ if (sdncDirectives.containsKey("k8s-rb-instance-status-check"))
+ request.setStatusCheck(sdncDirectives.get("k8s-rb-instance-status-check").equalsIgnoreCase("true"));
request.setOverrideValues(sdncDirectives);
return request;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
index 2d39cc185e..76c67eefc5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
@@ -21,11 +21,12 @@
*/
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+import static org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.common.SoPropertyConstants.CONTROLLER_STATUS;
import java.util.HashMap;
import java.util.Optional;
-import org.onap.so.logger.LoggingAnchor;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.onap.appc.client.lcm.model.Action;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
@@ -33,9 +34,9 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.appc.ApplicationControllerAction;
import org.onap.so.client.exception.ExceptionBuilder;
-import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
-import org.onap.logging.filter.base.ErrorCode;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -90,13 +91,12 @@ public class GenericVnfHealthCheck {
public void callAppcClient(BuildingBlockExecution execution) {
logger.trace("Start runAppcCommand ");
String appcCode = "1002";
- String appcMessage = "";
+ String appcMessage;
try {
- Action action = null;
- action = Action.valueOf(execution.getVariable("action"));
+ Action action = Action.valueOf(execution.getVariable("action"));
String msoRequestId = execution.getVariable("msoRequestId");
String vnfId = execution.getVariable("vnfId");
- Optional<String> payload = null;
+ Optional<String> payload = Optional.empty();
if (execution.getVariable("payload") != null) {
String pay = execution.getVariable("payload");
payload = Optional.of(pay);
@@ -108,7 +108,7 @@ public class GenericVnfHealthCheck {
payloadInfo.put(OAM_IP_ADDRESS, execution.getVariable(OAM_IP_ADDRESS));
payloadInfo.put(VNF_HOST_IP_ADDRESS, execution.getVariable(VNF_HOST_IP_ADDRESS));
- logger.debug("Running APP-C action: {}", action.toString());
+ logger.debug("Running APP-C action: {}", action);
logger.debug("VNFID: {}", vnfId);
// PayloadInfo contains extra information that adds on to payload before making request to appc
appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
@@ -134,11 +134,14 @@ public class GenericVnfHealthCheck {
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
}
}
+
logger.error("Error Message: " + appcMessage);
logger.error("ERROR CODE: " + appcCode);
- logger.trace("End of runAppCommand ");
if (appcCode != null && !("0").equals(appcCode)) {
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(appcCode), appcMessage);
}
+
+ execution.setVariable(CONTROLLER_STATUS, "Success");
+ logger.debug("Successfully end of runAppCommand ");
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java
index f4b2a8b4b1..c4fbdc5359 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java
@@ -7,83 +7,89 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"rb-name", "rb-version", "profile-name", "release-name", "cloud-region", "labels",
- "override-values"})
public class InstanceRequest {
@JsonProperty("modelInvariantId")
- private String rbName;
+ private String modelInvariantId;
@JsonProperty("modelVersionId")
- private String rbVersion;
+ private String modelVersionId;
+ @JsonProperty("modelCustomizationId")
+ private String modelCustomizationId;
@JsonProperty("k8sRBProfileName")
private String profileName;
@JsonProperty("k8sRBInstanceReleaseName")
private String releaseName;
+ @JsonProperty("k8sRBInstanceStatusCheck")
+ private Boolean statusCheck = false;
@JsonProperty("vfModuleUUID")
private String vfModuleUUID;
@JsonProperty("cloudRegionId")
private String cloudRegion;
@JsonProperty("labels")
private Map<String, String> labels;
- @JsonProperty(value = "override-values")
+ @JsonProperty("override-values")
private Map<String, String> overrideValues;
- @JsonProperty("rb-name")
- public String getRbName() {
- return rbName;
+ public String getModelInvariantId() {
+ return modelInvariantId;
}
- @JsonProperty("rb-name")
- public void setRbName(String rbName) {
- this.rbName = rbName;
+ public void setModelInvariantId(String modelInvariantId) {
+ this.modelInvariantId = modelInvariantId;
}
- @JsonProperty("rb-version")
- public String getRbVersion() {
- return rbVersion;
+ public String getModelVersionId() {
+ return modelVersionId;
}
- @JsonProperty("rb-version")
- public void setRbVersion(String rbVersion) {
- this.rbVersion = rbVersion;
+ public void setModelVersionId(String modelVersionId) {
+ this.modelVersionId = modelVersionId;
+ }
+
+ public String getModelCustomizationId() {
+ return modelCustomizationId;
+ }
+
+ public void setModelCustomizationId(String modelCustomizationId) {
+ this.modelCustomizationId = modelCustomizationId;
}
- @JsonProperty("profile-name")
public String getProfileName() {
return profileName;
}
- @JsonProperty("profile-name")
public void setProfileName(String profileName) {
this.profileName = profileName;
}
- @JsonProperty("release-name")
+ public Boolean getStatusCheck() {
+ return statusCheck;
+ }
+
+ public void setStatusCheck(Boolean statusCheck) {
+ this.statusCheck = statusCheck;
+ }
+
public String getReleaseName() {
return releaseName;
}
- @JsonProperty("release-name")
public void setReleaseName(String releaseName) {
this.releaseName = releaseName;
}
- @JsonProperty("cloud-region")
public String getCloudRegion() {
return cloudRegion;
}
- @JsonProperty("cloud-region")
public void setCloudRegion(String cloudRegion) {
this.cloudRegion = cloudRegion;
}
- @JsonProperty("labels")
public Map<String, String> getLabels() {
return labels;
}
- @JsonProperty("labels")
public void setLabels(Map<String, String> labels) {
this.labels = labels;
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelTest.java
index fb15ffa2b3..f22932b988 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelTest.java
@@ -25,7 +25,9 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
@@ -37,6 +39,8 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.infrastructure.service.level.impl.ServiceLevelConstants;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.db.catalog.beans.Workflow;
+import org.onap.so.db.catalog.client.CatalogDbClient;
@RunWith(MockitoJUnitRunner.class)
public class ServiceLevelTest {
@@ -44,11 +48,15 @@ public class ServiceLevelTest {
private static final String EXECUTION_KEY_PNF_NAME_LIST = "pnfNameList";
private static final String EXECUTION_KEY_PNF_COUNTER = "pnfCounter";
private static final String PARAM_NAME = "param1";
- private static final String SCOPE = "scope1";
private static final String PNF_NAME = "pnfName1";
+ private static final String OPERATION_NAME = ServiceLevelConstants.HEALTH_CHECK_OPERATION;
+ private static final String SCOPE = ServiceLevelConstants.PNF;
+ private static final String WORKFLOW_NAME = "workflowTestName";
@Mock
private ExceptionBuilder exceptionBuilderMock;
+ @Mock
+ private CatalogDbClient catalogDbClientMock;
@InjectMocks
private ServiceLevel testedObject;
@@ -60,6 +68,31 @@ public class ServiceLevelTest {
}
@Test
+ public void fetchWorkflowUsingScope_catalogDBReturnsEmpty() {
+ // given
+ when(catalogDbClientMock.findWorkflowByOperationName(OPERATION_NAME)).thenReturn(Collections.emptyList());
+ // when
+ String workflowResult = testedObject.fetchWorkflowUsingScope(SCOPE, OPERATION_NAME);
+ // then
+ assertThat(workflowResult).isEqualTo("GenericPnfHealthCheck");
+ }
+
+ @Test
+ public void fetchWorkflowUsingScope_catalogDBReturnsNotEmpty() {
+ // given
+ Workflow workflow = new Workflow();
+ workflow.setResourceTarget(SCOPE);
+ workflow.setName(WORKFLOW_NAME);
+ List<Workflow> workflowList = new ArrayList<>();
+ workflowList.add(workflow);
+ when(catalogDbClientMock.findWorkflowByOperationName(OPERATION_NAME)).thenReturn(workflowList);
+ // when
+ String workflowResult = testedObject.fetchWorkflowUsingScope(SCOPE, OPERATION_NAME);
+ // then
+ assertThat(workflowResult).isEqualTo(WORKFLOW_NAME);
+ }
+
+ @Test
public void pnfCounterExecution_success() {
// given
execution.setVariable(EXECUTION_KEY_PNF_NAME_LIST, createPnfNameList());
diff --git a/so-sdn-clients/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java b/so-sdn-clients/src/test/java/org/onap/so/client/sdnc/SdnCommonTasksTest.java
index a8816e1b04..fa3bf1d16c 100644
--- a/so-sdn-clients/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java
+++ b/so-sdn-clients/src/test/java/org/onap/so/client/sdnc/SdnCommonTasksTest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Copyright (C) 2021 - 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
@@ -18,8 +20,9 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdn.common;
+package org.onap.so.client.sdnc;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import java.util.LinkedHashMap;
@@ -29,7 +32,6 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
-import org.onap.so.client.sdnc.SdnCommonTasks;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
@@ -101,4 +103,31 @@ public class SdnCommonTasksTest {
sdnCommonTasks.validateSDNResponse(responseMap);
}
+ @Test
+ public void validateSDNResponse_emptyWhenNoSerializerFoundForValue() throws Exception {
+ LinkedHashMap<String, Object> output = new LinkedHashMap<>();
+ output.put("key1", new Object());
+ String result = sdnCommonTasks.validateSDNResponse(output);
+ assertThat(result).isEmpty();
+ }
+
+ @Test
+ public void validateSDNGetResponse_success() throws Exception {
+ LinkedHashMap<String, Object> output = new LinkedHashMap<>();
+ output.put("key1", "value1");
+ String result = sdnCommonTasks.validateSDNGetResponse(output);
+ assertThat(result).isEqualTo("{\"key1\":\"value1\"}");
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void validateSDNGetResponse_exWhenNoSerializerFoundForValue() throws Exception {
+ LinkedHashMap<String, Object> output = new LinkedHashMap<>();
+ output.put("key1", new Object());
+ sdnCommonTasks.validateSDNGetResponse(output);
+ }
+
+ @Test(expected = BadResponseException.class)
+ public void validateSDNGetResponse_exWhenMapEmpty() throws Exception {
+ sdnCommonTasks.validateSDNGetResponse(new LinkedHashMap<>());
+ }
}