Search in sources :

Example 6 with CollectionResource

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

the class ToscaResourceInstaller method createNetworkCollection.

protected CollectionNetworkResourceCustomization createNetworkCollection(IEntityDetails cnrEntity, ToscaResourceStructure toscaResourceStructure, Service service) {
    CollectionNetworkResourceCustomization collectionNetworkResourceCustomization = new CollectionNetworkResourceCustomization();
    // **** Build Object to populate Collection_Resource table
    CollectionResource collectionResource = new CollectionResource();
    collectionResource.setModelName(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
    collectionResource.setModelInvariantUUID(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
    collectionResource.setModelUUID(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
    collectionResource.setModelVersion(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
    collectionResource.setDescription(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
    collectionResource.setToscaNodeType(cnrEntity.getToscaType());
    toscaResourceStructure.setCatalogCollectionResource(collectionResource);
    // **** Build object to populate Collection_Resource_Customization table
    NetworkCollectionResourceCustomization ncfc = new NetworkCollectionResourceCustomization();
    ncfc.setFunction(getLeafPropertyValue(cnrEntity, "cr_function"));
    ncfc.setRole(getLeafPropertyValue(cnrEntity, "cr_role"));
    ncfc.setType(getLeafPropertyValue(cnrEntity, "cr_type"));
    ncfc.setModelInstanceName(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
    ncfc.setModelCustomizationUUID(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
    Set<CollectionNetworkResourceCustomization> networkResourceCustomizationSet = new HashSet<>();
    networkResourceCustomizationSet.add(collectionNetworkResourceCustomization);
    ncfc.setNetworkResourceCustomization(networkResourceCustomizationSet);
    ncfc.setCollectionResource(collectionResource);
    toscaResourceStructure.setCatalogCollectionResourceCustomization(ncfc);
    // *** Build object to populate the Instance_Group table
    List<IEntityDetails> ncEntityList = getEntityDetails(toscaResourceStructure, EntityQuery.newBuilder("org.openecomp.groups.NetworkCollection"), TopologyTemplateQuery.newBuilder(SdcTypes.CR).customizationUUID(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)), false);
    List<NetworkInstanceGroup> networkInstanceGroupList = new ArrayList<>();
    List<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationList = new ArrayList<>();
    for (IEntityDetails ncGroupEntity : ncEntityList) {
        NetworkInstanceGroup networkInstanceGroup = new NetworkInstanceGroup();
        Metadata instanceMetadata = ncGroupEntity.getMetadata();
        networkInstanceGroup.setModelName(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
        networkInstanceGroup.setModelInvariantUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
        networkInstanceGroup.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
        networkInstanceGroup.setModelVersion(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
        networkInstanceGroup.setToscaNodeType(ncGroupEntity.getToscaType());
        // Set
        networkInstanceGroup.setRole(SubType.SUB_INTERFACE.toString());
        // Role
        // Set
        networkInstanceGroup.setType(InstanceGroupType.L3_NETWORK);
        // type
        networkInstanceGroup.setCollectionResource(collectionResource);
        // ****Build object to populate
        // Collection_Resource_Instance_Group_Customization table
        CollectionResourceInstanceGroupCustomization crInstanceGroupCustomization = new CollectionResourceInstanceGroupCustomization();
        crInstanceGroupCustomization.setInstanceGroup(networkInstanceGroup);
        crInstanceGroupCustomization.setModelUUID(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
        crInstanceGroupCustomization.setModelCustomizationUUID(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
        // Loop through the template policy to find the subinterface_network_quantity property name. Then extract
        // the value for it.
        List<IEntityDetails> policyEntityList = getEntityDetails(toscaResourceStructure, EntityQuery.newBuilder("org.openecomp.policies.scaling.Fixed"), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), true);
        if (policyEntityList != null) {
            for (IEntityDetails policyEntity : policyEntityList) {
                for (String policyNetworkCollection : policyEntity.getTargets()) {
                    if (policyNetworkCollection.equalsIgnoreCase(ncGroupEntity.getName())) {
                        Map<String, Property> propMap = policyEntity.getProperties();
                        if (propMap.get("quantity") != null) {
                            String quantity = getLeafPropertyValue(cnrEntity, getPropertyInput(propMap.get("quantity").toString()));
                            if (quantity != null) {
                                crInstanceGroupCustomization.setSubInterfaceNetworkQuantity(Integer.parseInt(quantity));
                            }
                        }
                    }
                }
            }
        }
        crInstanceGroupCustomization.setDescription(getLeafPropertyValue(cnrEntity, instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME) + "_network_collection_description"));
        crInstanceGroupCustomization.setFunction(getLeafPropertyValue(cnrEntity, instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME) + "_network_collection_function"));
        crInstanceGroupCustomization.setCollectionResourceCust(ncfc);
        collectionResourceInstanceGroupCustomizationList.add(crInstanceGroupCustomization);
        networkInstanceGroup.setCollectionInstanceGroupCustomizations(collectionResourceInstanceGroupCustomizationList);
        networkInstanceGroupList.add(networkInstanceGroup);
        toscaResourceStructure.setCatalogNetworkInstanceGroup(networkInstanceGroupList);
        List<IEntityDetails> networkEntityList = getEntityDetails(toscaResourceStructure, EntityQuery.newBuilder(SdcTypes.VL), TopologyTemplateQuery.newBuilder(SdcTypes.CR).customizationUUID(cnrEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)), false);
        List<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationList = new ArrayList<>();
        // *****Build object to populate the NetworkResource table
        NetworkResource networkResource = new NetworkResource();
        for (IEntityDetails networkEntity : networkEntityList) {
            String providerNetwork = getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_PROVIDERNETWORK_ISPROVIDERNETWORK);
            if ("true".equalsIgnoreCase(providerNetwork)) {
                networkResource.setNeutronNetworkType(PROVIDER);
            } else {
                networkResource.setNeutronNetworkType(BASIC);
            }
            networkResource.setModelName(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
            networkResource.setModelInvariantUUID(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
            networkResource.setModelUUID(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
            networkResource.setModelVersion(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
            networkResource.setAicVersionMax(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES));
            TempNetworkHeatTemplateLookup tempNetworkLookUp = tempNetworkLookupRepo.findFirstBynetworkResourceModelName(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
            if (tempNetworkLookUp != null) {
                HeatTemplate heatTemplate = heatRepo.findByArtifactUuid(tempNetworkLookUp.getHeatTemplateArtifactUuid());
                networkResource.setHeatTemplate(heatTemplate);
                networkResource.setAicVersionMin(tempNetworkLookUp.getAicVersionMin());
            }
            networkResource.setToscaNodeType(networkEntity.getToscaType());
            networkResource.setDescription(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
            networkResource.setOrchestrationMode(HEAT);
            // Collection_Network_Resource_Customization table
            for (IEntityDetails networkMemberEntity : ncGroupEntity.getMemberNodes()) {
                collectionNetworkResourceCustomization.setModelInstanceName(networkMemberEntity.getName());
            }
            collectionNetworkResourceCustomization.setModelCustomizationUUID(networkEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
            collectionNetworkResourceCustomization.setNetworkTechnology(getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY));
            collectionNetworkResourceCustomization.setNetworkType(getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE));
            collectionNetworkResourceCustomization.setNetworkRole(getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKROLE));
            collectionNetworkResourceCustomization.setNetworkScope(getLeafPropertyValue(networkEntity, SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE));
            collectionNetworkResourceCustomization.setInstanceGroup(networkInstanceGroup);
            collectionNetworkResourceCustomization.setNetworkResource(networkResource);
            collectionNetworkResourceCustomization.setNetworkResourceCustomization(ncfc);
            collectionNetworkResourceCustomizationList.add(collectionNetworkResourceCustomization);
        }
    }
    return collectionNetworkResourceCustomization;
}
Also used : CollectionResource(org.onap.so.db.catalog.beans.CollectionResource) CollectionResourceInstanceGroupCustomization(org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization) ArrayList(java.util.ArrayList) Metadata(org.onap.sdc.toscaparser.api.elements.Metadata) NetworkCollectionResourceCustomization(org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization) IEntityDetails(org.onap.sdc.tosca.parser.api.IEntityDetails) NetworkResource(org.onap.so.db.catalog.beans.NetworkResource) TempNetworkHeatTemplateLookup(org.onap.so.db.catalog.beans.TempNetworkHeatTemplateLookup) HeatTemplate(org.onap.so.db.catalog.beans.HeatTemplate) CollectionNetworkResourceCustomization(org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization) NetworkInstanceGroup(org.onap.so.db.catalog.beans.NetworkInstanceGroup) Property(org.onap.sdc.toscaparser.api.Property) HashSet(java.util.HashSet)

Example 7 with CollectionResource

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

Example 8 with CollectionResource

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

the class WorkflowActionTest method selectExecutionListNetworkCollectionMacroDelete.

@Ignore
@Test
public void selectExecutionListNetworkCollectionMacroDelete() throws Exception {
    String gAction = "deleteInstance";
    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("DeactivateNetworkBB", "DeleteNetworkBB", "UnassignNetworkBB", "DeactivateNetworkCollectionBB", "DeleteNetworkCollectionBB");
    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, "DeactivateNetworkBB", "DeleteNetworkBB", "UnassignNetworkBB", "DeactivateNetworkBB", "DeleteNetworkBB", "UnassignNetworkBB", "DeactivateNetworkCollectionBB", "DeleteNetworkCollectionBB");
}
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)

Example 9 with CollectionResource

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

the class BBInputSetupTest method testPopulateNetworkCollectionAndInstanceGroupAssign.

@Test
public void testPopulateNetworkCollectionAndInstanceGroupAssign() throws Exception {
    Service service = Mockito.mock(Service.class);
    String key = "collectionCustId";
    ServiceInstance serviceInstance = mapper.readValue(new File(RESOURCE_PATH + "ServiceInstance_getServiceInstanceNOAAIExpected.json"), ServiceInstance.class);
    String resourceId = "123";
    Collection collection = SPY_bbInputSetup.createCollection(resourceId);
    InstanceGroup instanceGroup = SPY_bbInputSetup.createInstanceGroup();
    assertNull(serviceInstance.getCollection());
    doReturn(true).when(SPY_bbInputSetup).isVlanTagging(service, key);
    doReturn(collection).when(SPY_bbInputSetup).createCollection(resourceId);
    doReturn(instanceGroup).when(SPY_bbInputSetup).createInstanceGroup();
    doNothing().when(SPY_bbInputSetup).mapCatalogCollection(service, collection, key);
    NetworkCollectionResourceCustomization networkCollection = new NetworkCollectionResourceCustomization();
    networkCollection.setModelCustomizationUUID(key);
    networkCollection.setCollectionResource(new CollectionResource());
    networkCollection.getCollectionResource().setInstanceGroup(new org.onap.so.db.catalog.beans.InstanceGroup());
    networkCollection.getCollectionResource().getInstanceGroup().setToscaNodeType("NetworkCollectionResource");
    networkCollection.getCollectionResource().getInstanceGroup().setType(InstanceGroupType.L3_NETWORK);
    networkCollection.getCollectionResource().getInstanceGroup().setCollectionInstanceGroupCustomizations(new ArrayList<>());
    List<CollectionResourceCustomization> customizations = new ArrayList<>();
    customizations.add(networkCollection);
    doReturn(customizations).when(service).getCollectionResourceCustomizations();
    BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setService(service).setServiceInstance(serviceInstance).setResourceId(resourceId).setKey(key).setBbName(AssignFlows.NETWORK_COLLECTION.toString()).build();
    SPY_bbInputSetup.populateNetworkCollectionAndInstanceGroupAssign(parameter);
    assertNotNull(serviceInstance.getCollection());
    assertNotNull(serviceInstance.getCollection().getInstanceGroup());
    verify(SPY_bbInputSetup, times(1)).mapCatalogCollection(service, serviceInstance.getCollection(), key);
    verify(SPY_bbInputSetup, times(1)).mapCatalogNetworkCollectionInstanceGroup(service, serviceInstance.getCollection().getInstanceGroup(), key);
}
Also used : CollectionResource(org.onap.so.db.catalog.beans.CollectionResource) AAIFluentTypeBuilder(org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder) ArrayList(java.util.ArrayList) Service(org.onap.so.db.catalog.beans.Service) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup) NetworkCollectionResourceCustomization(org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization) Collection(org.onap.so.bpmn.servicedecomposition.bbobjects.Collection) ModelInfoCollection(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection) CollectionResourceCustomization(org.onap.so.db.catalog.beans.CollectionResourceCustomization) NetworkCollectionResourceCustomization(org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization) File(java.io.File) Test(org.junit.Test)

Example 10 with CollectionResource

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

the class BBInputSetupTest method testMapCatalogCollectionAndInstanceGroup.

@Test
public void testMapCatalogCollectionAndInstanceGroup() {
    ModelInfoCollection modelInfoCollection = new ModelInfoCollection();
    modelInfoCollection.setCollectionFunction("collectionFunction");
    modelInfoCollection.setCollectionRole("collectionRole");
    modelInfoCollection.setCollectionType("collectionType");
    modelInfoCollection.setDescription("description");
    modelInfoCollection.setModelInvariantUUID("modelInvariantUUID");
    modelInfoCollection.setQuantity(0);
    ModelInfoInstanceGroup modelInfoInstanceGroup = new ModelInfoInstanceGroup();
    modelInfoInstanceGroup.setFunction("function");
    modelInfoInstanceGroup.setInstanceGroupRole("instanceGroupRole");
    modelInfoInstanceGroup.setModelInvariantUUID("modelInvariantUUID");
    modelInfoInstanceGroup.setModelUUID("modelUUID");
    modelInfoInstanceGroup.setType("VNFC");
    modelInfoInstanceGroup.setDescription("description");
    InstanceGroup instanceGroup = new InstanceGroup();
    Collection collection = new Collection();
    collection.setInstanceGroup(instanceGroup);
    CollectionResource collectionResource = new CollectionResource();
    org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup = new org.onap.so.db.catalog.beans.InstanceGroup();
    collectionResource.setToscaNodeType("NetworkCollection");
    collectionResource.setInstanceGroup(catalogInstanceGroup);
    CollectionResourceCustomization collectionCust = new NetworkCollectionResourceCustomization();
    collectionCust.setModelCustomizationUUID("modelCustomizationUUID");
    collectionCust.setCollectionResource(collectionResource);
    Service service = new Service();
    service.getCollectionResourceCustomizations().add(collectionCust);
    ServiceInstance serviceInstance = new ServiceInstance();
    serviceInstance.setCollection(collection);
    List<CollectionResourceInstanceGroupCustomization> instanceGroupCustList = new ArrayList<>();
    CollectionResourceInstanceGroupCustomization instanceGroupCust = new CollectionResourceInstanceGroupCustomization();
    instanceGroupCust.setFunction("function");
    instanceGroupCust.setDescription("description");
    doReturn(modelInfoCollection).when(bbInputSetupMapperLayer).mapCatalogCollectionToCollection(collectionCust, collectionResource);
    doReturn(modelInfoInstanceGroup).when(bbInputSetupMapperLayer).mapCatalogInstanceGroupToInstanceGroup(collectionCust, catalogInstanceGroup);
    SPY_bbInputSetup.mapCatalogCollection(service, serviceInstance.getCollection(), "modelCustomizationUUID");
    SPY_bbInputSetup.mapCatalogNetworkCollectionInstanceGroup(service, serviceInstance.getCollection().getInstanceGroup(), collectionCust.getModelCustomizationUUID());
    assertThat(collection.getModelInfoCollection(), sameBeanAs(modelInfoCollection));
    assertThat(instanceGroup.getModelInfoInstanceGroup(), sameBeanAs(modelInfoInstanceGroup));
}
Also used : CollectionResource(org.onap.so.db.catalog.beans.CollectionResource) CollectionResourceInstanceGroupCustomization(org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization) ArrayList(java.util.ArrayList) ModelInfoCollection(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection) Service(org.onap.so.db.catalog.beans.Service) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup) NetworkCollectionResourceCustomization(org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization) ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) Collection(org.onap.so.bpmn.servicedecomposition.bbobjects.Collection) ModelInfoCollection(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection) CollectionResourceCustomization(org.onap.so.db.catalog.beans.CollectionResourceCustomization) NetworkCollectionResourceCustomization(org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization) Test(org.junit.Test)

Aggregations

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