Search in sources :

Example 11 with OrchestrationFlow

use of org.onap.so.db.catalog.beans.macro.OrchestrationFlow in project so by onap.

the class WorkflowActionTest method selectExecutionListALaCarteVfModuleFabricDeleteTest.

@Test
public void selectExecutionListALaCarteVfModuleFabricDeleteTest() throws Exception {
    String gAction = "deleteInstance";
    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("DeactivateVfModuleBB", "DeleteVfModuleBB", "UnassignVfModuleBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB");
    northBoundRequest.setOrchestrationFlowList(orchFlows);
    when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
    org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
    vnf.setVnfId("vnf0");
    vnf.setModelCustomizationId("modelCustomizationId");
    when(bbSetupUtils.getAAIGenericVnf(anyObject())).thenReturn(vnf);
    org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule();
    vfModule.setModelCustomizationId("modelCustomizationId");
    when(bbSetupUtils.getAAIVfModule(anyObject(), anyObject())).thenReturn(vfModule);
    List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>();
    org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
    vnfc.setModelInvariantId("modelInvariantId");
    vnfc.setVnfcName("testVnfcName");
    vnfcs.add(vnfc);
    doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(anyObject(), anyObject(), anyObject(), anyObject());
    org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
    configuration.setConfigurationId("configurationId");
    configuration.setModelCustomizationId("modelCustimizationId");
    configuration.setConfigurationName("testConfigurationName");
    doReturn(configuration).when(SPY_workflowAction).getRelatedResourcesInVnfc(anyObject(), anyObject(), anyObject());
    SPY_workflowAction.selectExecutionList(execution);
    List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
    assertEqualsBulkFlowName(ebbs, "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB", "DeactivateVfModuleBB", "DeleteVfModuleBB", "UnassignVfModuleBB");
}
Also used : GenericVnf(org.onap.aai.domain.yang.GenericVnf) GenericVnf(org.onap.aai.domain.yang.GenericVnf) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) ArrayList(java.util.ArrayList) OrchestrationFlow(org.onap.so.db.catalog.beans.macro.OrchestrationFlow) 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) VfModule(org.onap.aai.domain.yang.VfModule) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) 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 12 with OrchestrationFlow

use of org.onap.so.db.catalog.beans.macro.OrchestrationFlow in project so by onap.

the class WorkflowActionTest method selectExecutionListALaCarteVfModuleFabricCreateTest.

@Test
public void selectExecutionListALaCarteVfModuleFabricCreateTest() 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", "AddFabricConfigurationBB");
    northBoundRequest.setOrchestrationFlowList(orchFlows);
    List<CvnfcCustomization> cvnfcCustomizations = new ArrayList<CvnfcCustomization>();
    CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
    CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new CvnfcConfigurationCustomization();
    ConfigurationResource configurationResource = new ConfigurationResource();
    configurationResource.setToscaNodeType("FabricConfiguration");
    vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
    vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName("modelInstanceName1");
    vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
    List<CvnfcConfigurationCustomization> custSet = new ArrayList<CvnfcConfigurationCustomization>();
    custSet.add(vnfVfmoduleCvnfcConfigurationCustomization);
    cvnfcCustomization.setCvnfcConfigurationCustomization(custSet);
    cvnfcCustomization.setDescription("description");
    cvnfcCustomizations.add(cvnfcCustomization);
    CvnfcCustomization cvnfcCustomization2 = new CvnfcCustomization();
    CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization2 = new CvnfcConfigurationCustomization();
    ConfigurationResource configurationResource2 = new ConfigurationResource();
    configurationResource2.setToscaNodeType("FabricConfiguration");
    vnfVfmoduleCvnfcConfigurationCustomization2.setConfigurationResource(configurationResource2);
    vnfVfmoduleCvnfcConfigurationCustomization2.setModelInstanceName("modelInstanceName2");
    vnfVfmoduleCvnfcConfigurationCustomization2.setCvnfcCustomization(cvnfcCustomization2);
    List<CvnfcConfigurationCustomization> custSet2 = new ArrayList<CvnfcConfigurationCustomization>();
    custSet2.add(vnfVfmoduleCvnfcConfigurationCustomization2);
    cvnfcCustomization2.setCvnfcConfigurationCustomization(custSet2);
    cvnfcCustomization2.setDescription("description2");
    cvnfcCustomizations.add(cvnfcCustomization2);
    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 : ArrayList(java.util.ArrayList) 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) ConfigurationResource(org.onap.so.db.catalog.beans.ConfigurationResource) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) CvnfcCustomization(org.onap.so.db.catalog.beans.CvnfcCustomization) ArgumentMatchers.anyList(org.mockito.ArgumentMatchers.anyList) List(java.util.List) ArrayList(java.util.ArrayList) RelationshipList(org.onap.aai.domain.yang.RelationshipList) CvnfcConfigurationCustomization(org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 13 with OrchestrationFlow

use of org.onap.so.db.catalog.beans.macro.OrchestrationFlow in project so by onap.

the class WorkflowActionTest method selectExecutionListALaCarteNoRequestParametersTest.

@Test
public void selectExecutionListALaCarteNoRequestParametersTest() throws Exception {
    String gAction = "createInstance";
    String resource = "VfModule";
    String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_NO_PARAMS_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 14 with OrchestrationFlow

use of org.onap.so.db.catalog.beans.macro.OrchestrationFlow in project so by onap.

the class WorkflowActionTest method selectExecutionListServiceMacroDeactivateTest.

@Test
public void selectExecutionListServiceMacroDeactivateTest() throws Exception {
    String gAction = "deactivateInstance";
    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("DeactivateServiceInstanceBB");
    northBoundRequest.setOrchestrationFlowList(orchFlows);
    when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
    workflowAction.selectExecutionList(execution);
    List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
    assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(), "DeactivateServiceInstanceBB");
}
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 15 with OrchestrationFlow

use of org.onap.so.db.catalog.beans.macro.OrchestrationFlow 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)

Aggregations

OrchestrationFlow (org.onap.so.db.catalog.beans.macro.OrchestrationFlow)44 ArrayList (java.util.ArrayList)39 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)37 Test (org.junit.Test)33 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)32 NorthBoundRequest (org.onap.so.db.catalog.beans.macro.NorthBoundRequest)32 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)31 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)31 List (java.util.List)30 ArgumentMatchers.anyList (org.mockito.ArgumentMatchers.anyList)27 RelationshipList (org.onap.aai.domain.yang.RelationshipList)27 VfModule (org.onap.aai.domain.yang.VfModule)15 GenericVnf (org.onap.aai.domain.yang.GenericVnf)11 ServiceInstance (org.onap.aai.domain.yang.ServiceInstance)9 Service (org.onap.so.db.catalog.beans.Service)9 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)8 WorkflowResourceIds (org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds)8 VfModuleCustomization (org.onap.so.db.catalog.beans.VfModuleCustomization)8 VolumeGroup (org.onap.aai.domain.yang.VolumeGroup)7 CollectionResource (org.onap.so.db.catalog.beans.CollectionResource)7