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");
}
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");
}
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");
}
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");
}
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");
}
Aggregations