Search in sources :

Example 41 with NorthBoundRequest

use of org.onap.so.db.catalog.beans.macro.NorthBoundRequest 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");
}
Also used : HeatEnvironment(org.onap.so.db.catalog.beans.HeatEnvironment) OrchestrationFlow(org.onap.so.db.catalog.beans.macro.OrchestrationFlow) 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 42 with NorthBoundRequest

use of org.onap.so.db.catalog.beans.macro.NorthBoundRequest 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");
}
Also used : HeatEnvironment(org.onap.so.db.catalog.beans.HeatEnvironment) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) VfModule(org.onap.aai.domain.yang.VfModule) NorthBoundRequest(org.onap.so.db.catalog.beans.macro.NorthBoundRequest) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) VolumeGroup(org.onap.aai.domain.yang.VolumeGroup) 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)

Aggregations

NorthBoundRequest (org.onap.so.db.catalog.beans.macro.NorthBoundRequest)42 Test (org.junit.Test)41 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)40 ArrayList (java.util.ArrayList)39 List (java.util.List)38 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)38 ArgumentMatchers.anyList (org.mockito.ArgumentMatchers.anyList)38 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)38 RelationshipList (org.onap.aai.domain.yang.RelationshipList)38 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)38 OrchestrationFlow (org.onap.so.db.catalog.beans.macro.OrchestrationFlow)30 VfModule (org.onap.aai.domain.yang.VfModule)19 HeatEnvironment (org.onap.so.db.catalog.beans.HeatEnvironment)12 HeatTemplate (org.onap.so.db.catalog.beans.HeatTemplate)12 VfModuleCustomization (org.onap.so.db.catalog.beans.VfModuleCustomization)12 VolumeGroup (org.onap.aai.domain.yang.VolumeGroup)11 GenericVnf (org.onap.aai.domain.yang.GenericVnf)9 ServiceInstance (org.onap.aai.domain.yang.ServiceInstance)9 Service (org.onap.so.db.catalog.beans.Service)9 Configuration (org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration)4