Search in sources :

Example 6 with CollectionResourceCustomization

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

the class BBInputSetup method mapCatalogNetworkCollectionInstanceGroup.

protected void mapCatalogNetworkCollectionInstanceGroup(Service service, InstanceGroup instanceGroup, String key) {
    CollectionResourceCustomization collectionCust = this.findCatalogNetworkCollection(service, key);
    org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = null;
    if (collectionCust != null) {
        catalogInstanceGroup = collectionCust.getCollectionResource().getInstanceGroup();
    }
    instanceGroup.setModelInfoInstanceGroup(mapperLayer.mapCatalogInstanceGroupToInstanceGroup(collectionCust, catalogInstanceGroup));
}
Also used : CollectionResourceCustomization(org.onap.so.db.catalog.beans.CollectionResourceCustomization) NetworkCollectionResourceCustomization(org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization)

Example 7 with CollectionResourceCustomization

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

the class BBInputSetupMapperLayerTest method testMapCatalogInstanceGroupToInstanceGroup.

@Test
public void testMapCatalogInstanceGroupToInstanceGroup() throws IOException {
    ModelInfoInstanceGroup expected = mapper.readValue(new File(RESOURCE_PATH + "ModelInfoInstanceGroup.json"), ModelInfoInstanceGroup.class);
    InstanceGroup instanceGroup = mapper.readValue(new File(RESOURCE_PATH + "InstanceGroup.json"), InstanceGroup.class);
    instanceGroup.setCollectionInstanceGroupCustomizations(new ArrayList<>());
    CollectionResourceInstanceGroupCustomization collectionInstanceGroupCust = new CollectionResourceInstanceGroupCustomization();
    collectionInstanceGroupCust.setModelCustomizationUUID("modelCustomizationUUID");
    collectionInstanceGroupCust.setFunction("function");
    collectionInstanceGroupCust.setDescription("description");
    instanceGroup.getCollectionInstanceGroupCustomizations().add(collectionInstanceGroupCust);
    CollectionResourceCustomization collectionResourceCust = new CollectionResourceCustomization();
    collectionResourceCust.setModelCustomizationUUID("modelCustomizationUUID");
    ModelInfoInstanceGroup actual = bbInputSetupMapperLayer.mapCatalogInstanceGroupToInstanceGroup(collectionResourceCust, instanceGroup);
    assertThat(actual, sameBeanAs(expected));
}
Also used : ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) CollectionResourceInstanceGroupCustomization(org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization) CollectionResourceCustomization(org.onap.so.db.catalog.beans.CollectionResourceCustomization) File(java.io.File) InstanceGroup(org.onap.so.db.catalog.beans.InstanceGroup) ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) Test(org.junit.Test)

Example 8 with CollectionResourceCustomization

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

the class ServiceEBBLoader method traverseNetworkCollection.

protected void traverseNetworkCollection(DelegateExecution execution, List<Resource> resourceList, Resource serviceResource, org.onap.so.db.catalog.beans.Service service) {
    if (isVnfCustomizationsInTheService(service)) {
        buildAndThrowException(execution, "Cannot orchestrate Service-Macro-Create without user params with a vnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows");
    }
    if (isPnfCustomizationsInTheService(service)) {
        buildAndThrowException(execution, "Cannot orchestrate Service-Macro-Create without user params with a pnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows");
    }
    List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
    if (customizations.isEmpty()) {
        logger.debug("No Collections found. CollectionResourceCustomization list is empty.");
    } else {
        CollectionResourceCustomization collectionResourceCustomization = findCatalogNetworkCollection(execution, service);
        traverseNetworkCollectionResourceCustomization(resourceList, serviceResource, collectionResourceCustomization);
    }
    traverseNetworkCollectionCustomization(resourceList, serviceResource, service);
}
Also used : CollectionResourceCustomization(org.onap.so.db.catalog.beans.CollectionResourceCustomization)

Example 9 with CollectionResourceCustomization

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

the class ServiceEBBLoader method findCatalogNetworkCollection.

public CollectionResourceCustomization findCatalogNetworkCollection(DelegateExecution execution, org.onap.so.db.catalog.beans.Service service) {
    CollectionResourceCustomization networkCollection = null;
    int count = 0;
    for (CollectionResourceCustomization collectionCust : service.getCollectionResourceCustomizations()) {
        if (catalogDbClient.getNetworkCollectionResourceCustomizationByID(collectionCust.getModelCustomizationUUID()) != null) {
            networkCollection = collectionCust;
            count++;
        }
    }
    if (count == 0) {
        return null;
    } else if (count > 1) {
        buildAndThrowException(execution, "Found multiple Network Collections in the Service model, only one per Service is supported.");
    }
    return networkCollection;
}
Also used : CollectionResourceCustomization(org.onap.so.db.catalog.beans.CollectionResourceCustomization)

Example 10 with CollectionResourceCustomization

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

the class WorkflowActionTest method selectExecutionListNetworkCollectionMacroCreate.

@Ignore
@Test
public void selectExecutionListNetworkCollectionMacroCreate() throws Exception {
    String gAction = "createInstance";
    String resource = "NetworkCollection";
    String bpmnRequest = readBpmnRequestFromFile(MACRO_CREATE_NETWORK_COLLECTION_JSON);
    initExecution(gAction, bpmnRequest, false);
    execution.setVariable("requestUri", "v6/serviceInstances/123/networkCollections/123");
    NorthBoundRequest northBoundRequest = new NorthBoundRequest();
    List<OrchestrationFlow> orchFlows = createFlowList("CreateNetworkCollectionBB", "AssignNetworkBB", "CreateNetworkBB", "ActivateNetworkBB", "ActivateNetworkCollectionBB");
    northBoundRequest.setOrchestrationFlowList(orchFlows);
    Service service = new Service();
    CollectionResourceCustomization collectionResourceCustomization = new CollectionResourceCustomization();
    CollectionResource collectionResource = new CollectionResource();
    collectionResource.setToscaNodeType("Data NetworkCollection Data");
    collectionResourceCustomization.setCollectionResource(collectionResource);
    service.getCollectionResourceCustomizations().add(collectionResourceCustomization);
    when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
    when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
    workflowAction.selectExecutionList(execution);
    List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
    assertEqualsBulkFlowName(ebbs, "CreateNetworkCollectionBB", "AssignNetworkBB", "CreateNetworkBB", "ActivateNetworkBB", "AssignNetworkBB", "CreateNetworkBB", "ActivateNetworkBB", "ActivateNetworkCollectionBB");
}
Also used : CollectionResource(org.onap.so.db.catalog.beans.CollectionResource) 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) CollectionResourceCustomization(org.onap.so.db.catalog.beans.CollectionResourceCustomization) NetworkCollectionResourceCustomization(org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization) 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) Ignore(org.junit.Ignore) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Aggregations

CollectionResourceCustomization (org.onap.so.db.catalog.beans.CollectionResourceCustomization)15 Test (org.junit.Test)10 NetworkCollectionResourceCustomization (org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization)10 Service (org.onap.so.db.catalog.beans.Service)8 ArrayList (java.util.ArrayList)6 CollectionResource (org.onap.so.db.catalog.beans.CollectionResource)6 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)4 File (java.io.File)3 ModelInfoCollection (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection)3 ModelInfoInstanceGroup (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup)3 CollectionResourceInstanceGroupCustomization (org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization)3 List (java.util.List)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 Ignore (org.junit.Ignore)2 ArgumentMatchers.anyList (org.mockito.ArgumentMatchers.anyList)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 RelationshipList (org.onap.aai.domain.yang.RelationshipList)2 Collection (org.onap.so.bpmn.servicedecomposition.bbobjects.Collection)2 InstanceGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup)2 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)2