aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/pom.xml5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java17
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java2
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java20
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn47
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java23
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java65
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java54
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResources.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java22
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientLogResponseTest.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java59
28 files changed, 375 insertions, 124 deletions
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml
index c993071969..83714ed022 100644
--- a/bpmn/MSOCommonBPMN/pom.xml
+++ b/bpmn/MSOCommonBPMN/pom.xml
@@ -15,7 +15,6 @@
<properties>
<camunda.version>7.8.0</camunda.version>
<httpclient.version>4.5.5</httpclient.version>
- <jackson.version>1.1.1</jackson.version>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
@@ -312,10 +311,6 @@
</dependency>
<dependency>
- <groupId>com.fasterxml.jackson.jaxrs</groupId>
- <artifactId>jackson-jaxrs-base</artifactId>
- </dependency>
- <dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
</dependency>
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java
index ca1acc5963..47e36424dd 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/PayloadClient.java
@@ -85,12 +85,9 @@ public class PayloadClient {
public static Optional<String> healthCheckFormat(String vnfName, String vnfHostIpAddress) throws JsonProcessingException{
HealthCheckAction payloadResult = new HealthCheckAction();
RequestParametersHealthCheck requestParams = new RequestParametersHealthCheck();
- ConfigurationParametersHealthCheck configParams = new ConfigurationParametersHealthCheck();
- requestParams.setVnfName(vnfName);
- configParams.setVnfName(vnfName);
- payloadResult.setConfigurationParameters(configParams);
+ requestParams.setVnfHostIpAddress(vnfHostIpAddress);
payloadResult.setRequestParameters(requestParams);
- return Optional.of(mapper.writeValueAsString(payloadResult));
+ return Optional.of((mapper.writeValueAsString(payloadResult)).replaceAll("\"", "\\\\\""));
}
public static Optional<String> snapshotFormat(String vmId, String identityUrl)throws JsonProcessingException{
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java
index ca87ad6d15..053ac5e741 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/appc/payload/beans/RequestParametersHealthCheck.java
@@ -32,16 +32,27 @@ public class RequestParametersHealthCheck {
@JsonProperty("vnf-name")
private String vnfName;
-
+@JsonProperty("vnf-host-ip-address")
+private String vnfHostIpAddress;
@JsonProperty("vnf-name")
public String getVnfName() {
-return vnfName;
+ return vnfName;
}
@JsonProperty("vnf-name")
public void setVnfName(String vnfName) {
-this.vnfName = vnfName;
+ this.vnfName = vnfName;
+}
+
+@JsonProperty("vnf-host-ip-address")
+public void setVnfHostIpAddress(String vnfHostIpAddress) {
+ this.vnfHostIpAddress = vnfHostIpAddress;
+}
+
+@JsonProperty("vnf-host-ip-address")
+public String getVnfHostIpAddress() {
+ return vnfHostIpAddress;
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
index fe6b0f8b4e..bb2ad9507f 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
@@ -55,9 +55,9 @@ import com.google.gson.reflect.TypeToken;
public class ResourceRequestBuilder {
- public static String CUSTOMIZATION_UUID = "customizationUUID";
+ private static String CUSTOMIZATION_UUID = "customizationUUID";
- public static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar";
+ private static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar";
private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ResourceRequestBuilder.class);
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index fc48996b9b..6d5fb2f825 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -927,7 +927,9 @@ public class BBInputSetup implements JavaDelegate {
if(collectionNetworkResourceCust != null) {
if((bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString())
|| bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) {
- serviceInstance.getNetworks().add(createNetwork(lookupKeyMap, null, networkId, null));
+ L3Network network = createNetwork(lookupKeyMap, null, networkId, null);
+ serviceInstance.getNetworks().add(network);
+ return network;
} else {
for (L3Network network : serviceInstance.getNetworks()) {
if (network.getNetworkId().equalsIgnoreCase(networkId)) {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java
index 80b978e4fd..a08d8ca25d 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/appc/payload/PayloadClientTest.java
@@ -66,7 +66,7 @@ public class PayloadClientTest {
@Test
public void healthCheckFormatTest() throws Exception {
- String payloadResult = "{\"request-parameters\":{\"vnf-name\":\"vnfName1\"},\"configuration-parameters\":{\"vnf_name\":\"vnfName1\"}}";
+ String payloadResult = "{\\\"request-parameters\\\":{\\\"vnf-host-ip-address\\\":\\\"vnfHostIpAddress1\\\"}}";
Optional<String> payloadClient = PayloadClient.healthCheckFormat("vnfName1", "vnfHostIpAddress1");
assertEquals(payloadResult, payloadClient.get());
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
index 9dadb8b623..041afe398b 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
@@ -141,7 +141,8 @@ public abstract class WorkflowTest {
*/
protected static final String JSON = "application/json; charset=UTF-8";
-
+ private static final int timeout = 2000;
+
/**
* Constructor.
*/
@@ -580,10 +581,27 @@ public abstract class WorkflowTest {
* reserve, assign, delete:ERR
* </pre>
* Errors are handled with junit assertions and will cause the test to fail.
+ * Uses the static/default timeout value for backward compatibility.
* @param callbacks an object containing callback data for the program
* @param program the program to execute
*/
protected void injectSDNCCallbacks(CallbackSet callbacks, String program) {
+ injectSDNCCallbacks(callbacks, program, timeout);
+ }
+
+ /**
+ * Runs a program to inject SDNC callback data into the test environment.
+ * A program is essentially just a list of keys that identify callback data
+ * to be injected, in sequence. An example program:
+ * <pre>
+ * reserve, assign, delete:ERR
+ * </pre>
+ * Errors are handled with junit assertions and will cause the test to fail.
+ * @param callbacks an object containing callback data for the program
+ * @param program the program to execute
+ * @param timeout a timeout value to wait for the callback
+ */
+ protected void injectSDNCCallbacks(CallbackSet callbacks, String program, int timeout) {
String[] cmds = program.replaceAll("\\s+", "").split(",");
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn
index 6fd7773714..97ac11373e 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVolumeGroupBB.bpmn
@@ -1,5 +1,5 @@
<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3">
+<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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0">
<bpmn:process id="DeleteVolumeGroupBB" name="DeleteVolumeGroupBB" isExecutable="true">
<bpmn:startEvent id="DeleteVolumeGroupBB_Start" name="Start">
<bpmn:outgoing>SequenceFlow_1wz1rfg</bpmn:outgoing>
@@ -9,15 +9,30 @@
<bpmn:incoming>SequenceFlow_0mh0v9h</bpmn:incoming>
</bpmn:endEvent>
<bpmn:serviceTask id="UpdateVolumeGroupAAI" name="Update Volume Group A&#38;AI (AAI Assigned)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedVolumeGroup(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_13ngwev</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0fkan8t</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0mh0v9h</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0mh0v9h" sourceRef="UpdateVolumeGroupAAI" targetRef="DeleteVolumeGroupBB_End" />
- <bpmn:sequenceFlow id="SequenceFlow_13ngwev" sourceRef="DeleteVolumeGroupVnfAdapter" targetRef="UpdateVolumeGroupAAI" />
+ <bpmn:sequenceFlow id="SequenceFlow_13ngwev" sourceRef="DeleteVolumeGroupVnfAdapter" targetRef="VnfAdapter" />
<bpmn:serviceTask id="DeleteVolumeGroupVnfAdapter" name="Delete Volume Group Vnf Adapter (AIC Delete)" camunda:expression="${VnfAdapterDeleteTasks.deleteVolumeGroup(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_1wz1rfg</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_13ngwev</bpmn:outgoing>
</bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0fkan8t" sourceRef="VnfAdapter" targetRef="UpdateVolumeGroupAAI" />
+ <bpmn:callActivity id="VnfAdapter" name="Vnf Adapter" calledElement="VnfAdapter">
+ <bpmn:extensionElements>
+ <camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
+ <camunda:inputOutput>
+ <camunda:outputParameter name="Output_3bec9ju" />
+ </camunda:inputOutput>
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="heatStackId" target="heatStackId" />
+ <camunda:in source="deleteVolumeGroupRequest" target="deleteVolumeGroupRequest" />
+ <camunda:in source="VNFREST_Request" target="VNFREST_Request" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_13ngwev</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0fkan8t</bpmn:outgoing>
+ </bpmn:callActivity>
</bpmn:process>
<bpmn:error id="Error_0pz4sdi" name="gDelegateError" errorCode="7000" />
<bpmn:escalation id="Escalation_1hjulni" name="Escalation_2cgup2p" />
@@ -37,31 +52,41 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_1k6463v_di" bpmnElement="DeleteVolumeGroupBB_End">
- <dc:Bounds x="684" y="102" width="36" height="36" />
+ <dc:Bounds x="824" y="102" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="657" y="142" width="90" height="12" />
+ <dc:Bounds x="842" y="142" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0rytcj0_di" bpmnElement="UpdateVolumeGroupAAI">
- <dc:Bounds x="525" y="80" width="100" height="80" />
+ <dc:Bounds x="665" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0mh0v9h_di" bpmnElement="SequenceFlow_0mh0v9h">
- <di:waypoint xsi:type="dc:Point" x="625" y="120" />
- <di:waypoint xsi:type="dc:Point" x="684" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="765" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="824" y="120" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="609.5" y="98.5" width="90" height="13" />
+ <dc:Bounds x="795" y="99" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_13ngwev_di" bpmnElement="SequenceFlow_13ngwev">
<di:waypoint xsi:type="dc:Point" x="488" y="120" />
- <di:waypoint xsi:type="dc:Point" x="525" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="526" y="120" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="506.5" y="99" width="0" height="12" />
+ <dc:Bounds x="507" y="105" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1nrp0hb_di" bpmnElement="DeleteVolumeGroupVnfAdapter">
<dc:Bounds x="388" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0fkan8t_di" bpmnElement="SequenceFlow_0fkan8t">
+ <di:waypoint xsi:type="dc:Point" x="626" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="665" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="646" y="105" width="0" height="0" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="CallActivity_0li7q97_di" bpmnElement="VnfAdapter">
+ <dc:Bounds x="526" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java
index d2f4db5d5c..b30ea41296 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/DeleteVolumeGroupBBTest.java
@@ -35,7 +35,7 @@ public class DeleteVolumeGroupBBTest extends BaseBPMNTest {
public void sunnyDayDeleteVolumeGroup_Test() throws InterruptedException {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVolumeGroupBB", variables);
assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", "UpdateVolumeGroupAAI", "DeleteVolumeGroupBB_End");
+ assertThat(pi).isStarted().hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", "VnfAdapter", "UpdateVolumeGroupAAI", "DeleteVolumeGroupBB_End");
assertThat(pi).isEnded();
}
@@ -45,7 +45,7 @@ public class DeleteVolumeGroupBBTest extends BaseBPMNTest {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("DeleteVolumeGroupBB", variables);
assertThat(pi).isNotNull();
assertThat(pi).isStarted()
- .hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", "UpdateVolumeGroupAAI")
+ .hasPassedInOrder("DeleteVolumeGroupBB_Start", "DeleteVolumeGroupVnfAdapter", "VnfAdapter", "UpdateVolumeGroupAAI")
.hasNotPassed("DeleteVolumeGroupBB_End");
assertThat(pi).isEnded();
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
index 3d8b2571aa..17dbe50cc5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -20,7 +20,6 @@
package org.onap.so.bpmn.infrastructure.scripts
-import org.codehaus.jackson.map.ObjectMapper
import org.onap.so.bpmn.infrastructure.properties.BPMNProperties
import java.util.ArrayList
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
index 353b4e32c5..70323b726c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
@@ -26,8 +26,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import javax.ws.rs.core.UriBuilder;
@@ -49,10 +48,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, PnfEventReadyDmaapClient.class);
- private static final String JSON_PATH_CORRELATION_ID = "$.pnfRegistrationFields.correlationId";
-
- @Autowired
- private Environment env;
+ private final Environment env;
private HttpClient httpClient;
private String dmaapHost;
private int dmaapPort;
@@ -63,10 +59,15 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
private String consumerGroup;
private Map<String, Runnable> pnfCorrelationIdToThreadMap;
private HttpGet getRequest;
- private ScheduledExecutorService executor;
private int dmaapClientDelayInSeconds;
+ private volatile ScheduledThreadPoolExecutor executor;
private volatile boolean dmaapThreadListenerIsRunning;
+ @Autowired
+ public PnfEventReadyDmaapClient(Environment env) {
+ this.env = env;
+ }
+
public void init() {
httpClient = HttpClientBuilder.create().build();
pnfCorrelationIdToThreadMap = new ConcurrentHashMap<>();
@@ -97,7 +98,9 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
private synchronized void startDmaapThreadListener() {
if (!dmaapThreadListenerIsRunning) {
- executor = Executors.newScheduledThreadPool(1);
+ executor = new ScheduledThreadPoolExecutor(1);
+ executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
+ executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
executor.scheduleWithFixedDelay(new DmaapTopicListenerThread(), 0,
dmaapClientDelayInSeconds, TimeUnit.SECONDS);
dmaapThreadListenerIsRunning = true;
@@ -106,7 +109,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
private synchronized void stopDmaapThreadListener() {
if (dmaapThreadListenerIsRunning) {
- executor.shutdownNow();
+ executor.shutdown();
dmaapThreadListenerIsRunning = false;
executor = null;
}
@@ -166,7 +169,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
return Collections.emptyList();
}
- private synchronized void informAboutPnfReadyIfCorrelationIdFound(String correlationId) {
+ private void informAboutPnfReadyIfCorrelationIdFound(String correlationId) {
Runnable runnable = unregister(correlationId);
if (runnable != null) {
LOGGER.debug("pnf ready event got from dmaap for correlationId: " + correlationId);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
index 08ac9b6948..9ae7ad9bdc 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
@@ -34,6 +34,7 @@ import java.lang.reflect.Field;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
@@ -82,16 +83,16 @@ public class PnfEventReadyDmaapClientTest {
private static final String CONSUMER_GROUP = "consumerGroupTest";
@Mock
private Environment env;
- @InjectMocks
- private PnfEventReadyDmaapClient testedObject = new PnfEventReadyDmaapClient();
-;
+ private PnfEventReadyDmaapClient testedObject;
+
private DmaapTopicListenerThread testedObjectInnerClassThread;
private HttpClient httpClientMock;
private Runnable threadMockToNotifyCamundaFlow;
- private ScheduledExecutorService executorMock;
+ private ScheduledThreadPoolExecutor executorMock;
@Before
public void init() throws NoSuchFieldException, IllegalAccessException {
+ testedObject = new PnfEventReadyDmaapClient(env);
when(env.getProperty(eq("pnf.dmaap.port"), eq(Integer.class))).thenReturn(PORT);
when(env.getProperty(eq("pnf.dmaap.host"))).thenReturn(HOST);
testedObject.setDmaapProtocol(PROTOCOL);
@@ -104,7 +105,7 @@ public class PnfEventReadyDmaapClientTest {
testedObjectInnerClassThread = testedObject.new DmaapTopicListenerThread();
httpClientMock = mock(HttpClient.class);
threadMockToNotifyCamundaFlow = mock(Runnable.class);
- executorMock = mock(ScheduledExecutorService.class);
+ executorMock = mock(ScheduledThreadPoolExecutor.class);
setPrivateField();
}
@@ -127,7 +128,7 @@ public class PnfEventReadyDmaapClientTest {
.hasPath(
"/" + URI_PATH_PREFIX + "/" + EVENT_TOPIC_TEST + "/" + CONSUMER_GROUP + "/" + CONSUMER_ID + "");
verify(threadMockToNotifyCamundaFlow).run();
- verify(executorMock).shutdownNow();
+ verify(executorMock).shutdown();
}
/**
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java
index 6ec9007cd0..48b4ebb982 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasks.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.adapter.vnf.tasks;
import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -57,7 +58,9 @@ public class VnfAdapterDeleteTasks {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
- vnfAdapterVolumeGroupResources.deleteVolumeGroup(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, volumeGroup);
+ DeleteVolumeGroupRequest deleteVolumeGroupRequest = vnfAdapterVolumeGroupResources.deleteVolumeGroupRequest(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, volumeGroup);
+ execution.setVariable(VNFREST_REQUEST, deleteVolumeGroupRequest.toXmlString());
+ execution.setVariable("deleteVolumeGroupRequest", "true");
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
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 772def739b..61162f4d85 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
@@ -67,6 +67,7 @@ public class GenericVnfHealthCheck {
execution.setVariable("vnfId", vnfId);
execution.setVariable("vnfName", vnfName);
execution.setVariable("oamIpAddress", oamIpAddress);
+ execution.setVariable("vnfHostIpAddress", oamIpAddress);
execution.setVariable("msoRequestId", gBBInput.getRequestContext().getMsoRequestId());
execution.setVariable("action", actionCategory);
execution.setVariable("controllerType", controllerName);
@@ -93,6 +94,7 @@ public class GenericVnfHealthCheck {
payloadInfo.put("vnfName", execution.getVariable("vnfName"));
payloadInfo.put("vfModuleId",execution.getVariable("vfModuleId"));
payloadInfo.put("oamIpAddress",execution.getVariable("oamIpAddress"));
+ payloadInfo.put("vnfHostIpAddress",execution.getVariable("vnfHostIpAddress"));
//PayloadInfo contains extra information that adds on to payload before making request to appc
appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java
index 6fcad95144..03559afb33 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/Resource.java
@@ -27,6 +27,9 @@ public class Resource {
private boolean generated;
private boolean baseVfModule;
private String virtualLinkKey;
+ private String vnfCustomizationId;
+ private String vfModuleCustomizationId;
+ private String cvnfModuleCustomizationId;
public Resource(WorkflowType resourceType, String resourceId, boolean generated){
this.resourceId = resourceId;
@@ -64,4 +67,22 @@ public class Resource {
public void setVirtualLinkKey(String virtualLinkKey) {
this.virtualLinkKey = virtualLinkKey;
}
+ public String getVnfCustomizationId() {
+ return vnfCustomizationId;
+ }
+ public void setVnfCustomizationId(String vnfCustomizationId) {
+ this.vnfCustomizationId = vnfCustomizationId;
+ }
+ public String getVfModuleCustomizationId() {
+ return vfModuleCustomizationId;
+ }
+ public void setVfModuleCustomizationId(String vfModuleCustomizationId) {
+ this.vfModuleCustomizationId = vfModuleCustomizationId;
+ }
+ public String getCvnfModuleCustomizationId() {
+ return cvnfModuleCustomizationId;
+ }
+ public void setCvnfModuleCustomizationId(String cvnfModuleCustomizationId) {
+ this.cvnfModuleCustomizationId = cvnfModuleCustomizationId;
+ }
}
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 57d097e87a..a998f6934f 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
@@ -43,6 +43,7 @@ import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
@@ -167,9 +168,10 @@ public class WorkflowAction {
} else {
key = modelInfo.getModelCustomizationId();
}
+ Resource resourceKey = new Resource(resourceType, key, aLaCarte);
for (OrchestrationFlow orchFlow : orchFlows) {
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, key, apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null);
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false);
flowsToExecute.add(ebb);
}
} else {
@@ -564,7 +566,10 @@ public class WorkflowAction {
if(!vnfCustomizationUUID.equals("")&&!vfModuleCustomizationUUID.equals("")){
List<String> configs = traverseCatalogDbForConfiguration(vnfCustomizationUUID,vfModuleCustomizationUUID);
for(String config : configs){
- resourceCounter.add(new Resource(WorkflowType.CONFIGURATION,config,false));
+ Resource configResource = new Resource(WorkflowType.CONFIGURATION,config,false);
+ resource.setVnfCustomizationId(vnf.getModelInfo().getModelCustomizationId());
+ resource.setVfModuleCustomizationId(vfModule.getModelInfo().getModelCustomizationId());
+ resourceCounter.add(configResource);
}
}
}
@@ -722,6 +727,7 @@ public class WorkflowAction {
}
return generatedResourceId;
} catch (Exception ex) {
+ msoLogger.error(ex);
throw new IllegalStateException(
"WorkflowAction was unable to verify if the instance name already exist in AAI.");
}
@@ -820,69 +826,73 @@ public class WorkflowAction {
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.SERVICE == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
workflowResourceIds.setServiceInstanceId(resourceId);
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.SERVICE == x.getResourceType())
- .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ .collect(Collectors.toList()).get(i), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
}
} else if (orchFlow.getFlowName().contains(VNF)) {
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VNF == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VNF == x.getResourceType())
- .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ .collect(Collectors.toList()).get(i), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
}
} else if (orchFlow.getFlowName().contains(NETWORK)
&& !orchFlow.getFlowName().contains(NETWORKCOLLECTION)) {
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.NETWORK == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.NETWORK == x.getResourceType())
- .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ .collect(Collectors.toList()).get(i), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
}
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
Resource resource = resourceCounter.stream().filter(x -> WorkflowType.VIRTUAL_LINK == x.getResourceType())
.collect(Collectors.toList()).get(i);
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource.getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true, resource.getVirtualLinkKey()));
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, true, resource.getVirtualLinkKey(), false));
}
} else if (orchFlow.getFlowName().contains(VFMODULE)) {
List<Resource> vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream().filter(x -> WorkflowType.VFMODULE == x.getResourceType())
.collect(Collectors.toList()));
for (int i = 0; i < vfModuleResourcesSorted.size(); i++) {
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, vfModuleResourcesSorted.get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, vfModuleResourcesSorted.get(i), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
}
} else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) {
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.VOLUMEGROUP == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.VOLUMEGROUP == x.getResourceType())
- .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ .collect(Collectors.toList()).get(i), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
}
} else if (orchFlow.getFlowName().contains(NETWORKCOLLECTION)) {
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
- .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ .collect(Collectors.toList()).get(i), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
}
} else if (orchFlow.getFlowName().contains(CONFIGURATION)) {
for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.CONFIGURATION == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.CONFIGURATION == x.getResourceType())
- .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ .collect(Collectors.toList()).get(i), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, true));
}
}else {
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, "", apiVersion, resourceId,
- requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null, false));
}
}
return flowsToExecute;
}
- protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, String key,
+ protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, Resource resource,
String apiVersion, String resourceId, String requestAction, boolean aLaCarte, String vnfType,
- WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isVirtualLink, String virtualLinkKey) {
+ WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, boolean isVirtualLink, String virtualLinkKey, boolean isConfiguration) {
ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
BuildingBlock buildingBlock = new BuildingBlock();
buildingBlock.setBpmnFlowName(orchFlow.getFlowName());
buildingBlock.setMsoId(UUID.randomUUID().toString());
- buildingBlock.setKey(key);
+ if(resource == null){
+ buildingBlock.setKey("");
+ }else{
+ buildingBlock.setKey(resource.getResourceId());
+ }
buildingBlock.setIsVirtualLink(isVirtualLink);
buildingBlock.setVirtualLinkKey(virtualLinkKey);
executeBuildingBlock.setApiVersion(apiVersion);
@@ -894,6 +904,13 @@ public class WorkflowAction {
executeBuildingBlock.setRequestId(requestId);
executeBuildingBlock.setBuildingBlock(buildingBlock);
executeBuildingBlock.setRequestDetails(requestDetails);
+ if(isConfiguration){
+ ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
+ configurationResourceKeys.setCvnfcCustomizationUUID(resource.getCvnfModuleCustomizationId());
+ configurationResourceKeys.setVfModuleCustomizationUUID(resource.getVfModuleCustomizationId());
+ configurationResourceKeys.setVnfResourceCustomizationUUID(resource.getVnfCustomizationId());
+ executeBuildingBlock.setConfigurationResourceKeys(configurationResourceKeys);
+ }
return executeBuildingBlock;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
index 515f04b218..11a694140c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
@@ -506,33 +506,35 @@ public class VnfAdapterVfModuleObjectMapper {
String vmTypeKey = vnfcNetworkdata.getVnfcType();
GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcPorts vnfcPorts = vnfcNetworkdata.getVnfcPorts();
- List<GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcportsVnfcPort> vnfcPortList = vnfcPorts.getVnfcPort();
- if (vnfcPortList != null) {
- for(int portIdx = 0; portIdx < vnfcPortList.size(); portIdx++){
-
- GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcportsVnfcPort vnfcPort = vnfcPortList.get(portIdx);
- GenericResourceApiSubInterfaceNetworkData vnicSubInterfaces = vnfcPort.getVnicSubInterfaces();
-
- String vnicSubInterfacesString = convertToString(vnicSubInterfaces);
- String networkRoleKey = vnfcPort.getCommonSubInterfaceRole();
- String subInterfaceKey = createVnfcSubInterfaceKey(vmTypeKey, networkDataIdx, networkRoleKey, portIdx);
- String globalSubInterfaceKey = createGlobalVnfcSubInterfaceKey(vmTypeKey, networkRoleKey, portIdx);
+ if (vnfcPorts != null) {
+ List<GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcportsVnfcPort> vnfcPortList = vnfcPorts.getVnfcPort();
+ if (vnfcPortList != null) {
+ for(int portIdx = 0; portIdx < vnfcPortList.size(); portIdx++){
- buildVfModuleSubInterfacesCount(paramsMap, globalSubInterfaceKey, vnicSubInterfaces);
-
- buildVfModuleVlanTag(paramsMap, subInterfaceKey, vnicSubInterfacesString);
-
- buildVfModuleNetworkName(paramsMap, subInterfaceKey, vnicSubInterfacesString);
-
- buildVfModuleNetworkId(paramsMap, subInterfaceKey, vnicSubInterfacesString);
-
- buildVfModuleIpV4AddressHeatTemplate(paramsMap, subInterfaceKey, vnicSubInterfacesString);
-
- buildVfModuleIpV6AddressHeatTemplate(paramsMap, subInterfaceKey, vnicSubInterfacesString);
-
- buildVfModuleFloatingIpV4HeatTemplate(paramsMap, globalSubInterfaceKey, vnicSubInterfacesString);
-
- buildVfModuleFloatingIpV6HeatTemplate(paramsMap, globalSubInterfaceKey, vnicSubInterfacesString);
+ GenericResourceApiVnfcnetworkdataVnfcnetworkdataVnfcportsVnfcPort vnfcPort = vnfcPortList.get(portIdx);
+ GenericResourceApiSubInterfaceNetworkData vnicSubInterfaces = vnfcPort.getVnicSubInterfaces();
+
+ String vnicSubInterfacesString = convertToString(vnicSubInterfaces);
+ String networkRoleKey = vnfcPort.getCommonSubInterfaceRole();
+ String subInterfaceKey = createVnfcSubInterfaceKey(vmTypeKey, networkDataIdx, networkRoleKey, portIdx);
+ String globalSubInterfaceKey = createGlobalVnfcSubInterfaceKey(vmTypeKey, networkRoleKey, portIdx);
+
+ buildVfModuleSubInterfacesCount(paramsMap, globalSubInterfaceKey, vnicSubInterfaces);
+
+ buildVfModuleVlanTag(paramsMap, subInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleNetworkName(paramsMap, subInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleNetworkId(paramsMap, subInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleIpV4AddressHeatTemplate(paramsMap, subInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleIpV6AddressHeatTemplate(paramsMap, subInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleFloatingIpV4HeatTemplate(paramsMap, globalSubInterfaceKey, vnicSubInterfacesString);
+
+ buildVfModuleFloatingIpV6HeatTemplate(paramsMap, globalSubInterfaceKey, vnicSubInterfacesString);
+ }
}
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
index e9dc3742f5..e13a765cf2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
@@ -148,6 +148,18 @@ public class AAIConfigurationResources {
AAIResourceUri vpnBindingURI = AAIUriFactory.createResourceUri(AAIObjectType.VPN_BINDING, vpnId);
injectionHelper.getAaiClient().connect(configurationURI, vpnBindingURI);
}
+
+ public void connectConfigurationToVfModule(String configurationId, String vfModuleId, String vnfId){
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
+ injectionHelper.getAaiClient().connect(configurationURI, vfModuleURI);
+ }
+
+ public void connectConfigurationToVnfc(String configurationId, String vnfcName){
+ AAIResourceUri configurationURI = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
+ AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfcName);
+ injectionHelper.getAaiClient().connect(configurationURI, vnfcURI);
+ }
/**
* method to delete Configuration details in A&AI
*
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 8655104830..efbbeae737 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
@@ -22,7 +22,6 @@ package org.onap.so.client.orchestration;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
-import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -49,9 +48,7 @@ public class VnfAdapterVolumeGroupResources {
return vnfAdapterObjectMapper.createVolumeGroupRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, genericVnf, volumeGroup, sdncVfModuleQueryResponse);
}
- public DeleteVolumeGroupResponse deleteVolumeGroup(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws Exception {
- DeleteVolumeGroupRequest deleteVolumeGroupRequest = vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup);
- msoLogger.debug(deleteVolumeGroupRequest.toString());
- return vnfVolumeAdapterClient.deleteVNFVolumes(volumeGroup.getVolumeGroupId(), deleteVolumeGroupRequest);
+ public DeleteVolumeGroupRequest deleteVolumeGroupRequest(RequestContext requestContext, CloudRegion cloudRegion, ServiceInstance serviceInstance, VolumeGroup volumeGroup) throws Exception {
+ return vnfAdapterObjectMapper.deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
index 0061f50ba8..a4b40393a3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
@@ -21,6 +21,7 @@
package org.onap.so.client.sdnc;
import java.util.LinkedHashMap;
+import java.util.Optional;
import javax.ws.rs.core.UriBuilder;
@@ -35,6 +36,9 @@ import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
@Component
public class SDNCClient {
@@ -62,10 +66,25 @@ public class SDNCClient {
STOClient.setHttpHeader(httpHeader);
msoLogger.info("Running SDNC CLIENT for TargetUrl: " + targetUrl);
LinkedHashMap<?, ?> output = STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {});
+ Optional<String> sdncResponse = logSDNCResponse(output);
+ if(sdncResponse.isPresent()){
+ msoLogger.info(sdncResponse.get());
+ }
msoLogger.info("Validating output...");
return sdnCommonTasks.validateSDNResponse(output);
}
+ protected Optional<String> logSDNCResponse(LinkedHashMap<?, ?> output) {
+ ObjectMapper mapper = new ObjectMapper();
+ String sdncOutput = "";
+ try {
+ sdncOutput = mapper.writeValueAsString(output);
+ return Optional.of(sdncOutput);
+ } catch (JsonProcessingException e) {
+ msoLogger.debug("Failed to map response from sdnc to json string for logging purposes.");
+ }
+ return Optional.empty();
+ }
/**
*
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
index 53e7dc4536..84f056dc4d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
@@ -25,6 +25,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.*;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.springframework.stereotype.Component;
+import org.onap.so.client.exception.MapperException;
@Component
public class GeneralTopologyObjectMapper {
@@ -109,16 +110,21 @@ public class GeneralTopologyObjectMapper {
/*
* Build GenericResourceApiVfModuleinformationVfModuleInformation
*/
- public GenericResourceApiVfmoduleinformationVfModuleInformation buildVfModuleInformation(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance, boolean includeModelInformation){
+ public GenericResourceApiVfmoduleinformationVfModuleInformation buildVfModuleInformation(VfModule vfModule, GenericVnf vnf, ServiceInstance serviceInstance, boolean includeModelInformation) throws MapperException {
GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = new GenericResourceApiVfmoduleinformationVfModuleInformation();
if (includeModelInformation) {
- GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation();
- onapModelInformation.setModelInvariantUuid(vfModule.getModelInfoVfModule().getModelInvariantUUID());
- onapModelInformation.setModelName(vfModule.getModelInfoVfModule().getModelName());
- onapModelInformation.setModelVersion(vfModule.getModelInfoVfModule().getModelVersion());
- onapModelInformation.setModelUuid(vfModule.getModelInfoVfModule().getModelUUID());
- onapModelInformation.setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID());
- vfModuleInformation.setOnapModelInformation(onapModelInformation);
+ if (vfModule.getModelInfoVfModule() == null) {
+ throw new MapperException("VF Module model info is null for " + vfModule.getVfModuleId());
+ }
+ else {
+ GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation();
+ onapModelInformation.setModelInvariantUuid(vfModule.getModelInfoVfModule().getModelInvariantUUID());
+ onapModelInformation.setModelName(vfModule.getModelInfoVfModule().getModelName());
+ onapModelInformation.setModelVersion(vfModule.getModelInfoVfModule().getModelVersion());
+ onapModelInformation.setModelUuid(vfModule.getModelInfoVfModule().getModelUUID());
+ onapModelInformation.setModelCustomizationUuid(vfModule.getModelInfoVfModule().getModelCustomizationUUID());
+ vfModuleInformation.setOnapModelInformation(onapModelInformation);
+ }
}
if (vfModule.getModelInfoVfModule() != null) {
vfModuleInformation.setVfModuleType(vfModule.getModelInfoVfModule().getModelName());
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
index af670d13d5..7013a50dcf 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
@@ -30,6 +30,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.so.logger.MessageEnum;
@@ -58,7 +59,7 @@ public class VfModuleTopologyOperationRequestMapper {
public GenericResourceApiVfModuleOperationInformation reqMapper(SDNCSvcOperation svcOperation,
SDNCSvcAction svcAction, VfModule vfModule, VolumeGroup volumeGroup, GenericVnf vnf, ServiceInstance serviceInstance,
- Customer customer, CloudRegion cloudRegion, RequestContext requestContext, String sdncAssignResponse) {
+ Customer customer, CloudRegion cloudRegion, RequestContext requestContext, String sdncAssignResponse) throws MapperException {
GenericResourceApiVfModuleOperationInformation req = new GenericResourceApiVfModuleOperationInformation();
boolean includeModelInformation = false;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java
index 4ea11c235b..3ff9ce605e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterDeleteTasksTest.java
@@ -30,7 +30,7 @@ import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Test;
import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
-import org.onap.so.adapters.vnfrest.DeleteVolumeGroupResponse;
+import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -95,20 +95,22 @@ public class VnfAdapterDeleteTasksTest extends BaseTaskTest{
@Test
public void test_deleteVolumeGroup() throws Exception {
- DeleteVolumeGroupResponse deleteVolumeGroupResponse = new DeleteVolumeGroupResponse();
+ DeleteVolumeGroupRequest deleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
+ deleteVolumeGroupRequest.setVolumeGroupId("volumeGroupId");
- doReturn(deleteVolumeGroupResponse).when(vnfAdapterVolumeGroupResources).deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup);
+ doReturn(deleteVolumeGroupRequest).when(vnfAdapterVolumeGroupResources).deleteVolumeGroupRequest(requestContext, cloudRegion, serviceInstance, volumeGroup);
vnfAdapterDeleteTasks.deleteVolumeGroup(execution);
- verify(vnfAdapterVolumeGroupResources, times(1)).deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup);
+ verify(vnfAdapterVolumeGroupResources, times(1)).deleteVolumeGroupRequest(requestContext, cloudRegion, serviceInstance, volumeGroup);
+ assertEquals(execution.getVariable("VNFREST_Request"), deleteVolumeGroupRequest.toXmlString());
}
@Test
public void deleteVolumeGroupExceptionTest() throws Exception {
expectedException.expect(BpmnError.class);
- doThrow(Exception.class).when(vnfAdapterVolumeGroupResources).deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup);
+ doThrow(Exception.class).when(vnfAdapterVolumeGroupResources).deleteVolumeGroupRequest(requestContext, cloudRegion, serviceInstance, volumeGroup);
vnfAdapterDeleteTasks.deleteVolumeGroup(execution);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java
index 3aaf15cf11..9f0bb910e6 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java
@@ -84,6 +84,7 @@ public class GenericVnfHealthCheckTest extends BaseTaskTest {
payloadInfo.put("vnfName", "testVnfName");
payloadInfo.put("vfModuleId", "testVfModuleId");
payloadInfo.put("oamIpAddress", "testOamIpAddress");
+ payloadInfo.put("vnfHostIpAddress", "testOamIpAddress");
execution.setVariable("action", Action.HealthCheck.toString());
execution.setVariable("msoRequestId", msoRequestId);
execution.setVariable("controllerType", controllerType);
@@ -91,6 +92,7 @@ public class GenericVnfHealthCheckTest extends BaseTaskTest {
execution.setVariable("vnfName", "testVnfName");
execution.setVariable("vfModuleId", "testVfModuleId");
execution.setVariable("oamIpAddress", "testOamIpAddress");
+ execution.setVariable("vnfHostIpAddress", "testOamIpAddress");
execution.setVariable("payload", payload);
doNothing().when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
index 5948c66baa..3dc9a4da63 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
@@ -43,6 +43,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
@@ -63,6 +64,7 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{
private ServiceInstance serviceInstance;
private GenericVnf genericVnf;
private VpnBinding vpnBinding;
+ private VfModule vfModule;
@Mock
protected AAIResourcesClient MOCK_aaiResourcesClient;
@@ -82,6 +84,7 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{
serviceProxy = buildServiceProxy();
serviceInstance = buildServiceInstance();
genericVnf = buildGenericVnf();
+ vfModule = buildVfModule();
vpnBinding = buildVpnBinding();
doReturn(MOCK_aaiResourcesClient).when(MOCK_injectionHelper).getAaiClient();
}
@@ -126,6 +129,20 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{
aaiConfigurationResources.connectConfigurationToGenericVnf(configuration.getConfigurationId(), genericVnf.getVnfId());
verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
}
+
+ @Test
+ public void connectConfigurationToVfModuleTest() {
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ aaiConfigurationResources.connectConfigurationToVfModule(configuration.getConfigurationId(), vfModule.getVfModuleId(),genericVnf.getVnfId());
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
+
+ @Test
+ public void connectConfigurationToVnfcTest() {
+ doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
+ aaiConfigurationResources.connectConfigurationToVnfc(configuration.getConfigurationId(), "vnfcName");
+ verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
+ }
@Test
public void connectConfigurationToVpnBindingTest() {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java
index ee0e60c38a..d582253df1 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/VnfAdapterVolumeGroupResourcesTest.java
@@ -110,13 +110,10 @@ public class VnfAdapterVolumeGroupResourcesTest extends TestDataSetup {
DeleteVolumeGroupRequest deleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
doReturn(deleteVolumeGroupRequest).when(MOCK_vnfAdapterObjectMapper).deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup);
- DeleteVolumeGroupResponse expectedDeleteVolumeGroupResponse = new DeleteVolumeGroupResponse();
- doReturn(expectedDeleteVolumeGroupResponse).when(MOCK_vnfVolumeAdapterClient).deleteVNFVolumes(volumeGroup.getVolumeGroupId(), deleteVolumeGroupRequest);
+ DeleteVolumeGroupRequest expectedDeleteVolumeGroupRequest = new DeleteVolumeGroupRequest();
+ DeleteVolumeGroupRequest actualDeleteVolumeGroupRequest = vnfAdapterVolumeGroupResources.deleteVolumeGroupRequest(requestContext, cloudRegion, serviceInstance, volumeGroup);
- DeleteVolumeGroupResponse actualDeleteVolumeGroupResponse = vnfAdapterVolumeGroupResources.deleteVolumeGroup(requestContext, cloudRegion, serviceInstance, volumeGroup);
-
- verify(MOCK_vnfVolumeAdapterClient, times(1)).deleteVNFVolumes(volumeGroup.getVolumeGroupId(), deleteVolumeGroupRequest);
verify(MOCK_vnfAdapterObjectMapper, times(1)).deleteVolumeGroupRequestMapper(requestContext, cloudRegion, serviceInstance, volumeGroup);
- assertThat(expectedDeleteVolumeGroupResponse, Matchers.sameBeanAs(actualDeleteVolumeGroupResponse));
+ assertThat(expectedDeleteVolumeGroupRequest, Matchers.sameBeanAs(actualDeleteVolumeGroupRequest));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientLogResponseTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientLogResponseTest.java
new file mode 100644
index 0000000000..e28c465437
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientLogResponseTest.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.sdnc;
+
+import static org.junit.Assert.*;
+
+import java.util.LinkedHashMap;
+import java.util.Optional;
+
+import org.junit.Test;
+
+public class SDNCClientLogResponseTest {
+
+ private SDNCClient sdncClient = new SDNCClient();
+
+ @Test
+ public void logSDNCResponseTest() {
+ LinkedHashMap<String, String> output = new LinkedHashMap<>();
+ output.put("response-code", "404");
+ output.put("response-message", "not found");
+ Optional<String> response = sdncClient.logSDNCResponse(output);
+ assertEquals(true, response.isPresent());
+ assertEquals("{\"response-code\":\"404\",\"response-message\":\"not found\"}",response.get());
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
index b3999a788c..04397c499d 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
@@ -29,7 +29,9 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -41,6 +43,7 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
+import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
@@ -50,6 +53,10 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class VfModuleTopologyOperationRequestMapperTest {
private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
+ private final static String ERRORMESSAGE = "VF Module model info is null for testVfModuleId";
+
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
@Test
public void assignGenericResourceApiVfModuleInformationTest() throws Exception {
@@ -220,5 +227,57 @@ public class VfModuleTopologyOperationRequestMapperTest {
assertEquals("vnfModelCustomizationUuid", vfModuleSDNCrequest.getVnfInformation().getOnapModelInformation().getModelCustomizationUuid());
assertEquals("vfModuleModelCustomizationUuid", vfModuleSDNCrequest.getVfModuleInformation().getOnapModelInformation().getModelCustomizationUuid());
}
+
+ @Test
+ public void reqMapperNoModelInfoTest() throws Exception {
+
+ // prepare and set service instance
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelInvariantUuid("serviceModelInvariantUuid");
+ modelInfoServiceInstance.setModelName("serviceModelName");
+ modelInfoServiceInstance.setModelUuid("serviceModelUuid");
+ modelInfoServiceInstance.setModelVersion("serviceModelVersion");
+
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ // prepare Customer object
+ Customer customer = new Customer();
+ customer.setGlobalCustomerId("globalCustomerId");
+ customer.setServiceSubscription(new ServiceSubscription());
+ // set Customer on service instance
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ //
+ RequestContext requestContext = new RequestContext();
+ HashMap<String, String> userParams = new HashMap<String, String>();
+ userParams.put("key1", "value1");
+ requestContext.setUserParams(userParams);
+ requestContext.setProductFamilyId("productFamilyId");
+
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfId("testVnfId");
+ vnf.setVnfType("testVnfType");
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelInvariantUuid("vnfModelInvariantUuid");
+ modelInfoGenericVnf.setModelName("vnfModelName");
+ modelInfoGenericVnf.setModelVersion("vnfModelVersion");
+ modelInfoGenericVnf.setModelUuid("vnfModelUuid");
+ modelInfoGenericVnf.setModelCustomizationUuid("vnfModelCustomizationUuid");
+ vnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("testVfModuleId");
+ vfModule.setVfModuleName("testVfModuleName");
+ vfModule.setModelInfoVfModule(null);
+
+ CloudRegion cloudRegion = new CloudRegion();
+
+ VfModuleTopologyOperationRequestMapper mapper = new VfModuleTopologyOperationRequestMapper();
+ expectedException.expect(MapperException.class);
+ expectedException.expectMessage(ERRORMESSAGE);
+
+ mapper.reqMapper(SDNCSvcOperation.VF_MODULE_TOPOLOGY_OPERATION, SDNCSvcAction.ASSIGN, vfModule, null, vnf, serviceInstance, customer,
+ cloudRegion, requestContext, null);
+ }
}