use of org.onap.so.db.catalog.beans.HeatEnvironment in project so by onap.
the class WorkflowActionTest method selectExecutionListServiceMacroCreateWithUserParams.
@Test
public void selectExecutionListServiceMacroCreateWithUserParams() throws Exception {
String gAction = "createInstance";
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", "CreateNetworkCollectionBB", "AssignNetworkBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "CreateNetworkBB", "ActivateNetworkBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB", "ActivateVfModuleBB", "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "ActivateVnfBB", "ActivateNetworkCollectionBB", "ActivateServiceInstanceBB");
northBoundRequest.setOrchestrationFlowList(orchFlows);
Service service = new Service();
service.setModelUUID("3c40d244-808e-42ca-b09a-256d83d19d0a");
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);
when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "AssignVfModuleBB", "AssignVfModuleBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB", "ActivateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB", "ActivateServiceInstanceBB");
assertEquals(3, ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
int randomUUIDLength = UUID.randomUUID().toString().length();
assertEquals(randomUUIDLength, ebbs.get(1).getWorkflowResourceIds().getVnfId().length());
assertEquals(randomUUIDLength, ebbs.get(2).getWorkflowResourceIds().getVolumeGroupId().length());
assertEquals(randomUUIDLength, ebbs.get(3).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(4).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(5).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(6).getWorkflowResourceIds().getVolumeGroupId().length());
assertEquals(randomUUIDLength, ebbs.get(7).getWorkflowResourceIds().getVolumeGroupId().length());
assertEquals(randomUUIDLength, ebbs.get(8).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(9).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(10).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(11).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(12).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(13).getWorkflowResourceIds().getVfModuleId().length());
assertEquals(randomUUIDLength, ebbs.get(14).getWorkflowResourceIds().getVnfId().length());
assertEquals(3, ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
assertEquals(true, execution.getVariable("homing"));
}
use of org.onap.so.db.catalog.beans.HeatEnvironment in project so by onap.
the class MsoVnfAdapterImplTest method getVfModuleCustomization.
private VfModuleCustomization getVfModuleCustomization() {
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
VfModule vfModule = new VfModule();
vfModule.setIsBase(false);
HeatTemplate heatTemplate = new HeatTemplate();
heatTemplate.setTemplateBody("");
heatTemplate.setTimeoutMinutes(200);
HeatTemplateParam heatTemplateParam = new HeatTemplateParam();
heatTemplateParam.setParamAlias("ParamAlias");
heatTemplateParam.setRequired(true);
heatTemplateParam.setParamName("test");
Set set = new HashSet();
set.add(heatTemplateParam);
heatTemplate.setParameters(set);
vfModule.setModuleHeatTemplate(heatTemplate);
vfModuleCustomization.setVfModule(vfModule);
HeatEnvironment heatEnvironment = new HeatEnvironment();
heatEnvironment.setEnvironment("parameters:ist");
vfModuleCustomization.setHeatEnvironment(heatEnvironment);
return vfModuleCustomization;
}
use of org.onap.so.db.catalog.beans.HeatEnvironment in project so by onap.
the class MsoVnfAdapterImplTest method createVnfTest_ExceptionInCreateStack.
@Test
public void createVnfTest_ExceptionInCreateStack() throws Exception {
expectedException.expect(VnfException.class);
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
mockOpenStackGetStackVfModule_404(wireMockServer);
wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
VfModule vfModule = new VfModule();
vfModule.setIsBase(false);
HeatTemplate heatTemplate = new HeatTemplate();
heatTemplate.setTemplateBody("");
heatTemplate.setTimeoutMinutes(200);
vfModule.setModuleHeatTemplate(heatTemplate);
vfModuleCustomization.setVfModule(vfModule);
HeatEnvironment heatEnvironment = new HeatEnvironment();
heatEnvironment.setEnvironment("ist");
vfModuleCustomization.setHeatEnvironment(heatEnvironment);
MsoRequest msoRequest = getMsoRequest();
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "VFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", "9b339a61-69ca-465f-86b8-1c72c582b8e8", map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>());
}
use of org.onap.so.db.catalog.beans.HeatEnvironment in project so by onap.
the class MsoVnfAdapterImplTest method createVnfTest_ModelCustUuidIsNull.
@Test
public void createVnfTest_ModelCustUuidIsNull() throws Exception {
expectedException.expect(VnfException.class);
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
mockOpenStackGetStackVfModule_404(wireMockServer);
wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/volumeGroupHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
wireMockServer.stubFor(get(urlPathEqualTo("/mockPublicUrl/stacks/baseVfHeatStackId")).willReturn(aResponse().withBodyFile("OpenstackResponse_Stack_Created_VfModule.json").withStatus(HttpStatus.SC_OK)));
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
VfModule vfModule = new VfModule();
vfModule.setIsBase(false);
HeatTemplate heatTemplate = new HeatTemplate();
heatTemplate.setTemplateBody("");
heatTemplate.setTimeoutMinutes(200);
vfModule.setModuleHeatTemplate(heatTemplate);
vfModuleCustomization.setVfModule(vfModule);
HeatEnvironment heatEnvironment = new HeatEnvironment();
heatEnvironment.setEnvironment("ist");
vfModuleCustomization.setHeatEnvironment(heatEnvironment);
VnfResource vnfResource = new VnfResource();
vnfResource.setAicVersionMin("1");
vnfResource.setAicVersionMin("3");
MsoRequest msoRequest = getMsoRequest();
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "", "XVFMOD", "volumeGroupHeatStackId", "baseVfHeatStackId", null, map, Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>());
}
use of org.onap.so.db.catalog.beans.HeatEnvironment in project so by onap.
the class VfModuleCustomizationToVduMapperTest method createHeatEnvironment.
private HeatEnvironment createHeatEnvironment(String volHeatEnvName, String volHeatEnvContent) {
HeatEnvironment heatEnvironment = new HeatEnvironment();
heatEnvironment.setName(volHeatEnvName);
heatEnvironment.setEnvironment(volHeatEnvContent);
return heatEnvironment;
}
Aggregations