Search in sources :

Example 6 with ControllerSelectionReference

use of org.onap.so.db.catalog.beans.ControllerSelectionReference in project so by onap.

the class AppcOrchestratorPreProcessorTest method mockReferenceResponse.

private void mockReferenceResponse() {
    ControllerSelectionReference reference = new ControllerSelectionReference();
    reference.setControllerName("TEST-CONTROLLER-NAME");
    when(catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(eq("TEST-VNF-TYPE"), eq(Action.Lock.toString()))).thenReturn(reference);
}
Also used : ControllerSelectionReference(org.onap.so.db.catalog.beans.ControllerSelectionReference)

Example 7 with ControllerSelectionReference

use of org.onap.so.db.catalog.beans.ControllerSelectionReference in project so by onap.

the class AppcRunTasksIT method runAppcCommandTest.

@Test
public void runAppcCommandTest() throws Exception {
    Action action = Action.QuiesceTraffic;
    ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference();
    controllerSelectionReference.setControllerName("testName");
    controllerSelectionReference.setActionCategory(action.toString());
    controllerSelectionReference.setVnfType("testVnfType");
    doReturn(controllerSelectionReference).when(catalogDbClient).getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(), Action.QuiesceTraffic.toString());
    execution.setVariable("aicIdentity", "testAicIdentity");
    String vnfId = genericVnf.getVnfId();
    genericVnf.setIpv4OamAddress("testOamIpAddress");
    String payload = "{\"testName\":\"testValue\",}";
    RequestParameters requestParameters = new RequestParameters();
    requestParameters.setPayload(payload);
    gBBInput.getRequestContext().setRequestParameters(requestParameters);
    String controllerType = "testName";
    HashMap<String, String> payloadInfo = new HashMap<String, String>();
    payloadInfo.put("vnfName", "testVnfName1");
    payloadInfo.put("aicIdentity", "testAicIdentity");
    payloadInfo.put("vnfHostIpAddress", "testOamIpAddress");
    payloadInfo.put("vserverIdList", null);
    payloadInfo.put("vfModuleId", null);
    payloadInfo.put("identityUrl", null);
    payloadInfo.put("vmIdList", null);
    doNothing().when(appCClient).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
    appcRunTasks.runAppcCommand(execution, action);
    verify(appCClient, times(1)).runAppCCommand(action, msoRequestId, vnfId, Optional.of(payload), payloadInfo, controllerType);
}
Also used : Action(org.onap.appc.client.lcm.model.Action) ControllerSelectionReference(org.onap.so.db.catalog.beans.ControllerSelectionReference) HashMap(java.util.HashMap) RequestParameters(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters) Test(org.junit.Test) BaseIntegrationTest(org.onap.so.BaseIntegrationTest)

Example 8 with ControllerSelectionReference

use of org.onap.so.db.catalog.beans.ControllerSelectionReference in project so by onap.

the class ControllerSelectionReferenceTest method Find_ControllerNameByVnfTypeAndAction_Test.

@Test
public void Find_ControllerNameByVnfTypeAndAction_Test() {
    String vnfType = "vLoadBalancerMS/vLoadBalancerMS 0";
    String controllerName = "APPC";
    String actionCategory = "ConfigScaleOut";
    ControllerSelectionReference controller = controllerSelectionReferenceRepository.findControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, actionCategory);
    assertEquals(vnfType, controller.getVnfType());
    assertEquals(controllerName, controller.getControllerName());
    assertEquals(actionCategory, controller.getActionCategory());
}
Also used : ControllerSelectionReference(org.onap.so.db.catalog.beans.ControllerSelectionReference) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) Test(org.junit.Test)

Example 9 with ControllerSelectionReference

use of org.onap.so.db.catalog.beans.ControllerSelectionReference in project so by onap.

the class GenericVnfHealthCheckTest method setParamsForGenericVnfHealthCheckTest.

@Test
public void setParamsForGenericVnfHealthCheckTest() {
    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"));
}
Also used : ControllerSelectionReference(org.onap.so.db.catalog.beans.ControllerSelectionReference) Test(org.junit.Test)

Example 10 with ControllerSelectionReference

use of org.onap.so.db.catalog.beans.ControllerSelectionReference in project so by onap.

the class ConfigurationScaleOutTest method setParamsForConfigurationScaleOutBadPathTest.

@Test
public void setParamsForConfigurationScaleOutBadPathTest() throws Exception {
    ControllerSelectionReference controllerSelectionReference = new ControllerSelectionReference();
    controllerSelectionReference.setControllerName("testName");
    controllerSelectionReference.setActionCategory("testAction");
    controllerSelectionReference.setVnfType("testVnfType");
    String sdncResponse = new String(Files.readAllBytes(Paths.get("src/test/resources/__files/SDNCClientResponseIncorrectPath.json")));
    String expectedPayload = "{\"request-parameters\":{\"vnf-host-ip-address\":\"10.222.22.2\"," + "\"vf-module-id\":\"testVfModuleId1\"},\"configuration-parameters\"" + ":{\"vnf-id\":\"66dac89b-2a5b-4cb9-b22e-a7e4488fb3db\",\"availability-zone\":null}}";
    execution.setVariable("SDNCQueryResponse_" + vfModule.getVfModuleId(), sdncResponse);
    doReturn(controllerSelectionReference).when(catalogDbClient).getControllerSelectionReferenceByVnfTypeAndActionCategory(genericVnf.getVnfType(), Action.ConfigScaleOut.toString());
    configurationScaleOut.setParamsForConfigurationScaleOut(execution);
    assertEquals(genericVnf.getVnfId(), execution.getVariable("vnfId"));
    assertEquals(genericVnf.getVnfName(), execution.getVariable("vnfName"));
    assertEquals("ConfigScaleOut", execution.getVariable("action"));
    assertEquals(requestContext.getMsoRequestId(), execution.getVariable("msoRequestId"));
    assertEquals(controllerSelectionReference.getControllerName(), execution.getVariable("controllerType"));
    assertEquals(vfModule.getVfModuleId(), execution.getVariable("vfModuleId"));
    assertEquals(expectedPayload, execution.getVariable("payload"));
}
Also used : ControllerSelectionReference(org.onap.so.db.catalog.beans.ControllerSelectionReference) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Aggregations

ControllerSelectionReference (org.onap.so.db.catalog.beans.ControllerSelectionReference)15 Test (org.junit.Test)6 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)4 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)4 HashMap (java.util.HashMap)3 VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 Action (org.onap.appc.client.lcm.model.Action)2 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)2 RequestParameters (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters)2 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)2 PnfResourceCustomization (org.onap.so.db.catalog.beans.PnfResourceCustomization)2 VnfResourceCustomization (org.onap.so.db.catalog.beans.VnfResourceCustomization)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 Map (java.util.Map)1 BaseIntegrationTest (org.onap.so.BaseIntegrationTest)1 ApplicationControllerTaskRequest (org.onap.so.appc.orchestrator.service.beans.ApplicationControllerTaskRequest)1 ApplicationControllerVnf (org.onap.so.appc.orchestrator.service.beans.ApplicationControllerVnf)1 ConfigScaleOutPayload (org.onap.so.bpmn.appc.payload.beans.ConfigScaleOutPayload)1