use of org.onap.aai.domain.yang.ServiceInstance in project so by onap.
the class WorkflowActionTest method isRequestMacroServiceResumeTest.
@Test
public void isRequestMacroServiceResumeTest() {
ServiceInstance si = new ServiceInstance();
when(bbSetupUtils.getAAIServiceInstanceById(anyString())).thenReturn(si);
assertFalse(workflowAction.isRequestMacroServiceResume(false, WorkflowType.SERVICE, "createInstance", ""));
assertTrue(workflowAction.isRequestMacroServiceResume(false, WorkflowType.SERVICE, "createInstance", "123"));
}
use of org.onap.aai.domain.yang.ServiceInstance in project so by onap.
the class WorkflowActionTest method selectExecutionListVnfMacroRecreateTest.
@Test
public void selectExecutionListVnfMacroRecreateTest() throws Exception {
String gAction = "recreateInstance";
String resource = "Vnf";
String bpmnRequest = readBpmnRequestFromFile(MACRO_VNF_MACRO_REPLACE_JSON);
initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v7/serviceInstances/123/vnfs/1234/recreate");
execution.setVariable("serviceInstanceId", "123");
execution.setVariable("vnfId", "1234");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AAICheckVnfInMaintBB", "AAISetVnfInMaintBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB", "DeactivateVfModuleBB", "DeleteVfModuleBB", "DeactivateVnfBB", "CreateVfModuleBB", "ActivateVfModuleBB", "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "ActivateVnfBB", "SDNOVnfHealthCheckBB", "AAIUnsetVnfInMaintBB");
northBoundRequest.setOrchestrationFlowList(orchFlows);
ServiceInstance serviceInstanceAAI = new ServiceInstance();
serviceInstanceAAI.setServiceInstanceId("123");
org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
vnf.setVnfId("1234");
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
vfModule.setVfModuleId("vfModule1");
vnf.getVfModules().add(vfModule);
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
vfModule2.setVfModuleId("vfModule2");
vnf.getVfModules().add(vfModule2);
serviceInstanceMSO.getVnfs().add(vnf);
org.onap.aai.domain.yang.VfModule aaiVfModule = new org.onap.aai.domain.yang.VfModule();
aaiVfModule.setIsBaseVfModule(false);
doReturn(aaiVfModule).when(bbSetupUtils).getAAIVfModule(any(), any());
doReturn(new org.onap.aai.domain.yang.GenericVnf()).when(bbSetupUtils).getAAIGenericVnf(vnf.getVnfId());
doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, false, "cloud-owner")).thenReturn(northBoundRequest);
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "AAICheckVnfInMaintBB", "AAISetVnfInMaintBB", "DeactivateVfModuleBB", "DeleteVfModuleBB", "DeactivateVfModuleBB", "DeleteVfModuleBB", "DeactivateVnfBB", "CreateVfModuleBB", "ActivateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB", "SDNOVnfHealthCheckBB", "AAIUnsetVnfInMaintBB");
}
use of org.onap.aai.domain.yang.ServiceInstance in project so by onap.
the class WorkflowActionTest method selectExecutionListServiceMacroActivateTest.
@Test
public void selectExecutionListServiceMacroActivateTest() throws Exception {
String gAction = "activateInstance";
String resource = "Service";
String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/si0");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("CreateNetworkBB", "ActivateNetworkBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB", "ActivateServiceInstanceBB");
northBoundRequest.setOrchestrationFlowList(orchFlows);
ServiceInstance serviceInstanceAAI = new ServiceInstance();
serviceInstanceAAI.setServiceInstanceId("si0");
org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO = new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf = new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
vnf.setVnfId("vnf0");
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = buildVfModule();
vnf.getVfModules().add(vfModule);
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = buildVfModule();
vnf.getVfModules().add(vfModule2);
org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = new org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup();
volumeGroup.setVolumeGroupId("volumeGroup0");
vnf.getVolumeGroups().add(volumeGroup);
serviceInstanceMSO.getVnfs().add(vnf);
VfModule aaiVfModule = new VfModule();
aaiVfModule.setIsBaseVfModule(false);
doReturn(aaiVfModule).when(bbSetupUtils).getAAIVfModule(any(), any());
doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("si0");
doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
doReturn(Mockito.mock(GenericVnf.class)).when(bbSetupUtils).getAAIGenericVnf(any());
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, "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB", "ActivateVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB", "ActivateVnfBB", "ActivateServiceInstanceBB");
assertEquals("volumeGroup0", ebbs.get(0).getWorkflowResourceIds().getVolumeGroupId());
assertEquals("volumeGroup0", ebbs.get(1).getWorkflowResourceIds().getVolumeGroupId());
assertEquals("testVfModuleId1", ebbs.get(2).getWorkflowResourceIds().getVfModuleId());
assertEquals("testVfModuleId1", ebbs.get(3).getWorkflowResourceIds().getVfModuleId());
assertEquals("testVfModuleId2", ebbs.get(4).getWorkflowResourceIds().getVfModuleId());
assertEquals("testVfModuleId2", ebbs.get(5).getWorkflowResourceIds().getVfModuleId());
assertEquals("vnf0", ebbs.get(6).getWorkflowResourceIds().getVnfId());
assertEquals("si0", ebbs.get(7).getWorkflowResourceIds().getServiceInstanceId());
}
use of org.onap.aai.domain.yang.ServiceInstance in project so by onap.
the class WorkflowActionTest method selectExecutionListServiceMacroUnassignTest.
@Test
public void selectExecutionListServiceMacroUnassignTest() throws Exception {
String gAction = "unassignInstance";
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("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.GenericVnf vnf = new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
vnf.setVnfId("vnfId123");
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = buildVfModule();
vnf.getVfModules().add(vfModule);
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = buildVfModule();
vnf.getVfModules().add(vfModule2);
org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = new org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup();
volumeGroup.setVolumeGroupId("vg123");
vnf.getVolumeGroups().add(volumeGroup);
serviceInstanceMSO.getVnfs().add(vnf);
VfModule aaiVfModule = new VfModule();
aaiVfModule.setIsBaseVfModule(false);
doReturn(aaiVfModule).when(bbSetupUtils).getAAIVfModule(any(), any());
doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
doReturn(Mockito.mock(GenericVnf.class)).when(bbSetupUtils).getAAIGenericVnf(any());
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, "UnassignVfModuleBB", "UnassignVfModuleBB", "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignServiceInstanceBB");
}
use of org.onap.aai.domain.yang.ServiceInstance in project so by onap.
the class WorkflowActionTest method selectExecutionListServiceMacroDeleteTest.
@Test
public void selectExecutionListServiceMacroDeleteTest() 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", "DeactivatePnfBB", "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.GenericVnf vnf = new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf pnf = new org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf();
vnf.setVnfId("vnfId123");
pnf.setPnfId("pnfId123");
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = buildVfModule();
vnf.getVfModules().add(vfModule);
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = buildVfModule();
vnf.getVfModules().add(vfModule2);
org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup = new org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup();
volumeGroup.setVolumeGroupId("vg123");
vnf.getVolumeGroups().add(volumeGroup);
serviceInstanceMSO.getVnfs().add(vnf);
serviceInstanceMSO.getPnfs().add(pnf);
VfModule aaiVfModule = new VfModule();
aaiVfModule.setIsBaseVfModule(false);
doReturn(aaiVfModule).when(bbSetupUtils).getAAIVfModule(any(), any());
doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
doReturn(Mockito.mock(GenericVnf.class)).when(bbSetupUtils).getAAIGenericVnf(any());
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, "DeactivateVfModuleBB", "DeleteVfModuleBB", "DeactivateVfModuleBB", "DeleteVfModuleBB", "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB", "DeactivatePnfBB", "DeactivateServiceInstanceBB", "UnassignVfModuleBB", "UnassignVfModuleBB", "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignServiceInstanceBB");
}
Aggregations