Search in sources :

Example 61 with Service

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

the class CatalogDbClientTest method testGetServiceByModelNameNotFound.

@Test
public void testGetServiceByModelNameNotFound() {
    Service service = client.getServiceByModelName("Not_Found");
    assertNull(service);
}
Also used : Service(org.onap.so.db.catalog.beans.Service) ExternalServiceToInternalService(org.onap.so.db.catalog.beans.ExternalServiceToInternalService) Test(org.junit.Test) CatalogDbAdapterBaseTest(org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest)

Example 62 with Service

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

the class CatalogDbClientTest method testGetServiceByID.

@Test
public void testGetServiceByID() throws Exception {
    Service serviceByID = client.getServiceByID("5df8b6de-2083-11e7-93ae-92361f002671");
    assertNotNull(serviceByID);
    assertEquals("MSOTADevInfra_vSAMP10a_Service", serviceByID.getModelName());
    assertEquals("NA", serviceByID.getServiceType());
    assertEquals("NA", serviceByID.getServiceRole());
}
Also used : Service(org.onap.so.db.catalog.beans.Service) ExternalServiceToInternalService(org.onap.so.db.catalog.beans.ExternalServiceToInternalService) Test(org.junit.Test) CatalogDbAdapterBaseTest(org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest)

Example 63 with Service

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

the class CatalogDbClientTest method testGetServiceByModelVersionAndModelInvariantUUID.

@Test
public void testGetServiceByModelVersionAndModelInvariantUUID() {
    Service service = client.getServiceByModelVersionAndModelInvariantUUID("2.0", "9647dfc4-2083-11e7-93ae-92361f002671");
    assertNotNull(service);
    assertNotNull(service.getModelVersion());
    assertNotNull(service.getModelInvariantUUID());
    assertEquals("MSOTADevInfra_vSAMP10a_Service", service.getModelName());
    assertEquals("NA", service.getServiceRole());
}
Also used : Service(org.onap.so.db.catalog.beans.Service) ExternalServiceToInternalService(org.onap.so.db.catalog.beans.ExternalServiceToInternalService) Test(org.junit.Test) CatalogDbAdapterBaseTest(org.onap.so.adapters.catalogdb.CatalogDbAdapterBaseTest)

Example 64 with Service

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

the class WorkflowActionTest method selectExecutionListServiceMacroCreateWithNetworkCollectionTest.

@Test
public void selectExecutionListServiceMacroCreateWithNetworkCollectionTest() throws Exception {
    String gAction = "createInstance";
    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();
    northBoundRequest.setIsToplevelflow(true);
    List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB", "AssignNetworkBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "CreateNetworkBB", "ActivateNetworkBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB", "CreateVfModuleBB", "ActivateVfModuleBB", "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "ActivateVnfBB", "ActivateNetworkCollectionBB", "ActivateServiceInstanceBB");
    northBoundRequest.setOrchestrationFlowList(orchFlows);
    Service service = new Service();
    List<NetworkResourceCustomization> networkCustomizations = new ArrayList<>();
    NetworkResourceCustomization networkCust = new NetworkResourceCustomization();
    networkCust.setModelCustomizationUUID("123");
    networkCustomizations.add(networkCust);
    service.setNetworkCustomizations(networkCustomizations);
    NetworkCollectionResourceCustomization collectionResourceCustomization = new NetworkCollectionResourceCustomization();
    collectionResourceCustomization.setModelCustomizationUUID("123");
    CollectionResource collectionResource = new CollectionResource();
    collectionResource.setToscaNodeType("NetworkCollection");
    InstanceGroup instanceGroup = new InstanceGroup();
    instanceGroup.setToscaNodeType("NetworkCollectionResource");
    instanceGroup.setCollectionNetworkResourceCustomizations(new ArrayList<>());
    CollectionNetworkResourceCustomization collectionNetworkResourceCust = new CollectionNetworkResourceCustomization();
    collectionNetworkResourceCust.setModelCustomizationUUID("123");
    collectionNetworkResourceCust.setNetworkResourceCustomization(collectionResourceCustomization);
    instanceGroup.getCollectionNetworkResourceCustomizations().add(collectionNetworkResourceCust);
    List<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupCustomizations = new ArrayList<>();
    CollectionResourceInstanceGroupCustomization collectionInstanceGroupCustomization = new CollectionResourceInstanceGroupCustomization();
    collectionInstanceGroupCustomization.setModelCustomizationUUID("123");
    collectionInstanceGroupCustomization.setSubInterfaceNetworkQuantity(3);
    collectionInstanceGroupCustomizations.add(collectionInstanceGroupCustomization);
    collectionInstanceGroupCustomization.setInstanceGroup(instanceGroup);
    collectionInstanceGroupCustomization.setCollectionResourceCust(collectionResourceCustomization);
    instanceGroup.setCollectionInstanceGroupCustomizations(collectionInstanceGroupCustomizations);
    collectionResource.setInstanceGroup(instanceGroup);
    collectionResourceCustomization.setCollectionResource(collectionResource);
    ;
    service.getCollectionResourceCustomizations().add(collectionResourceCustomization);
    doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a");
    doReturn(collectionResourceCustomization).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("123");
    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, "AssignServiceInstanceBB", "CreateNetworkCollectionBB", "AssignNetworkBB", "CreateNetworkBB", "ActivateNetworkBB", "AssignNetworkBB", "CreateNetworkBB", "ActivateNetworkBB", "AssignNetworkBB", "CreateNetworkBB", "ActivateNetworkBB", "ActivateNetworkCollectionBB", "ActivateServiceInstanceBB");
    assertEquals("Network id not empty", !ebbs.get(2).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
    assertEquals("Network id not empty", !ebbs.get(3).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
    assertEquals("Network id not empty", !ebbs.get(4).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
    assertEquals("Network id same for AssignNetworkBB CreateNetworkBB ActivateNetworkBB", ebbs.get(2).getWorkflowResourceIds().getNetworkId() == ebbs.get(3).getWorkflowResourceIds().getNetworkId() && ebbs.get(3).getWorkflowResourceIds().getNetworkId() == ebbs.get(4).getWorkflowResourceIds().getNetworkId(), true);
    assertEquals("Network id not empty", !ebbs.get(5).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
    assertEquals("Network id not empty", !ebbs.get(6).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
    assertEquals("Network id not empty", !ebbs.get(7).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
    assertEquals("Network id same for AssignNetworkBB CreateNetworkBB ActivateNetworkBB", ebbs.get(5).getWorkflowResourceIds().getNetworkId() == ebbs.get(6).getWorkflowResourceIds().getNetworkId() && ebbs.get(6).getWorkflowResourceIds().getNetworkId() == ebbs.get(7).getWorkflowResourceIds().getNetworkId(), true);
    assertEquals("Network id not empty", !ebbs.get(8).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
    assertEquals("Network id not empty", !ebbs.get(9).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
    assertEquals("Network id not empty", !ebbs.get(10).getWorkflowResourceIds().getNetworkId().isEmpty(), true);
    assertEquals("Network id same for AssignNetworkBB CreateNetworkBB ActivateNetworkBB", ebbs.get(8).getWorkflowResourceIds().getNetworkId() == ebbs.get(9).getWorkflowResourceIds().getNetworkId() && ebbs.get(9).getWorkflowResourceIds().getNetworkId() == ebbs.get(10).getWorkflowResourceIds().getNetworkId(), true);
}
Also used : CollectionResource(org.onap.so.db.catalog.beans.CollectionResource) CollectionResourceInstanceGroupCustomization(org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization) ArrayList(java.util.ArrayList) OrchestrationFlow(org.onap.so.db.catalog.beans.macro.OrchestrationFlow) Service(org.onap.so.db.catalog.beans.Service) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) NorthBoundRequest(org.onap.so.db.catalog.beans.macro.NorthBoundRequest) InstanceGroup(org.onap.so.db.catalog.beans.InstanceGroup) NetworkCollectionResourceCustomization(org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) CollectionNetworkResourceCustomization(org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization) ArgumentMatchers.anyList(org.mockito.ArgumentMatchers.anyList) List(java.util.List) ArrayList(java.util.ArrayList) RelationshipList(org.onap.aai.domain.yang.RelationshipList) CollectionNetworkResourceCustomization(org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization) NetworkResourceCustomization(org.onap.so.db.catalog.beans.NetworkResourceCustomization) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 65 with Service

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

the class WorkflowActionTest method selectExecutionListMacroResumeTest.

@Test
public void selectExecutionListMacroResumeTest() throws Exception {
    String gAction = "createInstance";
    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");
    northBoundRequest.setOrchestrationFlowList(orchFlows);
    Service service = new Service();
    service.setModelUUID("3c40d244-808e-42ca-b09a-256d83d19d0a");
    ServiceInstance si = new ServiceInstance();
    when(bbSetupUtils.getAAIServiceInstanceById("123")).thenReturn(si);
    when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
    String flowsToExecuteString = "[{\"buildingBlock\":{\"mso-id\":\"2f9ddc4b-4dcf-4129-a35f-be1625ae0176\",\"bpmn-flow-name\":\"AssignServiceInstanceBB\",\"key\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"is-virtual-link\":false,\"virtual-link-key\":null},\"requestId\":\"9c944122-d161-4280-8594-48c06a9d96d5\",\"apiVersion\":\"7\",\"resourceId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"requestAction\":\"deleteInstance\",\"vnfType\":\"\",\"aLaCarte\":true,\"homing\":false,\"workflowResourceIds\":{\"serviceInstanceId\":\"ff9dae72-05bb-4277-ad2b-1b082467c138\",\"vnfId\":\"84a29830-e533-4f20-a838-910c740bf24c\",\"networkId\":\"\",\"volumeGroupId\":\"\",\"vfModuleId\":\"d1d35800-783d-42d3-82f6-d654c5054a6e\",\"networkCollectionId\":null,\"configurationId\":\"10f8a3a3-91bf-4821-9515-c01b2864dff0\",\"instanceGroupId\":\"\"},\"requestDetails\":{\"modelInfo\":{\"modelCustomizationName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelInvariantId\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelType\":\"vfModule\",\"modelId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\",\"modelVersion\":\"1\",\"modelCustomizationUuid\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelVersionId\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelCustomizationId\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"modelUuid\":\"00d15ebb-c80e-43c1-80f0-90c40dde70b0\",\"modelInvariantUuid\":\"8028fcc0-96dc-427d-a4de-4536245943da\",\"modelInstanceName\":\"McmrNcUpVnf20191..cr_mccm_fc_base..module-0\"},\"requestInfo\":{\"source\":\"VID\",\"suppressRollback\":false,\"requestorId\":\"pj8646\"},\"cloudConfiguration\":{\"tenantId\":\"e2a6af59d1cb43b2874e943bbbf8470a\",\"cloudOwner\":\"att-nc\",\"lcpCloudRegionId\":\"auk51b\"},\"requestParameters\":{\"testApi\":\"GR_API\"}},\"configurationResourceKeys\":{\"vfModuleCustomizationUUID\":\"7adc7c29-21a3-40a2-b8b6-5d4ad08b68e9\",\"vnfResourceCustomizationUUID\":\"a80f05b8-d651-44af-b999-8ed78fb4582f\",\"cvnfcCustomizationUUID\":\"69cce457-9ffd-4359-962b-0596a1e83ad1\",\"vnfcName\":\"zauk51bmcmr01mcm001\"}}]";
    ObjectMapper om = new ObjectMapper();
    List<ExecuteBuildingBlock> flowsToExecute = null;
    try {
        ExecuteBuildingBlock[] asArray = om.readValue(flowsToExecuteString, ExecuteBuildingBlock[].class);
        flowsToExecute = Arrays.asList(asArray);
    } catch (Exception e) {
        e.printStackTrace();
    }
    when(bbSetupUtils.loadOriginalFlowExecutionPath(anyString())).thenReturn(flowsToExecute);
    workflowAction.selectExecutionList(execution);
    List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
    assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB");
}
Also used : ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) OrchestrationFlow(org.onap.so.db.catalog.beans.macro.OrchestrationFlow) Service(org.onap.so.db.catalog.beans.Service) ServiceInstance(org.onap.aai.domain.yang.ServiceInstance) 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) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) DuplicateNameException(org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException) ExpectedException(org.junit.rules.ExpectedException) MalformedURLException(java.net.MalformedURLException) AAIEntityNotFoundException(org.onap.so.client.orchestration.AAIEntityNotFoundException) IOException(java.io.IOException) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Aggregations

Service (org.onap.so.db.catalog.beans.Service)171 Test (org.junit.Test)135 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)57 File (java.io.File)48 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)47 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)46 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)40 ArrayList (java.util.ArrayList)39 HashMap (java.util.HashMap)37 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)37 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)36 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)29 ServiceRecipe (org.onap.so.db.catalog.beans.ServiceRecipe)24 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)22 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)19 BuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock)18 ConfigurationResourceKeys (org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys)18 NetworkResourceCustomization (org.onap.so.db.catalog.beans.NetworkResourceCustomization)18 VnfResourceCustomization (org.onap.so.db.catalog.beans.VnfResourceCustomization)18 CloudConfiguration (org.onap.so.serviceinstancebeans.CloudConfiguration)18