summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrittany Plummer (bp896r) <bp896r@att.com>2018-08-28 15:58:07 -0400
committerBrittany Plummer (bp896r) <bp896r@att.com>2018-08-28 15:58:07 -0400
commit3cea07cfa59720df58e85f25081a5e8ff8d004cf (patch)
treedab1b8d87da6c02642abf29f758391029ca421b9
parenteb94991c543a1d9cf3c9b6c4dfca921dedf48da5 (diff)
Added GenericVnfHealthCheckBB, tasks, and tests
Issue-ID: SO-777 Change-Id: I8a46f1802feb18ab4df098472fef5373ac42208b Signed-off-by: Brittany Plummer (bp896r) <bp896r@att.com>
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java3
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/GenericVnfHealthCheckBB.bpmn56
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java4
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java41
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java103
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java101
8 files changed, 314 insertions, 1 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
index 9feee14640..8fae2816b2 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/appc/ApplicationControllerAction.java
@@ -31,12 +31,13 @@ import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.client.appc.ApplicationControllerSupport.StatusCategory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-
+@Component
public class ApplicationControllerAction {
protected ApplicationControllerOrchestrator client = new ApplicationControllerOrchestrator();
private String errorCode = "1002";
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/GenericVnfHealthCheckBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/GenericVnfHealthCheckBB.bpmn
new file mode 100644
index 0000000000..d7828c5163
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/GenericVnfHealthCheckBB.bpmn
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_0ky0lyw" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.16.2">
+ <bpmn:process id="GenericVnfHealthCheckBB" name="GenericVnfHealthCheckBB" isExecutable="true">
+ <bpmn:startEvent id="Start_GenericVnfHealthChkBB" name="Start">
+ <bpmn:outgoing>SequenceFlow_06ab7wm</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:serviceTask id="SetParamsHealthCheck" name="Set Params HealthCheck" camunda:expression="${GenericVnfHealthCheck.setParamsForGenericVnfHealthCheck(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_06ab7wm</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1yhmh9s</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_06ab7wm" sourceRef="Start_GenericVnfHealthChkBB" targetRef="SetParamsHealthCheck" />
+ <bpmn:endEvent id="End_GenericVnfHealthChkBB" name="End">
+ <bpmn:incoming>SequenceFlow_12srn62</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1yhmh9s" sourceRef="SetParamsHealthCheck" targetRef="Call-AppC-HealthCheck" />
+ <bpmn:sequenceFlow id="SequenceFlow_12srn62" sourceRef="Call-AppC-HealthCheck" targetRef="End_GenericVnfHealthChkBB" />
+ <bpmn:serviceTask id="Call-AppC-HealthCheck" name="Call APP-C For&#10;HealthCheck&#10;" camunda:expression="${GenericVnfHealthCheck.callAppcClient(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_1yhmh9s</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_12srn62</bpmn:outgoing>
+ </bpmn:serviceTask>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericVnfHealthCheckBB">
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_GenericVnfHealthChkBB">
+ <dc:Bounds x="173" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="179" y="145" width="25" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1juzqvs_di" bpmnElement="SetParamsHealthCheck">
+ <dc:Bounds x="261" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_06ab7wm_di" bpmnElement="SequenceFlow_06ab7wm">
+ <di:waypoint x="209" y="120" />
+ <di:waypoint x="261" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_07e01q3_di" bpmnElement="End_GenericVnfHealthChkBB">
+ <dc:Bounds x="554" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="562" y="145" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1yhmh9s_di" bpmnElement="SequenceFlow_1yhmh9s">
+ <di:waypoint x="361" y="120" />
+ <di:waypoint x="413" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_12srn62_di" bpmnElement="SequenceFlow_12srn62">
+ <di:waypoint x="513" y="120" />
+ <di:waypoint x="554" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0d1v1dn_di" bpmnElement="Call-AppC-HealthCheck">
+ <dc:Bounds x="413" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions> \ No newline at end of file
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java
index f6d81ba771..21b6dd402b 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/BaseBPMNTest.java
@@ -51,6 +51,7 @@ import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils;
import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignVnf;
import org.onap.so.bpmn.infrastructure.flowspecific.tasks.CreateNetwork;
import org.onap.so.bpmn.infrastructure.flowspecific.tasks.CreateNetworkCollection;
+import org.onap.so.bpmn.infrastructure.flowspecific.tasks.GenericVnfHealthCheck;
import org.onap.so.bpmn.infrastructure.flowspecific.tasks.UnassignNetworkBB;
import org.onap.so.bpmn.infrastructure.flowspecific.tasks.UnassignVnf;
import org.onap.so.bpmn.infrastructure.sdnc.tasks.SDNCActivateTasks;
@@ -182,6 +183,9 @@ public abstract class BaseBPMNTest {
@MockBean
protected WorkflowActionBBTasks workflowActionBBTasks;
+ @MockBean
+ protected GenericVnfHealthCheck genericVnfHealthCheck;
+
@LocalServerPort
private int port;
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java
new file mode 100644
index 0000000000..1c882e85d1
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java
@@ -0,0 +1,41 @@
+package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
+
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doThrow;
+
+import java.io.IOException;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseBPMNTest;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+
+
+
+public class GenericVnfHealthCheckBBTest extends BaseBPMNTest {
+
+ @Test
+ public void sunnyDayGenericVnfHealthCheckBBTest() throws InterruptedException, IOException {
+
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericVnfHealthCheckBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted().hasPassedInOrder("Start_GenericVnfHealthChkBB", "SetParamsHealthCheck",
+ "Call-AppC-HealthCheck", "End_GenericVnfHealthChkBB");
+ assertThat(pi).isEnded();
+ }
+
+ @Test
+ public void genericVnfHealthCheckBBExceptionTest() throws Exception {
+ doThrow(new BpmnError("7000", "TESTING ERRORS")).when(genericVnfHealthCheck).setParamsForGenericVnfHealthCheck(any(BuildingBlockExecution.class));
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("GenericVnfHealthCheckBB", variables);
+ assertThat(pi).isNotNull();
+ assertThat(pi).isStarted()
+ .hasPassedInOrder("Start_GenericVnfHealthChkBB", "SetParamsHealthCheck")
+ .hasNotPassed("Call-AppC-HealthCheck", "End_GenericVnfHealthChkBB");
+ assertThat(pi).isEnded();
+ }
+}
+
+
diff --git a/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml b/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml
index d7bb084195..2d102afe9f 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml
+++ b/bpmn/so-bpmn-building-blocks/src/test/resources/application-test.yaml
@@ -67,6 +67,9 @@ mso:
workflow:
message:
endpoint: http://localhost:28090/workflows/messages/message
+ requestDb:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ endpoint: http://localhost:8081
async:
core-pool-size: 50
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
new file mode 100644
index 0000000000..772def739b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheck.java
@@ -0,0 +1,103 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import java.util.HashMap;
+import java.util.Optional;
+
+import org.onap.appc.client.lcm.model.Action;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+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.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class GenericVnfHealthCheck {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenericVnfHealthCheck.class);
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+ @Autowired
+ private ExtractPojosForBB extractPojosForBB;
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+ @Autowired
+ private ApplicationControllerAction appCClient;
+
+ public void setParamsForGenericVnfHealthCheck(BuildingBlockExecution execution) {
+
+ GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+
+ try {
+ ControllerSelectionReference controllerSelectionReference;
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ String vnfId = vnf.getVnfId();
+ String vnfName = vnf.getVnfName();
+ String vnfType = vnf.getVnfType();
+ String oamIpAddress = vnf.getIpv4OamAddress();
+ String actionCategory = Action.HealthCheck.toString();
+ controllerSelectionReference = catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, actionCategory);
+ String controllerName = controllerSelectionReference.getControllerName();
+
+ execution.setVariable("vnfId", vnfId);
+ execution.setVariable("vnfName", vnfName);
+ execution.setVariable("oamIpAddress", oamIpAddress);
+ execution.setVariable("msoRequestId", gBBInput.getRequestContext().getMsoRequestId());
+ execution.setVariable("action", actionCategory);
+ execution.setVariable("controllerType", controllerName);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void callAppcClient(BuildingBlockExecution execution) {
+
+ try {
+ Action action = null;
+ action = Action.valueOf(execution.getVariable("action"));
+ String msoRequestId = execution.getVariable("msoRequestId");
+ String vnfId = execution.getVariable("vnfId");
+ Optional<String> payload = null;
+ if(execution.getVariable("payload") != null){
+ String pay = execution.getVariable("payload");
+ payload = Optional.of(pay);
+ }
+ String controllerType = execution.getVariable("controllerType");
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", execution.getVariable("vnfName"));
+ payloadInfo.put("vfModuleId",execution.getVariable("vfModuleId"));
+ payloadInfo.put("oamIpAddress",execution.getVariable("oamIpAddress"));
+ //PayloadInfo contains extra information that adds on to payload before making request to appc
+ appCClient.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType);
+
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
index 87852e9922..3fce15a6c4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
@@ -27,6 +27,7 @@ import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper;
+import org.onap.so.client.appc.ApplicationControllerAction;
import org.onap.so.client.db.request.RequestsDbClient;
import org.onap.so.client.orchestration.AAICollectionResources;
import org.onap.so.client.orchestration.AAIInstanceGroupResources;
@@ -120,4 +121,7 @@ public abstract class BaseTaskTest extends TestDataSetup {
@SpyBean
protected SDNCClient SPY_sdncClient;
+
+ @MockBean
+ protected ApplicationControllerAction appCClient;
}
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
new file mode 100644
index 0000000000..3aaf15cf11
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericVnfHealthCheckTest.java
@@ -0,0 +1,101 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.util.HashMap;
+import java.util.Optional;
+import java.util.UUID;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.appc.client.lcm.model.Action;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.db.catalog.beans.ControllerSelectionReference;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class GenericVnfHealthCheckTest extends BaseTaskTest {
+
+ @Autowired
+ private GenericVnfHealthCheck genericVnfHealthCheck;
+
+ private GenericVnf genericVnf;
+ private RequestContext requestContext;
+ private String msoRequestId;
+
+ @Before
+ public void before() {
+ genericVnf = setGenericVnf();
+ msoRequestId = UUID.randomUUID().toString();
+ requestContext = setRequestContext();
+ requestContext.setMsoRequestId(msoRequestId);
+ gBBInput.setRequestContext(requestContext);
+ }
+
+ @Test
+ public void setParamsForGenericVnfHealthCheckTest() throws Exception {
+ ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference();
+ controllerSelectionReference.setControllerName("testName");
+ controllerSelectionReference.setActionCategory("testAction");
+ controllerSelectionReference.setVnfType("testVnfType");
+
+ doReturn(controllerSelectionReference).when(catalogDbClient).getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(), Action.HealthCheck.toString());
+
+ genericVnfHealthCheck.setParamsForGenericVnfHealthCheck(execution);
+
+ assertEquals(genericVnf.getVnfId(), execution.getVariable("vnfId"));
+ assertEquals(genericVnf.getVnfName(), execution.getVariable("vnfName"));
+ assertEquals(genericVnf.getIpv4OamAddress(), execution.getVariable("oamIpAddress"));
+ assertEquals("HealthCheck", execution.getVariable("action"));
+ assertEquals(requestContext.getMsoRequestId(), execution.getVariable("msoRequestId"));
+ assertEquals(controllerSelectionReference.getControllerName(), execution.getVariable("controllerType"));
+ }
+ @Test
+ public void callAppcClientTest() throws Exception {
+ Action action = Action.HealthCheck;
+ String vnfId = genericVnf.getVnfId();
+ String payload = "{\"testName\":\"testValue\",}";
+ String controllerType = "testType";
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", "testVnfName");
+ payloadInfo.put("vfModuleId", "testVfModuleId");
+ payloadInfo.put("oamIpAddress", "testOamIpAddress");
+ execution.setVariable("action", Action.HealthCheck.toString());
+ execution.setVariable("msoRequestId", msoRequestId);
+ execution.setVariable("controllerType", controllerType);
+ execution.setVariable("vnfId", "testVnfId1");
+ execution.setVariable("vnfName", "testVnfName");
+ execution.setVariable("vfModuleId", "testVfModuleId");
+ execution.setVariable("oamIpAddress", "testOamIpAddress");
+ execution.setVariable("payload", payload);
+
+ doNothing().when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
+
+ genericVnfHealthCheck.callAppcClient(execution);
+ verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
+ }
+}