Search in sources :

Example 51 with ExecuteBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock in project so by onap.

the class WorkflowActionTest method selectExecutionListServiceMacroDeleteNetworkCollectionTest.

@Test
public void selectExecutionListServiceMacroDeleteNetworkCollectionTest() throws Exception {
    String gAction = "deleteInstance";
    String resource = "Service";
    String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
    initExecution(gAction, bpmnRequest, false);
    execution.setVariable("requestUri", "v6/serviceInstances/123");
    NorthBoundRequest northBoundRequest = new NorthBoundRequest();
    List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB", "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB", "DeactivateNetworkBB", "DeleteNetworkBB", "DeleteNetworkCollectionBB", "DeactivateServiceInstanceBB", "UnassignVfModuleBB", "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignNetworkBB", "UnassignServiceInstanceBB");
    northBoundRequest.setOrchestrationFlowList(orchFlows);
    ServiceInstance serviceInstanceAAI = new ServiceInstance();
    serviceInstanceAAI.setServiceInstanceId("aaisi123");
    org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
    org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network = new org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network();
    network.setNetworkId("123");
    serviceInstanceMSO.getNetworks().add(network);
    org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network2 = new org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network();
    network2.setNetworkId("321");
    serviceInstanceMSO.getNetworks().add(network2);
    Collection collection = new Collection();
    serviceInstanceMSO.setCollection(collection);
    doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
    doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
    when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
    workflowAction.selectExecutionList(execution);
    List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
    assertEqualsBulkFlowName(ebbs, "DeactivateNetworkBB", "DeleteNetworkBB", "UnassignNetworkBB", "DeactivateNetworkBB", "DeleteNetworkBB", "UnassignNetworkBB", "DeleteNetworkCollectionBB", "DeactivateServiceInstanceBB", "UnassignServiceInstanceBB");
}
Also used : OrchestrationFlow(org.onap.so.db.catalog.beans.macro.OrchestrationFlow) ServiceInstance(org.onap.aai.domain.yang.ServiceInstance) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) NorthBoundRequest(org.onap.so.db.catalog.beans.macro.NorthBoundRequest) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) Collection(org.onap.so.bpmn.servicedecomposition.bbobjects.Collection) ArgumentMatchers.anyList(org.mockito.ArgumentMatchers.anyList) List(java.util.List) ArrayList(java.util.ArrayList) RelationshipList(org.onap.aai.domain.yang.RelationshipList) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 52 with ExecuteBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock in project so by onap.

the class WorkflowActionTest method selectExecutionListALaCarteVfModuleNoFabricCreateTest.

@Test
public void selectExecutionListALaCarteVfModuleNoFabricCreateTest() throws Exception {
    String gAction = "createInstance";
    String resource = "VfModule";
    String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
    initExecution(gAction, bpmnRequest, true);
    execution.setVariable("requestUri", "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
    NorthBoundRequest northBoundRequest = new NorthBoundRequest();
    List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB");
    northBoundRequest.setOrchestrationFlowList(orchFlows);
    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, "AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB");
}
Also used : ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) OrchestrationFlow(org.onap.so.db.catalog.beans.macro.OrchestrationFlow) ArgumentMatchers.anyList(org.mockito.ArgumentMatchers.anyList) List(java.util.List) ArrayList(java.util.ArrayList) RelationshipList(org.onap.aai.domain.yang.RelationshipList) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) NorthBoundRequest(org.onap.so.db.catalog.beans.macro.NorthBoundRequest) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 53 with ExecuteBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock in project so by onap.

the class WorkflowActionTest method selectExecutionListALaCarteNetworkDeleteTest.

@Test
public void selectExecutionListALaCarteNetworkDeleteTest() throws Exception {
    String gAction = "deleteInstance";
    String resource = "Network";
    String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
    initExecution(gAction, bpmnRequest, true);
    execution.setVariable("requestUri", "v6/networks/123");
    NorthBoundRequest northBoundRequest = new NorthBoundRequest();
    List<OrchestrationFlow> orchFlows = createFlowList("DeactivateNetworkBB", "DeleteNetworkBB", "UnassignNetwork1802BB");
    northBoundRequest.setOrchestrationFlowList(orchFlows);
    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, "DeactivateNetworkBB", "DeleteNetworkBB", "UnassignNetwork1802BB");
}
Also used : ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) OrchestrationFlow(org.onap.so.db.catalog.beans.macro.OrchestrationFlow) ArgumentMatchers.anyList(org.mockito.ArgumentMatchers.anyList) List(java.util.List) ArrayList(java.util.ArrayList) RelationshipList(org.onap.aai.domain.yang.RelationshipList) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) NorthBoundRequest(org.onap.so.db.catalog.beans.macro.NorthBoundRequest) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 54 with ExecuteBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock in project so by onap.

the class WorkflowActionBBTasksTest method rollbackExecutionRollbackToAssignedTest.

@Test
public void rollbackExecutionRollbackToAssignedTest() {
    execution.setVariable("isRollback", false);
    execution.setVariable("handlingCode", "RollbackToAssigned");
    execution.setVariable("requestAction", EMPTY_STRING);
    execution.setVariable("resourceName", EMPTY_STRING);
    List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
    BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
    ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
    flowsToExecute.add(ebb1);
    BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
    ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
    flowsToExecute.add(ebb2);
    BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
    ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
    flowsToExecute.add(ebb3);
    execution.setVariable("flowsToExecute", flowsToExecute);
    execution.setVariable("gCurrentSequence", 2);
    workflowActionBBTasks.rollbackExecutionPath(execution);
    List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
    assertEquals("DeleteVfModuleBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
    assertEquals(0, execution.getVariable("gCurrentSequence"));
    assertEquals(1, ebbs.size());
}
Also used : ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) BuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock) ArrayList(java.util.ArrayList) List(java.util.List) RelatedInstanceList(org.onap.so.serviceinstancebeans.RelatedInstanceList) ArrayList(java.util.ArrayList) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 55 with ExecuteBuildingBlock

use of org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock in project so by onap.

the class WorkflowActionBBTasksTest method getExecuteBBForConfigTest.

@Test
public void getExecuteBBForConfigTest() throws CloneNotSupportedException {
    BuildingBlock bbActivateVfModule = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
    ExecuteBuildingBlock ebbActivateVfModule = new ExecuteBuildingBlock().setBuildingBlock(bbActivateVfModule);
    WorkflowResourceIds resourceIdsActivateVfModule = new WorkflowResourceIds();
    resourceIdsActivateVfModule.setServiceInstanceId("test-service-inbstance-id");
    resourceIdsActivateVfModule.setVnfId("test-vnf-id");
    resourceIdsActivateVfModule.setVfModuleId("test-vf-module-id");
    resourceIdsActivateVfModule.setConfigurationId("");
    RequestDetails requestDetails = new RequestDetails();
    ebbActivateVfModule.setApiVersion("7");
    ebbActivateVfModule.setaLaCarte(true);
    ebbActivateVfModule.setRequestAction("createInstance");
    ebbActivateVfModule.setVnfType("test-vnf-type");
    ebbActivateVfModule.setRequestId("f6c00ae2-a205-4cbd-b055-02e553efde12");
    ebbActivateVfModule.setRequestDetails(requestDetails);
    ebbActivateVfModule.setWorkflowResourceIds(resourceIdsActivateVfModule);
    ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
    configurationResourceKeys.setCvnfcCustomizationUUID("07d64cd2-4427-4156-b11d-d14b96b3e4cb");
    configurationResourceKeys.setVfModuleCustomizationUUID("50b61075-6ebb-4aab-a9fc-bedad9a2aa76");
    configurationResourceKeys.setVnfResourceCustomizationUUID("a1d0e36e-34a9-431b-b5ba-4bbb72f63c7c");
    configurationResourceKeys.setVnfcName("rdm54bvbgw5001vm018pim001");
    ExecuteBuildingBlock ebbAddFabricConfig = workflowActionBBTasks.getExecuteBBForConfig("AddFabricConfigurationBB", ebbActivateVfModule, "cc7e12f9-967c-4362-8d14-e5b2bf0608a4", configurationResourceKeys);
    assertEquals("7", ebbAddFabricConfig.getApiVersion());
    assertTrue(ebbAddFabricConfig.isaLaCarte());
    assertEquals("createInstance", ebbAddFabricConfig.getRequestAction());
    assertEquals("test-vnf-type", ebbAddFabricConfig.getVnfType());
    assertEquals("f6c00ae2-a205-4cbd-b055-02e553efde12", ebbAddFabricConfig.getRequestId());
    assertEquals(requestDetails, ebbAddFabricConfig.getRequestDetails());
    assertEquals("cc7e12f9-967c-4362-8d14-e5b2bf0608a4", ebbAddFabricConfig.getWorkflowResourceIds().getConfigurationId());
    assertEquals("test-service-inbstance-id", ebbAddFabricConfig.getWorkflowResourceIds().getServiceInstanceId());
    assertEquals("test-vnf-id", ebbAddFabricConfig.getWorkflowResourceIds().getVnfId());
    assertEquals("test-vf-module-id", ebbAddFabricConfig.getWorkflowResourceIds().getVfModuleId());
    assertThat(ebbAddFabricConfig.getConfigurationResourceKeys()).isEqualTo(configurationResourceKeys);
    assertThat(ebbAddFabricConfig.getWorkflowResourceIds()).isNotEqualTo(ebbActivateVfModule.getWorkflowResourceIds());
    assertThat(ebbAddFabricConfig.getWorkflowResourceIds().getConfigurationId()).isNotEqualTo(ebbActivateVfModule.getWorkflowResourceIds().getConfigurationId());
}
Also used : ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) BuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) ConfigurationResourceKeys(org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) WorkflowResourceIds(org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Aggregations

ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)147 Test (org.junit.Test)107 ArrayList (java.util.ArrayList)86 List (java.util.List)65 BuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock)63 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)61 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)49 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)45 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)45 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)41 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)40 NorthBoundRequest (org.onap.so.db.catalog.beans.macro.NorthBoundRequest)40 File (java.io.File)38 ArgumentMatchers.anyList (org.mockito.ArgumentMatchers.anyList)38 RelationshipList (org.onap.aai.domain.yang.RelationshipList)38 OrchestrationFlow (org.onap.so.db.catalog.beans.macro.OrchestrationFlow)37 Service (org.onap.so.db.catalog.beans.Service)35 HashMap (java.util.HashMap)27 VfModule (org.onap.aai.domain.yang.VfModule)25 RelatedInstanceList (org.onap.so.serviceinstancebeans.RelatedInstanceList)24