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);
}
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);
}
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());
}
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"));
}
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"));
}
Aggregations