Search in sources :

Example 11 with HeatEnvironment

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"));
}
Also used : HeatEnvironment(org.onap.so.db.catalog.beans.HeatEnvironment) OrchestrationFlow(org.onap.so.db.catalog.beans.macro.OrchestrationFlow) Service(org.onap.so.db.catalog.beans.Service) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) NorthBoundRequest(org.onap.so.db.catalog.beans.macro.NorthBoundRequest) VfModule(org.onap.aai.domain.yang.VfModule) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) HeatTemplate(org.onap.so.db.catalog.beans.HeatTemplate) ArgumentMatchers.anyList(org.mockito.ArgumentMatchers.anyList) List(java.util.List) ArrayList(java.util.ArrayList) RelationshipList(org.onap.aai.domain.yang.RelationshipList) VfModuleCustomization(org.onap.so.db.catalog.beans.VfModuleCustomization) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 12 with HeatEnvironment

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;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HeatTemplate(org.onap.so.db.catalog.beans.HeatTemplate) HeatEnvironment(org.onap.so.db.catalog.beans.HeatEnvironment) VfModuleCustomization(org.onap.so.db.catalog.beans.VfModuleCustomization) VfModule(org.onap.so.db.catalog.beans.VfModule) HeatTemplateParam(org.onap.so.db.catalog.beans.HeatTemplateParam) HashSet(java.util.HashSet)

Example 13 with HeatEnvironment

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<>());
}
Also used : HashMap(java.util.HashMap) HeatTemplate(org.onap.so.db.catalog.beans.HeatTemplate) HeatEnvironment(org.onap.so.db.catalog.beans.HeatEnvironment) MsoRequest(org.onap.so.entity.MsoRequest) VfModuleCustomization(org.onap.so.db.catalog.beans.VfModuleCustomization) VfModule(org.onap.so.db.catalog.beans.VfModule) Test(org.junit.Test)

Example 14 with HeatEnvironment

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<>());
}
Also used : VnfResource(org.onap.so.db.catalog.beans.VnfResource) HashMap(java.util.HashMap) HeatTemplate(org.onap.so.db.catalog.beans.HeatTemplate) HeatEnvironment(org.onap.so.db.catalog.beans.HeatEnvironment) MsoRequest(org.onap.so.entity.MsoRequest) VfModuleCustomization(org.onap.so.db.catalog.beans.VfModuleCustomization) VfModule(org.onap.so.db.catalog.beans.VfModule) Test(org.junit.Test)

Example 15 with HeatEnvironment

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;
}
Also used : HeatEnvironment(org.onap.so.db.catalog.beans.HeatEnvironment)

Aggregations

HeatEnvironment (org.onap.so.db.catalog.beans.HeatEnvironment)24 VfModuleCustomization (org.onap.so.db.catalog.beans.VfModuleCustomization)21 HeatTemplate (org.onap.so.db.catalog.beans.HeatTemplate)19 ArrayList (java.util.ArrayList)16 Test (org.junit.Test)14 List (java.util.List)12 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)12 ArgumentMatchers.anyList (org.mockito.ArgumentMatchers.anyList)12 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)12 RelationshipList (org.onap.aai.domain.yang.RelationshipList)12 VfModule (org.onap.aai.domain.yang.VfModule)12 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)12 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)12 NorthBoundRequest (org.onap.so.db.catalog.beans.macro.NorthBoundRequest)12 HashMap (java.util.HashMap)6 VolumeGroup (org.onap.aai.domain.yang.VolumeGroup)6 VfModule (org.onap.so.db.catalog.beans.VfModule)6 OrchestrationFlow (org.onap.so.db.catalog.beans.macro.OrchestrationFlow)5 JsonParseException (com.fasterxml.jackson.core.JsonParseException)3 HeatTemplateParam (org.onap.so.db.catalog.beans.HeatTemplateParam)3