use of org.onap.so.db.catalog.beans.HeatTemplate in project so by onap.
the class WorkflowActionTest method selectExecutionListServiceMacroAssignTest.
/**
* SERVICE MACRO TESTS
*/
@Test
public void selectExecutionListServiceMacroAssignTest() throws Exception {
String gAction = "assignInstance";
String resource = "Service";
String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "AssignNetworkBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB");
northBoundRequest.setOrchestrationFlowList(orchFlows);
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
vfModuleCustomization.setModelCustomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
HeatEnvironment volumeHeatEnv = new HeatEnvironment();
vfModuleCustomization.setVolumeHeatEnv(volumeHeatEnv);
org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule();
HeatTemplate volumeHeatTemplate = new HeatTemplate();
vfModule.setVolumeHeatTemplate(volumeHeatTemplate);
vfModuleCustomization.setVfModule(vfModule);
VfModuleCustomization vfModuleCustomization2 = new VfModuleCustomization();
vfModuleCustomization2.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
HeatEnvironment heatEnvironment = new HeatEnvironment();
vfModuleCustomization2.setHeatEnvironment(heatEnvironment);
org.onap.so.db.catalog.beans.VfModule vfModule2 = new org.onap.so.db.catalog.beans.VfModule();
HeatTemplate moduleHeatTemplate = new HeatTemplate();
vfModule2.setModuleHeatTemplate(moduleHeatTemplate);
vfModuleCustomization2.setVfModule(vfModule2);
VfModuleCustomization vfModuleCustomization3 = vfModuleCustomization2;
vfModuleCustomization3.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
when(userParamsServiceTraversal.getResourceListFromUserParams(any(), anyList(), anyString(), anyString())).thenReturn(prepareListWithResources(false, false));
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f")).thenReturn(vfModuleCustomization);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8")).thenReturn(vfModuleCustomization2);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("da4d4327-fb7d-4311-ac7a-be7ba60cf969")).thenReturn(vfModuleCustomization3);
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "AssignVfModuleBB", "AssignVfModuleBB");
}
use of org.onap.so.db.catalog.beans.HeatTemplate in project so by onap.
the class WorkflowActionTest method selectExecutionListALaCarteVfModuleRebuildVolumeGroupReplaceRetainAssignmentsTest.
@Test
public void selectExecutionListALaCarteVfModuleRebuildVolumeGroupReplaceRetainAssignmentsTest() throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";
String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_REPLACE_REBUILD_VOLUME_GROUPS_JSON);
initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri", "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
execution.setVariable("vfModuleId", "1234");
VolumeGroup volumeGroup = new VolumeGroup();
volumeGroup.setVolumeGroupId("volumeGroupId");
doReturn(Optional.of(volumeGroup)).when(bbSetupUtils).getRelatedVolumeGroupFromVfModule("b80b16a5-f80d-4ffa-91c8-bd47c7438a3d", "1234");
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
vfModuleCustomization.setVolumeHeatEnv(new HeatEnvironment());
org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule();
vfModule.setVolumeHeatTemplate(new HeatTemplate());
vfModuleCustomization.setVfModule(vfModule);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("9a6d01fd-19a7-490a-9800-460830a12e0b")).thenReturn(vfModuleCustomization);
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
northBoundRequest.setOrchestrationFlowList(replaceRetainAssignmentsVfModuleOrchFlows);
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "DeactivateVfModuleBB", "DeleteVfModuleATTBB", "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "UnassignVolumeGroupBB", "AssignVolumeGroupBB", "ChangeModelVfModuleBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ChangeModelVnfBB", "ChangeModelServiceInstanceBB");
}
use of org.onap.so.db.catalog.beans.HeatTemplate in project so by onap.
the class UserParamsServiceTraversalTest method getVfModuleCustomization.
private VfModuleCustomization getVfModuleCustomization(String modelCustomizationUUID, boolean includeVolumeGroup) {
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
vfModuleCustomization.setModelCustomizationUUID(modelCustomizationUUID);
VfModule vfModule = new VfModule();
if (includeVolumeGroup) {
vfModuleCustomization.setVolumeHeatEnv(new HeatEnvironment());
vfModule.setVolumeHeatTemplate(new HeatTemplate());
vfModule.setModelName("helm");
} else {
vfModuleCustomization.setHeatEnvironment(new HeatEnvironment());
}
vfModule.setModuleHeatTemplate(new HeatTemplate());
vfModuleCustomization.setVfModule(vfModule);
return vfModuleCustomization;
}
use of org.onap.so.db.catalog.beans.HeatTemplate in project so by onap.
the class MsoHeatUtilsUnitTest method convertInputMapValuesTest.
@Test
public final void convertInputMapValuesTest() {
MsoHeatUtils utils = new MsoHeatUtils();
Map<String, Object> inputs = new HashMap<>();
Set<HeatTemplateParam> params = new HashSet<>();
HeatTemplate ht = new HeatTemplate();
HeatTemplateParam htp = new HeatTemplateParam();
htp.setParamName("vnf_name");
htp.setParamType("string");
params.add(htp);
inputs.put("vnf_name", "a_vnf_name");
htp = new HeatTemplateParam();
htp.setParamName("image_size");
htp.setParamType("number");
params.add(htp);
inputs.put("image_size", "1024");
htp = new HeatTemplateParam();
htp.setParamName("external");
htp.setParamType("boolean");
params.add(htp);
inputs.put("external", "false");
htp = new HeatTemplateParam();
htp.setParamName("oam_ips");
htp.setParamType("comma_delimited_list");
params.add(htp);
inputs.put("oam_ips", "a,b");
htp = new HeatTemplateParam();
htp.setParamName("oam_prefixes");
htp.setParamType("json");
params.add(htp);
String jsonEscInput = "[{\"prefix\": \"aValue\"}, {\"prefix\": \"aValue2\"}]";
inputs.put("oam_prefixes", jsonEscInput);
ht.setParameters(params);
Map<String, Object> output = utils.convertInputMap(inputs, ht);
assertEquals("a_vnf_name", output.get("vnf_name"));
assertEquals(1024, output.get("image_size"));
assertEquals(false, output.get("external"));
List<String> cdl = new ArrayList<>();
cdl.add(0, "a");
cdl.add(1, "b");
assertEquals(cdl, output.get("oam_ips"));
ObjectMapper JSON_MAPPER = new ObjectMapper();
JsonNode jn = null;
try {
jn = JSON_MAPPER.readTree(jsonEscInput);
} catch (Exception e) {
}
assertEquals(jn, output.get("oam_prefixes"));
}
use of org.onap.so.db.catalog.beans.HeatTemplate in project so by onap.
the class MsoHeatUtilsTest method testGetVfHeatTimeoutValue.
@Test
public void testGetVfHeatTimeoutValue() {
VfModuleCustomization vfmc = new VfModuleCustomization();
VfModule vf = new VfModule();
HeatTemplate heat = new HeatTemplate();
heat.setTimeoutMinutes(110);
vf.setModuleHeatTemplate(heat);
vfmc.setVfModule(vf);
Mockito.when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("uuid")).thenReturn(vfmc);
int timeout = heatUtils.getVfHeatTimeoutValue("uuid", false);
assertEquals(110, timeout);
Mockito.verify(catalogDbClient, times(1)).getVfModuleCustomizationByModelCuztomizationUUID("uuid");
}
Aggregations